/* === 3-Bant 3-Top Bilardo Simülatörü === */
:root {
  --bg-0: #0a0d10;
  --bg-1: #11161b;
  --bg-2: #181f26;
  --bg-3: #232c36;
  --line: #2a333d;
  --line-2: #3a4654;
  --text: #e7ecf2;
  --text-dim: #98a4b3;
  --text-faint: #5e6b7a;
  --gold: #d4a85a;
  --gold-bright: #f0c674;
  --gold-dim: #8a6d35;
  --white: #f3f1ea;
  --yellow: #f2c14b;
  --red: #c8392f;
  --green: #2d6c4a;
  --green-cloth: #1d4738;
  --good: #4caf83;
  --bad: #d8534f;
  --warn: #e2a23a;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.35);
  --shadow-2: 0 12px 40px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.4);
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --t-fast: 120ms cubic-bezier(.2,.6,.2,1);
  --t-med:  240ms cubic-bezier(.2,.6,.2,1);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", "SF Mono", ui-monospace, "Roboto Mono", monospace;
  --font-display: "Sora", "Inter", sans-serif;
}

[data-theme="light"] {
  --bg-0: #f4f5f7;
  --bg-1: #ffffff;
  --bg-2: #f7f8fa;
  --bg-3: #eef0f4;
  --line: #e1e5ec;
  --line-2: #cdd3dc;
  --text: #131820;
  --text-dim: #4f5b6b;
  --text-faint: #8a95a4;
  --gold: #b58a3c;
  --gold-bright: #c89a44;
  --gold-dim: #8c6c2c;
  --green-cloth: #2a6b54;
  --shadow-1: 0 1px 2px rgba(20,30,45,.06), 0 6px 18px rgba(20,30,45,.08);
  --shadow-2: 0 14px 40px rgba(20,30,45,.18);
}

* { box-sizing: border-box; }

html, body, #root {
  height: 100%;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; color: inherit; }

/* iOS Safari focus zoom fix: 16px altındaki form elemanlarına odaklanınca
 * tarayıcı otomatik zoom yapar ve kullanıcı geri çıkamaz. Tüm input/textarea/
 * select için 16px tabanı koy; UI'da daha küçük göstermek isteyen yerler kendi
 * font-size'larını override eder ama mobil odakta zoom tetiklenmez. */
@media (max-width: 1100px) {
  input, textarea, select {
    font-size: 16px;
  }
  /* Range/checkbox/color/file input'larda font-size etkisiz; bunları hariç tut */
  input[type="range"], input[type="checkbox"], input[type="radio"],
  input[type="color"], input[type="file"], input[type="submit"], input[type="button"] {
    font-size: inherit;
  }
}

/* === Shell === */
.app {
  display: grid;
  grid-template-rows: 56px auto 1fr;  /* topbar | ad banner | main */
  height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(212,168,90,.06), transparent 60%),
    var(--bg-0);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-1), var(--bg-1) 70%, rgba(0,0,0,0));
  z-index: 50;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .02em;
  font-size: 15px;
  white-space: nowrap;
}
.brand > div { display: flex; flex-direction: column; line-height: 1.05; }
@media (max-width: 1180px) {
  .brand small { display: none !important; }
}
.brand .mark {
  width: 28px; height: 28px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff8e0, var(--gold) 60%, #6e4f1c);
  box-shadow: inset 0 -4px 8px rgba(0,0,0,.35), 0 0 16px rgba(212,168,90,.4);
  position: relative; flex-shrink: 0;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, #fff, transparent 50%);
  opacity: .6;
}
.brand small {
  display: block; color: var(--text-faint); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .14em; margin-top: 2px;
}

.topbar .sep { width: 1px; height: 24px; background: var(--line); }
.topbar .grow { flex: 1; }

.tab-group { display: flex; gap: 2px; background: var(--bg-2); border-radius: 10px; padding: 3px; border: 1px solid var(--line); }
.tab-group button {
  background: transparent; border: 0; color: var(--text-dim);
  padding: 7px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: var(--t-fast); letter-spacing: .01em;
  white-space: nowrap;
}
.tab-group button:hover { color: var(--text); }
.tab-group button.active {
  background: var(--bg-3); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.04);
}

/* Game-mode segmented (3-Top / 3-Bant) */
.mode-toggle {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-2); border-radius: 10px; border: 1px solid var(--line);
}
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: 0; color: var(--text-dim);
  padding: 7px 12px; border-radius: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; white-space: nowrap;
  transition: color .12s;
}
.mode-btn:hover { color: var(--text); }
.mode-btn.active {
  background: var(--bg-3); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.04);
}
.mode-dot {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
  opacity: .85;
}

.icon-btn {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text-dim); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--t-fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--bg-3); }
.icon-btn.active { color: var(--gold-bright); border-color: var(--gold-dim); background: rgba(212,168,90,.08); }

/* === Main Layout === */
.main {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  gap: 0;
  min-height: 0;
}

.panel-left, .panel-right {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column;
}
.panel-right { border-right: 0; border-left: 1px solid var(--line); }

.stage {
  position: relative;
  background: var(--bg-0);
  overflow: hidden;
  display: flex; flex-direction: column; min-width: 0;
}

.canvas-host {
  flex: 1; position: relative; min-height: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(212,168,90,.04), transparent 60%),
    var(--bg-0);
}
.canvas-host canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.canvas-host.dragging canvas { cursor: grabbing; }
.canvas-host.placing canvas { cursor: crosshair; }

/* === Zoom controls === */
.zoom-controls {
  position: absolute;
  right: 10px; bottom: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 5px;
  background: rgba(17,22,27,.78);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 30;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
  -webkit-tap-highlight-color: transparent;
}
[data-theme="light"] .zoom-controls { background: rgba(255,255,255,.88); }
.zoom-controls .zoom-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .1s, background .15s, border-color .15s;
}
.zoom-controls .zoom-btn:active { transform: scale(.92); border-color: var(--gold-dim); }
.zoom-controls .zoom-btn.reset { color: var(--text-faint); }
.zoom-controls .zoom-slider {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 24px; height: 90px;
  accent-color: var(--gold-bright);
  cursor: pointer;
}
@media (max-width: 1100px) {
  /* Slider mobilde de görünür — hassas yakınlaştırma için.
     Kompakt boyut + dokunmatık-dostu kalın track. */
  .zoom-controls .zoom-slider {
    height: 72px;
    width: 30px;
  }
  .zoom-controls { right: 8px; bottom: calc(176px + var(--safe-bottom)); }
  /* Aim-bar collapsed iken aşağı in */
  .canvas-host:has(.mobile-aim-bar.collapsed) .zoom-controls {
    bottom: calc(74px + var(--safe-bottom));
  }
  /* Aim-bar yokken (örn. shoot tab kapalıyken) tab-bar üzerinde dur */
  .canvas-host:not(:has(.mobile-aim-bar)) .zoom-controls {
    bottom: calc(76px + var(--safe-bottom));
  }
}

/* === Side panel sections === */
.section {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}
.section:last-child { border-bottom: 0; }
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 700; letter-spacing: .18em;
  color: var(--text-faint); text-transform: uppercase; margin: 0 0 12px;
}
.section-title .badge {
  font-size: 10px; font-weight: 600; letter-spacing: 0;
  background: rgba(212,168,90,.12); color: var(--gold-bright);
  padding: 2px 7px; border-radius: 6px; text-transform: none;
}

/* === Controls === */
.row { display: flex; gap: 8px; align-items: center; }
.row + .row { margin-top: 10px; }

