/* ==========================================================================
   Sky Rescue Command - style.css
   Palette: deep navy #0b1d33, rescue orange #ff7a1a, signal gold #ffcc33,
   sea cyan #3fb6ff. One font (Inter), one icon set (svg sprite).
   ========================================================================== */
@font-face { font-family: Inter; font-weight: 400; src: url("../assets/fonts/Inter-Regular.otf") format("opentype"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 700; src: url("../assets/fonts/Inter-Bold.otf") format("opentype"); font-display: swap; }
@font-face { font-family: Inter; font-weight: 900; src: url("../assets/fonts/Inter-Black.otf") format("opentype"); font-display: swap; }

:root {
    --navy: #0b1d33; --navy2: #14304f; --navy3: #1d4268; --orange: #ff7a1a; --orange2: #ff9a45; --gold: #ffcc33; --cyan: #3fb6ff; --green: #46d98c; --red: #ff4d4d;
    --text: #f4f8ff; --muted: #9fb6d1; --u: min(1vw, 1.8vh);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--navy); color: var(--text); font-family: Inter, system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ic { width: 1.3em; height: 1.3em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.gold { color: var(--gold); } .ic.on { color: var(--gold); } .ic.off { color: rgba(255, 255, 255, .22); } .ic.life { color: var(--red); width: 1em; height: 1em; stroke: none; }

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: var(--navy); }
.screen { position: fixed; inset: 0; display: none; }
.screen.show { display: block; }

/* ---------- Loader ---------- */
#loader { background: radial-gradient(circle at 50% 40%, var(--navy3), var(--navy) 70%); display: none; place-items: center; z-index: 30; }
#loader.show { display: grid; }
.loader-box { text-align: center; width: min(86vw, 340px); }
.loader-logo { width: clamp(64px, 18vh, 110px); height: auto; border-radius: 22%; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.loader-box .bar { margin: 14px 0 8px; }
#loadText { margin: 0; color: var(--muted); font-size: 14px; }

.logo { margin: 0; font-weight: 900; line-height: .95; letter-spacing: -.02em; font-size: clamp(26px, 5.4vh, 44px); text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.logo span { display: block; color: var(--orange); font-size: 1.28em; }

/* ---------- Bars ---------- */
.bar { flex: 1; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, .45); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--orange), var(--gold)); transition: width .15s linear; }

