:root {
  --krem: #FAF6EE; --krem-koyu: #F1EADB; --lacivert: #1B2A4A;
  --lacivert-60: #5A6478; --altin: #C9A227; --altin-soft: #E7D9A8;
  --nazar: #2B7DBB; --cizgi: #E4DCC9; --beyaz: #FFFFFF;
  --dogru: #2E7D5B; --yanlis: #B3384B;
  --m-root: #1B2A4A; --m-tense: #C9A227; --m-person: #2E7D74;
  --m-case: #C0603B; --m-poss: #6B4E8E; --m-neg: #B3384B; --m-q: #5A6B7A;
  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "DM Sans", -apple-system, "Segoe UI", sans-serif;
  --radius: 14px; --radius-pill: 999px;
  --shadow-soft: 0 10px 30px rgba(27, 42, 74, 0.08);
}
.m-root, .m-tense, .m-person, .m-case, .m-poss, .m-neg, .m-q {
  text-decoration: underline dotted 1.5px; text-underline-offset: 3px;
}
.m-root { color: var(--m-root); } .m-tense { color: var(--m-tense); }
.m-person { color: var(--m-person); } .m-case { color: var(--m-case); }
.m-poss { color: var(--m-poss); } .m-neg { color: var(--m-neg); } .m-q { color: var(--m-q); }
.renksiz .m-root, .renksiz .m-tense, .renksiz .m-person,
.renksiz .m-case, .renksiz .m-poss, .renksiz .m-neg, .renksiz .m-q { color: inherit; }

/* Grammatical person colors (soft): 1st teal, 2nd amber, 3rd plum.
   Used by conjugation tables and anywhere person needs a hue. */
:root {
  --kisi1-bg: #E7F2EE; --kisi1-ink: #2E7D74;
  --kisi2-bg: #F7EFDA; --kisi2-ink: #8A6E15;
  --kisi3-bg: #EFE9F5; --kisi3-ink: #6B4E8E;
}

/* Dark mode (gece): flip the token values, every component follows.
   State lives in JS memory only until Supabase, so it resets per page load. */
.gece {
  --krem: #10192B; --krem-koyu: #1B2740; --lacivert: #EDE7D8;
  --lacivert-60: #9BA6BC; --cizgi: #2A3A5C; --beyaz: #16233C;
  --altin: #D4AF37; --altin-soft: #8A742F;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.45);
  --kisi1-bg: #14332E; --kisi1-ink: #8FD8CB;
  --kisi2-bg: #332B10; --kisi2-ink: #E4C86A;
  --kisi3-bg: #2A2138; --kisi3-ink: #C4A9E8;
}

/* Shared progress bar */
.pbar { height: 0.55rem; border-radius: 999px; background: var(--cizgi); overflow: hidden; }
.pbar > span { display: block; height: 100%; border-radius: 999px; background: var(--altin); transition: width 0.4s ease; }
@media (prefers-reduced-motion: reduce) { .pbar > span { transition: none; } }

/* =====================================================================
   THE SHELL (rendered by app/js/shell.js): one header + footer everywhere.
   Pages provide only the middle; do not restyle these locally.
   ===================================================================== */
:root { --hdrh: 3.7rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0.5rem; background: var(--lacivert); color: var(--krem); padding: 0.5rem 1rem; border-radius: 8px; z-index: 100; text-decoration: none; }
.skip:focus { left: 0.5rem; }
:focus-visible { outline: 2px solid var(--nazar); outline-offset: 2px; }

.hdr { position: sticky; top: 0; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 0.4rem 0.9rem; background: var(--krem); border-bottom: 1px solid var(--cizgi);
  padding: 0.5rem clamp(1rem, 2.5vw, 2.5rem); min-height: var(--hdrh); }