.field { display: block; }
.field-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px; color: var(--text-dim); margin-bottom: 6px;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.field-label .value {
  font-family: var(--font-num); font-size: 12px; color: var(--gold-bright);
  font-weight: 600; letter-spacing: 0; text-transform: none;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; background: var(--bg-3); border-radius: 999px;
  outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 1px 4px rgba(0,0,0,.5), 0 0 0 4px rgba(212,168,90,.18);
  cursor: pointer; transition: transform var(--t-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 0;
  background: var(--gold-bright);
  box-shadow: 0 1px 4px rgba(0,0,0,.5), 0 0 0 4px rgba(212,168,90,.18);
}

button.btn {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  padding: 9px 14px; border-radius: var(--r-md); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: var(--t-fast); display: inline-flex; align-items: center; gap: 7px;
  justify-content: center;
}
button.btn:hover { background: var(--bg-3); border-color: var(--line-2); }
button.btn:active { transform: translateY(1px); }
button.btn:disabled { opacity: .4; cursor: not-allowed; }

button.btn.primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #1a1208; border-color: var(--gold);
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 18px rgba(212,168,90,.25);
}
button.btn.primary:hover { filter: brightness(1.05); }
button.btn.ghost { background: transparent; }
button.btn.danger { color: var(--bad); border-color: rgba(216,83,79,.3); }
button.btn.danger:hover { background: rgba(216,83,79,.08); }
button.btn.full { width: 100%; }
button.btn.sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
button.btn.lg { padding: 12px 18px; font-size: 14px; }

.btn-grid { display: grid; gap: 6px; }
.btn-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.btn-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.btn-grid.cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* === Cue ball "english" picker === */
.english-pad {
  position: relative;
  width: 100%; max-width: 180px; aspect-ratio: 1;
  border-radius: 50%;
  margin: 4px auto;
  background:
    radial-gradient(circle at 50% 38%, #ffffff, #ece7d4 50%, #b9b09a 100%);
  box-shadow:
    inset 0 -10px 24px rgba(0,0,0,.18),
    inset 0 4px 10px rgba(255,255,255,.5),
    0 4px 18px rgba(0,0,0,.35);
  cursor: crosshair;
  touch-action: none;
}
.english-pad::before {
  content: ""; position: absolute; inset: 12%;
  border: 1px dashed rgba(0,0,0,.18); border-radius: 50%; pointer-events: none;
}
.english-pad::after {
  content: ""; position: absolute; inset: 32%;
  border: 1px dotted rgba(0,0,0,.14); border-radius: 50%; pointer-events: none;
}
.english-pad .axis-h, .english-pad .axis-v {
  position: absolute; background: rgba(0,0,0,.14); pointer-events: none;
}
.english-pad .axis-h { top: 50%; left: 8%; right: 8%; height: 1px; transform: translateY(-.5px); }
.english-pad .axis-v { left: 50%; top: 8%; bottom: 8%; width: 1px; transform: translateX(-.5px); }
.english-pad .tip {
  position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffeec0, var(--gold) 60%, #5e3d10);
  box-shadow: 0 0 0 2px rgba(0,0,0,.45), 0 0 12px rgba(212,168,90,.6);
  transform: translate(-50%,-50%); pointer-events: none;
  transition: box-shadow var(--t-fast);
}
.english-pad .tip.warn { box-shadow: 0 0 0 2px var(--bad), 0 0 12px rgba(216,83,79,.5); }

.english-readout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px;
  font-family: var(--font-num); font-size: 11px;
}
.english-readout div {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 8px; display: flex; justify-content: space-between;
}
.english-readout span:first-child { color: var(--text-faint); }
.english-readout span:last-child { color: var(--gold-bright); font-weight: 600; }

/* === Solutions list === */
.solution-card {
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--t-fast);
  position: relative;
  overflow: hidden;
}
.solution-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.solution-card.active {
  border-color: var(--gold-dim);
  background: linear-gradient(180deg, rgba(212,168,90,.08), rgba(212,168,90,.02));
  box-shadow: 0 0 0 1px var(--gold-dim) inset;
}
.solution-card .head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.solution-card .name { font-weight: 700; font-size: 13px; }
.solution-card .diff {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  padding: 2px 7px; border-radius: 4px; text-transform: uppercase;
}
.diff.lvl-0 { background: rgba(76,175,131,.16); color: #6dd1a5; }
.diff.lvl-1 { background: rgba(76,175,131,.12); color: #6dd1a5; }
.diff.lvl-2 { background: rgba(226,162,58,.14); color: #f0c674; }
.diff.lvl-3 { background: rgba(216,83,79,.14); color: #ef807c; }

.solution-card .meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  font-family: var(--font-num); font-size: 10px;
}
.solution-card .meta div { display: flex; flex-direction: column; }
.solution-card .meta span:first-child { color: var(--text-faint); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.solution-card .meta span:last-child { color: var(--text); font-weight: 600; }

.solution-card .pct {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 3px; background: var(--gold-bright);
  opacity: 0; transition: var(--t-fast);
}
.solution-card.active .pct { opacity: 1; }

/* === Result toast === */
.toast {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%) translateY(-12px);
  padding: 10px 18px; border-radius: 999px;
  background: var(--bg-1); border: 1px solid var(--line); box-shadow: var(--shadow-2);
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 10px;
  opacity: 0; pointer-events: none; transition: var(--t-med);
  z-index: 30;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.good { border-color: rgba(76,175,131,.35); color: #88e2b5; }
.toast.bad { border-color: rgba(216,83,79,.35); color: #ef807c; }

/* === Bottom playback === */
.playback {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 14px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 999px;
  background: rgba(11,15,20,.78); backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow-2);
  z-index: 20;
}
[data-theme="light"] .playback { background: rgba(255,255,255,.85); border-color: var(--line); }

.playback .speed-pills { display: flex; gap: 2px; }
.playback .speed-pills button {
  background: transparent; border: 0; color: var(--text-dim);
  padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: var(--font-num);
}
.playback .speed-pills button.active { background: var(--bg-3); color: var(--gold-bright); }

.playback .scrub {
  width: 220px; height: 4px; background: var(--bg-3); border-radius: 999px;
  position: relative; cursor: pointer;
}
.playback .scrub .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--gold-bright); border-radius: 999px;
}
.playback .scrub .knob {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold-bright); transform: translate(-50%,-50%);
  box-shadow: 0 0 0 4px rgba(212,168,90,.2);
}

/* === Top-down minimap & overlays === */
.minimap {
  position: absolute; top: 14px; right: 14px;
  width: 240px; height: 130px; border-radius: 10px;
  background: var(--bg-1); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); overflow: hidden; z-index: 15;
}
.minimap canvas { display: block; width: 100%; height: 100%; }
.minimap .lbl {
  position: absolute; top: 6px; left: 8px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  color: var(--text-faint); text-transform: uppercase;
}

/* === HUD chips on stage === */
.hud {
  position: absolute; top: 14px; left: 14px;
  display: flex; flex-direction: column; gap: 6px; z-index: 14;
}
.hud .chip {
  padding: 6px 10px; border-radius: 8px;
  background: rgba(11,15,20,.8); backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
[data-theme="light"] .hud .chip { background: rgba(255,255,255,.85); border-color: var(--line); }
.hud .chip strong { color: var(--gold-bright); font-family: var(--font-num); font-weight: 700; }
.hud .chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 6px currentColor; }

/* === Position library === */
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
  cursor: pointer;
  transition: var(--t-fast);
  aspect-ratio: 2/1.2;
  display: flex; flex-direction: column;
}
.lib-card:hover { border-color: var(--line-2); }
.lib-card svg { flex: 1; width: 100%; height: auto; min-height: 0; }
.lib-card .lbl {
  font-size: 10.5px; font-weight: 600; color: var(--text-dim); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* === Stat pill === */
.stat-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 10px;
  text-align: center;
}
.stat .num {
  font-family: var(--font-num); font-size: 22px; font-weight: 700;
  color: var(--gold-bright); line-height: 1;
}
.stat .lbl {
  font-size: 9.5px; color: var(--text-faint); text-transform: uppercase;
  letter-spacing: .14em; margin-top: 6px; font-weight: 600;
}

