/* Tema: Alman okul defteri (kariert). Mavi kareli kâğıt, kırmızı kenar çizgisi,
   fosforlu kalem sarısı vurgular. Tek "akılda kalan" şey kâğıt; geri kalanı sade. */
:root {
  --paper: #FDFDFB;
  --grid: rgba(64, 104, 196, .13);
  --margin: #F2A3A3;
  --ink: #2340A8;
  --ink-soft: #5B6FB8;
  --text: #1E2440;
  --marker: #FFE45C;
  --fox: #F07A2B;
  --ok: #138F6C;
  --fix: #D9473F;
  --line: #D7DDF0;
  --radius-lg: 22px;
  --radius-sm: 12px;
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  font-size: 18px; line-height: 1.5;
}
.page {
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px 32px 34px;
  position: relative;
}
/* Defterin kırmızı kenar çizgisi */
.page::before {
  content: ''; position: fixed; top: 0; bottom: 0; width: 2px; background: var(--margin);
  margin-left: -16px;
}
h1, h2, b, .btn, .tile b { font-family: 'Fredoka', 'Atkinson Hyperlegible', sans-serif; font-weight: 600; }
h1 { font-size: 2.2rem; margin: .2em 0; color: var(--ink); }
h2 { font-size: 1.35rem; margin: 0; color: var(--ink); }
.lead { color: #3D466B; margin: .3em 0 1em; }
.view { display: none; }
.view.active { display: block; animation: in .18s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } }

button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--fox); outline-offset: 2px; }

.fox { font-size: 2.6rem; line-height: 1; }
.fox.big { font-size: 4.5rem; text-align: center; margin-top: 8vh; }
#v-login, #v-locked { text-align: center; }