.tb-left { display: flex; align-items: center; gap: 0.7rem; }
.tb-right { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; text-decoration: none; letter-spacing: -0.01em; view-transition-name: wordmark; color: var(--lacivert); }
.brand .i { position: relative; display: inline-block; }
.brand .i svg { position: absolute; left: 50%; transform: translateX(-50%); top: 0.05em; width: 0.2em; height: 0.2em; }
.icon-btn { width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--cizgi); background: var(--beyaz);
  cursor: pointer; font-size: 0.95rem; display: grid; place-items: center; font-family: inherit; color: var(--lacivert); }
.menu-btn { display: none; width: 2.4rem; height: 2.4rem; border-radius: 10px; border: 1px solid var(--cizgi);
  background: var(--beyaz); font-size: 1.05rem; cursor: pointer; place-items: center; font-family: inherit; color: var(--lacivert); }
.nb-chip { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--cizgi);
  background: var(--beyaz); color: var(--lacivert); border-radius: var(--radius-pill);
  padding: 0.35rem 0.85rem; font-size: 0.8125rem; font-weight: 500; cursor: pointer; font-family: inherit; }
.nb-chip b { color: var(--altin); }
.btn { border: 1px solid var(--lacivert); background: var(--lacivert); color: var(--krem);
  border-radius: var(--radius-pill); padding: 0.5rem 1.2rem; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; color: var(--lacivert); }

/* layout with a page-provided sidebar */
.layout { display: grid; grid-template-columns: clamp(230px, 21vw, 300px) minmax(0, 1fr); min-height: calc(100svh - var(--hdrh)); }
.side { border-right: 1px solid var(--cizgi); padding: 1.1rem 0.9rem 2rem; position: sticky; top: var(--hdrh);
  height: calc(100svh - var(--hdrh)); overflow-y: auto; background: var(--krem); z-index: 66; }
.mainc { min-width: 0; padding: 1rem clamp(1.25rem, 3vw, 3rem) 4rem; }
.backdrop { position: fixed; inset: 0; background: rgba(27, 42, 74, 0.45); z-index: 75; }
.backdrop[hidden] { display: none; }
@media (max-width: 940px) {
  .layout { display: block; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 86vw); height: auto; z-index: 76;
    transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: var(--shadow-soft); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
}
@media (max-width: 760px) {
  .nb-chip .lbl { display: none; }
  .ds-toggle { font-size: 0.75rem; }
  .ds-toggle .seg { padding: 0.3rem 0.6rem; }
  .ds-toggle .seg.on { padding: 0.3rem 0.7rem; }
}

/* side menu items */
.side-head { font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lacivert-60); margin: 0 0.5rem 0.7rem; }
.s-link { display: block; padding: 0.45rem 0.55rem; border-radius: 8px; text-decoration: none; font-size: 0.875rem; font-weight: 500; }
.s-link:hover { background: var(--krem-koyu); }
.s-unit { margin-top: 0.15rem; }
.s-row { display: flex; gap: 0.4rem; align-items: stretch; }
.s-num-btn { white-space: nowrap; border: 1px solid var(--cizgi); background: var(--beyaz); border-radius: 8px;
  padding: 0.3rem 0.5rem; font-family: inherit; font-size: 0.75rem; font-weight: 700; color: var(--lacivert);
  cursor: pointer; min-width: 4.1rem; text-align: center; text-decoration: none; display: grid; place-items: center; }
.s-num-btn:hover { border-color: var(--altin); }
.s-num-btn[aria-current="true"] { background: var(--lacivert); color: var(--krem); border-color: var(--lacivert); }
.s-toggle { flex: 1; min-width: 0; display: flex; gap: 0.45rem; align-items: center; justify-content: space-between;
  text-align: left; background: none; border: none; font-family: inherit; color: var(--lacivert);
  font-size: 0.83rem; font-weight: 500; padding: 0.35rem 0.5rem; border-radius: 8px; cursor: pointer; }