/* === Aim controller (touch friendly fine-tune) === */
.aim-fine {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 6px; align-items: center;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 6px;
}
.aim-fine button {
  width: 36px; height: 36px; border-radius: 7px; border: 0;
  background: var(--bg-3); color: var(--text); cursor: pointer;
  font-size: 14px; font-weight: 700; transition: var(--t-fast);
  font-family: var(--font-num);
}
.aim-fine button:hover { background: var(--line-2); color: var(--gold-bright); }
.aim-fine button:active { transform: scale(.93); }
.aim-fine .display {
  text-align: center; font-family: var(--font-num); font-weight: 700;
  font-size: 14px; color: var(--gold-bright);
}
.aim-fine .display small { display: block; font-size: 9px; color: var(--text-faint); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

/* === Tooltip / tip card === */
.tip-card {
  background: linear-gradient(135deg, rgba(212,168,90,.08), rgba(212,168,90,.02));
  border: 1px solid rgba(212,168,90,.2);
  border-radius: var(--r-md); padding: 10px 12px;
  font-size: 12px; color: var(--text-dim);
  display: flex; gap: 10px;
}
.tip-card .ico {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(212,168,90,.15); color: var(--gold-bright);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
}
.tip-card strong { color: var(--text); }

/* === Loading shimmer === */
.shimmer {
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

/* === Responsive (tablet + mobile = bilardo salonu, drawer panel UX) ===
 * Threshold raised from 920 → 1100: tablet portraits (e.g. 1024×1366 iPad)
 * were inheriting the desktop 3-column layout (320 + 1fr + 340), leaving
 * only ~360px for the 3D stage. Drawer mode gives the canvas the full width.
 */
@media (max-width: 1100px) {
  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .panel-left, .panel-right {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    max-height: 70dvh;
    border: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    z-index: 40;
    box-shadow: var(--shadow-2);
    transform: translateY(calc(100% - 56px));
    transition: transform var(--t-med);
  }
  .panel-left.open, .panel-right.open { transform: translateY(0); }
  .panel-handle {
    height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer;
    font-weight: 700; font-size: 13px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--bg-1); z-index: 5;
  }
  .panel-handle::before {
    content: ""; width: 38px; height: 4px; border-radius: 999px;
    background: var(--line-2); position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  }
  .minimap { width: 160px; height: 88px; top: 8px; right: 8px; }
  .stage .mobile-fab {
    position: absolute; bottom: 16px;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    color: #1a1208; border: 0; cursor: pointer;
    box-shadow: var(--shadow-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 22px; z-index: 18;
  }
  .stage .mobile-fab.left { left: 16px; }
  .stage .mobile-fab.right { right: 16px; }
}
@media (min-width: 1101px) { .panel-handle, .stage .mobile-fab { display: none; } }

/* === Scrollbar === */
.panel-left::-webkit-scrollbar, .panel-right::-webkit-scrollbar { width: 8px; }
.panel-left::-webkit-scrollbar-thumb, .panel-right::-webkit-scrollbar-thumb {
  background: var(--bg-3); border-radius: 999px;
}
.panel-left::-webkit-scrollbar-track, .panel-right::-webkit-scrollbar-track {
  background: transparent;
}

/* utility */
.muted { color: var(--text-faint); }
.gold  { color: var(--gold-bright); }
.flex { display: flex; gap: 8px; align-items: center; }
.flex.col { flex-direction: column; align-items: stretch; }
.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.tnum { font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

.kbd {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: var(--bg-3); border: 1px solid var(--line); border-bottom-width: 2px;
  font-family: var(--font-num); font-size: 10.5px; color: var(--text-dim);
  min-width: 16px; text-align: center;
}


/* === LOGIN === */
.login-root {
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 30% 30%, #15252a 0%, #0a0d10 60%);
  display: grid; place-items: center;
  font-family: var(--font-ui, Inter, system-ui, sans-serif);
  color: var(--text);
  overflow: hidden;
  z-index: 1000;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.login-bg-table {
  position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%) rotate(-8deg);
  width: 1200px; height: 600px;
  background:
    radial-gradient(ellipse at center, rgba(45,108,74,.25), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 10px);
  border: 1px solid rgba(212,168,90,.06);
  border-radius: 24px;
  box-shadow: 0 80px 200px rgba(0,0,0,.7), inset 0 0 120px rgba(0,0,0,.5);
  filter: blur(.6px);
  opacity: .7;
}
.login-bg-glow {
  position: absolute; top: 12%; right: -10%;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(240,198,116,.13), transparent 60%);
  border-radius: 50%; filter: blur(40px);
}
.login-card {
  position: relative;
  width: 380px; max-width: calc(100vw - 32px);
  background: rgba(17,22,27,.92);
  border: 1px solid rgba(212,168,90,.18);
  border-radius: 18px;
  padding: 28px 28px 22px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.04);
  display: flex; flex-direction: column; gap: 18px;
  z-index: 2;
  opacity: 1;
}
@keyframes loginIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-logo {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1a2128, #11161b);
  border: 1px solid rgba(212,168,90,.25);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 4px 12px rgba(0,0,0,.4);
}
.login-title {
  font-family: var(--font-display, "Sora", Inter, sans-serif);
  font-weight: 700; font-size: 18px; letter-spacing: -.01em;
  color: #f3eede;
}
.login-subtitle {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .12em;
  margin-top: 2px;
}
.login-fields { display: flex; flex-direction: column; gap: 12px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span {
  font-size: 11px; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .08em;
}
.login-field input {
  height: 40px; padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text); font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.login-field input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px rgba(212,168,90,.1);
}
.login-pwd { position: relative; }
.login-pwd input { width: 100%; padding-right: 64px; }
.login-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  height: 28px; padding: 0 10px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-dim); font-size: 11px; cursor: pointer;
  border-radius: 6px; font-family: inherit;
}
.login-eye:hover { color: var(--text); border-color: var(--line-2); }
.login-err {
  background: rgba(216,83,79,.08);
  border: 1px solid rgba(216,83,79,.3);
  color: #f0a8a4;
  padding: 8px 12px; border-radius: 8px;
  font-size: 12px;
}
.login-submit {
  height: 44px;
  background: linear-gradient(180deg, #f0c674, #c89b3a);
  color: #1a1c1f;
  border: 1px solid #b8861f;
  border-radius: 10px;
  font-weight: 700; font-size: 14px; letter-spacing: .01em;
  cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 14px rgba(212,168,90,.25), inset 0 1px 0 rgba(255,255,255,.4);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(212,168,90,.35), inset 0 1px 0 rgba(255,255,255,.4);
}
.login-submit:disabled { opacity: .6; cursor: wait; }
.login-remember {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 6px 0;
}
.login-remember input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: var(--bg-2);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all .15s;
}
.login-remember input[type="checkbox"]:checked {
  background: linear-gradient(180deg, #f0c674, #c89b3a);
  border-color: #b8861f;
}
.login-remember input[type="checkbox"]:checked::after {
  content: ""; position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 10px;
  border: solid #1a1c1f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.login-remember small {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-faint);
}
.login-quick {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  font-size: 11px;
}
.login-quick-lbl {
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}
.login-quick-btn {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.login-quick-btn:hover { border-color: var(--gold-dim); color: var(--text); }
.login-quick-btn.active {
  background: var(--bg-3);
  color: var(--gold-bright);
  border-color: var(--gold-dim);
}
.login-foot {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.login-foot-row { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.login-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.login-hint { font-size: 11px; color: var(--text-faint); }
.login-hint kbd {
  display: inline-block; padding: 1px 5px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 4px; font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
}
.login-watermark {
  position: absolute; bottom: 18px; right: 22px;
  font-size: 10px; color: var(--text-faint); letter-spacing: .15em;
  text-transform: uppercase;
  z-index: 1;
}

/* === Language Switcher === */
.lang-switcher { position: relative; }
.lang-btn {
  width: auto !important;
  padding: 0 10px !important;
  display: inline-flex; align-items: center; gap: 4px;
}
.lang-code {
  font-size: 11px; font-weight: 700;
  letter-spacing: .04em;
  font-family: var(--font-num);
  color: var(--text-dim);
}
.icon-btn:hover .lang-code { color: var(--gold-bright); }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  padding: 4px;
  z-index: 90;
  min-width: 160px;
  display: flex; flex-direction: column;
}
.lang-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  background: transparent; border: 0;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.lang-item:hover { background: var(--bg-3); color: var(--text); }
.lang-item.active {
  background: rgba(212,168,90,.12);
  color: var(--gold-bright);
}
.lang-flag { font-size: 16px; flex-shrink: 0; }
.lang-name { flex: 1; }
.lang-check { font-weight: 700; }
@media (max-width: 1100px) {
  /* Topbar'da overflow-x: auto var → absolute dropdown clip'lenir.
     Mobilde menüyü viewport'a sabitle (topbar yüksekliği 52px + 4px gap). */
  .lang-menu {
    position: fixed;
    top: 56px;
    right: 8px;
    left: auto;
    transform: none;
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
  }
}

/* === GUIDE MODAL (Nasıl Kullanılır) === */
.guide-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 180;
  display: grid; place-items: center;
  padding: 20px;
  animation: fb-fade .18s ease-out;
}
.guide-card {
  width: 100%;
  max-width: 980px;
  height: calc(100dvh - 40px);
  max-height: 800px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: grid;
  grid-template-rows: 56px 1fr;
  overflow: hidden;
}
.guide-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.guide-head h2 {
  margin: 0;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}
.guide-head h2 .badge { font-size: 10px; }
.guide-close {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-dim);
  width: 32px; height: 32px; border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.guide-close:hover { background: var(--bg-3); color: var(--text); }
.guide-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  overflow: hidden;
}
.guide-toc {
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  padding: 14px 8px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.guide-toc button {
  text-align: left;
  background: transparent; border: 0;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: background .12s, color .12s;
}
.guide-toc button:hover { background: var(--bg-3); color: var(--text); }
.guide-toc button.active {
  background: var(--bg-3);
  color: var(--gold-bright);
  box-shadow: inset 3px 0 0 var(--gold-bright);
}
.guide-toc button .num {
  font-size: 10px;
  font-family: var(--font-num);
  color: var(--text-faint);
  width: 16px;
}
.guide-toc button.active .num { color: var(--gold); }

.guide-content {
  overflow-y: auto;
  padding: 24px 32px 60px;
  scroll-behavior: smooth;
}
.guide-section {
  scroll-margin-top: 12px;
  margin-bottom: 38px;
}
.guide-section:last-child { margin-bottom: 0; }
.guide-section h3 {
  margin: 0 0 10px;
  font-size: 19px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  color: var(--gold-bright);
}
.guide-section h3 .ico {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  background: rgba(212,168,90,.12);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  color: var(--gold-bright);
}
.guide-section p {
  margin: 0 0 10px;
  font-size: 14px; line-height: 1.55;
  color: var(--text-dim);
}
.guide-section p strong { color: var(--text); }
.guide-section ul {
  margin: 6px 0 12px;
  padding-left: 0;
  list-style: none;
}
.guide-section ul li {
  position: relative;
  padding: 6px 0 6px 22px;
  font-size: 13.5px; line-height: 1.5;
  color: var(--text-dim);
  border-bottom: 1px dashed var(--line);
}
.guide-section ul li:last-child { border-bottom: 0; }
.guide-section ul li::before {
  content: "›"; position: absolute;
  left: 4px; top: 5px;
  color: var(--gold-bright); font-weight: 700;
  font-size: 16px;
}
.guide-section ul li strong { color: var(--text); }

.guide-card-row {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px 14px;
  margin: 8px 0;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
}
.guide-card-row .lead {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bg-3);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  color: var(--gold-bright);
  font-size: 18px;
}
.guide-card-row .body {
  flex: 1;
}
.guide-card-row .body strong {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 2px;
}
.guide-card-row .body span {
  color: var(--text-dim);
  font-size: 12px; line-height: 1.4;
}

.guide-kbd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.guide-kbd {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.guide-kbd kbd {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--gold-bright);
  min-width: 22px; text-align: center;
}
.guide-kbd .desc { color: var(--text-dim); flex: 1; }

.guide-mini-pad {
  width: 100px; height: 100px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.05), transparent 70%),
    var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.guide-mini-pad::before, .guide-mini-pad::after {
  content: ""; position: absolute;
  background: var(--line);
}
.guide-mini-pad::before { left: 0; right: 0; top: 50%; height: 1px; }
.guide-mini-pad::after { top: 0; bottom: 0; left: 50%; width: 1px; }
.guide-mini-pad .dot {
  position: absolute;
  width: 14px; height: 14px;
  background: var(--gold-bright);
  border-radius: 50%;
  left: 56%; top: 32%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(212,168,90,.5);
}

