:root {
  --bg: #04060d;
  --panel: #0b1020;
  --cyan: #5de4ff;
  --pink: #ff5d8f;
  --yellow: #ffd23f;
  --text: #e8f1ff;
  --dim: #7f8fb0;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; touch-action: none; padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); }
#hud { flex: 0 0 auto; padding: 6px 10px 4px; background: linear-gradient(180deg, #0b1020, #04060d); border-bottom: 1px solid #16203a; }
.hud-row { display: flex; justify-content: space-between; align-items: flex-end; }
.hud-row.small { margin-top: 2px; }
.hud-box { display: flex; flex-direction: column; min-width: 90px; }
.hud-box.center { align-items: center; }
.hud-box.right { align-items: flex-end; }
.lbl { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.pct { font-size: 28px; font-weight: 800; color: var(--cyan); line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 0 0 12px rgba(93,228,255,0.6); }
.pct small { font-size: 14px; }
.pct.done { color: #9bff8a; text-shadow: 0 0 12px rgba(155,255,138,0.7); }
.lvl { font-size: 12px; letter-spacing: 1px; color: var(--yellow); }
.timer { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.timer.hurry { color: #ff5d5d; animation: blink 0.5s steps(2) infinite; }
.lives { font-size: 14px; color: var(--cyan); letter-spacing: 2px; }
.powers { display: flex; gap: 6px; margin-top: 4px; min-height: 16px; }
.power { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 10px; background: #16203a; color: #fff; letter-spacing: 1px; }
.power .bar { display: inline-block; width: 40px; height: 4px; background: #000; margin-left: 4px; vertical-align: middle; border-radius: 2px; overflow: hidden; }
.power .bar i { display: block; height: 100%; background: currentColor; }

#field { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; }
#game { display: block; background: #04060d; box-shadow: 0 0 0 1px #1c2a4a, 0 0 30px rgba(93,228,255,0.15); image-rendering: auto; }

#controls { flex: 0 0 auto; height: 112px; position: relative; display: flex; align-items: flex-start; justify-content: center; padding: 10px 12px 0; }
.hint { font-size: 12px; color: var(--dim); text-align: center; max-width: 340px; line-height: 1.35; }
.fire { position: absolute; right: 14px; bottom: 8px; width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--pink); background: radial-gradient(circle at 35% 35%, #ff9ab8, #c21f55); color: #fff; font-weight: 800; letter-spacing: 1px; font-size: 14px; box-shadow: 0 0 24px rgba(255,93,143,0.6); touch-action: none; }
.fire:active { transform: scale(0.94); }
.icon-btn { position: absolute; left: 16px; bottom: 10px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #2a3a60; background: #0b1020; color: var(--text); font-size: 16px; font-weight: 700; }
#btn-mute { left: 68px; }
#btn-mute.off { color: var(--dim); text-decoration: line-through; }

#stick { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; background: rgba(4,6,13,0.82); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); overflow-y: auto; touch-action: pan-y; }
.screen.hidden, .hidden { display: none !important; }
.logo { font-size: 64px; font-weight: 900; letter-spacing: 8px; background: linear-gradient(90deg, var(--cyan), #fff, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 0 18px rgba(93,228,255,0.5)); }
.tag { color: var(--dim); font-size: 13px; letter-spacing: 1px; margin-top: -4px; }
.hi { margin: 14px 0 4px; font-size: 14px; color: var(--yellow); letter-spacing: 2px; }
.big-btn { margin-top: 14px; padding: 16px 32px; font-size: 18px; font-weight: 800; letter-spacing: 2px; border: 0; border-radius: 14px; background: linear-gradient(90deg, var(--cyan), #3aa8ff); color: #04060d; box-shadow: 0 0 24px rgba(93,228,255,0.5); animation: pulse 1.6s ease-in-out infinite; }
.big-btn.ghost { background: transparent; color: var(--text); border: 1px solid #2a3a60; box-shadow: none; animation: none; }
.howto { margin-top: 18px; max-width: 360px; text-align: left; background: rgba(11,16,32,0.8); border: 1px solid #16203a; border-radius: 12px; padding: 10px 16px; }
.howto h3 { margin: 4px 0 8px; font-size: 12px; letter-spacing: 3px; color: var(--cyan); }
.howto ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.45; color: #c9d6f2; }
.howto .kbd { font-size: 11px; color: var(--dim); margin: 8px 0 2px; }
.lvl-no { font-size: 14px; letter-spacing: 6px; color: var(--yellow); }
.lvl-name { font-size: 30px; font-weight: 900; letter-spacing: 3px; margin: 8px 0; color: var(--text); text-shadow: 0 0 20px rgba(93,228,255,0.6); }
.lvl-sub { font-size: 13px; letter-spacing: 4px; color: var(--cyan); animation: blink 0.8s steps(2) infinite; }
.bonus { margin-top: 16px; border-collapse: collapse; font-size: 16px; }
.bonus td { padding: 6px 14px; }
.bonus td:last-child { text-align: right; font-weight: 800; color: var(--yellow); font-variant-numeric: tabular-nums; }
.final { font-size: 26px; font-weight: 800; margin: 10px 0; }
.newhi { color: var(--yellow); font-weight: 900; letter-spacing: 3px; animation: blink 0.6s steps(2) infinite; }

@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes blink { 50% { opacity: 0.35; } }

@media (min-width: 700px) {
  #controls { height: 80px; }
  .hint { font-size: 13px; }
}

/* ===== Kampanya arayüzü ===== */
.val.coin, .coin { color: #ffcc33; }
.user-chip { margin-top: 6px; font-size: 12px; color: var(--dim); background: #0b1020; border: 1px solid #16203a; border-radius: 20px; padding: 4px 12px; }
.row-btns { display: flex; gap: 10px; }
.row-btns .big-btn { margin-top: 10px; padding: 12px 20px; font-size: 14px; }
details.howto summary { cursor: pointer; font-size: 12px; letter-spacing: 3px; color: var(--cyan); list-style: none; text-align: center; padding: 4px; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto { max-width: 360px; width: 100%; }

.screen.panel { justify-content: flex-start; padding: calc(var(--safe-top) + 10px) 0 calc(var(--safe-bottom) + 16px); background: radial-gradient(1200px 600px at 50% -10%, #122048 0%, #04060d 60%); }
.panel-head { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; padding: 0 14px; margin-bottom: 8px; }
.panel-title { text-align: center; font-size: 15px; letter-spacing: 5px; color: var(--text); font-weight: 700; }
.back { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #2a3a60; background: #0b1020; color: var(--text); font-size: 24px; line-height: 1; }
.honor-chip, .coin-chip { font-size: 13px; font-weight: 800; padding: 6px 12px; border-radius: 20px; background: #0b1020; border: 1px solid #2a3a60; }
.honor-chip { color: var(--yellow); }
.coin-chip { color: #ffcc33; }
.coin-chip::before { content: 'H'; display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0, #ffcc33 60%, #b8860b); color: #5a3f00; font-size: 10px; line-height: 16px; text-align: center; margin-right: 6px; }
.progress-line { width: calc(100% - 28px); height: 4px; background: #0b1020; border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.progress-line div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--yellow)); transition: width .4s; }

/* bölüm kartları: yatay kaydırmalı, snap */
.carousel { width: 100%; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 18vw 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; }
.carousel::-webkit-scrollbar { display: none; }
.level-card { flex: 0 0 64vw; max-width: 300px; aspect-ratio: 4 / 5; scroll-snap-align: center; position: relative; border-radius: 20px; overflow: hidden; border: 1px solid #22305a; background: #0b1020; box-shadow: 0 10px 40px rgba(0,0,0,0.5); transition: transform .25s, box-shadow .25s; transform: scale(0.92); }
.level-card.active { transform: scale(1); box-shadow: 0 0 0 2px var(--cyan), 0 14px 50px rgba(93,228,255,0.25); }
.level-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.level-card .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4,6,13,0.1) 30%, rgba(4,6,13,0.92) 100%); }
.level-card .no { position: absolute; top: 12px; left: 14px; font-size: 13px; letter-spacing: 3px; color: var(--yellow); font-weight: 800; text-shadow: 0 1px 6px #000; }
.level-card .nm { position: absolute; left: 14px; right: 14px; bottom: 54px; font-size: 20px; font-weight: 900; letter-spacing: 1px; text-shadow: 0 2px 10px #000; }
.level-card .meta { position: absolute; left: 14px; right: 14px; bottom: 14px; display: flex; justify-content: space-between; font-size: 12px; color: #c9d6f2; }
.level-card .bar { position: absolute; left: 14px; right: 14px; bottom: 40px; height: 4px; background: rgba(255,255,255,0.15); border-radius: 2px; }
.level-card .bar i { display: block; height: 100%; background: var(--yellow); border-radius: 2px; }
.level-card.locked { filter: saturate(0.2) brightness(0.6); }
.level-card.locked::after { content: '🔒'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -60%); font-size: 44px; filter: none; }
.level-card.done .no::after { content: ' ✓'; color: #9bff8a; }
.dots { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; max-width: 320px; margin: 2px 0 10px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #22305a; }
.dots i.on { background: var(--cyan); }
.dots i.done { background: var(--yellow); }

.parkur-panel { width: calc(100% - 28px); max-width: 380px; background: rgba(11,16,32,0.85); border: 1px solid #22305a; border-radius: 16px; padding: 12px 14px 14px; }
.parkur-head { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: 2px; color: var(--dim); margin-bottom: 10px; }
.parkur-head span:last-child { color: var(--yellow); }
.parkur-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.pk { aspect-ratio: 1; border-radius: 12px; border: 1px solid #2a3a60; background: #0b1020; color: var(--text); font-weight: 800; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; }
.pk small { font-size: 10px; color: var(--yellow); font-weight: 700; }
.pk.done { border-color: var(--yellow); background: linear-gradient(180deg, #1a2440, #0b1020); }
.pk.sel { outline: 2px solid var(--cyan); box-shadow: 0 0 16px rgba(93,228,255,0.4); }
.pk.locked { opacity: 0.35; }
.pk.boss::after { content: 'BOSS'; position: absolute; top: -7px; right: -4px; font-size: 8px; background: var(--pink); color: #fff; padding: 1px 5px; border-radius: 6px; letter-spacing: 1px; }
.parkur-panel .big-btn { width: 100%; margin-top: 4px; padding: 14px; font-size: 16px; }
.big-btn:disabled { opacity: 0.4; animation: none; }

.ship-preview { width: calc(100% - 28px); max-width: 380px; background: radial-gradient(circle at 50% 40%, #16234a, #0b1020 70%); border: 1px solid #22305a; border-radius: 16px; display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; margin-bottom: 10px; }
.ship-preview canvas { width: 150px; height: 90px; }
.ship-stats { font-size: 11px; color: #c9d6f2; line-height: 1.6; text-align: right; }
.upgrade-list { width: calc(100% - 28px); max-width: 380px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.upg { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; background: rgba(11,16,32,0.85); border: 1px solid #22305a; border-radius: 14px; padding: 10px 12px; text-align: left; }
.upg .ic { font-size: 22px; text-align: center; }
.upg .nm { font-size: 13px; font-weight: 800; letter-spacing: 1px; }
.upg .ds { font-size: 11px; color: var(--dim); }
.upg .pips { display: flex; gap: 3px; margin-top: 4px; }
.upg .pips i { width: 18px; height: 5px; border-radius: 3px; background: #22305a; }
.upg .pips i.on { background: var(--cyan); }
.upg button { border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 800; font-size: 12px; background: #ffcc33; color: #3a2a00; white-space: nowrap; }
.upg button:disabled { background: #22305a; color: var(--dim); }
.upg button.max { background: transparent; color: #9bff8a; border: 1px solid #9bff8a; }

.card { width: calc(100% - 28px); max-width: 380px; background: rgba(11,16,32,0.85); border: 1px solid #22305a; border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; text-align: left; }
.card h3 { margin: 0 0 8px; font-size: 11px; letter-spacing: 3px; color: var(--cyan); }
.acct-info { font-size: 13px; color: #c9d6f2; margin-bottom: 8px; }
.login-form { display: flex; flex-direction: column; gap: 8px; }
.login-form input { background: #04060d; border: 1px solid #2a3a60; border-radius: 10px; padding: 11px 12px; color: var(--text); font-size: 14px; }
.big-btn.small { padding: 11px 18px; font-size: 14px; margin-top: 2px; animation: none; }
.big-btn.danger { border-color: #7a2a3a; color: #ff8aa0; }
.msg { font-size: 12px; min-height: 14px; color: #ff8aa0; }
.msg.ok { color: #9bff8a; }
.link { font-size: 12px; color: var(--cyan); text-decoration: none; }
.switch { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; border-bottom: 1px solid #16203a; }
.switch:last-child { border-bottom: 0; }
.switch input { width: 22px; height: 22px; accent-color: var(--cyan); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; color: #c9d6f2; margin-bottom: 10px; }
.stats b { color: var(--text); }
.honor-big { font-size: 34px; font-weight: 900; color: var(--yellow); margin: 8px 0 0; text-shadow: 0 0 20px rgba(255,210,63,0.5); }
.note { font-size: 12px; color: var(--dim); margin: 2px 0 4px; }
.unlock { margin-top: 10px; color: #9bff8a; font-weight: 900; letter-spacing: 3px; animation: blink 0.6s steps(2) infinite; }

/* ===== v0.3: zamanlayıcı uyarısı, gemiler, kaydırma okları ===== */
.timer.warn { color: #ffd23f; font-size: 20px; animation: blink 0.5s steps(2) infinite; }
.timer.warn.last { color: #ff4d4d; font-size: 22px; }
.armor-pips, .defl-pips { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.armor-pips i { width: 9px; height: 9px; background: #ffa94d; border-radius: 2px; }
.armor-pips i.off, .defl-pips i.off { opacity: 0.2; }
.defl-pips i { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #b48cff; }
.carousel-wrap { position: relative; width: 100%; }
.car-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #2a3a60; background: rgba(11,16,32,0.85); color: var(--text); font-size: 22px; line-height: 1; }
.car-arrow.left { left: 6px; } .car-arrow.right { right: 6px; }
.car-arrow:disabled { opacity: 0.25; }
.carousel { cursor: grab; }
.carousel.dragging { cursor: grabbing; scroll-snap-type: none; }
.dots i { cursor: pointer; }
.ship-list { width: calc(100% - 28px); max-width: 380px; display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; margin-bottom: 8px; touch-action: pan-x; }
.ship-list::-webkit-scrollbar { display: none; }
.ship { flex: 0 0 150px; background: rgba(11,16,32,0.85); border: 1px solid #22305a; border-radius: 14px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.ship.sel { border-color: var(--cyan); box-shadow: 0 0 16px rgba(93,228,255,0.3); }
.ship canvas { width: 100%; height: 70px; }
.ship .nm { font-size: 12px; font-weight: 800; letter-spacing: 1px; }
.ship .st { font-size: 10px; color: var(--dim); line-height: 1.5; }
.ship .st b { color: var(--text); }
.ship button { border: 0; border-radius: 9px; padding: 7px; font-weight: 800; font-size: 11px; background: #ffcc33; color: #3a2a00; }
.ship button.use { background: #16203a; color: var(--cyan); border: 1px solid var(--cyan); }
.ship button.cur { background: transparent; color: #9bff8a; border: 1px solid #9bff8a; }
.ship button:disabled { background: #22305a; color: var(--dim); border: 0; }
.hangar-sub { width: calc(100% - 28px); max-width: 380px; font-size: 11px; letter-spacing: 3px; color: var(--cyan); margin: 4px 0 6px; text-align: left; }
.screen.panel .upgrade-list { overflow: visible; }
.screen.panel > * { flex-shrink: 0; }
.ship-list { min-height: 190px; }
.creature-line { font-size: 12px; letter-spacing: 3px; color: var(--pink); margin-bottom: 10px; }
.creature-line span { color: var(--text); font-weight: 800; }

.opt-label { font-size: 13px; margin: 6px 0 6px; }
.opt-label small { color: var(--dim); font-size: 11px; }
.opt-note { font-size: 11px; color: var(--dim); margin-top: 8px; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 10px; border: 1px solid #2a3a60; background: #04060d; color: var(--text); font-size: 12px; font-weight: 700; }
.seg button.on { background: linear-gradient(90deg, var(--cyan), #3aa8ff); color: #04060d; border-color: transparent; }
.seg button small { display: block; font-size: 9px; font-weight: 400; opacity: 0.8; }