.s-toggle:hover { background: var(--krem-koyu); }
.s-toggle .arr { color: var(--altin); transition: transform 0.15s; display: inline-block; flex: none; }
.s-toggle[aria-expanded="true"] .arr { transform: rotate(90deg); }
.s-toggle .tw { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-subs { margin: 0.05rem 0 0.35rem 1rem; border-left: 1px solid var(--cizgi); padding-left: 0.3rem; }
.s-sub { display: flex; width: 100%; gap: 0.4rem; align-items: baseline; background: none; border: none; font-family: inherit;
  color: var(--lacivert); font-size: 0.83rem; text-align: left; padding: 0.35rem 0.5rem; border-radius: 8px; cursor: pointer;
  line-height: 1.35; text-decoration: none; }
.s-sub:hover { background: var(--krem-koyu); }
.s-sub[aria-current="true"] { background: var(--lacivert); color: var(--krem); }
.s-sub .ok { color: var(--altin); margin-left: auto; }
.s-sub[aria-current="true"] .ok { color: var(--altin-soft); }
.side-note { font-size: 0.72rem; color: var(--lacivert-60); margin: 1rem 0.5rem 0; }
.side-loading { font-size: 0.83rem; color: var(--lacivert-60); padding: 0.4rem 0.55rem; }

/* notebook panels */
.panel { display: none; position: fixed; top: 4rem; right: clamp(1rem, 3vw, 3rem); z-index: 60;
  width: min(360px, 92vw); background: var(--beyaz); border: 1px solid var(--cizgi); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); padding: 1rem; max-height: 76vh; flex-direction: column; }
.panel.open { display: flex; }
.panel h3 { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--lacivert-60); margin-bottom: 0.5rem; }
.panel .count { font-size: 0.95rem; margin-bottom: 0.5rem; }
.panel .count b { font-size: 1.3rem; font-family: var(--font-display); color: var(--altin); }
.panel ul { list-style: none; overflow: auto; font-size: 0.875rem; flex: 1; margin: 0; padding: 0; }
.panel li { padding: 0.4rem 0; border-bottom: 1px dashed var(--cizgi); }
.panel li button { background: none; border: none; cursor: pointer; font-family: inherit; font-size: inherit; color: var(--lacivert); text-align: left; padding: 0; }
.panel li button:hover { color: var(--altin); }
.panel .empty { color: var(--lacivert-60); font-size: 0.875rem; padding: 0.6rem 0; }
.panel .pnote { font-size: 0.72rem; color: var(--lacivert-60); margin-top: 0.6rem; }
.kel-search { width: 100%; border: 1px solid var(--cizgi); border-radius: var(--radius-pill); padding: 0.45rem 0.9rem;
  font-family: inherit; font-size: 0.875rem; color: var(--lacivert); background: var(--krem); margin-bottom: 0.6rem; }
.kel-row { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.6rem; }
.kel-row .w { font-weight: 700; }
.kel-row .w .hyf { color: var(--altin); }
.kel-row .g { color: var(--lacivert-60); }
.kel-row .src { grid-column: 1 / -1; font-size: 0.72rem; }
.kel-row .src button { color: var(--lacivert-60); text-decoration: underline dotted; }

/* overlay + karne */
.overlay { position: fixed; inset: 0; background: rgba(27, 42, 74, 0.55); z-index: 80; display: none; align-items: center; justify-content: center; padding: 1rem; }
.overlay.open { display: flex; }
.ov-close { border: 1px solid var(--cizgi); background: var(--beyaz); border-radius: var(--radius-pill);
  padding: 0.3rem 0.8rem; font-size: 0.8125rem; cursor: pointer; font-family: inherit; color: var(--lacivert); }
.karne { width: min(470px, 94vw); background: var(--beyaz); border-radius: var(--radius);
  box-shadow: var(--shadow-soft); display: flex; flex-direction: column; max-height: 92vh; overflow-y: auto; }