.guide-tip {
  border-left: 3px solid var(--gold-bright);
  background: rgba(212,168,90,.06);
  padding: 10px 14px;
  margin: 10px 0;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  color: var(--text-dim);
}
.guide-tip strong { color: var(--gold-bright); }

.guide-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 11.5px; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.guide-trigger:hover { color: var(--gold-bright); border-color: var(--gold-dim); }

@media (max-width: 1100px) {
  .guide-card {
    height: 100dvh; max-height: 100dvh;
    max-width: 100%;
    border-radius: 0; border: 0;
  }
  .guide-modal { padding: 0; }
  .guide-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .guide-toc {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    scrollbar-width: none;
  }
  .guide-toc::-webkit-scrollbar { display: none; }
  .guide-toc button {
    flex-shrink: 0;
    padding: 7px 12px;
    box-shadow: none !important;
    border-radius: 999px;
  }
  .guide-toc button.active {
    background: rgba(212,168,90,.16);
  }
  .guide-toc button .num { display: none; }
  .guide-content { padding: 16px 18px 80px; }
  .guide-section h3 { font-size: 17px; }
  .guide-trigger .lbl { display: none; }
}

/* === TOPBAR NICKNAME (login kaldırıldıktan sonra) === */
.topbar-nick {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 32px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.topbar-nick:hover { border-color: var(--gold-dim); background: var(--bg-3); }
.topbar-nick-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1a1c1f;
  display: grid; place-items: center;
  font-weight: 700; font-size: 11px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.topbar-nick-name {
  font-size: 11px; font-weight: 600;
  white-space: nowrap; max-width: 140px;
  overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 1100px) {
  .topbar-nick-name { display: none; }
  .topbar-nick { padding: 4px; }
}

/* (Eski) === TOPBAR USER — kullanılmıyor, korunuyor === */
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 36px;
}
.topbar-user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  color: #1a1c1f;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.topbar-user-info { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.topbar-user-name { font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; }
.topbar-user-role { font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
@media (max-width: 1100px) {
  .topbar-user-info { display: none; }
}

/* === VISION PANEL === */
.vp { display: flex; flex-direction: column; gap: 12px; }
.vp-header { display: flex; flex-direction: column; gap: 4px; }
.vp-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display, "Sora", Inter, sans-serif);
  font-weight: 600; font-size: 13px; letter-spacing: .02em;
}
.vp-badge {
  display: inline-block;
  padding: 1px 7px;
  background: linear-gradient(135deg, #f0c674, #b8861f);
  color: #1a1c1f;
  font-size: 9px; font-weight: 800; letter-spacing: .1em;
  border-radius: 4px;
}
.vp-sub { font-size: 11px; color: var(--text-faint); }
.vp-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  padding: 28px 12px;
  background: var(--bg-2);
  border: 1.5px dashed var(--line-2);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.vp-drop:hover {
  border-color: var(--gold-dim);
  background: rgba(212,168,90,.04);
}
.vp-drop-icon { font-size: 28px; opacity: .8; }
.vp-drop-text { font-size: 12px; font-weight: 600; }
.vp-drop-hint { font-size: 10px; color: var(--text-faint); }

.vp-preview {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.vp-preview-stage {
  position: relative;
  background: #000;
  touch-action: none;
}
.vp-preview-stage img {
  display: block; width: 100%; height: auto;
  max-height: 360px; object-fit: contain;
  pointer-events: none;
  user-select: none;
}
.vp-preview-tools {
  display: flex; gap: 6px;
  padding: 8px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  justify-content: space-between;
}

.vp-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
}

/* === Corner selector === */
/* Overlay div boş alanlarda tıklamayı YUTMASIN — yalnız handle butonları yutar.
   Aksi halde üst üste yerleşen overlay'ler birbirinin handle'ını bloklar. */
.vp-corner-overlay {
  position: absolute; inset: 0;
  touch-action: none;
  pointer-events: none;
}
.vp-corner-svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.vp-corner-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: transparent;
  border: 0;
  display: grid; place-items: center;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  pointer-events: auto; /* override parent */
}
.vp-corner-handle:active { cursor: grabbing; }
.vp-corner-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold-bright);
  border: 2px solid #1a1208;
  box-shadow: 0 0 0 2px rgba(212,168,90,.45), 0 2px 8px rgba(0,0,0,.6);
  transition: transform .1s;
}
.vp-corner-handle:active .vp-corner-dot { transform: scale(1.25); }
.vp-corner-label {
  position: absolute;
  top: -2px; left: 50%; transform: translate(-50%, -100%);
  font-size: 9px; font-weight: 700;
  color: var(--gold-bright);
  background: rgba(0,0,0,.7);
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: .04em;
  pointer-events: none;
  white-space: nowrap;
}

.vp-corner-hint {
  font-size: 11px;
  color: var(--text-dim);
  padding: 8px 10px;
  background: rgba(212,168,90,.06);
  border-top: 1px solid rgba(212,168,90,.18);
  display: flex; align-items: center; gap: 8px;
  line-height: 1.4;
}
.vp-corner-reset {
  margin-left: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px; font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.vp-corner-reset:hover { border-color: var(--gold-dim); }

/* === Error boundary fallback === */
.error-boundary {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px;
  margin: 10px 0;
  background: rgba(216,83,79,.06);
  border: 1px solid rgba(216,83,79,.25);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.error-boundary-icon {
  flex-shrink: 0;
  font-size: 22px;
  line-height: 1;
  color: var(--bad);
}
.error-boundary-msg {
  flex: 1;
  display: flex; flex-direction: column; gap: 8px;
}
.error-boundary-msg strong { color: var(--text); }
.error-boundary-msg .btn { align-self: flex-start; }

/* === Magnifier loupe ===
   Drag esnasında dairesel zoomlu önizleme. Parmağı kapatmamak için dinamik
   olarak finger pozisyonunun karşısındaki köşeye yerleşir. */
.vp-loupe {
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--gold-bright);
  box-shadow:
    0 6px 24px rgba(0,0,0,.7),
    inset 0 2px 8px rgba(255,255,255,.15),
    inset 0 -2px 8px rgba(0,0,0,.4);
  background: #000;
  z-index: 10;
  pointer-events: none;
  animation: vp-loupe-in .12s ease-out;
}
.vp-loupe canvas { display: block; width: 100%; height: 100%; }
@keyframes vp-loupe-in {
  from { opacity: 0; transform: scale(.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* === Ball markers (3 top şablonu — manuel yerleştirme) === */
/* Overlay div boş alanlarda tıklamayı YUTMASIN — köşe handle'ları altta kalsa
   bile erişilebilir. Sadece ball-handle butonları pointer event yakalar. */
.vp-ball-overlay {
  position: absolute; inset: 0;
  touch-action: none;
  z-index: 3;
  pointer-events: none;
}
.vp-ball-handle {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 44px; height: 44px;          /* mobilde rahat tap area */
  background: transparent;
  border: 0;
  display: grid; place-items: center;
  cursor: grab;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto; /* override parent */
}
.vp-ball-handle:active { cursor: grabbing; }
.vp-ball-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.85);
  box-shadow:
    inset 0 -4px 8px rgba(0,0,0,.35),
    inset 0 3px 6px rgba(255,255,255,.5),
    0 0 0 3px rgba(0,0,0,.35),
    0 4px 12px rgba(0,0,0,.55);
  transition: transform .12s, box-shadow .12s;
  position: relative;
}
.vp-ball-dot::after {
  /* parlak iç highlight — bilardo topu hissi */
  content: "";
  position: absolute;
  top: 18%; left: 24%;
  width: 30%; height: 30%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.9), transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.vp-ball-handle:active .vp-ball-dot {
  transform: scale(1.18);
  box-shadow:
    inset 0 -4px 8px rgba(0,0,0,.35),
    inset 0 3px 6px rgba(255,255,255,.5),
    0 0 0 4px rgba(212,168,90,.7),
    0 6px 18px rgba(0,0,0,.65);
}
.vp-ball-label {
  position: absolute;
  top: -2px; left: 50%; transform: translate(-50%, -100%);
  font-size: 10px; font-weight: 800;
  color: #1a1208;
  background: var(--gold-bright);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: .04em;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
}
/* Beyaz topun gölgesi az olsun, görünür kalsın */
.vp-ball-white .vp-ball-dot { border-color: rgba(0,0,0,.75); }

/* === Numaralı ipucu satırları === */
.vp-tips {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px;
  background: rgba(212,168,90,.05);
  border-top: 1px solid rgba(212,168,90,.18);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-dim);
}
.vp-tip-row {
  display: flex; align-items: flex-start; gap: 10px;
}
.vp-tip-num {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--gold-bright);
  color: #1a1208;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  margin-top: 1px;
}
.vp-tip-row strong { color: var(--text); font-weight: 600; }

.vp-info {
  background: rgba(76,175,131,.1);
  border: 1px solid rgba(76,175,131,.3);
  color: var(--good);
  padding: 8px 10px; border-radius: 6px;
  font-size: 11px;
}