/* ---------- Buttons ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 46px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 16px; background: linear-gradient(#27527d, #1b3d62); box-shadow: 0 3px 0 #0a1a2d, inset 0 1px 0 rgba(255, 255, 255, .18); transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.12); } .btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a1a2d; }
.btn.primary { background: linear-gradient(var(--orange2), var(--orange)); box-shadow: 0 3px 0 #b34a00, inset 0 1px 0 rgba(255, 255, 255, .35); color: #2a1200; }
.btn.big { min-height: 58px; font-size: 19px; font-weight: 900; }
.btn.wide { width: 100%; } .btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn.danger { background: linear-gradient(#c53b3b, #9e2626); box-shadow: 0 3px 0 #5e1010; }
.btn.locked { filter: grayscale(.7) brightness(.8); }
.btn.off { filter: grayscale(.8) brightness(.7); }
.btn.buy { min-height: 40px; padding: 0 14px; background: linear-gradient(#e0b22a, #c8921a); box-shadow: 0 3px 0 #7a5208; color: #2a1c00; }
.btn.buy .ic { color: #2a1c00; }
.icon-btn { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: rgba(11, 29, 51, .78); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .22), 0 3px 10px rgba(0, 0, 0, .4); }
.icon-btn .ic { width: 24px; height: 24px; } .icon-btn.sm { width: 38px; height: 38px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: rgba(11, 29, 51, .78); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .2); font-size: 15px; }
.chip b { font-weight: 900; }

/* ---------- Home: the artwork is shown unchanged, the card sits on top ---------- */
#home { background: #0b1d33 url("../assets/images/ui/menu.jpg") 28% center / cover no-repeat; z-index: 10; }
.home-card { position: absolute; right: max(3vw, env(safe-area-inset-right)); top: 50%; transform: translateY(-50%); width: min(370px, 40vw); max-height: 96dvh; padding: clamp(12px, 2.4vh, 22px); border-radius: 24px; background: rgba(9, 22, 40, .86); box-shadow: 0 14px 50px rgba(0, 0, 0, .55), inset 0 0 0 1.5px rgba(255, 255, 255, .16); display: flex; flex-direction: column; gap: clamp(7px, 1.4vh, 12px); }
.home-card .tag { margin: 0; color: var(--muted); font-size: clamp(12px, 1.8vh, 14px); }
.home-card .chips { display: flex; gap: 8px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-icons { display: flex; gap: 10px; justify-content: flex-end; }
.row-icons .icon-btn { background: rgba(255, 255, 255, .08); }

/* ---------- HUD ---------- */
#hud { z-index: 5; touch-action: none; }
.hud-top { position: absolute; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); display: flex; gap: 10px; align-items: flex-start; }
.gauges { flex: 1; max-width: 340px; display: grid; gap: 6px; padding: 9px 12px; border-radius: 16px; background: rgba(11, 29, 51, .8); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18); }
.gauge { display: flex; align-items: center; gap: 8px; } .gauge .ic { width: 18px; height: 18px; }
.gauge.fuel .bar i { background: linear-gradient(90deg, #2b8fe0, var(--cyan)); } .gauge.hull .bar i { background: linear-gradient(90deg, #2fb36c, var(--green)); }
.gauge.time .bar i { background: linear-gradient(90deg, var(--orange), var(--gold)); }
.gauge.low .bar i { background: var(--red); animation: blink .5s steps(2) infinite; } .gauge.low .ic { color: var(--red); }
.gauge b { font-size: 13px; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
@keyframes blink { 50% { opacity: .45; } }
.goal { margin-left: auto; } .goal span { display: inline-flex; gap: 2px; }
#mini { position: absolute; right: max(10px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 56px); width: clamp(120px, 22vw, 210px); aspect-ratio: 1376 / 768; border-radius: 12px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .45), 0 6px 18px rgba(0, 0, 0, .5); }
.cabin { position: absolute; left: max(10px, env(safe-area-inset-left)); top: calc(max(10px, env(safe-area-inset-top)) + 84px); display: flex; gap: 6px; }
.cabin i { width: 26px; height: 26px; border-radius: 8px; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); }
.cabin i.full { background: var(--gold); box-shadow: inset 0 0 0 2px #fff; }
.status { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 8px 16px; border-radius: 99px; background: rgba(11, 29, 51, .82); font-weight: 700; font-size: clamp(12px, 1.9vh, 15px); white-space: nowrap; max-width: 62vw; overflow: hidden; text-overflow: ellipsis; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .18); }
.act { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: clamp(86px, 16vh, 124px); height: clamp(86px, 16vh, 124px); border-radius: 50%; font-weight: 900; font-size: clamp(13px, 2.3vh, 17px); letter-spacing: .02em; background: radial-gradient(circle at 35% 30%, #5b7a99, #2a4560); box-shadow: 0 6px 0 #0a1a2d, 0 10px 24px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .25); color: #cfe0f2; }
.act:active { transform: translateY(3px); }
.act.pickup, .act.drop, .act.fuel, .act.winch { color: #2a1200; background: radial-gradient(circle at 35% 30%, var(--gold), var(--orange)); box-shadow: 0 6px 0 #b34a00, 0 0 28px rgba(255, 170, 40, .65), inset 0 2px 0 rgba(255, 255, 255, .4); animation: pulse 1s ease-in-out infinite; }
.act.fuel { background: radial-gradient(circle at 35% 30%, #8fd8ff, var(--cyan)); box-shadow: 0 6px 0 #1a6aa6, 0 0 28px rgba(63, 182, 255, .7); }
@keyframes pulse { 50% { transform: scale(1.06); } }
.joy { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .1); display: none; pointer-events: none; z-index: 6; }
.joy.on { display: block; } .joy i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .7); transform: translate(-50%, -50%); }

/* ---------- Dialogs ---------- */
.dlg { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(4, 10, 24, .4); padding: 10px; }
.dlg.show { display: grid; }
.panel { width: min(520px, 96vw); max-height: 96dvh; overflow: auto; padding: 16px; border-radius: 24px; background: linear-gradient(#17395c, #0e2744); box-shadow: 0 18px 60px rgba(0, 0, 0, .6), inset 0 0 0 1.5px rgba(255, 255, 255, .18); display: flex; flex-direction: column; gap: 10px; }
.dlg.small .panel { width: min(400px, 94vw); } .dlg.wide .panel { width: min(600px, 96vw); }
.panel header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel h2 { margin: 0; font-size: clamp(18px, 3.4vh, 24px); font-weight: 900; } .panel h3 { margin: 0; }
.note { margin: 0; color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .note b { color: var(--text); }
.stack { display: grid; gap: 9px; }
.tabs { display: flex; gap: 8px; } .tab { flex: 1; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-weight: 900; display: grid; place-items: center; }
.tab.on { background: var(--orange); color: #2a1200; } .tab.locked { opacity: .6; } .tab .ic { width: 18px; height: 18px; }
.region { font-size: 17px; font-weight: 900; color: var(--gold); }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tile { position: relative; aspect-ratio: 1; min-height: 52px; border-radius: 14px; background: linear-gradient(#27527d, #1b3d62); box-shadow: 0 3px 0 #0a1a2d, inset 0 1px 0 rgba(255, 255, 255, .15); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tile b { font-size: clamp(16px, 3.4vh, 22px); font-weight: 900; } .tile .stars .ic { width: 12px; height: 12px; }
.tile.done { background: linear-gradient(#2f6a62, #1e4d4a); } .tile.locked { opacity: .5; background: #1a2f48; }
.tile.boss { background: linear-gradient(#a8460e, #7a2f08); } .tile.boss em { position: absolute; top: 3px; right: 4px; color: var(--gold); font-style: normal; } .tile.boss em .ic { width: 13px; height: 13px; stroke: none; }
.stars { display: inline-flex; }
.panel footer { display: flex; justify-content: flex-end; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); }
.rowinfo { display: grid; gap: 2px; } .rowinfo small { color: var(--muted); font-size: 12px; }
.pips { display: flex; gap: 4px; margin-top: 3px; } .pips i { width: 22px; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .2); } .pips i.on { background: var(--gold); }
.maxed { font-weight: 900; color: var(--green); font-size: 13px; }
.skins { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.skin { display: grid; justify-items: center; gap: 6px; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .07); } .skin.on { box-shadow: inset 0 0 0 2px var(--gold); }
.skin img { height: clamp(70px, 15vh, 120px); width: auto; transform: rotate(0deg); }
.toggle { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); font-weight: 700; font-size: 16px; text-align: left; }
.toggle span { flex: 1; } .toggle i { width: 46px; height: 26px; border-radius: 99px; background: rgba(255, 255, 255, .22); position: relative; transition: background .15s; }
.toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on i { background: var(--green); } .toggle.on i::after { transform: translateX(20px); }
.help { display: grid; gap: 8px; font-size: 14.5px; line-height: 1.4; } .help p { margin: 0; } .help .tip { color: var(--muted); }
kbd { background: rgba(255, 255, 255, .15); border-radius: 6px; padding: 1px 6px; font: inherit; font-weight: 900; }
.newnote { text-align: center; display: grid; gap: 10px; justify-items: center; } .newnote p { margin: 0; color: var(--muted); line-height: 1.45; }
.badge { padding: 3px 12px; border-radius: 99px; background: var(--orange); color: #2a1200; font-weight: 900; font-size: 13px; }
header.res { justify-content: center; text-align: center; } header.res.win h2 { color: var(--gold); } header.res.lose h2 { color: var(--red); }
.bigstars { text-align: center; } .bigstars .ic { width: clamp(40px, 9vh, 64px); height: clamp(40px, 9vh, 64px); } .bigstars .ic.on { animation: pop .5s both; } .bigstars .ic.on:nth-child(2) { animation-delay: .2s; } .bigstars .ic.on:nth-child(3) { animation-delay: .4s; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.goals { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; } .goals li { display: flex; gap: 8px; align-items: center; font-size: 14px; } .goals .ok { color: var(--green); } .goals .no { color: var(--muted); }
.earn { margin: 0; text-align: center; font-weight: 900; font-size: 18px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.big { margin: 0; text-align: center; font-size: 34px; font-weight: 900; color: var(--gold); }

/* ---------- Phones in landscape and small screens ---------- */
@media (max-height: 600px) { .row { padding: 7px 10px; } .rowinfo small { font-size: 11px; } .panel { gap: 8px; } }
@media (max-height: 520px) {
    .tab { height: 34px; } .panel .note { font-size: 13px; } .list { grid-template-columns: 1fr 1fr; } .row { padding: 6px 8px; } .rowinfo small { display: none; } .pips i { height: 6px; width: 18px; }
    .skins { grid-template-columns: repeat(4, 1fr); gap: 8px; } .skin { padding: 6px; } .skin img { height: 56px; } .skin b { font-size: 12px; }
    .help { grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 12px; line-height: 1.3; } .help .tip { grid-column: 1 / -1; }
    .home-card .tag { display: none; } .home-card .btn { min-height: 36px; font-size: 14px; } .home-card .btn.big { min-height: 42px; } .home-card .icon-btn { width: 36px; height: 36px; }
    .home-card { width: min(330px, 46vw); } .panel h2 { font-size: 18px; } .dlg.wide .panel, .dlg .panel { width: min(640px, 96vw); } .dlg.small .panel { width: min(560px, 96vw); }
    .panel { padding: 12px; gap: 7px; } .btn { min-height: 40px; } .btn.big { min-height: 48px; }
    .tile { min-height: 40px; aspect-ratio: auto; height: 46px; flex-direction: row; gap: 6px; } .tile .stars { display: none; }
    .home-card { gap: 6px; padding: 12px; } .gauges { padding: 6px 10px; gap: 4px; }
}
@media (max-width: 760px) and (orientation: portrait), (max-width: 560px) {
    #home { background-position: 22% top; background-size: auto 56%; background-color: #0a1a2d; }
    .home-card { right: 50%; top: auto; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(50%); width: min(94vw, 420px); }
    .gauges { max-width: none; }
    .hud-top { flex-wrap: wrap; } #mini { top: calc(max(10px, env(safe-area-inset-top)) + 104px); }
    .cabin { top: calc(max(10px, env(safe-area-inset-top)) + 104px); }
    .status { max-width: 54vw; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
