/* EREN vs BABA — koyu, premium satranç salonu */

@font-face {
  font-family: 'Cormorant';
  src: url('../fonts/cormorant-latin-ext.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cormorant';
  src: url('../fonts/cormorant-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #0d0b09;
  --bg-2: #15120e;
  --surface: rgba(255, 244, 222, 0.035);
  --surface-2: rgba(255, 244, 222, 0.06);
  --line: rgba(214, 178, 108, 0.16);
  --line-2: rgba(214, 178, 108, 0.32);
  --text: #efe5d3;
  --muted: #a3957f;
  --faint: #6f6454;
  --gold: #c9a45c;
  --gold-2: #e8cd8f;
  --gold-deep: #8a6a2f;
  --red: #d4543f;
  --green: #7fb07a;
  --sq-l: #e9d7b4;
  --sq-d: #a2724b;
  --coord-l: #a2724b;
  --coord-d: #f0e0c0;
  --last: rgba(214, 170, 72, 0.42);
  --sel: rgba(232, 205, 143, 0.55);
  --dot: rgba(38, 24, 10, 0.34);
  --serif: 'Cormorant', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --gutter: 8px;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

.theme-zumrut { --sq-l: #e4e1cc; --sq-d: #5f8a6a; --coord-l: #5f8a6a; --coord-d: #eeeadb; --dot: rgba(10, 30, 16, 0.32); }
.theme-grafit { --sq-l: #cfd2d4; --sq-d: #6f7a84; --coord-l: #6f7a84; --coord-d: #e8eaec; --dot: rgba(10, 16, 24, 0.32); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(201, 164, 92, 0.13), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(120, 70, 30, 0.12), transparent 60%),
    linear-gradient(180deg, #120f0c 0%, var(--bg) 60%);
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ üst bar */
.app { min-height: 100%; display: flex; flex-direction: column; padding-top: var(--safe-t); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 6px; max-width: 1280px; width: 100%; margin: 0 auto;
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 25px; letter-spacing: 0.06em; display: flex; align-items: baseline; gap: 8px; user-select: none; }
.brand .b-eren { color: var(--text); }
.brand .b-vs { font-style: italic; font-weight: 500; font-size: 17px; color: var(--gold); letter-spacing: 0; }
.brand .b-baba {
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  display: grid; place-items: center; color: var(--muted); cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.icon-btn svg { display: block; }
.icon-btn:hover { color: var(--gold-2); background: var(--surface); border-color: var(--line); }
.icon-btn:active { transform: scale(0.96); }

/* ------------------------------------------------------------------ yerleşim */
.stage { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; padding: 0 var(--gutter) calc(12px + var(--safe-b)); gap: 10px; }
.play { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.board-frame {
  --bsize: min(calc(100vw - 2 * var(--gutter) - 12px), 620px);
  width: calc(var(--bsize) + 12px);
  padding: 6px;
  border-radius: 10px;
  background: linear-gradient(145deg, #2b2016, #150f0a 60%, #231911);
  box-shadow: 0 0 0 1px rgba(214, 178, 108, 0.22), 0 1px 0 1px rgba(255, 230, 180, 0.05) inset, 0 24px 60px rgba(0, 0, 0, 0.6), 0 8px 18px rgba(0, 0, 0, 0.45);
}
.panel { width: 100%; max-width: 632px; display: flex; flex-direction: column; gap: 10px; }

@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .stage { flex-direction: row; align-items: flex-start; justify-content: center; gap: 28px; padding-top: 8px; }
  .play { width: auto; }
  .board-frame { --bsize: min(calc(100dvh - 250px), calc(100vw - 480px), 800px); }
  .panel { width: 360px; max-width: none; height: calc(min(calc(100dvh - 250px), calc(100vw - 480px), 800px) + 140px); }
  .panel .moves { flex: 1; max-height: none; }
}

/* ------------------------------------------------------------------ oyuncu şeritleri */
.player { width: 100%; max-width: 632px; display: flex; align-items: center; gap: 12px; padding: 4px 2px; min-height: 50px; }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) { .player { max-width: none; width: 100%; } }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 24px; line-height: 1; position: relative;
}
.avatar.baba {
  color: var(--gold-2);
  background: radial-gradient(circle at 35% 30%, #3a2c1c, #120d08 70%);
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 0 4px rgba(201, 164, 92, 0.12), 0 6px 16px rgba(0, 0, 0, 0.5);
}
.avatar.eren {
  color: var(--text);
  background: radial-gradient(circle at 35% 30%, #3b3632, #171412 70%);
  box-shadow: 0 0 0 1.5px rgba(239, 229, 211, 0.55), 0 6px 16px rgba(0, 0, 0, 0.45);
}
.avatar.thinking::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 1.5px solid transparent; border-top-color: var(--gold-2); border-right-color: rgba(232, 205, 143, 0.35);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.p-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.p-name { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: 0.06em; display: flex; align-items: center; gap: 8px; }
.p-name .turn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); opacity: 0; transition: opacity .2s; }
.p-name .turn-dot.on { opacity: 1; }
.p-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub .think { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--gold-2); letter-spacing: 0.02em; }
.p-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.p-right { min-width: 0; max-width: 52%; }
.captured { display: flex; align-items: center; min-height: 20px; overflow: hidden; max-width: 100%; }
.captured .cp { width: 18px; height: 18px; flex: none; margin-left: -7px; background-size: contain; background-repeat: no-repeat; opacity: 0.9; }
.captured .cp:first-child { margin-left: 0; }
.captured .gap { width: 6px; }
.captured .adv { font-size: 12.5px; color: var(--muted); margin-left: 5px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ tahta */
.board {
  position: relative; width: var(--bsize); height: var(--bsize); border-radius: 4px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.b-squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { position: relative; }
.sq.l { background: var(--sq-l); }
.sq.d { background: var(--sq-d); }
.sq.l { background-image: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,0,0,0.02)); background-color: var(--sq-l); }
.sq.d { background-image: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(0,0,0,0.05)); background-color: var(--sq-d); }
.sq span { position: absolute; font-size: max(9px, calc(var(--bsize) * 0.022)); font-weight: 700; line-height: 1; pointer-events: none; opacity: 0.9; }
.sq.l span { color: var(--coord-l); }
.sq.d span { color: var(--coord-d); }
.c-file { right: 3px; bottom: 2px; }
.c-rank { left: 3px; top: 3px; }

.b-marks, .b-pieces, .b-hover, .b-promo { position: absolute; inset: 0; pointer-events: none; }
.mk { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; }
.mk.last { background: var(--last); }
.mk.sel { background: var(--sel); }
.mk.check { background: radial-gradient(circle, rgba(255, 60, 40, 0.95) 0%, rgba(220, 30, 20, 0.6) 28%, rgba(180, 0, 0, 0.18) 55%, transparent 72%); }
.mk.dest { display: grid; place-items: center; }
.mk.dest i { width: 28%; height: 28%; border-radius: 50%; background: var(--dot); }
.mk.dest.cap i { width: 100%; height: 100%; border-radius: 0; background: radial-gradient(circle, transparent 0 62%, var(--dot) 63% 100%); }

.b-hover { width: 12.5%; height: 12.5%; right: auto; bottom: auto; opacity: 0; border-radius: 50%; transform-origin: center; }
.b-hover.on { opacity: 1; box-shadow: 0 0 0 calc(var(--bsize) * 0.03) rgba(232, 205, 143, 0.35); background: rgba(232, 205, 143, 0.25); scale: 1.6; }

.pc {
  position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%;
  background-size: 100% 100%; background-repeat: no-repeat;
  transition: transform 0.2s cubic-bezier(.25,.8,.3,1), opacity 0.2s;
  will-change: transform; filter: drop-shadow(0 2px 1.5px rgba(0,0,0,0.28));
}
.pc.no-anim { transition: none !important; }
.pc.dragging { transition: none; z-index: 10; scale: 1.28; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.45)); cursor: grabbing; }
.pc.moving { z-index: 5; }
.pc.captured { opacity: 0; transition: opacity .18s; }
.pc.appear { animation: appear .25s ease; }
@keyframes appear { from { opacity: 0; scale: 0.8; } to { opacity: 1; scale: 1; } }
.pc.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { translate: -4% 0; } 40%, 80% { translate: 4% 0; } }
.board.interactive { cursor: pointer; }

.pc.wK { background-image: url('../pieces/wK.svg'); } .pc.wQ { background-image: url('../pieces/wQ.svg'); }
.pc.wR { background-image: url('../pieces/wR.svg'); } .pc.wB { background-image: url('../pieces/wB.svg'); }
.pc.wN { background-image: url('../pieces/wN.svg'); } .pc.wP { background-image: url('../pieces/wP.svg'); }
.pc.bK { background-image: url('../pieces/bK.svg'); } .pc.bQ { background-image: url('../pieces/bQ.svg'); }
.pc.bR { background-image: url('../pieces/bR.svg'); } .pc.bB { background-image: url('../pieces/bB.svg'); }
.pc.bN { background-image: url('../pieces/bN.svg'); } .pc.bP { background-image: url('../pieces/bP.svg'); }

/* terfi seçici */
.b-promo { pointer-events: auto; z-index: 20; }
.promo-scrim { position: absolute; inset: 0; background: rgba(8, 6, 4, 0.55); backdrop-filter: blur(1.5px); }
.promo-opt {
  position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; border: 0; padding: 0; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #f4e7cb, #cdb384); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold), 0 8px 18px rgba(0,0,0,0.5); transition: scale .12s;
}
.promo-opt:hover, .promo-opt:active { scale: 1.06; }
.promo-opt .pc { position: absolute; inset: 6%; width: 88%; height: 88%; transform: none !important; }
.promo-opt em { position: absolute; left: 50%; bottom: -2px; translate: -50% 100%; font-style: normal; font-size: 10px; color: var(--gold-2); opacity: 0; }

/* ------------------------------------------------------------------ panel */
.analysis {
  font-size: 12.5px; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-variant-numeric: tabular-nums; display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline;
}
.analysis b { color: var(--gold-2); font-weight: 600; }
.analysis .pv { flex-basis: 100%; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.moves {
  list-style: none; margin: 0; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; min-height: 44px; align-items: center;
  scrollbar-width: none; scroll-behavior: smooth;
}
.moves::-webkit-scrollbar { display: none; }
.moves:empty::before { content: 'Hamleler burada görünecek'; color: var(--faint); font-size: 13px; padding: 0 8px; }
.moves li { display: flex; align-items: center; flex: none; }
.moves .no { color: var(--faint); font-size: 12px; padding: 0 3px 0 6px; font-variant-numeric: tabular-nums; }
.moves .mv { padding: 5px 7px; border-radius: 7px; font-size: 14.5px; font-weight: 500; cursor: default; white-space: nowrap; }
.moves .mv.cur { background: rgba(201, 164, 92, 0.22); color: var(--gold-2); }
.moves .mv.click { cursor: pointer; }
.moves .mv.click:hover { background: var(--surface-2); }
.moves .res { padding: 5px 8px; color: var(--gold); font-weight: 600; }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .moves { flex-wrap: wrap; align-content: flex-start; overflow-y: auto; overflow-x: hidden; }
  .moves li.pair { width: 100%; }
  .moves li.pair .no { width: 36px; text-align: right; padding-right: 8px; }
  .moves li.pair .mv { width: 42%; }
}

.controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ctl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 58px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 11.5px; letter-spacing: 0.02em; transition: background .15s, border-color .15s, opacity .15s;
}
.ctl svg { width: 21px; height: 21px; color: var(--gold); }
.ctl:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-2); }
.ctl:active:not(:disabled) { transform: scale(0.97); }
.ctl:disabled { opacity: 0.35; cursor: default; }
.ctl[hidden] { display: none; }

/* ------------------------------------------------------------------ sayfalar / diyaloglar */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(5, 4, 3, 0.6); backdrop-filter: blur(4px); animation: fade .18s; }
.sheet[hidden], .result[hidden], .view[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet-card {
  width: 100%; max-width: 520px; max-height: 92dvh; overflow-y: auto; padding: 20px 18px calc(18px + var(--safe-b));
  background: linear-gradient(180deg, #1d1813, #13100d); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 20px 20px 0 0; box-shadow: 0 -20px 50px rgba(0,0,0,0.5); animation: rise .24s cubic-bezier(.2,.8,.3,1);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0.4; } }
@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-card { border-radius: 20px; border-bottom: 1px solid var(--line); }
}
.sheet-card.small { max-width: 400px; }
.sheet-card h2 { font-family: var(--serif); font-size: 28px; font-weight: 600; margin: 0 0 14px; letter-spacing: 0.02em; }
.sheet-card p { color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin-bottom: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button {
  height: 46px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; transition: all .15s;
}
.seg button.on { border-color: var(--gold); background: rgba(201, 164, 92, 0.14); color: var(--gold-2); }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.3); }
.dot.w { background: #f2ead8; } .dot.b { background: #1b1714; } .dot.r { background: linear-gradient(90deg, #f2ead8 50%, #1b1714 50%); }
.sw { width: 16px; height: 16px; border-radius: 4px; }
.sw.ceviz { background: linear-gradient(135deg, #e9d7b4 50%, #a2724b 50%); }
.sw.zumrut { background: linear-gradient(135deg, #e4e1cc 50%, #5f8a6a 50%); }
.sw.grafit { background: linear-gradient(135deg, #cfd2d4 50%, #6f7a84 50%); }
.levels { display: flex; flex-direction: column; gap: 6px; }
.levels button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; text-align: left; transition: all .15s;
}
.levels button.on { border-color: var(--gold); background: rgba(201, 164, 92, 0.12); }
.levels .pips { display: flex; gap: 3px; flex: none; }
.levels .pips i { width: 6px; height: 16px; border-radius: 2px; background: rgba(255,255,255,0.1); }
.levels .pips i.f { background: var(--gold); }
.levels .lv-name { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.levels .lv-desc { font-size: 12.5px; color: var(--muted); margin-left: auto; text-align: right; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px; border-bottom: 1px solid rgba(214, 178, 108, 0.08); cursor: pointer; }
.switch-row span { display: flex; flex-direction: column; gap: 2px; }
.switch-row strong { font-weight: 500; font-size: 15px; }
.switch-row small { color: var(--muted); font-size: 12px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 44px; height: 26px; border-radius: 13px; background: rgba(255,255,255,0.12); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #d8ccb6; transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--gold-deep); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: var(--gold-2); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--gold); outline-offset: 2px; }
.engine-note { font-size: 12px; color: var(--faint) !important; margin: 14px 0 0 !important; }

.sheet-actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }
.btn {
  height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-size: 15px; font-weight: 500; letter-spacing: 0.02em; transition: all .15s;
}
.btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn.gold { background: linear-gradient(180deg, #d9b56a, #b08a40); border-color: #e6c77f; color: #1a130a; font-weight: 600; box-shadow: 0 6px 18px rgba(201, 164, 92, 0.25); }
.btn.gold:hover { background: linear-gradient(180deg, #e6c47a, #bc964a); }
.btn.text { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: #e98a78; }

/* sonuç */
.result { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(40, 30, 16, 0.75), rgba(5, 4, 3, 0.88)); backdrop-filter: blur(5px); animation: fade .3s; padding: 16px; }
.result-card { text-align: center; max-width: 440px; width: 100%; animation: pop .45s cubic-bezier(.2,.9,.3,1.2); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
.result-crest { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-size: 44px; font-weight: 700; }
.result-crest.win { color: #1a130a; background: radial-gradient(circle at 35% 30%, #f3dc9c, #b8903f); box-shadow: 0 0 0 2px #f0d58f, 0 0 50px rgba(232, 205, 143, 0.45); }
.result-crest.loss { color: var(--gold-2); background: radial-gradient(circle at 35% 30%, #3a2c1c, #120d08); box-shadow: 0 0 0 2px var(--gold), 0 0 40px rgba(201, 164, 92, 0.25); }
.result-crest.draw { color: var(--text); background: radial-gradient(circle at 35% 30%, #3b3632, #171412); box-shadow: 0 0 0 2px rgba(239, 229, 211, 0.5); }
.result h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(40px, 12vw, 64px); letter-spacing: 0.08em; margin: 0; line-height: 1.05; }
.result h1.win { background: linear-gradient(180deg, #fff1c6, var(--gold-2) 40%, var(--gold) 70%, var(--gold-deep)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.result p { color: var(--muted); font-size: 16px; margin: 10px 0 26px; letter-spacing: 0.04em; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-actions .btn.gold { grid-column: 1 / -1; }
.result-actions .btn.text { grid-column: 1 / -1; }

/* tam ekran görünümler */
.view { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; padding-top: var(--safe-t); animation: fade .15s; }
.view::before { content: ''; position: fixed; inset: 0; background: radial-gradient(1000px 600px at 50% -10%, rgba(201, 164, 92, 0.10), transparent 60%); pointer-events: none; }
.view-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 10px; background: rgba(13, 11, 9, 0.85); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(214, 178, 108, 0.1); }
.view-bar h2 { flex: 1; font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0; letter-spacing: 0.03em; }
.score-line { position: relative; max-width: 760px; margin: 14px auto 4px; padding: 0 14px; display: flex; gap: 8px; }
.score-line .stat { flex: 1; text-align: center; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.score-line .stat b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1; }
.score-line .stat span { font-size: 11.5px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.score-line .stat.e b { color: var(--text); } .score-line .stat.b b { color: var(--gold-2); }
.archive-list { position: relative; list-style: none; margin: 0 auto; padding: 10px 14px calc(24px + var(--safe-b)); max-width: 760px; display: flex; flex-direction: column; gap: 8px; }
.archive-list li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); cursor: pointer; transition: all .15s;
}
.archive-list li:hover { border-color: var(--line-2); background: var(--surface-2); }
.archive-list .res-badge { width: 44px; height: 44px; flex: none; border-radius: 10px; display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 16px; }
.res-badge.win { background: rgba(127, 176, 122, 0.16); color: #a9d7a3; }
.res-badge.loss { background: rgba(212, 84, 63, 0.14); color: #ee9a8a; }
.res-badge.draw { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.archive-list .a-main { flex: 1; min-width: 0; }
.archive-list .a-title { font-weight: 600; font-size: 15px; }
.archive-list .a-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-list .empty { justify-content: center; color: var(--muted); cursor: default; border-style: dashed; padding: 30px; }

.replay-body { position: relative; max-width: 1200px; margin: 0 auto; padding: 10px var(--gutter) calc(20px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.replay-board-col { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.replay-meta { width: 100%; max-width: 632px; font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: 0.05em; display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; }
.replay-meta > span:last-child { font-family: var(--sans); font-size: 16px; font-weight: 600; color: var(--gold-2); }
.replay-meta small { font-family: var(--sans); font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.replay-nav { display: flex; gap: 8px; justify-content: center; }
.replay-nav .icon-btn { width: 54px; height: 48px; border: 1px solid var(--line); background: var(--surface); color: var(--gold); }
.replay-nav .icon-btn.play { width: 64px; }
.replay-side { width: 100%; max-width: 632px; display: flex; flex-direction: column; gap: 10px; }
.replay-side .moves { flex-wrap: wrap; overflow: visible; }
.replay-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.pgn-text { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,0.25); color: var(--muted); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 220px; overflow: auto; }
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .replay-body { flex-direction: row; align-items: flex-start; justify-content: center; gap: 28px; }
  .replay-board-col { width: auto; }
  .replay-body .board-frame { --bsize: min(calc(100dvh - 250px), calc(100vw - 500px), 760px); }
  .replay-side { width: 380px; }
  .replay-meta { max-width: none; }
}

.toast {
  position: fixed; left: 50%; bottom: calc(22px + var(--safe-b)); translate: -50% 20px; z-index: 80; opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 12px; background: #221b14; border: 1px solid var(--line-2); color: var(--text); font-size: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5); transition: opacity .2s, translate .2s; max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; translate: -50% 0; }

/* Yatay telefon: tahta yüksekliğe göre, oyuncular ve hamleler sağ sütunda */
@media (orientation: landscape) and (max-height: 540px) {
  .topbar { padding: 4px 12px 0; }
  .brand { font-size: 20px; }
  .icon-btn { width: 38px; height: 38px; }
  .stage {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto 1fr auto;
    grid-template-areas: "board top" "board panel" "board bottom"; gap: 4px 18px; align-items: start; padding-top: 0;
  }
  .play { display: contents; }
  #playerTop { grid-area: top; max-width: none; }
  #playerBottom { grid-area: bottom; max-width: none; }
  .play > .board-frame { grid-area: board; --bsize: calc(100dvh - 62px - var(--safe-t) - var(--safe-b)); }
  .panel { grid-area: panel; max-width: none; height: auto; }
  .panel .moves { flex-wrap: nowrap; }
  .ctl { height: 46px; }
  .replay-body { flex-direction: row; align-items: flex-start; justify-content: center; }
  .replay-body .board-frame { --bsize: calc(100dvh - 190px); }
  .replay-board-col { width: auto; }
}

@media (max-width: 380px) {
  .brand { font-size: 21px; }
  .p-name { font-size: 19px; }
  .ctl { height: 54px; font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .pc { transition-duration: 0s; }
  .avatar.thinking::after { animation-duration: 3s; }
}