/* Mobil: handle'lar daha büyük, label'lar daha okunaklı */
@media (max-width: 1100px) {
  .vp-ball-handle { width: 52px; height: 52px; }
  .vp-ball-dot { width: 26px; height: 26px; }
  .vp-corner-handle { width: 44px; height: 44px; }
  .vp-corner-dot { width: 16px; height: 16px; }
  .vp-tips { font-size: 13px; padding: 12px; }
}
.vp-overlay-dot {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.7);
  box-shadow: 0 0 0 2px rgba(255,255,255,.3), 0 2px 6px rgba(0,0,0,.5);
  transform: translate(-50%, -50%);
  /* overlay positions are inside the frame's 6% padding */
  margin-left: 0; margin-top: 0;
}
/* Note: overlay dot positions are computed assuming the image fills the box.
   Real fotoğrafta masa kadrajı tam olmayacaktır; bu yüzden sadece yaklaşık
   bir görsel ipucu sunar. */

.vp-error {
  background: rgba(216,83,79,.08);
  border: 1px solid rgba(216,83,79,.3);
  color: #f0a8a4;
  padding: 8px 10px; border-radius: 6px;
  font-size: 11px;
}

.vp-result {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.vp-result-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
}
.vp-result-row span { font-weight: 600; min-width: 50px; }
.vp-result-row code {
  margin-left: auto;
  font-family: var(--font-mono, monospace);
  font-size: 10px; color: var(--text-dim);
  background: var(--bg-1);
  padding: 2px 6px; border-radius: 4px;
}
.vp-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.4);
  box-shadow: inset 0 -2px 3px rgba(0,0,0,.25);
}
.vp-result-meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 10px; color: var(--text-faint);
  padding-top: 4px; border-top: 1px solid var(--line);
}
.vp-conf {
  padding: 2px 6px; border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
}
.vp-conf.high { background: rgba(76,175,131,.15); color: var(--good); }
.vp-conf.mid  { background: rgba(226,162,58,.15); color: var(--warn); }
.vp-conf.low  { background: rgba(216,83,79,.15);  color: var(--bad); }
.vp-notes { flex: 1; font-style: italic; }

.vp-result-actions { display: flex; gap: 6px; margin-top: 4px; }
.vp-result-actions .btn { flex: 1; }


/* ============================================================== */
/* === v2 PREMIUM OVERHAUL — refined polish & mobile-first    === */
/* ============================================================== */

:root {
  --gold-glow: 0 0 24px rgba(240, 198, 116, .25);
  --inner-hi: inset 0 1px 0 rgba(255,255,255,.05);
  --t-spring: 380ms cubic-bezier(.34, 1.4, .64, 1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

/* --- Topbar refinement: glass + subtle gold seam --- */
.topbar {
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  background: linear-gradient(180deg, rgba(17,22,27,.96), rgba(17,22,27,.92));
  border-bottom: 1px solid var(--line);
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,90,.35), transparent);
  pointer-events: none;
}
[data-theme="light"] .topbar { background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.86)); }

.brand .mark {
  width: 32px; height: 32px;
  box-shadow:
    inset 0 -4px 8px rgba(0,0,0,.4),
    inset 0 2px 4px rgba(255,255,255,.3),
    0 0 24px rgba(212,168,90,.45),
    0 4px 14px rgba(0,0,0,.5);
}

/* --- Refined tabs with sliding indicator feel --- */
.tab-group {
  background: rgba(0,0,0,.18);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
[data-theme="light"] .tab-group { background: rgba(0,0,0,.04); box-shadow: inset 0 1px 2px rgba(0,0,0,.05); }
.tab-group button {
  position: relative;
  font-weight: 600; font-size: 12.5px;
  letter-spacing: .015em;
  transition: color .18s cubic-bezier(.2,.6,.2,1), background .25s ease;
}
.tab-group button:hover:not(.active) { color: var(--text); background: rgba(255,255,255,.02); }
.tab-group button.active {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  color: var(--gold-bright);
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 6px rgba(0,0,0,.35);
}
.tab-group button.active::before {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
  opacity: .7;
}

/* --- Mode toggle refined --- */
.mode-toggle { box-shadow: inset 0 1px 2px rgba(0,0,0,.35); }
.mode-btn.active {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  color: var(--gold-bright);
}

/* --- Section title: small accent dot --- */
.section-title {
  font-size: 10.5px;
  position: relative;
  padding-left: 12px;
}
.section-title::before {
  content: "";
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 12px; border-radius: 2px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  opacity: .85;
}
.section-title .badge {
  background: linear-gradient(135deg, rgba(240,198,116,.18), rgba(212,168,90,.08));
  border: 1px solid rgba(212,168,90,.18);
}

/* --- Premium buttons --- */
button.btn {
  letter-spacing: .005em;
  position: relative;
  background: linear-gradient(180deg, var(--bg-2), rgba(0,0,0,.1) 100%), var(--bg-2);
}
[data-theme="light"] button.btn { background: var(--bg-2); }
button.btn:hover {
  background: linear-gradient(180deg, var(--bg-3), var(--bg-2));
  border-color: var(--line-2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
button.btn.primary {
  background: linear-gradient(180deg, #f7d289, var(--gold-bright) 50%, var(--gold) 100%);
  color: #1a1208;
  border: 1px solid var(--gold);
  box-shadow:
    var(--inner-hi),
    0 1px 0 rgba(255,255,255,.45) inset,
    0 8px 24px rgba(212,168,90,.32),
    0 2px 4px rgba(0,0,0,.35);
}
button.btn.primary:hover {
  filter: brightness(1.08);
  box-shadow:
    0 1px 0 rgba(255,255,255,.5) inset,
    0 12px 32px rgba(212,168,90,.42),
    0 2px 6px rgba(0,0,0,.4);
  transform: translateY(-1px);
}
button.btn.primary:active { transform: translateY(0); filter: brightness(.98); }

/* --- Solution cards: gold edge on active + hover halo --- */
.solution-card {
  background: linear-gradient(180deg, var(--bg-2), rgba(0,0,0,.08) 100%), var(--bg-2);
  transition: transform .18s cubic-bezier(.2,.6,.2,1), border-color .18s, box-shadow .25s, background .2s;
}
.solution-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212,168,90,.35);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 1px rgba(212,168,90,.08) inset;
}
.solution-card.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(240,198,116,.12), rgba(212,168,90,.04));
  box-shadow:
    0 0 0 1px var(--gold-dim) inset,
    0 0 32px rgba(212,168,90,.2),
    0 8px 28px rgba(0,0,0,.4);
}
.solution-card.active::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
}
.solution-card .name {
  font-family: var(--font-display);
  letter-spacing: .005em;
}
.solution-card .pct { width: 4px; }

/* --- HUD chips refined --- */
.hud .chip {
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 11.5px;
  background: rgba(11,15,20,.72);
  box-shadow: 0 8px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
}
[data-theme="light"] .hud .chip { background: rgba(255,255,255,.9); }

/* --- Minimap: subtle gold edge glow --- */
.minimap {
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow:
    var(--shadow-1),
    0 0 0 1px rgba(212,168,90,.06) inset,
    0 0 32px rgba(0,0,0,.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: rgba(17,22,27,.85);
}
[data-theme="light"] .minimap { background: rgba(255,255,255,.92); }

/* --- Playback bar: longer hover lift --- */
.playback {
  transition: transform .25s, box-shadow .25s;
}
.playback:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 16px 48px rgba(0,0,0,.5); }

