/* Layout: tek sütun (max 680px). Sahne ekranı: üstte bölüm başlığı, ortada sohbet akışı, altta sabit hareket paneli. */
:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --muted: #5B6578;
  --line: #E2E7EF;
  --accent: #2251FF;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8EDFF;
  --stamp: #FFB800;
  --ok: #0E9F57;
  --ok-soft: #E3F6EC;
  --bad: #D93A3F;
  --bad-soft: #FCE9EA;
  --npc: #FFFFFF;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0F17; --surface: #141A25; --ink: #E8ECF4; --muted: #98A2B6; --line: #232B3A;
    --accent: #7D9BFF; --accent-ink: #0B0F17; --accent-soft: #1B2546; --stamp: #FFC633;
    --ok: #3DD68C; --ok-soft: #0F2A1E; --bad: #FF6B70; --bad-soft: #351416; --npc: #182030;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.boot { padding: 40px 16px; color: var(--muted); }

.wrap {
  max-width: 680px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(48px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 20px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); }
.logo i { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-ink); font-style: normal; font-size: 15px; }
.ghost { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 600; }

.btn {
  border: 0; border-radius: 12px; padding: 14px 18px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .08s ease, background-color .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent); }
.btn-line { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-bad { background: var(--bad); color: #fff; }
.btn-wide { width: 100%; }
.btn-lg { font-size: 17px; padding: 16px 20px; }

/* Bugün kartı */
.today { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: grid; gap: 16px; }
.today h1 { margin: 0; font-size: clamp(24px, 6vw, 30px); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.today p { margin: 0; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 600; }
.goal { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.goal i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s ease; }
.today-actions { display: grid; gap: 10px; }

/* Rota */
.h2 { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 -6px; }
.h2 h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.h2 span { font-size: 13px; color: var(--muted); font-weight: 600; }
.season { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.season-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; }
.lvl { font-weight: 800; font-size: 13px; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 6px 8px; min-width: 44px; text-align: center; }
.season.locked .lvl { background: var(--bg); color: var(--muted); }
.season-title { font-weight: 800; font-size: 17px; }
.season-desc { color: var(--muted); font-size: 14px; }
.chip { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 99px; white-space: nowrap; border: 0; }
.chip-muted { background: var(--bg); color: var(--muted); }
.chip-stamp { background: transparent; color: var(--ok); border: 2px solid var(--ok); transform: rotate(-4deg); text-transform: uppercase; letter-spacing: .05em; }
.chip-exam { background: var(--stamp); color: #1A1300; }
.eps { list-style: none; margin: 0; padding: 0 10px 10px; display: grid; gap: 4px; }
.ep { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; width: 100%; text-align: left; border: 0; background: transparent; }
.ep:not(:disabled):hover { background: var(--bg); }
.ep-dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--bg); color: var(--muted); }
.ep.done .ep-dot { background: var(--ok); color: #fff; }
.ep.current .ep-dot { background: var(--accent); color: var(--accent-ink); }
.ep-title { font-weight: 700; }
.ep-goal { font-size: 13px; color: var(--muted); }
.ep-go { font-size: 13px; font-weight: 700; color: var(--accent); }
.note { color: var(--muted); font-size: 13px; margin: 0; }

/* Sahne */
.play { height: 100%; display: flex; flex-direction: column; max-width: 680px; margin: 0 auto; }
.play-top {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding-top: calc(12px + env(safe-area-inset-top, 0px)); padding-bottom: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.x { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 6px 2px; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .3s ease; }
.meta { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.meta.hot { color: var(--accent); }
.log {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
  scroll-behavior: smooth;
}
.scene-title { text-align: center; padding: 10px 0 4px; }
.scene-title b { display: block; font-size: 20px; letter-spacing: -0.01em; }
.scene-title span { font-size: 13px; color: var(--muted); font-weight: 600; }
.narr { align-self: center; max-width: 92%; text-align: center; color: var(--muted); font-size: 15px; background: transparent; border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; }
.msg { max-width: 86%; border-radius: 16px; padding: 10px 14px; display: grid; gap: 2px; animation: pop .18s ease-out; }
.msg .who { font-size: 12px; font-weight: 700; color: var(--muted); }
.msg .en { font-size: 17px; font-weight: 600; }
.msg .tr { font-size: 14px; color: var(--muted); }
.msg.npc { align-self: flex-start; background: var(--npc); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.me .tr, .msg.me .who { color: inherit; opacity: .8; }
.msg.me.fixed { background: var(--bad-soft); color: var(--ink); border: 1px solid var(--bad); }
.replay { border: 0; background: transparent; color: inherit; opacity: .7; font-size: 13px; font-weight: 700; padding: 2px 0 0; text-align: left; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  flex: none; background: var(--surface); border-top: 1px solid var(--line);
  padding-top: 14px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 12px; max-height: 62%; overflow-y: auto;
}
.panel.ok { background: var(--ok-soft); }
.panel.bad { background: var(--bad-soft); }
.task-label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.say-this { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.3; }
.say-this small { display: block; font-size: 14px; font-weight: 500; color: var(--muted); }
.opts { display: grid; gap: 8px; }
.opt { text-align: left; border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px 14px; font-size: 16px; font-weight: 600; }
.opt:hover:not(:disabled) { border-color: var(--accent); }
.opt.is-ok { border-color: var(--ok); color: var(--ok); }
.opt.is-bad { border-color: var(--bad); color: var(--bad); }
.zone { min-height: 52px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; padding: 6px; border-radius: 12px; border: 2px dashed var(--line); }
.bank { display: flex; flex-wrap: wrap; gap: 6px; }
.tile { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 11px; font-size: 16px; font-weight: 600; box-shadow: 0 2px 0 var(--line); }
.tile.used { visibility: hidden; }
.gap-line { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.8; }
.gap { font: inherit; color: var(--accent); background: transparent; border: 0; border-bottom: 3px solid var(--accent); width: calc(var(--len, 6) * 0.68em + 1em); max-width: 100%; text-align: center; padding: 0 2px; }
.gap:focus { outline: none; background: var(--accent-soft); }
.field { width: 100%; font: 600 17px/1.4 var(--font); color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 12px; resize: none; }
.field:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1; }
.mic { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; justify-self: center; }
.mic svg { width: 30px; height: 30px; fill: currentColor; }
.mic.on { background: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--bad) 25%, transparent); } }
.heard { text-align: center; color: var(--muted); font-size: 14px; margin: 0; min-height: 1.4em; }
.fb-title { font-weight: 800; font-size: 18px; }
.panel.ok .fb-title { color: var(--ok); }
.panel.bad .fb-title { color: var(--bad); }
.fb-en { margin: 0; font-weight: 700; font-size: 17px; }
.fb-tr { margin: 0; color: var(--muted); font-size: 14px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0; justify-self: start; }
.listen { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 12px; font-size: 14px; font-weight: 700; }
.listen svg { width: 16px; height: 16px; fill: currentColor; }

/* Sonuç */
.result h1 { margin: 0; font-size: clamp(28px, 8vw, 38px); line-height: 1.1; letter-spacing: -0.02em; text-wrap: balance; }
.stamp { justify-self: start; border: 3px solid var(--ok); color: var(--ok); border-radius: 10px; padding: 6px 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; transform: rotate(-3deg); font-size: 14px; }
.stamp.fail { border-color: var(--bad); color: var(--bad); }
.result { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* Ayarlar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: grid; gap: 12px; }
.card h2 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.input { flex: 1; min-width: 0; font: 500 16px var(--font); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
textarea.input { width: 100%; font: 500 12px/1.4 ui-monospace, Menlo, monospace; min-height: 80px; resize: vertical; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.status { font-size: 13px; color: var(--muted); }

#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }