:root {
  --panel: rgba(3, 23, 43, 0.88);
  --accent: #00d4ff;
  --accent2: #ffcf33;
  --violet: #a777ff;
  --mint: #61f3cf;
  --danger: #ff5470;
  --text: #eaf6ff;
  --ui-scale: 1;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #00101d;
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif; color: var(--text); user-select: none; touch-action: none; }
#game-root { position: fixed; inset: 0; overflow: hidden; }
#game-canvas { display: block; width: 100%; height: 100%; cursor: none; }
body.touch #game-canvas { cursor: auto; }
.hidden { display: none !important; }

/* HUD — sade cam tema */
#hud { position: absolute; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: clamp(8px, 1.2vw, 16px); padding-top: max(clamp(8px,1.2vw,16px), env(safe-area-inset-top));
  pointer-events: none; z-index: 5; font-size: calc(1rem * var(--ui-scale)); gap: 10px; }
.hud-left { display: flex; flex-direction: column; gap: 8px; }
.hud-right { display: flex; gap: 6px; pointer-events: auto; align-items: center; }
.glass-panel { background: linear-gradient(145deg, rgba(9,45,72,.82), rgba(3,18,36,.78)); border: 1px solid rgba(110,224,255,.22);
  border-radius: 14px; padding: 9px 15px; backdrop-filter: blur(14px); box-shadow: 0 8px 28px rgba(0,5,18,.38), inset 0 1px rgba(255,255,255,.05); }
.gp-row { display: flex; align-items: baseline; gap: 6px; }
.gp-lbl { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; opacity: .55; }
.gp-sep { margin-left: 8px; }
.gp-val { font-size: 18px; font-weight: 800; }
.gp-biome { font-size: 12px; opacity: .8; margin-top: 2px; }
.chain-badge { --chain-progress: 1; align-self: flex-start; position: relative; overflow: hidden; background: rgba(255,140,40,.9); color: #2a1500; font-weight: 800; font-size: 13px;
  padding: 4px 10px 6px; border-radius: 20px; box-shadow: 0 3px 10px rgba(255,120,0,.4); animation: pop .2s ease; }
