/* Shared look of every page: colour tokens (same as the analysis page), fonts, buttons,
   the top navigation bar (nav.js) and the page title row. Page stylesheets build on this. */
:root{
  --bg:#EDEFF2; --surface:#FFFFFF; --ink:#1B2333; --muted:#5A6474; --line:#D5DAE1;
  --accent:#2B4C7E; --accent-soft:rgba(43,76,126,.10);
  --err:#B42318; --ok:#1F7A55; --warn:#B07F0A;
  --sq-l:#E3E8ED; --sq-d:#8FA3B6;
  --serif:"Newsreader", Georgia, "Times New Roman", serif;
  --sans:"Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme:light dark;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#11161F; --surface:#19202C; --ink:#E6EAF0; --muted:#9AA5B5; --line:#2A3342;
    --accent:#9DB9E6; --accent-soft:rgba(157,185,230,.14);
    --err:#F0615A; --ok:#4CC08D; --warn:#E0B040; --sq-l:#B8C5D2; --sq-d:#6A8197;
  }
}
:root[data-theme="dark"]{
  --bg:#11161F; --surface:#19202C; --ink:#E6EAF0; --muted:#9AA5B5; --line:#2A3342;
  --accent:#9DB9E6; --accent-soft:rgba(157,185,230,.14);
  --err:#F0615A; --ok:#4CC08D; --warn:#E0B040; --sq-l:#B8C5D2; --sq-d:#6A8197;
}
:root[data-theme="light"]{color-scheme:light}
:root[data-theme="dark"]{color-scheme:dark}
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);font-size:15px;line-height:1.5;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
a{color:var(--accent)}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.wrap{max-width:1180px;margin:0 auto;padding:16px 20px calc(40px + env(safe-area-inset-bottom,0px))}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:8px;padding:7px 12px;font-weight:500;font-size:14px;line-height:1.35;cursor:pointer;text-decoration:none}
.btn:hover{border-color:var(--accent)}
.btn.primary{background:var(--accent);border-color:var(--accent);color:var(--surface)}
.btn.danger{color:var(--err);border-color:var(--err)}
.btn.small{padding:4px 10px;font-size:13px}
.btn:disabled{opacity:.45;cursor:not-allowed}

/* top navigation bar: identical on every page */
.appnav{display:flex;align-items:center;gap:12px 20px;flex-wrap:wrap;padding:4px 0 14px;margin-bottom:18px;border-bottom:1px solid var(--line)}
.appnav .brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);margin-right:auto}
.appnav .brand img{width:34px;height:34px;display:block}
.appnav .brand span{font-family:var(--serif);font-weight:500;font-size:22px;letter-spacing:-.01em;white-space:nowrap}
.appnav .tabs{display:flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface)}
.appnav .tabs a{padding:7px 14px;font-weight:500;font-size:14px;color:var(--ink);text-decoration:none;white-space:nowrap;position:relative}
.appnav .tabs a+a{border-left:1px solid var(--line)}
.appnav .tabs a:hover{background:var(--accent-soft)}
.appnav .tabs a[aria-current="page"]{background:var(--accent);color:var(--surface)}
.appnav .tabs a .dot{position:absolute;top:6px;right:5px;width:7px;height:7px;border-radius:50%;background:var(--warn)}
.appnav .out{flex:none}
.appnav .themebtn{flex:none;min-width:40px;font-size:16px;padding:6px 10px}
.appnav .lookwrap{position:relative;flex:none}
.lookpop{position:absolute;right:0;top:calc(100% + 6px);z-index:50;width:290px;max-width:calc(100vw - 32px);padding:12px;background:var(--surface);border:1px solid var(--line);border-radius:10px;box-shadow:0 8px 28px rgba(0,0,0,.18)}
.lookpop .lk{font-size:12px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.04em;margin:0 0 6px}
.lookpop .lk+*{margin-bottom:12px}
.lookpop .boards{margin-bottom:0!important}
.lookpop .modes{display:flex;border:1px solid var(--line);border-radius:8px;overflow:hidden}
.lookpop .modes button{flex:1;padding:6px 4px;border:0;background:none;cursor:pointer;font-size:13px;white-space:nowrap}
.lookpop .modes button+button{border-left:1px solid var(--line)}
.lookpop .modes button[aria-pressed="true"]{background:var(--accent);color:var(--surface)}
.lookpop .boards{display:grid;gap:2px}
.lookpop .boards button{display:flex;align-items:center;gap:10px;padding:5px 6px;border:0;border-radius:6px;background:none;cursor:pointer;text-align:left;font-size:14px}
.lookpop .boards button:hover,.lookpop .modes button:hover:not([aria-pressed="true"]){background:var(--accent-soft)}
.lookpop .boards button[aria-pressed="true"]{background:var(--accent-soft);font-weight:600}
.lookpop .sw{flex:none;width:28px;height:28px;border-radius:4px;border:1px solid var(--line);background:repeating-conic-gradient(var(--b) 0 25%, var(--a) 0 50%) 0 0/50% 50%}
@media (max-width:760px){
  .appnav{gap:10px}
  .appnav .tabs{order:3;flex:1 1 100%;overflow-x:auto;scrollbar-width:none}
  .appnav .tabs::-webkit-scrollbar{display:none}
  .appnav .tabs a{flex:1 0 auto;text-align:center;padding:8px 7px;font-size:13px}
  .wrap{padding-left:14px;padding-right:14px}
}

