/* ==========================================================================
   Coral Orb Quest - style.css
   Palette: deep sea #072a3a, aqua #3fd9d0, pearl gold #ffd267, coral #fb7185.
   One font (Fredoka), one icon set (svg sprite).
   ========================================================================== */
@font-face { font-family: Fredoka; font-weight: 300 700; src: url("../assets/fonts/fredoka.ttf") format("truetype"); font-display: swap; }

:root {
    --navy: #072a3a; --navy2: #0d4257; --navy3: #17627a; --orange: #fb7185; --orange2: #ff98a8; --gold: #ffd267; --cyan: #3fd9d0; --green: #84dc8e; --red: #ff5a6e;
    --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: Fredoka, 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); touch-action: none; }
.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: 700; 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: 700; }
.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: 700; }

/* ---------- Home: the artwork is shown unchanged, the card sits on top ---------- */
#home { background: #072a3a 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 ---------- */
#view.behind { display: none; }
#hud { z-index: 5; touch-action: none; pointer-events: none; }
#hud button, #hud .chip { pointer-events: auto; }
.hud-top { position: absolute; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; height: 46px; }
.title { display: flex; flex-direction: column; line-height: 1.05; margin-right: auto; text-shadow: 0 2px 0 rgba(0,0,0,.4); } .title small { font-size: 12px; color: var(--cyan); font-weight: 500; } .title b { font-size: 18px; font-weight: 600; }
.stats { display: flex; gap: 8px; }
.meter { position: absolute; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); top: calc(max(8px, env(safe-area-inset-top)) + 52px); height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--gold) 70%, var(--red)); border-radius: 99px; }
.meter.hot { animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .5; } }
.controls { position: absolute; left: 0; right: 0; bottom: max(10px, env(safe-area-inset-bottom)); display: flex; justify-content: center; align-items: center; gap: 10px; }
.tool { position: relative; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px; border-radius: 16px; font-weight: 600; font-size: 16px; background: linear-gradient(#1f6f86, #14506a); box-shadow: 0 4px 0 #082838, inset 0 1px 0 rgba(255, 255, 255, .22); }
.tool:active { transform: translateY(2px); box-shadow: 0 2px 0 #082838; } .tool:disabled { filter: grayscale(.8) brightness(.65); } .tool.active { background: linear-gradient(#ffb36b, #ff8a3d); color: #3a1800; box-shadow: 0 4px 0 #a64f0a, 0 0 18px rgba(255, 160, 70, .6); }
.tool em { font-style: normal; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 99px; background: var(--gold); color: #2a1c00; font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.shield { display: inline-flex; }
/* ---------- 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: 700; } .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: 700; display: grid; place-items: center; }
.tabs.three .tab { font-size: 15px; }
.tab.on { background: var(--orange); color: #2a1200; } .tab.locked { opacity: .6; } .tab .ic { width: 18px; height: 18px; }
.region { font-size: 17px; font-weight: 700; 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: 700; } .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: 700; 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: 700; }
.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: 700; 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: 700; font-size: 18px; display: flex; justify-content: center; align-items: center; gap: 6px; }
.big { margin: 0; text-align: center; font-size: 34px; font-weight: 700; 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) {
    .tiles { grid-template-columns: repeat(10, 1fr); gap: 5px; } .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; }
}
@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); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

@media (max-height: 520px) { .tool { min-height: 42px; padding: 0 12px; font-size: 14px; } .title b { font-size: 15px; } }
@media (max-width: 460px) { .tool { padding: 0 12px; gap: 5px; } .tool span { display: none; } .tool .ic { width: 24px; height: 24px; } .controls { gap: 8px; } }
@media (max-height: 520px) { .panel > .note:last-child { display: none; } .toggle { padding: 8px 10px; font-size: 14px; } }
@media (max-width: 460px) { .title small { display: none; } .title b { font-size: 15px; } .hud-top { gap: 6px; } }