/* Ana sayfa */
.hello { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 18px; }
.bubble {
  background: #fff; border: 2px solid var(--ink); border-radius: 18px 18px 18px 4px;
  padding: 10px 14px; font-size: 1.05rem; box-shadow: 3px 3px 0 var(--ink);
}
.tile {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px; text-align: left; color: var(--text); margin-bottom: 12px; position: relative;
}
.tile .ico { font-size: 1.8rem; }
.tile b { font-size: 1.15rem; display: block; }
.tile small { display: block; color: #4A537A; font-size: .9rem; }
.tile.primary { background: var(--ink); border-color: var(--ink); color: #fff; padding: 20px; }
.tile.primary small { color: #D6DEFF; }
.tile:active { transform: translateY(1px); }
.tile[disabled] { opacity: .4; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid .tile { flex-direction: column; align-items: flex-start; margin: 0; min-height: 110px; }
.badge {
  position: absolute; top: 10px; right: 12px; font-style: normal; background: var(--fix); color: #fff;
  border-radius: 999px; min-width: 26px; height: 26px; display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.banner { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.banner.soft { background: #FFF6CC; border: 2px dashed #E3C400; }
.wotd { margin-top: 18px; padding: 14px; border-left: 4px solid var(--fox); background: #fff; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.wotd .w { font-family: 'Fredoka'; font-size: 1.4rem; color: var(--ink); }
mark, .hl { background: linear-gradient(transparent 45%, var(--marker) 45%, var(--marker) 90%, transparent 90%); color: inherit; padding: 0 2px; }
.demo { font-size: .8rem; color: #8790B0; text-align: center; }

/* Üst gezinme */
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; position: sticky; top: 0; background: var(--paper); padding: 6px 0; z-index: 2; }
.top h2 { flex: 1; }
.back { border: 0; background: none; color: var(--ink); font-size: 1.05rem; padding: 6px 4px; }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; color: var(--ink); padding: 4px 10px; font-weight: 700; }
.seg button.on { background: var(--ink); color: #fff; }

/* Tuş takımı */
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.f { background: var(--ink); }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; justify-content: center; }
.keypad button { height: 64px; border-radius: 18px; border: 2px solid var(--line); background: #fff; font-size: 1.6rem; font-family: 'Fredoka'; color: var(--ink); }
.error { color: var(--fix); min-height: 1.5em; }

/* Sohbet */
.chat-view.active { display: flex; flex-direction: column; height: calc(100dvh - 40px); }
.msgs { flex: 1; overflow-y: auto; padding: 4px 2px 12px; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; margin: 8px 0; white-space: pre-wrap; word-wrap: break-word; }
.msg.me { margin-left: auto; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg.her { background: #fff; border: 2px solid var(--line); border-bottom-left-radius: 4px; }
.msg .say { border: 0; background: none; font-size: 1rem; padding: 0 0 0 6px; vertical-align: middle; }
.msg.typing { color: #7A84A8; font-style: italic; }
.composer { display: flex; gap: 8px; }
.composer input { flex: 1; border: 2px solid var(--line); border-radius: 999px; padding: 12px 16px; background: #fff; min-width: 0; }
.composer button { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; font-size: 1.2rem; flex: none; }
.composer .mic { background: var(--fox); }
.composer .mic.rec { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(240,122,43,.25); } }
.mic-lang { font-size: .85rem; color: #4A537A; margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mic-lang button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 10px; }
.mic-lang button.on { border-color: var(--ink); color: var(--ink); font-weight: 700; }

/* Kartlar: görev, ders, sonuç */
.card { background: #fff; border: 2px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 14px; }
.card h3 { font-family: 'Fredoka'; margin: 0 0 6px; color: var(--ink); font-weight: 600; }
.card .meta { font-size: .85rem; color: #6A739A; }
.wrong { text-decoration: underline wavy var(--fix); text-underline-offset: 4px; }
.row { display: flex; gap: 8px; margin: 10px 0; }
.row input, .field { flex: 1; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: #fff; min-width: 0; width: 100%; }
.btn { border: 0; background: var(--ink); color: #fff; border-radius: var(--radius-sm); padding: 12px 18px; font-size: 1rem; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid var(--ink); }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); }
.feedback.ok { background: #E3F6EF; color: #0B5E47; }
.feedback.no { background: #FDECEB; color: #8C2A24; }
.reveal { margin-top: 8px; font-family: 'Fredoka'; font-size: 1.15rem; color: var(--ok); }
.step { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.step .de { font-family: 'Fredoka'; font-size: 1.2rem; color: var(--ink); }
.step .tr { color: #4A537A; }
.words { list-style: none; padding: 0; margin: 0; }
.words li { background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.words .de { font-family: 'Fredoka'; color: var(--ink); font-size: 1.1rem; }
.empty { text-align: center; color: #5B648A; padding: 30px 10px; }
.spinner { text-align: center; padding: 26px; color: var(--ink-soft); }
.spinner::before { content: '🦊'; display: block; font-size: 2rem; animation: bob 1s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px; transition: transform .25s; max-width: 90vw; z-index: 9; }
.toast.show { transform: translateX(-50%) translateY(0); }
.say, .say-btn { border: 0; background: none; font-size: 1.05rem; padding: 2px 4px; vertical-align: middle; }

/* Giriş formu */
.login-form { text-align: left; max-width: 340px; margin: 0 auto; display: grid; gap: 14px; }
.login-form label { font-weight: 700; color: var(--ink); display: grid; gap: 6px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .field { padding-right: 48px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 1.2rem; }
.big-btn { padding: 14px; font-size: 1.15rem; }
.logout-old { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; border: 0; background: none; color: #6A739A; font-size: .85rem; z-index: 3; }

/* Profil kutucuğu (ana sayfa) */
.me-tile { margin-top: 12px; }
.me-tile .stars { margin-left: auto; font-family: 'Fredoka'; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* Profil sayfası */
.hero { text-align: center; padding: 8px 0 14px; }
.hero .big-stars { font-family: 'Fredoka'; font-size: 3rem; line-height: 1; color: var(--ink); }
.hero .big-stars span { font-size: 2.2rem; }
.hero .sub { color: #4A537A; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.chip { background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 700; font-size: .95rem; }
.chip.fire { border-color: var(--fox); color: #9A4512; }
.levels { display: flex; align-items: center; gap: 0; margin: 6px 0 4px; }
.levels .lv { flex: 1; text-align: center; font: 600 .85rem 'Fredoka'; color: #8A92B4; position: relative; padding-top: 22px; }
.levels .lv::before { content: ''; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line); z-index: 1; }
.levels .lv::after { content: ''; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.levels .lv:first-child::after { display: none; }
.levels .lv.done { color: var(--ink); } .levels .lv.done::before { background: var(--ink); border-color: var(--ink); }
.levels .lv.done::after, .levels .lv.now::after { background: var(--ink); }
.levels .lv.now { color: var(--ink); } .levels .lv.now::before { background: var(--marker); border-color: var(--ink); width: 18px; height: 18px; top: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #F6F8FE; border-radius: 14px; padding: 10px 8px; text-align: center; }
.stat .n { font: 600 1.5rem 'Fredoka'; color: var(--ink); line-height: 1.1; }
.stat .l { font-size: .78rem; color: #4A537A; }
/* 7 günlük çubuk grafik: tek seri, tek renk, ince çubuklar, yuvarlak uçlar */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 150px; padding-top: 22px; position: relative; }
.week .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.week .bar { width: 60%; max-width: 26px; background: var(--ink); border-radius: 4px 4px 0 0; min-height: 2px; }
.week .bar.zero { background: var(--line); }
.week .val { font: 600 .8rem 'Fredoka'; color: var(--text); margin-bottom: 4px; visibility: hidden; }
.week .col.today .val, .week .col:hover .val, .week .col:focus .val { visibility: visible; }
.week .col.today .bar { background: var(--fox); }
.week-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; border-top: 1px solid var(--line); margin-top: 0; padding-top: 4px; }
.week-labels span { text-align: center; font-size: .75rem; color: #4A537A; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge-card { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 10px 6px; text-align: center; }
.badge-card .e { font-size: 1.8rem; }
.badge-card .t { font: 600 .85rem 'Fredoka'; color: var(--ink); line-height: 1.2; }
.badge-card .p { font-size: .72rem; color: #4A537A; }
.badge-card.locked .e { filter: grayscale(1); opacity: .35; }
.badge-card.locked { border-style: dashed; }
.mini-bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 8px; }
.teacher-row { display: flex; align-items: center; gap: 12px; }
.teacher-row .avatar { font-size: 2.2rem; }
.card h3 small { font: 400 .85rem 'Atkinson Hyperlegible'; color: #4A537A; }

/* Ses seçimi */
.seg.wide { width: 100%; margin-bottom: 14px; }
.seg.wide button { flex: 1; padding: 10px; }
.voice-card { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px; margin-bottom: 10px; }
.voice-card.on { border-color: var(--ink); box-shadow: 3px 3px 0 var(--ink); }
.voice-card .who { flex: 1; }
.voice-card .who b { display: block; font-size: 1.1rem; }
.voice-card .who small { color: #4A537A; }
.play { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-size: 1.1rem; flex: none; }
.play.busy { animation: pulse 1s infinite; }
.small-note { font-size: .82rem; color: #6A739A; }