/* page title row: title + one-line description on the left, page actions on the right */
.pagehead{display:flex;flex-wrap:wrap;align-items:flex-end;justify-content:space-between;gap:10px 24px;margin-bottom:18px}
.pagehead h1{font-family:var(--serif);font-weight:500;font-size:30px;line-height:1.15;margin:0;letter-spacing:-.01em}
.pagehead p{margin:4px 0 0;color:var(--muted);font-size:14px}
.pagehead .actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}

/* on/off switches (same as the analysis page) */
.switch{display:inline-flex;align-items:center;gap:8px;font-size:14px;cursor:pointer;user-select:none}
.switch input{appearance:none;-webkit-appearance:none;flex:none;width:34px;height:20px;border-radius:10px;background:var(--line);position:relative;margin:0;cursor:pointer;transition:background .15s}
.switch input::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--surface);transition:transform .15s}
.switch input:checked{background:var(--accent)}
.switch input:checked::after{transform:translateX(14px)}

/* loading placeholders (skeletons) shown while a page waits for data */
.skel{display:block;border-radius:6px;background:linear-gradient(90deg,var(--line) 25%,var(--bg) 50%,var(--line) 75%);background-size:200% 100%;animation:skel 1.4s ease-in-out infinite}
.skel.line{height:12px;margin:10px 0}
.skel.title{height:18px;width:45%;margin:4px 0 14px}
.skel.w30{width:30%} .skel.w50{width:50%} .skel.w70{width:70%} .skel.w90{width:90%}
.skel.field{height:38px;border-radius:8px;margin:6px 0 14px}
.skel.chip{display:inline-block;height:36px;width:72px;border-radius:8px}
.skel.box{height:86px;border-radius:12px}
.skel.card{height:220px;border-radius:12px}
.skel-row{display:flex;gap:8px;flex-wrap:wrap}
.skel-grid{display:grid;gap:12px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@keyframes skel{from{background-position:100% 0}to{background-position:-100% 0}}
@media (prefers-reduced-motion:reduce){.skel{animation:none}}

/* analysis page: puzzle sets are downloading after "Bulmaca" was clicked */
body.pz-loading{cursor:progress}
body.pz-loading .appnav [data-k="bulmaca"]{background:linear-gradient(90deg,var(--accent-soft) 25%,var(--surface) 50%,var(--accent-soft) 75%);background-size:200% 100%;animation:skel 1.4s ease-in-out infinite}

/* "Uygulama güncellendi" (nav.js): a new version was deployed while the page was open */
.updbar{position:fixed;left:50%;bottom:calc(16px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:100;display:flex;align-items:center;gap:10px;padding:10px 12px 10px 16px;border-radius:12px;background:var(--ink);color:var(--surface);box-shadow:0 8px 28px rgba(0,0,0,.25);font-size:14px;max-width:calc(100vw - 32px)}
.updbar .btn.primary{background:var(--surface);color:var(--ink);border-color:var(--surface)}
.updx{border:0;background:none;color:inherit;opacity:.7;cursor:pointer;font-size:14px;padding:4px}
.updx:hover{opacity:1}

/* Piece-sound control next to the boards (sound.js): on/off button and volume slider. */
.sndctl{display:inline-flex;align-items:center;gap:6px;vertical-align:middle}
.sndctl .sndt{display:inline-grid;place-items:center;width:32px;height:30px;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-size:15px;line-height:1;cursor:pointer}
.sndctl .sndt:hover{border-color:var(--accent)}
.sndctl .sndv{width:78px;accent-color:var(--accent);cursor:pointer}
.sndctl.off .sndv{opacity:.45}
@media (max-width:520px){.sndctl .sndv{width:60px}}

/* Focus mode (focus.js): only the board's unit stays; the board grows to the window's height. */
[data-hyhide]{display:none!important}
.hy-focusbtn{display:inline-grid;place-items:center;width:32px;height:30px;padding:0;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--ink);font-size:16px;line-height:1;cursor:pointer;vertical-align:middle;margin-left:6px}
.hy-focusbtn:hover,.hy-focusbtn[aria-pressed="true"]{border-color:var(--accent);color:var(--accent)}
.hy-focus-exit{position:fixed;top:calc(env(safe-area-inset-top,0px) + 10px);right:12px;z-index:60;box-shadow:0 4px 14px rgba(0,0,0,.18)}
html.hy-focus .wrap{max-width:none;padding-top:12px}
html.hy-focus [data-hyunit]{margin-left:auto;margin-right:auto}
/* Öğren: the exercise */
html.hy-focus .mrun{max-width:none}
@media (min-width:761px){
  html.hy-focus .mplay{grid-template-columns:minmax(280px,calc(100vh - 110px)) minmax(240px,340px);grid-template-columns:minmax(280px,calc(100dvh - 110px)) minmax(240px,340px);justify-content:center}
}
@media (max-width:760px){ html.hy-focus .mboard{max-width:min(100%,calc(100dvh - 220px))} }
html.hy-focus [data-hychain]{display:block!important;width:auto!important;max-width:none!important;position:static!important}
/* the book's boards: the board large on the left, the buttons and moves beside it */
html.hy-focus .study[data-hyunit]{display:grid;grid-template-columns:minmax(0,calc(100vh - 60px)) minmax(220px,340px);grid-template-columns:minmax(0,calc(100dvh - 60px)) minmax(220px,340px);gap:8px 18px;align-items:start;justify-content:center;width:auto;max-width:calc(100vw - 40px)}
html.hy-focus .study[data-hyunit] > .sboard{grid-column:1;grid-row:1 / span 8}
@media (max-width:760px){ html.hy-focus .study[data-hyunit]{grid-template-columns:minmax(0,1fr)} html.hy-focus .study[data-hyunit] > .sboard{grid-row:auto} }
/* analysis and live play: the board column alone */
html.hy-focus .main,html.hy-focus main.grid{display:block}
html.hy-focus .main > .boardcol{--board:min(calc(100vw - 72px),calc(100vh - 130px));--board:min(calc(100vw - 72px),calc(100dvh - 130px));width:fit-content;position:static}
html.hy-focus main.grid > .boardcol{max-width:min(100%,calc(100vh - 120px));max-width:min(100%,calc(100dvh - 120px))}