.k-top { height: 6px; flex: none; background: linear-gradient(90deg, var(--altin), var(--altin-soft), var(--altin)); }
.k-head { display: flex; justify-content: space-between; align-items: center; padding: 0.8rem 1.2rem; border-bottom: 1px solid var(--cizgi); }
.k-title { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.k-body { padding: 1.1rem 1.3rem; }
.k-lvl { font-size: 0.76rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--lacivert-60); }
.k-name { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; margin: 0.15rem 0 0.8rem; }
.k-hero { display: flex; gap: 1.2rem; align-items: center; }
.k-ring { width: 6.4rem; height: 6.4rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--altin) calc(var(--pct) * 1%), var(--cizgi) 0); }
.k-ring > span { width: 4.8rem; height: 4.8rem; border-radius: 50%; background: var(--beyaz); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; }
.k-stats { flex: 1; display: grid; gap: 0.7rem; min-width: 0; }
.k-stat .l { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; color: var(--lacivert-60); margin-bottom: 0.3rem; }
.k-stat .l b { color: var(--lacivert); }
.k-units { display: flex; gap: 0.5rem; margin-top: 1.1rem; flex-wrap: wrap; }
.k-unit { flex: 1; min-width: 3.2rem; text-align: center; }
.k-unit .dots { display: flex; gap: 2px; justify-content: center; flex-wrap: wrap; }
.k-unit .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--cizgi); }
.k-unit .dots i.on { background: var(--altin); }
.k-unit small { font-size: 0.65rem; color: var(--lacivert-60); }
.k-actions { padding: 0.2rem 1.3rem 0.9rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.k-note { font-size: 0.72rem; color: var(--lacivert-60); padding: 0 1.3rem 1.1rem; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%) translateY(150%); z-index: 90;
  background: var(--lacivert); color: var(--krem); border-radius: var(--radius-pill); padding: 0.55rem 1.2rem;
  font-size: 0.875rem; transition: transform 0.25s ease; max-width: 92vw; }
.toast.show { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .side, .toast { transition: none; }
  .s-toggle .arr { transition: none; }
}

/* Ders Odası / Dil Bankası toggle (shared, morphs across pages).
   Navy capsule; the active side is a white pill with icon + label,
   the inactive side is an icon-only button. */
.ds-toggle {
  display: inline-flex; align-items: center; gap: 0.2rem;
  background: var(--lacivert); border-radius: var(--radius-pill); padding: 0.25rem;
  font-size: 0.8125rem; white-space: nowrap; view-transition-name: dstoggle;
}
.ds-toggle .seg {
  display: inline-flex; align-items: center; gap: 0.45rem; line-height: 1;
  border-radius: var(--radius-pill); padding: 0.4rem 0.7rem;
  color: var(--krem); text-decoration: none;
}
.ds-toggle .seg.on {
  background: var(--beyaz); color: var(--lacivert); font-weight: 700; padding: 0.4rem 1rem;
}
.ds-toggle a.seg:hover { background: rgba(255, 255, 255, 0.16); }
.gece .ds-toggle a.seg:hover { background: rgba(0, 0, 0, 0.18); }

/* Site footer: legend + quick links (shared) · same voice as the in-page notes */
.site-foot { border-top: 1px solid var(--cizgi); margin-top: 3rem; padding: 1.1rem clamp(1rem, 3vw, 2.5rem) 1.6rem; text-align: center; }
.site-foot .legend { font-size: 0.75rem; color: var(--lacivert-60); line-height: 1.8; }
.site-foot .legend b { color: var(--lacivert-60); }
.site-foot .quick { font-size: 0.75rem; color: var(--lacivert-60); margin-top: 0.4rem; }
.site-foot .quick a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--altin); }

/* Page transitions (View Transitions API — no-op where unsupported).
   The wordmark carries its own name so it stays anchored while the page fades. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out 0.22s ease both; }
::view-transition-new(root) { animation: vt-in 0.3s ease both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
