/* ===================== Shahrune — sade, modern arayüz ===================== */
:root {
  --bg: #0b0d18;
  --bg2: #12152a;
  --card: rgba(24, 28, 52, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9ecf8;
  --muted: #9aa1c0;
  --accent: #8b7bff;
  --accent2: #5fd4ff;
  --gold: #ffcf5a;
  --danger: #ff5a6a;
  --ok: #6be3a0;
  --radius: 14px;
  --hud-h: 56px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; inset: 0 0 auto 0; height: var(--hud-h); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: rgba(11, 13, 24, 0.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px; font-weight: 700; letter-spacing: .3px; }
.brand-mark { font-size: 24px; color: var(--accent); }
.chip { padding: 5px 12px; border-radius: 999px; background: rgba(139, 123, 255, .14); border: 1px solid rgba(139, 123, 255, .3); color: #cfc8ff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38vw; }
.hud-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.res { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid var(--line); font-size: 14px; }
.res b { min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; }
.res.bump { animation: bump .45s ease; }
@keyframes bump { 40% { transform: scale(1.18); background: rgba(255, 207, 90, .2); } }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); }

/* ---------------- Butonlar ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255,255,255,.07); transition: transform .12s, background .2s, border-color .2s; }
.btn:hover { background: rgba(255,255,255,.12); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--accent), #6a5cf0); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(255, 90, 106, .4); color: #ffb3bb; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- Ekranlar ---------------- */
main { position: absolute; inset: var(--hud-h) 0 0 0; }
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: flex; }