/* --- Stat cards: refined typography --- */
.stat {
  background: linear-gradient(180deg, var(--bg-2), rgba(0,0,0,.05));
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,168,90,.18), transparent);
}
.stat .num {
  font-family: var(--font-display);
  letter-spacing: -.02em;
  background: linear-gradient(180deg, #f7d289, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* --- Toast: glass + bigger --- */
.toast {
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  background: rgba(17,22,27,.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 16px 48px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.06);
}
[data-theme="light"] .toast { background: rgba(255,255,255,.95); }

/* --- Tip card refined --- */
.tip-card {
  background: linear-gradient(135deg, rgba(212,168,90,.1), rgba(212,168,90,.02));
  border: 1px solid rgba(212,168,90,.22);
  position: relative;
  overflow: hidden;
}
.tip-card::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--gold-bright), transparent);
}

/* --- Library cards: hover preview lift --- */
.lib-card {
  transition: transform .2s cubic-bezier(.2,.6,.2,1), border-color .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}
.lib-card:hover {
  transform: translateY(-2px);
  border-color: rgba(212,168,90,.35);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.lib-card::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 70%, rgba(0,0,0,.15));
  opacity: 0; transition: opacity .2s;
}
.lib-card:hover::after { opacity: 1; }

/* --- English pad refined --- */
.english-pad {
  box-shadow:
    inset 0 -12px 28px rgba(0,0,0,.22),
    inset 0 4px 12px rgba(255,255,255,.55),
    0 8px 28px rgba(0,0,0,.45),
    0 0 0 1px rgba(212,168,90,.12);
}

/* --- Panels: subtle inner shadow & better scrollbar --- */
.panel-left, .panel-right {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}
.panel-left::-webkit-scrollbar, .panel-right::-webkit-scrollbar { width: 6px; }

