:root {
  --bg: #0a111b;
  --bg-2: #101a29;
  --text: #e9f0f8;
  --muted: #a8b8cd;
  --card: rgba(20, 31, 48, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --primary: #2bd4a8;
  --primary-strong: #17b88f;
  --danger: #ff5b70;
  --warning: #f2bc4a;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.theme-light {
  --bg: #f6f9fc;
  --bg-2: #e7eef7;
  --text: #132033;
  --muted: #455b78;
  --card: rgba(255, 255, 255, 0.8);
  --line: rgba(18, 35, 57, 0.15);
  --primary: #0c9b7b;
  --primary-strong: #087c62;
  --danger: #d94259;
  --warning: #cb8b00;
  --shadow: 0 16px 45px rgba(37, 57, 84, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Sora', sans-serif;
  background: radial-gradient(circle at 15% 20%, #18304f, transparent 35%),
              radial-gradient(circle at 85% 20%, #0e6a60, transparent 35%),
              linear-gradient(150deg, var(--bg), var(--bg-2));
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.bg-orb {
  position: fixed;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.22;
  z-index: -1;
  animation: float 9s ease-in-out infinite;
}

.orb-a {
  left: -10vw;
  top: 25vh;
  background: #19c9a0;
}

.orb-b {
  right: -12vw;
  top: 15vh;
  background: #2d78ff;
  animation-delay: -3s;
}

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

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: color-mix(in oklab, var(--bg), transparent 38%);
  border-bottom: 1px solid var(--line);
  z-index: 50;
}

.nav-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 72px;
}

.brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.02em;
  font-size: 1.25rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.nav-links a,
.theme-toggle {
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
  background: transparent;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-links a:hover,
.theme-toggle:hover {
  border-color: var(--line);
  background: color-mix(in oklab, var(--card), transparent 5%);
}

.btn-small {
  border: 1px solid var(--line) !important;
}

main {
  padding: 2.1rem 0 3rem;
}

.page-enter {
  animation: fadeSlide 0.6s ease;
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-section {
  margin-top: 1.2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.2rem;
  align-items: stretch;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  margin-bottom: 0.8rem;
}

.eyebrow {
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 0.8rem;
}

.hero-subtitle {
  color: var(--muted);
  max-width: 60ch;
}

.hero-actions,
.action-row,
.chip-row,
.section-head {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
}

.section-head {
  justify-content: space-between;
}

.glass-panel,
.card,
.form-card,
.typing-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.metric-grid.large {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
}

.metric strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.25rem;
}

.section {
  margin-top: 1.5rem;
}

.dashboard-shell {
  background: linear-gradient(145deg, color-mix(in oklab, var(--card), #fff 2%), color-mix(in oklab, var(--card), #000 10%));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1rem;
}

.dashboard-subtitle {
  margin: 0.3rem 0 0;
  color: var(--muted);
  max-width: 62ch;
}

.stats-rail .metric {
  background: color-mix(in oklab, var(--card), #fff 4%);
}

.panel-strong {
  background: linear-gradient(165deg, color-mix(in oklab, var(--card), #fff 4%), color-mix(in oklab, var(--card), #000 10%));
}

.dashboard-table .table-wrap {
  background: color-mix(in oklab, var(--card), #000 8%);
}

.feature-grid,
.three-col,
.two-col {
  display: grid;
  gap: 0.9rem;
}

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

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.6rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  transition: 0.2s ease;
}

.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--primary-strong));
  color: #07231f;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-ghost {
  border-color: var(--line);
  background: color-mix(in oklab, var(--card), transparent 6%);
}

.btn-danger {
  border-color: color-mix(in oklab, var(--danger), #000 20%);
  background: color-mix(in oklab, var(--danger), #000 50%);
}

.form-card,
form.card {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.32rem;
  color: var(--muted);
  font-size: 0.92rem;
}

input, select, textarea {
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--card), #000 14%);
  color: var(--text);
  border-radius: 10px;
  padding: 0.62rem 0.72rem;
  font: inherit;
}

textarea {
  resize: vertical;
}

.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.58rem 0.62rem;
  text-align: left;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.auth-wrap.narrow {
  max-width: 460px;
  margin: 0 auto;
}

.alert {
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.9rem;
  border: 1px solid transparent;
}

.alert-success {
  background: color-mix(in oklab, var(--primary), transparent 84%);
  border-color: color-mix(in oklab, var(--primary), #000 15%);
}

.alert-error {
  background: color-mix(in oklab, var(--danger), transparent 88%);
  border-color: color-mix(in oklab, var(--danger), #000 10%);
}

.alert-warning {
  background: color-mix(in oklab, var(--warning), transparent 84%);
  border-color: color-mix(in oklab, var(--warning), #000 10%);
}

.prompt-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem;
  font-size: 1.06rem;
  line-height: 1.55;
  min-height: 130px;
}

.typing-surface {
  width: 100%;
  min-height: 190px;
  border-radius: 14px;
}

.prompt-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.8;
  min-height: 190px;
  letter-spacing: 0.02em;
  background: color-mix(in oklab, var(--card), #000 12%);
}

.mode-switch {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.mode-switch label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in oklab, var(--card), #000 8%);
  color: var(--text);
  font-size: 0.88rem;
}

.typing-headline {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 0.25rem 0 0.6rem;
  flex-wrap: wrap;
}

.typing-word-focus,
.typing-progress {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  background: color-mix(in oklab, var(--card), #000 8%);
  color: var(--muted);
}

.typing-word-focus strong,
.typing-progress strong {
  color: var(--text);
}

.typing-code-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  line-height: 1.65;
  min-height: 190px;
  background: color-mix(in oklab, var(--card), #000 12%);
}

.word-group {
  padding: 0.08rem 0.15rem;
  border-radius: 8px;
  transition: background 0.18s ease;
}

.word-active {
  background: color-mix(in oklab, var(--primary), transparent 85%);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary), #000 25%);
}

.char-pending {
  color: color-mix(in oklab, var(--muted), #fff 18%);
}

.char-ok {
  color: #4fe3a5;
}

.char-bad {
  color: #ff7c8f;
  text-decoration: underline;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.live-stats span {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
}

.advice-box {
  margin-top: 0.8rem;
  border-left: 3px solid var(--primary);
  padding: 0.6rem 0.7rem;
  background: color-mix(in oklab, var(--card), transparent 8%);
  border-radius: 9px;
}

.finish-feedback {
  min-height: 1.5rem;
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.finish-feedback.state-loading {
  color: color-mix(in oklab, var(--warning), #fff 10%);
}

.finish-feedback.state-success {
  color: #4fe3a5;
}

.finish-feedback.state-error {
  color: #ff7c8f;
}

.btn.is-loading {
  opacity: 0.8;
  cursor: wait;
}

.result-box {
  margin-top: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
}

.hidden {
  display: none;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  color: var(--muted);
}

.inline-form {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.3rem;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2.2rem;
  padding: 1rem 0;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  color: var(--muted);
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .hero-grid,
  .feature-grid,
  .three-col,
  .two-col,
  .metric-grid.large {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .hero-grid,
  .feature-grid,
  .three-col,
  .two-col,
  .metric-grid,
  .metric-grid.large,
  .live-stats {
    grid-template-columns: 1fr;
  }

  .nav-wrap {
    gap: 0.6rem;
    align-items: flex-start;
    flex-direction: column;
    padding: 0.6rem 0;
  }

  .bg-orb {
    width: 80vw;
    height: 80vw;
  }
}
