/* SECTION: Design System */
:root {
  /* Colors */
  --color-bg-primary: #020617;
  --color-bg-elevated: #020617ee;
  --color-bg-surface: #020617f5;
  --color-bg-soft: #020617dd;

  --color-text: #e5e7eb;
  --color-text-muted: #9ca3af;
  --color-text-soft: #6b7280;

  --color-accent: #38bdf8;
  --color-accent-soft: rgba(56, 189, 248, 0.12);
  --color-accent-strong: #0ea5e9;
  --color-danger: #f97373;
  --color-border: rgba(148, 163, 184, 0.38);

  --accent-rgb: 56, 189, 248;

  /* Layout */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-soft:
    0 1px 2px rgba(15, 23, 42, 0.4),
    0 4px 12px rgba(15, 23, 42, 0.6);

  --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.95);

  --transition-fast: 150ms ease-out;
  --transition-med: 220ms ease-out;

  /* Typography */
  --font-sans: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont,
    "SF Pro Text", sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
}

/* SECTION: Global Layout */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.app {
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: #020617;
  -webkit-font-smoothing: antialiased;
}

.shell {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 40px;
}

/* gradient mesh background (from visual-effects skill) */
.gradient-mesh {
  background:
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.14) 0px, transparent 55%),
    radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.12) 0px, transparent 55%),
    radial-gradient(at 0% 100%, rgba(52, 211, 153, 0.12) 0px, transparent 55%),
    radial-gradient(at 100% 100%, rgba(129, 140, 248, 0.16) 0px, transparent 55%);
}

.floating-shape {
  position: fixed;
  inset: auto -80px -120px auto;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #38bdf8, transparent 60%);
  opacity: 0.18;
  filter: blur(40px);
  pointer-events: none;
  animation: float 9s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-18px, -14px, 0) scale(1.05);
  }
}

/* SECTION: Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 0 0, #38bdf8, #0f172a);
  color: #e5e7eb;
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.8);
}

.brand-title {
  margin: 0 0 4px;
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
}

.brand-subtitle {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* SECTION: Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr);
  gap: 20px;
}

.primary-panel {
  position: relative;
  border-radius: 24px;
  padding: 22px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.95), #020617);
  box-shadow: var(--shadow-strong);
}

.secondary-panel {
  border-radius: 24px;
  padding: 22px 20px;
  background: rgba(15, 23, 42, 0.96);
}

/* gradient border helper (from visual-effects skill) */
.gradient-border {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-bg-elevated), var(--color-bg-elevated)) padding-box,
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.5), rgba(15, 23, 42, 0.9))
      border-box;
}

.shadow-soft {
  box-shadow: var(--shadow-soft);
}

/* SECTION: Cards & Common */
.card {
  border-radius: 18px;
  padding: 18px 18px 20px;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.12), transparent
        60%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.99));
  border: 1px solid rgba(148, 163, 184, 0.38);
  backdrop-filter: blur(18px);
}

.card + .card {
  margin-top: 14px;
}

.auth-card {
  margin-bottom: 12px;
}

.card-title {
  margin: 0 0 6px;
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}

.card-subtitle {
  margin: 0 0 16px;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.helper-text {
  margin: 4px 0 0;
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inline-list {
  margin: 12px 0 0;
  padding-left: 18px;
  font-size: var(--text-sm);
  color: var(--color-text-soft);
}

.inline-list li + li {
  margin-top: 4px;
}

/* SECTION: Buttons */
.btn {
  --btn-bg: var(--color-accent);
  --btn-bg-hover: var(--color-accent-strong);
  --btn-color: #0b1120;
  --btn-border: transparent;

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
  box-shadow: 0 14px 30px rgba(56, 189, 248, 0.28);
}

.btn.primary:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-1px) scale(1.01);
  box-shadow: 0 18px 40px rgba(56, 189, 248, 0.35);
}

.btn.primary:active {
  transform: translateY(0) scale(0.99);
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.25);
}

.btn.ghost {
  --btn-bg: rgba(15, 23, 42, 0.85);
  --btn-bg-hover: rgba(15, 23, 42, 1);
  --btn-color: var(--color-text);
  --btn-border: rgba(148, 163, 184, 0.6);

  padding-inline: 14px;
  box-shadow: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.btn.ghost:hover {
  background: var(--btn-bg-hover);
}

.btn.small {
  min-height: 34px;
  padding-inline: 12px;
  font-size: var(--text-xs);
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 1px #0b1120,
    0 0 0 3px rgba(56, 189, 248, 0.8);
}

/* SECTION: Form Styles */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: var(--text-sm);
}

.input {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  color: var(--color-text);
  padding: 9px 14px;
  font-family: inherit;
  font-size: var(--text-sm);
  outline: none;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.input::placeholder {
  color: var(--color-text-soft);
}

.input:focus {
  border-color: var(--color-accent);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 1px #0b1120, 0 0 0 3px rgba(56, 189, 248, 0.55);
}

/* SECTION: Language Selection */
.language-form {
  margin-top: 4px;
}

.language-grid {
  margin: 0 0 8px;
  padding: 0;
  border: 0;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.language-tile {
  position: relative;
  display: block;
  border-radius: 16px;
  padding: 10px 9px 11px;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.16), transparent 65%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.6);
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast),
    background var(--transition-fast);
}