/* --- Topbar user pill premium --- */
.topbar-user {
  background: linear-gradient(180deg, var(--bg-2), rgba(0,0,0,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.topbar-user-avatar {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.4),
    inset 0 -2px 4px rgba(0,0,0,.25),
    0 0 0 1.5px var(--bg-2),
    0 0 0 2px rgba(212,168,90,.35);
}

/* ============================================================== */
/* === MOBILE-FIRST RESPONSIVE                                === */
/* ============================================================== */

@media (max-width: 1100px) {
  /* Single-column shell with bottom-sheet panels */
  .app { grid-template-rows: 52px auto 1fr; }
  .topbar {
    padding: 0 10px;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .topbar::-webkit-scrollbar { display: none; }
  .topbar > * { flex-shrink: 0; }
  .topbar .grow { display: none; }
  .topbar .sep { display: none; }
  .brand { font-size: 13px; }
  .brand .mark { width: 26px; height: 26px; }

  /* Hide tab bar in topbar, show mobile bottom nav instead */
  .tab-group { display: none !important; }
  .topbar-user-info { display: none; }
  .topbar-user { padding: 4px; height: 32px; gap: 0; }
  .topbar-user > .icon-btn:not(:last-child) { display: none; }
  .icon-btn { width: 32px; height: 32px; }

  .main {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr auto !important;
    position: relative;
  }

  /* Stage takes full screen - panels become bottom sheets */
  .stage { grid-column: 1; grid-row: 1; }
  .panel-left, .panel-right {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    top: auto;
    height: 75dvh;
    max-height: 75dvh;
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    z-index: 60;
    background: var(--bg-1);
    box-shadow: 0 -20px 50px rgba(0,0,0,.6), 0 -1px 0 rgba(212,168,90,.15);
    transform: translateY(100%);
    transition: transform var(--t-spring);
    padding-bottom: var(--safe-bottom);
    overscroll-behavior: contain;
  }
  .panel-left.open, .panel-right.open { transform: translateY(0); }
  /* Shoot tab tek yükseklik: masa üst yarıda görünür kalır, panel detay
     kontrolleri için yeterli alan sağlar. Yarım/tam ikilemi kaldırıldı. */
  .panel-left.shoot-single {
    height: 56dvh;
    max-height: 56dvh;
  }
  .panel-left::before, .panel-right::before {
    content: "";
    position: sticky; top: 0;
    display: block;
    height: 22px;
    background: var(--bg-1);
    border-radius: 22px 22px 0 0;
    z-index: 5;
  }
  .panel-left::after, .panel-right::after {
    content: "";
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 999px;
    background: var(--line-2);
    z-index: 6;
    pointer-events: none;
  }
  /* snap-handle kaldırıldı (3-mod sadeleştirmesi) */

  /* Mobile bottom nav bar (replaces tabs) */
  .mobile-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex;
    background: rgba(17,22,27,.95);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-top: 1px solid var(--line);
    z-index: 50;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -8px 24px rgba(0,0,0,.4);
  }
  [data-theme="light"] .mobile-tabbar { background: rgba(255,255,255,.95); }
  .mobile-tabbar::before {
    content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,168,90,.3), transparent);
  }
  .mobile-tabbar button {
    flex: 1;
    background: transparent; border: 0;
    padding: 10px 4px;
    color: var(--text-faint);
    font-size: 10.5px; font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    position: relative;
    transition: color .15s;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-tabbar button .ic {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    border-radius: 8px;
  }
  .mobile-tabbar button.active {
    color: var(--gold-bright);
  }
  .mobile-tabbar button.active .ic {
    background: rgba(212,168,90,.15);
    box-shadow: 0 0 16px rgba(212,168,90,.3);
  }
  .mobile-tabbar button.active::before {
    content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-bright), transparent);
    border-radius: 2px;
  }

  /* Stage adjustments */
  .stage { padding-bottom: 64px; }
  .canvas-host { border-radius: 0; }
  .minimap {
    width: 130px; height: 72px; top: 8px; right: 8px;
  }
  /* Mobil HUD: chip'ler dikey stack yerine yatay tek satır + scroll. Masa
     görünür kalsın diye toplam yükseklik tek chip yüksekliğine düşer. */
  .hud {
    top: 8px; left: 8px; right: 152px;
    flex-direction: row; flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    pointer-events: auto;
  }
  .hud::-webkit-scrollbar { display: none; }
  .hud .chip {
    padding: 4px 8px; font-size: 10px;
    flex-shrink: 0;
    white-space: nowrap;
  }
  /* Path-legend mobilde gereksiz dikey alan yiyor; gizle */
  .hud .chip.path-legend { display: none; }

  /* Mobilde playback'i ÜST-SOL'a taşı; HUD'ın altına, minimap'in soluna.
     Masanın merkezi ve alt aim-bar artık tamamen serbest. */
  .playback {
    left: 8px;
    top: 40px;
    bottom: auto;
    transform: none;
    padding: 4px 6px;
    gap: 3px;
    max-width: calc(100vw - 16px - 138px); /* sağda minimap için pay (130+8) */
  }
  .playback:hover { transform: translateY(-2px); }
  .playback .scrub { width: 60px; }
  .playback .speed-pills { gap: 1px; }
  .playback .speed-pills button { padding: 2px 5px; font-size: 10px; }
  .playback .icon-btn { width: 26px !important; height: 26px !important; }

  /* Stage FAB for quick fire/solver */
  .stage-fab {
    position: fixed; right: 14px;
    bottom: calc(76px + var(--safe-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(180deg, #f7d289, var(--gold-bright) 50%, var(--gold));
    color: #1a1208; border: 1px solid var(--gold);
    box-shadow:
      0 12px 32px rgba(212,168,90,.4),
      0 4px 12px rgba(0,0,0,.5),
      inset 0 1px 0 rgba(255,255,255,.5);
    display: grid; place-items: center;
    cursor: pointer; z-index: 45;
    font-size: 22px;
    transition: transform .18s cubic-bezier(.2,.6,.2,1);
  }
  .stage-fab:active { transform: scale(.92); }

  /* Touch targets */
  button.btn { min-height: 40px; padding: 10px 14px; }
  button.btn.sm { min-height: 32px; padding: 7px 10px; }
  button.btn.lg { min-height: 48px; }
  .lib-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .section { padding: 14px; }

  /* English pad bigger on touch */
  .english-pad { max-width: 220px; }

  /* Bigger sliders */
  input[type="range"] { height: 6px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
  input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; }

  /* Hide stats panel topbar nav (already removed but defensive) */

  /* Solution cards on mobile */
  .solution-card { padding: 12px 14px; margin-bottom: 10px; }
  .solution-card .meta { font-size: 11px; }
  .solution-card .meta span:last-child { font-size: 12px; }

  /* Topbar mode toggle keeps single icon */
  .mode-btn { padding: 6px 9px; font-size: 11px; }

  /* === Mobile Aim Bar ===
   * Sticky alt bar — vurucu topa dokunup sürüklemenin yanında
   * canlı readout, ince güç ayarı ve VUR butonu sunar. */
  .mobile-aim-bar {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(64px + var(--safe-bottom));
    z-index: 48;
    background: linear-gradient(180deg, rgba(17,22,27,.94), rgba(17,22,27,.98));
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    border-top: 1px solid rgba(212,168,90,.22);
    box-shadow: 0 -10px 28px rgba(0,0,0,.45);
    padding: 8px 10px 9px;
    display: flex; flex-direction: column; gap: 7px;
    -webkit-tap-highlight-color: transparent;
  }
  [data-theme="light"] .mobile-aim-bar {
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.98));
    border-top-color: rgba(212,168,90,.4);
  }
  .mobile-aim-bar .aim-row {
    display: flex; align-items: center; gap: 6px;
  }
  .mobile-aim-bar .readouts {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 4px 2px;
    transition: border-color .15s, transform .12s;
  }
  /* Her readout artık <button>: kendi düzenleyicisini açar (vurucu döndür,
     açı/güç → panel, spin → pad). Buton default stillerini sıfırla. */
  .mobile-aim-bar .readout {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 4px 6px;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--line);
    min-width: 0;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 6px;
    transition: background .12s, transform .1s;
  }
  .mobile-aim-bar .readout:last-child { border-right: 0; }
  .mobile-aim-bar .readout:active {
    background: rgba(212,168,90,.1);
    transform: scale(.96);
  }
  .mobile-aim-bar .readout .lbl {
    font-size: 9px; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-faint);
  }
  .mobile-aim-bar .readout .val {
    font-size: 13px; font-weight: 700;
    font-family: var(--font-num);
    color: var(--gold-bright);
    margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
  }
  .mobile-aim-bar .readout.side-top { cursor: pointer; }
  .mobile-aim-bar .readout.side-top:active { background: rgba(212,168,90,.08); }

  .mobile-aim-bar .controls {
    align-items: stretch;
  }
  .mobile-aim-bar .aim-btn {
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    border-radius: 10px;
    min-width: 44px; min-height: 44px;
    display: grid; place-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform .1s, background .15s, border-color .15s;
  }
  .mobile-aim-bar .aim-btn:active { transform: scale(.94); }
  .mobile-aim-bar .aim-btn:disabled { opacity: .35; cursor: default; }
  .mobile-aim-bar .aim-btn.ghost { color: var(--text-dim); }
  .mobile-aim-bar .aim-btn.fire {
    background: linear-gradient(180deg, #f7d289, var(--gold-bright) 50%, var(--gold));
    color: #1a1208;
    border-color: var(--gold);
    font-weight: 800;
    letter-spacing: .12em;
    padding: 0 16px;
    font-size: 14px;
    min-height: 48px;
    min-width: 90px;
    gap: 6px;
    grid-template-columns: auto 1fr;
    box-shadow: 0 4px 14px rgba(212,168,90,.4), inset 0 1px 0 rgba(255,255,255,.45);
  }
  .mobile-aim-bar .aim-power {
    flex: 1;
    height: 32px;
    accent-color: var(--gold-bright);
  }

  /* Çekme kulpu — aim-bar üstünde her zaman görünür, swipe alanı + tıklanabilir toggle */
  .mobile-aim-bar .aim-bar-grabber {
    position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
    width: 80px; height: 22px;
    background: transparent; border: 0; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    display: grid; place-items: center;
  }
  .mobile-aim-bar .aim-bar-grabber::before {
    content: ""; display: block;
    width: 44px; height: 4px;
    border-radius: 999px;
    background: var(--line-2);
    transition: background .15s, width .15s;
  }
  .mobile-aim-bar .aim-bar-grabber:active::before { background: var(--gold-dim); width: 56px; }

  /* Vuruş replay sırasında veya kullanıcı manuel gizleyince kompakt mod.
     Tek satır: undo + durum etiketi + büyüt. Masayı görüş alanını rahat bırakır. */
  .mobile-aim-bar.collapsed {
    padding: 6px 10px 8px;
    gap: 0;
  }
  .mobile-aim-bar .aim-bar-mini {
    display: flex; align-items: center; gap: 8px;
    padding-top: 4px;
  }
  .mobile-aim-bar .aim-bar-mini-label {
    flex: 1;
    font-size: 12px; font-weight: 600;
    color: var(--text-dim);
    letter-spacing: .02em;
    text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .mobile-aim-bar .aim-bar-mini .aim-btn {
    min-width: 38px; min-height: 36px;
  }
  .mobile-aim-bar .aim-btn.fire.mini {
    padding: 0 10px;
    min-width: 38px;
    grid-template-columns: auto;
  }

  /* Playback artık üstte sabitlendiği için aim-bar pozisyonundan etkilenmez */
  /* Minimap'i aim-bar'ın altında bırakmamak için sağ-alt'tan sağ-üst'e taşı zaten var.
     HUD chip'leri için ekstra alt margin gerekmez (üstte sabit). */

  /* === English Pad Popup === */
  .english-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 80;
    display: grid; place-items: center;
    padding: 24px;
    -webkit-tap-highlight-color: transparent;
  }
  .english-modal-card {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    max-width: 340px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.6);
    display: flex; flex-direction: column; gap: 12px;
  }
  .english-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px;
  }
  .english-modal-card .english-pad {
    margin: 0 auto;
    max-width: 240px;
  }
  .english-modal-presets {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
  }
}

/* Hide mobile tabbar on desktop */
@media (min-width: 1101px) {
  .mobile-tabbar, .stage-fab, .mobile-backdrop { display: none !important; }
  .panel-left::before, .panel-right::before,
  .panel-left::after, .panel-right::after { display: none !important; }
}

/* Tablet polish — drawer mode is active here, but minimap/typography deserve
 * a dedicated touch-up in landscape tablet width range. */
@media (min-width: 768px) and (max-width: 1100px) {
  .minimap { width: 220px; height: 120px; top: 12px; right: 12px; }
  .panel-left, .panel-right { max-height: 80dvh; }
}

/* Portrait phones/tablets: render.js's portrait-aware camera fit handles
 * sizing — we don't cap the canvas here. We do nudge the canvas-host to
 * pull a comfortable share of the viewport (so it's not crushed under
 * stacked overlays). */
@media (max-width: 1100px) and (orientation: portrait) {
  .canvas-host { min-height: 56dvh; }
}

/* Very small phones */
@media (max-width: 380px) {
  .topbar { padding: 0 8px; gap: 6px; }
  .brand { font-size: 12px; }
  .brand small { display: none !important; }
  .mode-btn { padding: 5px 7px; font-size: 10.5px; }
  .mode-btn .mode-dot { width: 5px; height: 5px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
