:root {
  --bg: #0E1420;
  --bg-alt: #131A28;
  --surface: #171F2F;
  --surface-raised: #1E2739;
  --border: #2A3448;

  --text: #F4F0E6;
  --text-muted: #97A1B5;
  --text-dim: #6C7690;

  --accent: #F2A65A;
  --accent-dim: #B97D42;
  --accent-soft: rgba(242, 166, 90, 0.14);

  --correct: #6FD8C4;
  --correct-soft: rgba(111, 216, 196, 0.14);
  --wrong: #E8735A;
  --wrong-soft: rgba(232, 115, 90, 0.14);

  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'Inter', sans-serif;

  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 26px; border-radius: 999px; font-weight: 600; font-size: 15px;
  border: 1px solid transparent; cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: #17120B; }
.btn-primary:hover { background: #f5b476; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent-dim); }
.btn-danger { color: var(--wrong); }
.btn-danger:hover { border-color: var(--wrong); }
.btn-small { padding: 10px 18px; font-size: 14px; }
.btn-full { width: 100%; }

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(14,20,32,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.logo { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.logo-dot { color: var(--accent); }
.main-nav { display: flex; gap: 28px; flex: 1; }
.main-nav a { color: var(--text-muted); font-size: 15px; transition: color 0.2s ease; display: inline-flex; align-items: center; gap: 6px; }
.main-nav a:hover { color: var(--text); }
.pill { background: var(--accent); color: #17120B; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; font-family: var(--font-mono); }
@media (max-width: 760px) { .main-nav { display: none; } }

/* generic page */
.page { padding: 56px 0 100px; }
.section-eyebrow { font-family: var(--font-mono); font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 14px; }
.section-lead { color: var(--text-muted); max-width: 60ch; font-size: 16px; margin: 0 0 32px; }
.lesson-title { font-size: clamp(24px, 3.4vw, 34px); margin-bottom: 24px; }
.empty-state { color: var(--text-dim); font-size: 15px; }
.form-error { background: var(--wrong-soft); color: var(--wrong); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; }
.form-success { background: var(--correct-soft); color: var(--correct); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; }

/* auth screens */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--text); font-family: var(--font-body); }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 32px; margin: 24px; }
.auth-logo { display: block; margin-bottom: 28px; }
.auth-card h1 { font-size: 24px; margin-bottom: 20px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-top: 12px; }
.auth-form input {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 15px; margin-bottom: 4px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn { margin-top: 18px; }
.auth-switch { margin-top: 20px; color: var(--text-muted); font-size: 14px; text-align: center; }
.auth-switch a { color: var(--accent); }

/* stats row */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 40px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 6px;
}
.stat-card-link { transition: border-color 0.2s ease, transform 0.15s ease; }
.stat-card-link:hover { border-color: var(--accent-dim); transform: translateY(-2px); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-unit { font-size: 15px; color: var(--text-muted); font-weight: 500; }
.stat-label { font-size: 13px; color: var(--text-muted); }
@media (max-width: 600px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }
.add-lesson { margin-bottom: 56px; }
.add-lesson h1 { font-size: clamp(26px, 3.6vw, 36px); margin-bottom: 12px; }
.add-lesson-form { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.add-lesson-form input {
  flex: 1; min-width: 200px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px; color: var(--text); font-family: var(--font-body); font-size: 15px;
}
.add-lesson-form input:focus { outline: none; border-color: var(--accent); }

/* lesson list */
.lesson-list h2 { font-size: 20px; margin-bottom: 20px; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.lesson-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: border-color 0.2s ease;
}
.lesson-card:hover { border-color: var(--accent-dim); }
.lesson-lang { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.draft-tag { color: var(--text-dim); }
.lesson-card h3 { font-size: 16px; margin: 10px 0 6px; line-height: 1.3; }
.lesson-card p { margin: 0 0 14px; font-size: 13px; color: var(--text-dim); }
.lesson-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* admin: lesson edit */
.admin-toolbar { display: flex; gap: 12px; margin-bottom: 40px; flex-wrap: wrap; }
.inline-form { display: inline; }
.add-segment { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 40px; }
.add-segment h2 { font-size: 18px; margin-bottom: 18px; }
.segment-form { display: flex; flex-direction: column; gap: 6px; max-width: 560px; }
.segment-form label { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 10px; }
.segment-form textarea, .segment-form input[type="file"] {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; color: var(--text); font-family: var(--font-body); font-size: 15px; resize: vertical;
}
.segment-form textarea:focus { outline: none; border-color: var(--accent); }
.segment-form .btn { margin-top: 16px; align-self: flex-start; }

.segment-list h2 { font-size: 18px; margin-bottom: 18px; }
.segment-table { display: flex; flex-direction: column; gap: 10px; }
.segment-row {
  display: grid; grid-template-columns: 56px 220px 1fr 36px; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px;
}
.segment-order { display: flex; align-items: center; gap: 2px; font-family: var(--font-mono); }
.segment-order .icon-btn { padding: 2px 4px; font-size: 12px; }
.segment-idx { font-family: var(--font-mono); color: var(--text-dim); font-size: 13px; min-width: 16px; text-align: center; }
.segment-row audio { width: 100%; height: 32px; }
.segment-text-form { display: flex; align-items: center; gap: 8px; flex: 1; }
.segment-text-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; color: var(--text); font-family: var(--font-mono); font-size: 14px;
}
.segment-text-input:focus { outline: none; border-color: var(--accent); }
.icon-btn { background: transparent; border: none; color: var(--text-dim); font-size: 16px; cursor: pointer; padding: 4px 8px; }
.icon-btn:hover { color: var(--wrong); }
.icon-btn-save:hover { color: var(--correct); }
.icon-btn:disabled { opacity: 0.25; cursor: not-allowed; }
@media (max-width: 760px) { .segment-row { grid-template-columns: 1fr; } }

/* practice / demo shell */
.demo-shell { display: grid; grid-template-columns: 1fr 280px; gap: 24px; margin-top: 8px; }
@media (max-width: 800px) { .demo-shell { grid-template-columns: 1fr; } }
.demo-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.demo-progress { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
#scoreText { color: var(--accent); }

.progress-track { height: 4px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 24px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }

/* tamamlama paneli */
.completion-panel { text-align: center; padding: 40px 20px; position: relative; }
.completion-check {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--correct-soft); color: var(--correct); font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  animation: checkPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes checkPop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.completion-panel h2 { font-size: 26px; margin-bottom: 8px; }
.completion-sub { color: var(--text-muted); font-size: 15px; margin: 0 0 28px; }
.completion-stats { display: flex; justify-content: center; gap: 40px; margin-bottom: 32px; }
.completion-stats div { display: flex; flex-direction: column; gap: 4px; }
.completion-num { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--accent); }
.completion-stats span:last-child { font-size: 13px; color: var(--text-dim); }
.completion-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.completion-burst { position: absolute; top: 30px; left: 50%; width: 0; height: 0; }
.completion-burst span {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: burstOut 0.8s ease-out forwards;
}
.completion-burst span:nth-child(1) { animation-delay: 0.05s; transform: rotate(0deg) translateY(0); }
.completion-burst span:nth-child(2) { animation-delay: 0.1s; transform: rotate(60deg) translateY(0); }
.completion-burst span:nth-child(3) { animation-delay: 0.02s; transform: rotate(120deg) translateY(0); }
.completion-burst span:nth-child(4) { animation-delay: 0.15s; transform: rotate(180deg) translateY(0); }
.completion-burst span:nth-child(5) { animation-delay: 0.08s; transform: rotate(240deg) translateY(0); }
.completion-burst span:nth-child(6) { animation-delay: 0.12s; transform: rotate(300deg) translateY(0); }
@keyframes burstOut {
  from { opacity: 1; transform: translate(0, 0) scale(1); }
  to { opacity: 0; transform: translate(var(--tx, 60px), var(--ty, -60px)) scale(0.3); }
}
.completion-burst span:nth-child(1) { --tx: 0px; --ty: -70px; }
.completion-burst span:nth-child(2) { --tx: 55px; --ty: -40px; }
.completion-burst span:nth-child(3) { --tx: 65px; --ty: 30px; }
.completion-burst span:nth-child(4) { --tx: 0px; --ty: 65px; }
.completion-burst span:nth-child(5) { --tx: -60px; --ty: 30px; }
.completion-burst span:nth-child(6) { --tx: -60px; --ty: -40px; }

.demo-player { display: flex; align-items: center; gap: 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 24px; }
.play-btn { flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%; border: none; background: var(--accent); color: #17120B; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.15s ease; }
.play-btn:hover { transform: scale(1.05); }
.demo-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 40px; overflow: hidden; }
.demo-wave span { display: block; width: 4px; min-height: 4px; border-radius: 2px; background: var(--text-dim); transition: background 0.2s ease; }
.demo-wave.is-playing span { background: var(--accent); }
.replay-btn { flex-shrink: 0; background: transparent; border: 1px solid var(--border); color: var(--text-muted); border-radius: 999px; padding: 8px 14px; font-size: 13px; cursor: pointer; font-family: var(--font-body); }
.replay-btn:hover { color: var(--text); border-color: var(--accent-dim); }

.demo-label { display: block; font-family: var(--font-mono); font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.demo-input { width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; color: var(--text); font-family: var(--font-mono); font-size: 16px; }
.demo-input:focus { outline: none; border-color: var(--accent); }
.demo-actions { display: flex; gap: 12px; margin-top: 16px; }
.demo-result { margin-top: 22px; font-family: var(--font-mono); font-size: 17px; line-height: 1.8; min-height: 28px; }
.demo-result .w-correct { color: var(--correct); }
.demo-result .w-wrong { color: var(--wrong); text-decoration: line-through; text-decoration-color: var(--wrong); }
.demo-result .w-answer { color: var(--text-muted); }

.demo-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; align-self: start; }
.side-title { font-size: 16px; margin-bottom: 8px; }
.side-hint { color: var(--text-dim); font-size: 13px; margin: 0 0 18px; }

/* flashcard review */
.flash-review { max-width: 460px; }
.flash-card-review { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px 32px; text-align: center; animation: cardIn 0.35s ease; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.flash-counter { font-family: var(--font-mono); font-size: 13px; color: var(--text-dim); margin: 0 0 24px; }
.flash-word { font-family: var(--font-display); font-size: 32px; margin: 0 0 8px; }
.flash-source { color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }
.flash-instruction { color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.flash-btns { display: flex; gap: 12px; justify-content: center; }