#screen-home { align-items: center; justify-content: center; overflow-y: auto;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(139,123,255,.25), transparent 60%), radial-gradient(800px 500px at 90% 110%, rgba(95,212,255,.12), transparent 60%), var(--bg); }
.home-wrap { width: min(1040px, 94vw); padding: 28px 0 40px; text-align: center; }
.title { font-size: clamp(34px, 6vw, 58px); margin: 0; letter-spacing: 1px; background: linear-gradient(90deg, #fff, #cfc8ff 40%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.subtitle { color: var(--muted); margin: 6px 0 28px; }
.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 24px 18px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.mode-card.featured { border-color: rgba(139,123,255,.45); box-shadow: 0 0 40px rgba(139,123,255,.15); }
.mode-card h2 { margin: 0; font-size: 20px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 14px; min-height: 40px; }
.mode-icon { font-size: 40px; }
.mode-meta { font-size: 13px; color: #cfc8ff; }
.mode-card .btn.primary { margin-top: auto; width: 100%; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.seg-btn { padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 13px; }
.seg-btn.active { background: rgba(139,123,255,.3); color: #fff; }
.stats { color: var(--muted); font-size: 13px; margin-top: 22px; }

/* ---------------- Harita ---------------- */
#screen-map { flex-direction: column; align-items: center; padding: 14px; gap: 10px; background: var(--bg); overflow-y: auto; }
.map-toolbar { width: min(1100px, 100%); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.map-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.world-map { width: min(1100px, 100%); flex: 1; min-height: 260px; display: flex; align-items: center; justify-content: center; }
.world-svg { width: 100%; height: 100%; max-height: calc(100vh - var(--hud-h) - 120px); }
.region.locked { opacity: .35; filter: grayscale(.7); }
.region-name { font-size: 20px; font-weight: 700; letter-spacing: .4px; }
.map-path { fill: none; stroke: rgba(255,255,255,.18); stroke-width: 4; stroke-dasharray: 2 10; stroke-linecap: round; }
.map-path.done { stroke: rgba(255, 207, 90, .65); stroke-dasharray: none; }
.node { cursor: default; }
.node.open { cursor: pointer; }
.node-ring { fill: none; stroke-width: 3; }
.node.open .node-ring { animation: pulse 2.2s infinite; transform-box: fill-box; transform-origin: center; }
.node.done .node-ring { stroke: var(--gold); animation: none; }
.node.locked .node-ring { stroke: #3a3f5a; }
.node-label { fill: #fff; font-size: 13px; font-weight: 700; pointer-events: none; }
.node.open:hover .node-core, .node.open:focus .node-core { filter: brightness(1.6); }
.node:focus { outline: none; }
@keyframes pulse { 50% { stroke-width: 6; opacity: .65; } }
.map-hint { color: var(--muted); font-size: 13px; margin: 0; text-align: center; }

/* ---------------- Oyun ---------------- */
#screen-game { display: none; }
#screen-game.active { display: grid; grid-template-columns: 1fr 330px; }
.stage3d { position: relative; min-width: 0; min-height: 0; overflow: hidden; touch-action: none; }
.stage3d canvas { display: block; width: 100% !important; height: 100% !important; }
.gl-error { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 30px; text-align: center; color: var(--danger); }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--bg2); border-left: 1px solid var(--line); overflow-y: auto; }
.panel-head h2 { margin: 0 0 4px; font-size: 17px; }
.status { font-size: 14px; color: var(--muted); min-height: 20px; }
.status.turn-you { color: var(--ok); }
.status.warn { color: var(--gold); }
.panel-block h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; }
.panel-block.grow { flex: 1; min-height: 90px; display: flex; flex-direction: column; }
.captured { display: flex; flex-direction: column; gap: 4px; font-size: 20px; min-height: 28px; }
.captured span { letter-spacing: 1px; }
.move-list { margin: 0; padding: 0 0 0 26px; font-size: 13px; color: #cdd2ea; overflow-y: auto; flex: 1; font-variant-numeric: tabular-nums; }
.move-list li { padding: 1px 0; }
.panel-actions { justify-content: space-between; }

/* Yetenek çubuğu */
.ability-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.ab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.05); }
.ab .ic { font-size: 20px; line-height: 1; }
.ab .nm { font-size: 10px; color: var(--muted); text-align: center; line-height: 1.1; }
.ab .uses { font-size: 10px; color: #cfc8ff; }
.ab .cd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(5,6,14,.7); font-weight: 700; font-size: 18px; }
.ab.active { border-color: var(--accent2); box-shadow: 0 0 0 2px rgba(95,212,255,.35), 0 0 18px rgba(95,212,255,.35); }
.ab:disabled { opacity: .5; }
.ab:not(:disabled):hover { background: rgba(139,123,255,.18); }
.picker { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: 12px; background: rgba(255, 162, 58, .08); border: 1px solid rgba(255,162,58,.3); font-size: 13px; }
.picker .pk { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.06); }
.picker .pk:disabled { opacity: .4; }
.puzzle-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: rgba(107,227,160,.07); border: 1px solid rgba(107,227,160,.25); }
.puzzle-info { font-size: 13px; color: #c9f5dc; }

/* ---------------- Modal & toast ---------------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3,4,10,.62); backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(620px, 100%); max-height: 86vh; overflow-y: auto; padding: 22px; border-radius: 18px; background: #151935; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .22s ease; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: transparent; }
.modal-card h2 { margin: 0 0 4px; }
.modal-card .sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 13px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item h4 { margin: 0 0 3px; font-size: 15px; }
.item p { margin: 0; color: var(--muted); font-size: 13px; }
.item.locked { opacity: .5; }
.item.solved { border-color: rgba(107,227,160,.35); }
.swatches { display: flex; gap: 4px; }
.swatches i { width: 20px; height: 20px; border-radius: 6px; border: 1px solid rgba(255,255,255,.2); }
.tier { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.lvl { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.lvl i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.15); }
.lvl i.on { background: var(--accent2); }
.result { text-align: center; }
.result .big { font-size: 54px; }
.result .reward { font-size: 18px; margin: 10px 0 18px; color: var(--gold); }
.result .row { justify-content: center; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); z-index: 60; padding: 10px 16px; border-radius: 12px; background: #1d2246; border: 1px solid var(--line); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(255,90,106,.5); }
.toast.ok { border-color: rgba(107,227,160,.5); }

/* ---------------- Mobil ---------------- */
@media (max-width: 860px) {
  .mode-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .brand-text { display: none; }
  #screen-game.active { grid-template-columns: 1fr; grid-template-rows: 58% 42%; }
  .panel { border-left: 0; border-top: 1px solid var(--line); }
  .chip { max-width: 30vw; }
}
@media (max-width: 480px) {
  .chip { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