.language-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.3), transparent
        50%);
  opacity: 0;
  transition: opacity var(--transition-med);
}

.language-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(56, 189, 248, 0.9);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 1);
}

.language-tile:hover::after {
  opacity: 0.9;
}

.language-tile .tile-body h3 {
  margin: 0 0 4px;
  font-size: var(--text-md);
}

.language-tile .tile-body p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

.tile-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  margin-bottom: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 1);
  font-size: 0.65rem;
  color: var(--color-text-soft);
  border: 1px solid rgba(148, 163, 184, 0.55);
}

.language-tile input:focus-visible + .tile-body {
  outline: none;
  box-shadow:
    0 0 0 1px #0b1120,
    0 0 0 3px rgba(56, 189, 248, 0.8);
}

/* Selected state will be toggled via JS by adding this class */
.language-tile.is-selected {
  border-color: rgba(56, 189, 248, 1);
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.32), transparent 55%),
    linear-gradient(135deg, #0b1120, #020617);
  box-shadow: 0 22px 55px rgba(15, 23, 42, 1);
}

.language-tile.is-selected .tile-tag {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(34, 197, 94, 0.8);
  color: #bbf7d0;
}

/* SECTION: Dashboard */
.dashboard-empty {
  text-align: left;
  padding-top: 4px;
}

.dashboard-empty h2 {
  margin: 0 0 4px;
  font-size: var(--text-xl);
}

.dashboard-empty p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dashboard-header h2 {
  margin: 0 0 4px;
  font-size: var(--text-lg);
}

.dashboard-subtitle {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* SECTION: Tabs */
.lang-tabs-list {
  display: inline-flex;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 6px;
  border-radius: 999px;
  list-style: none;
  background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.22), transparent
        55%),
    rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.lang-tab-btn {
  border-radius: 999px;
  padding: 5px 11px;
  border: 0;
  min-width: 72px;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.lang-tab-btn:hover {
  color: var(--color-text);
}

.lang-tab-btn[aria-selected="true"] {
  background: rgba(15, 23, 42, 0.96);
  color: var(--color-text);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 1);
}

/* SECTION: Path Layout */
.path-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 14px;
  margin-top: 4px;
}

.path-sidebar {
  border-radius: 16px;
  padding: 12px 11px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 1));
  border: 1px solid rgba(148, 163, 184, 0.45);
  font-size: var(--text-xs);
}

.path-main {
  border-radius: 16px;
  padding: 14px 14px 16px;
  background:
    radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.14), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 1));
  border: 1px solid rgba(148, 163, 184, 0.5);
  min-height: 210px;
}

.path-title {
  margin: 0 0 4px;
  font-size: var(--text-lg);
}

.path-meta {
  margin: 0 0 12px;
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

.path-outline-title {
  margin: 0 0 8px;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-soft);
}

.path-outline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.path-outline-item {
  border-radius: 999px;
  padding: 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.path-outline-item.is-queued {
  border-style: dashed;
  border-color: rgba(56, 189, 248, 0.7);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 0.65rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.65);
  color: var(--color-text-soft);
}

.badge.quiz {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.9);
  color: #7dd3fc;
}

.badge.status-good {
  background: rgba(22, 163, 74, 0.16);
  border-color: rgba(22, 163, 74, 0.8);
  color: #bbf7d0;
}

.badge.status-review {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.9);
  color: #fed7aa;
}

.badge.status-new {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.9);
  color: #bae6fd;
}

.path-body {
  font-size: var(--text-sm);
}

.path-body p {
  margin: 0 0 10px;
}

.path-body ul {
  margin: 0 0 10px 18px;
  padding: 0;
}

.path-body li + li {
  margin-top: 3px;
}

.path-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* SECTION: Quiz Styles */
.quiz-question {
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.quiz-question-title {
  margin: 0 0 6px;
  font-size: var(--text-sm);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 5px 9px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.96);
  cursor: pointer;
  font-size: var(--text-xs);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.quiz-option:hover {
  border-color: rgba(56, 189, 248, 0.8);
  background: rgba(15, 23, 42, 1);
  transform: translateY(-1px);
}

.quiz-option input {
  width: 16px;
  height: 16px;
}

.quiz-feedback {
  margin-top: 8px;
  font-size: var(--text-xs);
  color: var(--color-text-soft);
}

/* SECTION: Utilities */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.is-hidden {
  display: none !important;
}

/* SECTION: Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .secondary-panel {
    order: -1;
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 20px 16px 26px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout {
    gap: 16px;
  }

  .primary-panel,
  .secondary-panel {
    padding: 18px 16px;
  }

  .language-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .path-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