.chain-badge::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 2px; height: 2px; border-radius: 2px;
  background: #fff4b0; transform: scaleX(var(--chain-progress)); transform-origin: left; transition: transform .08s linear; }

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1; max-width: 340px; }
.bars { display: flex; flex-direction: column; gap: 7px; width: min(300px, 40vw); }
.bar-line { display: flex; align-items: center; gap: 7px; }
.bi { font-size: 13px; width: 16px; text-align: center; opacity: .85; }
.bar { flex: 1; height: 13px; background: rgba(255,255,255,.1); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255,255,255,.14); position: relative; }
.bar-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; letter-spacing: .3px; color: #eaf6ff; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
#bar-evo.near { box-shadow: 0 0 10px #7ee081; }
.fill { height: 100%; width: 100%; transition: width .12s linear; }
.fill.hp { background: linear-gradient(90deg, #ff4d6a, #ff9a4d); }
.fill.energy { background: linear-gradient(90deg, #ffcf33, #ff8c42); }
.fill.evo { background: linear-gradient(90deg, #35e0c0, #33b6ff); }
.flow-meter { width: min(300px, 40vw); padding: 5px 9px 7px; border: 1px solid rgba(124,238,255,.18); border-radius: 10px;
  background: rgba(2,18,34,.62); backdrop-filter: blur(10px); transition: box-shadow .25s, border-color .25s; }
.flow-head { display: flex; justify-content: space-between; font-size: 8px; font-weight: 900; letter-spacing: 1.8px; color: #a8dcea; margin-bottom: 4px; }
.flow-head b { color: #75f0d0; }
.flow-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
#flow-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #39dcce, #22baff, #b77bff); box-shadow: 0 0 10px #37dfff; transition: width .12s linear; }
.flow-meter.fever { border-color: rgba(255,215,84,.75); box-shadow: 0 0 24px rgba(255,190,40,.28); animation: feverPulse .7s ease-in-out infinite alternate; }
.flow-meter.fever .flow-head, .flow-meter.fever .flow-head b { color: #ffe47a; }
.flow-meter.fever #flow-fill { background: linear-gradient(90deg,#ffb52e,#fff08a,#ff7dc6); box-shadow: 0 0 14px #ffd34e; }
@keyframes feverPulse { to { transform: scale(1.015); } }
.icon-btn { pointer-events: auto; background: rgba(6,34,58,.7); border: 1px solid rgba(120,190,240,.18); border-radius: 10px; color: var(--text); font-size: 17px; width: 40px; height: 40px; cursor: pointer; transition: transform .1s, background .2s; backdrop-filter: blur(6px); }
.icon-btn:hover { background: rgba(60,150,220,.3); transform: translateY(-2px); }
.icon-btn:active { transform: scale(.94); }

/* Dikey derinlik göstergesi (sağ kenar) */
.depth-gauge { position: absolute; right: clamp(6px,1vw,14px); top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.dg-track { width: 8px; height: min(46vh, 340px); background: rgba(6,34,58,.6); border: 1px solid rgba(120,190,240,.18);
  border-radius: 6px; position: relative; overflow: hidden; }
.dg-fill { position: absolute; top: 0; left: 0; right: 0; background: linear-gradient(180deg, #37c0e0, #0a3d68); border-radius: 6px; transition: height .15s linear; }
.dg-limit { position: absolute; left: -2px; right: -2px; height: 2px; background: #ffcf33; box-shadow: 0 0 6px #ffcf33; }
.dg-label { font-size: 11px; font-weight: 700; opacity: .85; writing-mode: initial; }
.dg-label.over { color: #ff6b7f; animation: pulse .5s infinite; }

/* Görev kartı */
.quest-card { position: absolute; left: clamp(8px,1.2vw,16px); top: 96px; z-index: 5; pointer-events: none;
  display: flex; align-items: center; gap: 8px; background: linear-gradient(180deg, rgba(6,34,58,.72), rgba(3,20,38,.72));
  border: 1px solid rgba(120,190,240,.18); border-radius: 10px; padding: 7px 12px; font-size: 13px; backdrop-filter: blur(8px);
  max-width: 240px; transition: max-width .3s ease, padding .3s ease; }
.quest-card.mini { max-width: 96px; }
.quest-card #quest-icon { font-size: 16px; }
.quest-card.bump { animation: pop .3s ease; }

/* Yetenek slotları (alt orta) */
.ability-slots { position: absolute; left: 50%; bottom: clamp(10px,2vh,22px); transform: translateX(-50%); z-index: 5;
  display: flex; gap: 10px; pointer-events: none; }
.ability-slot { position: relative; width: 46px; height: 46px; border-radius: 50%; background: rgba(6,34,58,.75);
  border: 2px solid rgba(120,190,240,.3); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.as-cd { position: absolute; bottom: 0; left: 0; right: 0; height: 0%; background: rgba(0,0,0,.45); transition: height .1s linear; }
.as-ico { font-size: 18px; z-index: 1; }
.as-key { position: absolute; top: -8px; font-size: 8px; background: #2a3a4a; padding: 1px 4px; border-radius: 4px; z-index: 2; }
.as-cost { position: absolute; bottom: -7px; font-size: 8px; color: #ffcf33; z-index: 2; }

/* Afiş */
.banner { position: absolute; top: 15%; left: 50%; transform: translateX(-50%); z-index: 7;
  background: var(--panel); border: 1px solid var(--accent); color: var(--text); padding: 12px 26px;
  border-radius: 14px; font-size: 20px; font-weight: 800; letter-spacing: 1px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.banner.show { animation: bannerIn .35s ease, bannerOut .4s ease 2s forwards; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes bannerOut { to { opacity: 0; } }

/* Mobil butonlar */
.touch-btn { position: absolute; bottom: 26px; z-index: 6; width: 84px; height: 84px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 26px; font-weight: 900; box-shadow: 0 8px 22px rgba(0,0,0,.4); touch-action: none; border: 2px solid rgba(255,255,255,.5); color: #3a2400; }
.touch-btn span { font-size: 11px; letter-spacing: 1px; }
.touch-btn:active { transform: scale(.92); filter: brightness(1.15); }
.touch-btn.nitro { right: 20px; background: radial-gradient(circle at 50% 35%, #ffcf33, #ff8c42); }
.touch-btn.dash { right: 116px; background: radial-gradient(circle at 50% 35%, #8ad0ff, #4f9fe0); }

/* Overlay */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 18% 18%, rgba(0,192,220,.18), transparent 34%), radial-gradient(circle at 84% 78%, rgba(135,72,220,.16), transparent 36%), linear-gradient(145deg, rgba(0,32,54,.76), rgba(0,6,18,.94)); backdrop-filter: blur(5px); z-index: 10; }
.panel { position: relative; background: linear-gradient(150deg, rgba(6,34,57,.94), rgba(2,14,29,.94)); border: 1px solid rgba(95,226,255,.28); border-radius: 26px; padding: 28px 36px;
  width: min(520px, 94vw); text-align: center; box-shadow: 0 28px 90px rgba(0,0,0,.62), 0 0 50px rgba(0,190,230,.08), inset 0 1px rgba(255,255,255,.06); animation: pop .35s ease; max-height: 94vh; overflow-y: auto; }
.panel::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(115deg, rgba(255,255,255,.06), transparent 28%); }
.panel.small { width: min(400px, 92vw); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
h1 { font-size: 38px; margin-bottom: 6px; letter-spacing: -1px; background: linear-gradient(90deg, #7ffff0, #25caff 52%, #ffe477); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 18px rgba(0,210,255,.2)); }
.brand-kicker { color: #7bc7dd; font-size: 9px; font-weight: 900; letter-spacing: 4px; margin-bottom: 7px; }
.brand-fish { color: #69f4da; }
.hero-copy { color: #b9d8e4; opacity: .82; letter-spacing: .2px; }
h2 { font-size: 26px; margin-bottom: 14px; }
.subtitle { opacity: .75; margin-bottom: 20px; font-size: 13px; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .7; margin-bottom: 6px; }
#input-name, select { width: 100%; padding: 11px 15px; border-radius: 12px; border: 1px solid rgba(0,212,255,.35); background: rgba(255,255,255,.07); color: var(--text); font-size: 15px; outline: none; }
input[type=range] { width: 100%; }
.starters { display: flex; gap: 10px; }
.starter-card { flex: 1; background: rgba(255,255,255,.05); border: 2px solid rgba(0,212,255,.25); border-radius: 12px; padding: 8px 6px; cursor: pointer; color: var(--text); transition: transform .15s, background .2s, border-color .2s; text-align: center; }
.starter-card:hover { background: rgba(0,212,255,.12); transform: translateY(-3px); }
.starter-card.active { border-color: var(--accent2); background: rgba(255,207,51,.12); }
.starter-card canvas { display: block; margin: 0 auto; }
.st-name { font-size: 13px; font-weight: 800; margin-top: 2px; }
.st-desc { font-size: 10px; opacity: .7; line-height: 1.3; }

.difficulty { display: flex; gap: 10px; }
.diff-btn { flex: 1; padding: 11px 0; border-radius: 12px; border: 1px solid rgba(0,212,255,.3); background: rgba(255,255,255,.05); color: var(--text); font-size: 15px; cursor: pointer; transition: all .18s; }
.diff-btn:hover { background: rgba(0,212,255,.15); }
.diff-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #012a4a; font-weight: 700; border-color: transparent; }
.primary-btn { width: 100%; padding: 14px 0; margin-top: 6px; border: none; border-radius: 14px; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #012a4a; font-size: 17px; font-weight: 800; letter-spacing: 1px; cursor: pointer; transition: transform .12s, box-shadow .2s; box-shadow: 0 8px 24px rgba(0,212,255,.35); }
.primary-btn:hover { transform: translateY(-2px); }
.primary-btn:active { transform: scale(.97); }
.ghost-btn { width: 100%; padding: 11px 0; margin-top: 9px; border: 1px solid rgba(255,255,255,.25); border-radius: 12px; background: transparent; color: var(--text); font-size: 14px; cursor: pointer; transition: background .18s; }
.ghost-btn:hover { background: rgba(255,255,255,.1); }

/* Evrim kartları */
.evo-cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.evo-card { flex: 1 1 130px; min-width: 130px; background: rgba(255,255,255,.05); border: 2px solid #444; border-radius: 16px; padding: 16px 12px; cursor: pointer; color: var(--text); transition: transform .15s, background .2s; text-align: center; }
.evo-card:hover { transform: translateY(-4px); background: rgba(255,255,255,.12); }
.evo-icon { font-size: 34px; margin-bottom: 6px; }
.evo-name { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.evo-desc { font-size: 12px; opacity: .8; line-height: 1.4; }

/* Skorlar */
.highscores { margin-top: 22px; text-align: left; }
.highscores h3 { font-size: 14px; margin-bottom: 10px; opacity: .85; display: flex; justify-content: space-between; align-items: center; }
.dna { font-size: 12px; opacity: .9; }
#highscore-list { list-style: none; counter-reset: hs; }
#highscore-list li { counter-increment: hs; display: flex; justify-content: space-between; padding: 6px 10px; border-radius: 8px; font-size: 14px; background: rgba(255,255,255,.04); margin-bottom: 4px; }
#highscore-list li::before { content: counter(hs) ". " attr(data-name); font-weight: 600; }
#highscore-list li.empty { justify-content: center; opacity: .5; }
#highscore-list li.empty::before { content: ""; }
.controls-hint { margin-top: 18px; font-size: 11px; opacity: .55; line-height: 1.7; }
.version { margin-top: 8px; font-size: 10px; opacity: .35; letter-spacing: 1px; }
.meta-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(119,213,240,.12); text-align: left; }
.meta-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.meta-title span { font-size: 10px; font-weight: 900; letter-spacing: 1.4px; color: #94d9ea; }
.meta-title small { font-size: 9px; opacity: .48; }
.meta-upgrades { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; }
.meta-card { position: relative; border: 1px solid rgba(99,211,240,.18); border-radius: 12px; padding: 9px 7px; color: var(--text); background: rgba(255,255,255,.035); cursor: pointer; text-align: center; transition: transform .15s, border-color .2s, background .2s; }
.meta-card:hover:not(:disabled) { transform: translateY(-2px); border-color: #62e9d0; background: rgba(77,233,211,.09); }
.meta-card:disabled { cursor: default; opacity: .56; }
.meta-icon { font-size: 18px; color: #74efd4; }
.meta-name { font-size: 10px; font-weight: 800; margin: 3px 0; }
.meta-level { font-size: 9px; color: #8eb7c4; }
.meta-cost { margin-top: 5px; font-size: 9px; font-weight: 800; color: #ffe36c; }
.result { margin-bottom: 16px; }
.result-row { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 15px; }
.result-row b { font-size: 17px; color: var(--accent2); }
.new-record { margin-top: 12px; font-size: 17px; color: var(--accent2); font-weight: 700; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

@media (max-width: 760px) {
  .gp-val { font-size: 15px; } .gp-biome { font-size: 10px; }
  .bars { width: min(200px, 46vw); }
  .flow-meter { width: min(200px, 46vw); }
  .bar { height: 11px; }
  .icon-btn { width: 36px; height: 36px; font-size: 15px; }
  .dg-track { height: 38vh; }
  .quest-card { top: 84px; font-size: 11px; max-width: 180px; }
  h1 { font-size: 27px; }
  .banner { font-size: 15px; padding: 9px 16px; }
}
@media (max-width: 430px) { .meta-upgrades { grid-template-columns: 1fr; } .meta-card { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; text-align: left; } }
@media (max-width: 760px) and (orientation: landscape) { .hud-center { max-width: 44vw; } }
