/* Orbit Defender. The space view fills the whole stage; the score bar, the nova button and every menu
   sit on top of it. Logical properties, so RTL and LTR share one file. game.js sets the layout classes
   on #game: tall, wide, short, narrow, roomy, plus data-screen and data-world. */
:root {
    --bg: #05061a; --text: #eef1ff; --muted: #a9b0e0; --line: rgba(140, 158, 255, .24);
    --accent: #38e1ff; --accent2: #ff4fd8; --gold: #ffc847; --ink: #04121a; --ok: #4ade80; --bad: #ff6b6b;
    --panel: rgba(12, 15, 46, .93); --panel2: rgba(26, 32, 84, .95);
    --wc: #38e1ff; --wc2: #3b82ff;
    --font: system-ui, "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
svg { display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
#game:focus { outline: none; }

.game { inline-size: 100%; margin-inline: auto; }
.game[data-world="dune"] { --wc: #ffb648; --wc2: #ff7a3c; }
.game[data-world="frost"] { --wc: #a8ecff; --wc2: #7f8cff; }
.game[data-world="ember"] { --wc: #ff9a5c; --wc2: #ff3d6e; }

.stage { position: relative; inline-size: 100%; block-size: 600px; overflow: hidden; background: #05061a; }
.stage canvas { position: absolute; inset: 0; display: block; inline-size: 100%; block-size: 100%; touch-action: none; cursor: crosshair; }

/* ---------- the bar on top of the view ---------- */
.hud {
    position: absolute; inset-block-start: 0; inset-inline: 0; z-index: 2; display: flex; align-items: stretch; gap: 6px;
    padding: 8px; pointer-events: none;
}
.hud > * { pointer-events: auto; }
.icon {
    flex: none; inline-size: 42px; block-size: 42px; border-radius: 14px; padding: 0; display: grid; place-items: center;
    background: rgba(8, 10, 34, .74); border: 1px solid var(--line); color: var(--text);
}
.icon svg { inline-size: 21px; block-size: 21px; }
.icon:active { transform: scale(.94); }
.icon[aria-pressed="false"] { color: var(--muted); }
.stat {
    position: relative; display: flex; flex-direction: column; justify-content: center; min-inline-size: 0; overflow: hidden;
    padding: 3px 12px 5px; border-radius: 14px; background: rgba(8, 10, 34, .74); border: 1px solid var(--line);
}
.stat .k { font-size: .66rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; line-height: 1.2; }
:lang(ar) .stat .k { letter-spacing: 0; font-size: .7rem; }
.stat b { font-size: 1.12rem; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }
.stat.score { flex: 0 1 auto; min-inline-size: 104px; margin-inline-end: auto; align-items: flex-start; }
.stat.score b { font-size: 1.3rem; }
.stat.wave { align-items: center; min-inline-size: 70px; }
.stat.shield { align-items: center; }
.stat b.bump { animation: od-bump .25s ease-out; }
@keyframes od-bump { 40% { transform: scale(1.14); color: var(--gold); } }
.stat .bar { position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 3px; background: rgba(255, 255, 255, .1); }
.stat .bar i { display: block; block-size: 100%; inline-size: 0; background: var(--wc); transition: inline-size .3s; }
.pips { display: flex; gap: 3px; align-items: center; block-size: 1.3em; }
.pips i { inline-size: 9px; block-size: 14px; border-radius: 3px; background: #2b3170; transition: background-color .2s; }
.pips.many i { inline-size: 7px; }
.pips i.on { background: var(--accent); box-shadow: 0 0 6px rgba(56, 225, 255, .7); }
.pips.low i.on { background: var(--bad); box-shadow: 0 0 6px rgba(255, 107, 107, .8); animation: od-low .7s ease-in-out infinite; }
@keyframes od-low { 50% { opacity: .45; } }
.stat.hurt { animation: od-hurt .4s; }
@keyframes od-hurt { 20% { transform: translateX(-4px); border-color: var(--bad); } 50% { transform: translateX(4px); } 80% { transform: translateX(-2px); border-color: var(--bad); } }

.bossbar {
    position: absolute; z-index: 2; inset-block-start: 62px; inset-inline: 0; margin-inline: auto; inline-size: min(74%, 420px);
    display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; animation: od-drop .4s ease-out;
}
.bossbar b { font-size: .8rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #ffd6d6; text-shadow: 0 1px 6px #000, 0 0 12px rgba(255, 70, 70, .6); }
:lang(ar) .bossbar b { letter-spacing: 0; font-size: .9rem; }
.bossbar .bar { inline-size: 100%; block-size: 10px; border-radius: 99px; background: rgba(8, 10, 34, .8); border: 1px solid rgba(255, 120, 120, .55); overflow: hidden; }
.bossbar .bar i { display: block; block-size: 100%; inline-size: 100%; border-radius: 99px; background: linear-gradient(90deg, #ff3d6e, #ff9a5c); transition: inline-size .18s; }
.bossbar.low .bar i { animation: od-low .5s ease-in-out infinite; }
@keyframes od-drop { from { opacity: 0; transform: translateY(-14px); } }

.banner {
    position: absolute; z-index: 3; inset-inline: 12px; inset-block-start: 21%; display: flex; justify-content: center;
    pointer-events: none; opacity: 0; transform: scale(.86); transition: opacity .25s, transform .25s cubic-bezier(.2, 1.4, .4, 1);
}
.banner.on { opacity: 1; transform: none; }
.banner span {
    background: rgba(8, 10, 34, .86); border: 1.5px solid var(--accent); border-radius: 999px; padding: 8px 20px; text-align: center;
    font-weight: 900; font-size: 1.08rem; letter-spacing: .02em; box-shadow: 0 0 24px rgba(56, 225, 255, .28);
}
.banner.boss span { border-color: var(--bad); color: #ffd6d6; box-shadow: 0 0 28px rgba(255, 80, 80, .5); font-size: 1.2rem; }
.banner.gold span { border-color: var(--gold); color: #fff1c9; box-shadow: 0 0 24px rgba(255, 200, 71, .4); }

/* the lesson's speech bubble */
.coach {
    position: absolute; z-index: 3; left: 12px; right: 12px; inset-block-end: 16px; margin-inline: auto; max-inline-size: 440px;
    display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 18px; pointer-events: none;
    background: rgba(10, 13, 44, .95); border: 1.5px solid var(--accent); box-shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 0 22px rgba(56, 225, 255, .2);
    font-weight: 700; font-size: 1rem; line-height: 1.4; opacity: 0; transform: translateY(12px);
}
.coach.in { opacity: 1; transform: none; transition: opacity .25s, transform .3s cubic-bezier(.2, 1.4, .4, 1); }
.coach .msg { flex: 1; display: flex; gap: 8px; align-items: center; }
.coach .msg svg { flex: none; inline-size: 22px; block-size: 22px; color: var(--ok); }
.coach.ok { border-color: var(--ok); box-shadow: 0 8px 28px rgba(0, 0, 0, .5), 0 0 22px rgba(74, 222, 128, .25); }
.coach .skip {
    flex: none; pointer-events: auto; padding: 7px 12px; border-radius: 10px; font-size: .8rem; font-weight: 700;
    background: transparent; border: 1px solid var(--line); color: var(--muted);
}
.tall .coach { inset-block-end: 108px; }
.game:not(.tall) .coach { right: 112px; }

/* the nova button: the ring fills with the charge */
.nova {
    position: absolute; z-index: 3; inset-block-end: 14px; right: 14px; inline-size: 80px; block-size: 80px; border-radius: 50%;
    border: 0; padding: 0; display: grid; place-content: center; text-align: center; color: var(--text); touch-action: none;
    background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(255, 255, 255, .16) 0);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .55);
}
.nova::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: radial-gradient(circle at 50% 30%, #2a327c, #0b0e30 72%); }
.nova b, .nova small { position: relative; display: block; line-height: 1.15; }
.nova b { font-size: .84rem; font-weight: 900; letter-spacing: .05em; }
:lang(ar) .nova b { letter-spacing: 0; font-size: .95rem; }
.nova small { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.nova small:empty { display: none; }
.nova.ready { background: var(--gold); animation: od-ready .9s ease-in-out infinite; }
.nova.ready::before { background: radial-gradient(circle at 50% 30%, #fff3c4, #ffb21e 72%); }
.nova.ready b { color: #3a2400; }
.nova.ready small { color: #6b4700; font-weight: 700; }
.nova:active { transform: scale(.94); }
@keyframes od-ready { 0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, .55), 0 0 0 0 rgba(255, 200, 71, .55); } 50% { box-shadow: 0 6px 18px rgba(0, 0, 0, .55), 0 0 0 12px rgba(255, 200, 71, 0); transform: scale(1.05); } }
.nova.hint::after { content: ""; position: absolute; inset: -12px; border-radius: 50%; border: 3px solid var(--gold); animation: od-hint 1s ease-out infinite; }
@keyframes od-hint { from { transform: scale(.8); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
.roomy .nova { inline-size: 92px; block-size: 92px; inset-block-end: 20px; right: 20px; }
.roomy .nova b { font-size: .95rem; }

/* paused: the sound buttons take the corner, so the bar steps aside */
.game[data-screen="paused"] .hud, .game[data-screen="paused"] .bossbar { visibility: hidden; }
.corner { position: absolute; z-index: 6; inset-block-start: 8px; inset-inline-end: 8px; display: flex; gap: 6px; }

/* ---------- menus ---------- */
.screen {
    position: absolute; inset: 0; z-index: 5; display: none; flex-direction: column; overflow: hidden auto;
    overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; scrollbar-color: #2b3170 transparent;
    background: rgba(5, 6, 26, .88);
}
.screen.on { display: flex; }
.screen.s-home { background: radial-gradient(ellipse 62% 48% at 50% 50%, rgba(5, 6, 26, 0) 0 40%, rgba(5, 6, 26, .5) 72%, rgba(5, 6, 26, .82) 100%); }
.screen.s-brief, .screen.s-paused, .screen.s-over, .screen.s-wait { padding: 12px; background: rgba(5, 6, 26, .72); }
.screen.s-over { background: radial-gradient(ellipse at 50% 40%, rgba(5, 6, 26, .5), rgba(5, 6, 26, .86)); }

.btn {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-block-size: 46px; padding: 10px 22px;
    border: 0; border-radius: 15px; font-weight: 900; font-size: 1.02rem; color: var(--ink); text-align: center;
    background: linear-gradient(180deg, var(--wc), var(--wc2)); box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 8px 22px rgba(0, 0, 0, .35);
    transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--text); font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:active { box-shadow: inset 0 0 0 1.5px var(--line); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-block-start: 14px; }
.actions .btn { flex: 1 1 auto; }
.actions .btn[data-primary] { flex: 1 1 100%; }
.actions.stack { flex-direction: column; }

.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 99px; font-size: .86rem; white-space: nowrap;
    background: rgba(8, 10, 34, .78); border: 1px solid var(--line); color: var(--muted);
}
.chip svg { inline-size: 16px; block-size: 16px; }
.chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chip i { font-style: normal; font-size: .78rem; }
.chip.gold svg, .chip.gold b { color: var(--gold); }
.chip.sm { padding: 3px 9px; font-size: .78rem; }
.chip.sm svg { inline-size: 13px; block-size: 13px; }

/* home: the title, the planet in the middle (the game plays itself there), then the buttons */
.home { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 58px 14px 14px; min-block-size: 100%; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.logo h1 {
    font-size: clamp(2rem, 10.5vw, 3.3rem); font-weight: 900; line-height: 1; letter-spacing: .04em; text-transform: uppercase;
    color: #fff; text-shadow: 0 2px 0 var(--wc2), 0 0 26px var(--wc), 0 6px 18px rgba(0, 0, 0, .7);
}
:lang(ar) .logo h1 { letter-spacing: 0; line-height: 1.25; }
.logo p { margin-block-start: 8px; color: #d5dbff; font-size: .98rem; font-weight: 600; text-shadow: 0 1px 8px #000; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.spacer { flex: 1; min-block-size: 96px; }
.menu { inline-size: min(100%, 430px); display: flex; flex-direction: column; gap: 9px; }
.btn.big { justify-content: flex-start; gap: 12px; min-block-size: 64px; padding: 9px 16px; border-radius: 20px; text-align: start; animation: od-cta 2.2s ease-in-out infinite; }
.btn.big .ico { flex: none; inline-size: 44px; block-size: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(4, 18, 26, .9); color: var(--wc); }
.btn.big .ico svg { inline-size: 22px; block-size: 22px; }
[dir="rtl"] .btn.big .ico svg { transform: scaleX(-1); }
.btn.big .col { display: flex; flex-direction: column; min-inline-size: 0; }
.btn.big b { font-size: 1.3rem; line-height: 1.15; }
.btn.big small { font-size: .82rem; font-weight: 700; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes od-cta { 50% { box-shadow: 0 4px 0 rgba(0, 0, 0, .35), 0 8px 34px color-mix(in srgb, var(--wc) 55%, transparent); } }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; min-inline-size: 0; border-radius: 16px; text-align: center;
    background: var(--panel); border: 1px solid var(--line); color: var(--text);
}
.mode svg { inline-size: 24px; block-size: 24px; color: var(--wc); margin-block-end: 2px; }
.mode b { font-size: .92rem; line-height: 1.2; }
.mode small { font-size: .7rem; color: var(--muted); line-height: 1.25; }
.mode:active, .tool:active, .item:active, .opt:active, .switch:active, .node:active { transform: scale(.96); }
.mode.locked { opacity: .72; }
.mode.locked svg { color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; min-inline-size: 0; border-radius: 13px;
    background: rgba(8, 10, 34, .78); border: 1px solid var(--line); color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tool svg { inline-size: 20px; block-size: 20px; color: var(--text); }
.tool span { max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* wide: the title on one side, the planet in the middle, the buttons on the other */
.wide .home { flex-direction: row; align-items: center; gap: 0; padding: 14px 22px; }
.wide .hero { flex: 1 1 0; min-inline-size: 0; }
.wide .spacer { flex: 0 0 clamp(160px, 25%, 300px); min-block-size: 0; }
.wide .menu { flex: 1 1 0; min-inline-size: 0; max-inline-size: 360px; }
.wide .logo h1 { font-size: clamp(1.7rem, 5.2vw, 3.2rem); }
.wide .modes { grid-template-columns: 1fr; gap: 6px; }
.wide .mode { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; text-align: start; padding: 7px 12px; }
.wide .mode svg { grid-row: 1 / span 2; margin: 0; }
.wide .mode b { align-self: end; }
.wide .mode small { align-self: start; }
.wide.short .home { padding: 8px 16px; }
.wide.short .menu { gap: 6px; margin-block-start: 40px; }
.wide.short .btn.big { min-block-size: 52px; padding-block: 5px; }
.wide.short .btn.big .ico { inline-size: 36px; block-size: 36px; }
.wide.short .btn.big b { font-size: 1.1rem; }
.wide.short .mode { padding-block: 4px; }
.wide.short .mode small { display: none; }
.wide.short .mode b { grid-row: 1 / span 2; align-self: center; }
.wide.short .tool { padding-block: 4px; }
.wide.short .logo p { font-size: .86rem; }
.narrow .home { padding-inline: 10px; }
.narrow .mode small { font-size: .64rem; }

/* inner pages */
.head {
    position: sticky; inset-block-start: 0; z-index: 2; flex: none; display: flex; align-items: center; gap: 10px;
    padding: 8px; padding-inline-end: 106px; background: rgba(5, 6, 26, .94); border-block-end: 1px solid var(--line);
}
.hbtn { flex: none; inline-size: 42px; block-size: 42px; border-radius: 14px; padding: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); }
.hbtn svg { inline-size: 22px; block-size: 22px; }
[dir="rtl"] .hbtn svg { transform: scaleX(-1); }
.head h2 { flex: 1; min-inline-size: 0; font-size: 1.2rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.body { inline-size: min(100%, 760px); margin: auto; padding: 12px; }
.roomy .body { inline-size: min(100%, 880px); padding: 16px; }
.body.narrowcol, .roomy .body.narrowcol { inline-size: min(100%, 460px); display: flex; flex-direction: column; gap: 8px; }
.sec { margin-block: 14px 8px; font-size: .82rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
:lang(ar) .sec { letter-spacing: 0; font-size: .95rem; }
.sec:first-child { margin-block-start: 2px; }
.sec small { font-size: .76rem; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* the mission map: one card per planet, five missions each */
.worlds { display: grid; gap: 10px; }
.wide .worlds, .roomy .worlds { grid-template-columns: 1fr 1fr; }
.world {
    position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 8px; align-items: center;
    padding: 10px 12px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); overflow: hidden;
}
.world::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .16; background: radial-gradient(circle at 0 0, var(--pc, #38e1ff), transparent 60%); }
[dir="rtl"] .world::before { background: radial-gradient(circle at 100% 0, var(--pc, #38e1ff), transparent 60%); }
.world[data-w="dune"] { --pc: #ffb648; }
.world[data-w="frost"] { --pc: #a8ecff; }
.world[data-w="ember"] { --pc: #ff6a4a; }
.world .pic { inline-size: 52px; block-size: 52px; grid-row: 1; }
.world .wh { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-inline-size: 0; }
.world h3 { font-size: 1.08rem; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.world.locked .pic { filter: grayscale(1) brightness(.55); }
.world.locked h3 { color: var(--muted); }
.wlock { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; }
.wlock svg { flex: none; inline-size: 18px; block-size: 18px; }
.nodes { position: relative; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, 1fr); }
.nodes::before { content: ""; position: absolute; inset-inline: 10%; inset-block-start: 21px; block-size: 3px; border-radius: 3px; background: rgba(140, 158, 255, .22); }
.node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; background: none; border: 0; color: var(--text); }
.node .n {
    inline-size: 44px; block-size: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem;
    background: linear-gradient(180deg, #2a327c, #151a4c); border: 2px solid var(--pc, #38e1ff); box-shadow: 0 3px 0 rgba(0, 0, 0, .4);
}
.node .n svg { inline-size: 20px; block-size: 20px; }
.node.boss .n { border-color: var(--bad); background: linear-gradient(180deg, #7c2a4a, #3c1228); color: #ffd6d6; }
.node.locked .n { border-color: #3a4188; background: #12163c; color: #5a62a8; box-shadow: none; }
.node.locked .n svg { inline-size: 17px; block-size: 17px; }
.node.cur .n { animation: od-cur 1.3s ease-in-out infinite; }
@keyframes od-cur { 0%, 100% { box-shadow: 0 3px 0 rgba(0, 0, 0, .4), 0 0 0 0 rgba(255, 255, 255, .5); } 50% { box-shadow: 0 3px 0 rgba(0, 0, 0, .4), 0 0 0 8px rgba(255, 255, 255, 0); transform: scale(1.06); } }
.st { display: flex; gap: 1px; direction: ltr; }
.st i { inline-size: 12px; block-size: 12px; color: #343b7e; }
.st i svg { inline-size: 100%; block-size: 100%; }
.st i.on { color: var(--gold); }
.node.locked .st { visibility: hidden; }
.node:focus-visible { outline: none; }
.node:focus-visible .n { outline: 3px solid #fff; outline-offset: 2px; }
.roomy .world { padding: 14px 16px; row-gap: 12px; }
.roomy .world .pic { inline-size: 60px; block-size: 60px; }
.roomy .world h3 { font-size: 1.25rem; }
.roomy .node .n { inline-size: 52px; block-size: 52px; font-size: 1.25rem; }
.roomy .nodes::before { inset-block-start: 25px; }
.roomy .st i { inline-size: 14px; block-size: 14px; }

/* cards: mission briefing, pause, results */
.card {
    position: relative; margin: auto; inline-size: min(100%, 410px); padding: 18px 18px 16px; border-radius: 24px; text-align: center;
    background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .1); animation: od-pop .3s cubic-bezier(.2, 1.3, .4, 1);
}
@keyframes od-pop { from { opacity: 0; transform: translateY(16px) scale(.94); } }
.card.small { inline-size: min(100%, 330px); }
.card h2 { font-size: 1.6rem; font-weight: 900; line-height: 1.2; }
.card .over { display: block; margin-block-end: 4px; font-size: .8rem; font-weight: 700; color: var(--wc); letter-spacing: .04em; }
:lang(ar) .card .over { letter-spacing: 0; font-size: .88rem; }
.card h2 + .over { margin-block: 4px 0; color: var(--muted); }
.goal { margin-block-start: 6px; color: var(--muted); font-size: .95rem; }
.threat {
    display: flex; align-items: center; gap: 12px; margin-block-start: 12px; padding: 10px 12px; border-radius: 16px; text-align: start;
    background: rgba(5, 6, 26, .6); border: 1px solid var(--line);
}
.threat img { flex: none; }
.threat small { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
:lang(ar) .threat small { letter-spacing: 0; font-size: .8rem; }
.threat b { display: block; font-size: 1.05rem; }
.threat p { font-size: .84rem; color: var(--muted); line-height: 1.35; }
.goals { margin-block-start: 12px; display: grid; gap: 5px; text-align: start; }
.goals li { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.goals i { flex: none; inline-size: 20px; block-size: 20px; color: #3a4188; }
.goals i svg { inline-size: 100%; block-size: 100%; }
.goals li.on { color: var(--text); }
.goals li.on i { color: var(--gold); }
.note { margin-block-start: 10px; font-size: .88rem; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.35; }
.note svg { flex: none; inline-size: 18px; block-size: 18px; }
.note.ok { color: var(--ok); }
.note.bad { color: var(--bad); }
.wait { font-weight: 800; font-size: 1.1rem; animation: od-low 1s ease-in-out infinite; }

.card.result.win { border-color: rgba(255, 200, 71, .6); box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 44px rgba(255, 200, 71, .18), inset 0 1px 0 rgba(255, 255, 255, .1); }
.card.result.win h2 { color: var(--gold); }
.card.result.lose h2 { color: #ffb3b3; }
.stars3 { display: flex; justify-content: center; align-items: flex-end; gap: 6px; margin-block: 10px 2px; }
.stars3 i { inline-size: 52px; block-size: 52px; color: #2d3470; }
.stars3 i:nth-child(2) { inline-size: 66px; block-size: 66px; margin-block-end: 6px; }
.stars3 i svg { inline-size: 100%; block-size: 100%; }
.stars3 i.got { color: var(--gold); filter: drop-shadow(0 0 10px rgba(255, 200, 71, .55)); animation: od-star .55s both; animation-delay: calc(.38s + var(--d) * .36s); }
@keyframes od-star { 0% { color: #2d3470; filter: none; transform: none; } 35% { color: #fff3c4; transform: scale(1.55) rotate(-14deg); } 100% { transform: none; } }
.score-wrap { position: relative; }
.big { font-size: 2.9rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; margin-block: 6px 2px; direction: ltr; }
.big.gold { color: var(--gold); text-shadow: 0 0 22px rgba(255, 200, 71, .45); }
.big.landed { animation: od-land .35s ease-out; }
@keyframes od-land { 40% { transform: scale(1.14); } }
.stamp {
    position: absolute; inset-block-start: -6px; inset-inline-end: -4px; padding: 3px 10px; border-radius: 8px; font-size: .74rem; font-weight: 900; letter-spacing: .06em;
    color: var(--gold); border: 2px solid var(--gold); background: rgba(5, 6, 26, .85); transform: rotate(9deg) scale(2.2); opacity: 0;
}
:lang(ar) .stamp { letter-spacing: 0; font-size: .82rem; }
[dir="rtl"] .stamp { transform: rotate(-9deg) scale(2.2); }
.stamp.on { opacity: 1; transform: rotate(9deg); transition: transform .28s cubic-bezier(.3, 1.5, .5, 1), opacity .12s; }
[dir="rtl"] .stamp.on { transform: rotate(-9deg); }
.row { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin-block-start: 6px; font-size: .86rem; color: var(--muted); }
.row b { color: var(--text); font-variant-numeric: tabular-nums; }
.row b.landed { animation: od-land .3s ease-out; }
.reach { margin-block-start: 8px; font-size: .98rem; font-weight: 700; }
.meter { margin-block: 8px 4px; block-size: 10px; border-radius: 99px; background: rgba(5, 6, 26, .7); border: 1px solid var(--line); overflow: hidden; }
.meter i { display: block; block-size: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--wc2), var(--wc)); animation: od-meter .8s ease-out; }
@keyframes od-meter { from { inline-size: 0; } }
.tip { margin-block-start: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(5, 6, 26, .55); font-size: .88rem; color: #d5dbff; line-height: 1.4; }
.news { margin-block-start: 10px; display: grid; gap: 5px; text-align: start; }
.news li {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; font-size: .86rem; font-weight: 700; color: #fff1c9;
    background: rgba(255, 200, 71, .1); border: 1px solid rgba(255, 200, 71, .4); animation: od-news .4s both; animation-delay: 1.5s;
}
.news li:nth-child(2) { animation-delay: 1.7s; }
.news li:nth-child(3) { animation-delay: 1.9s; }
.news li:nth-child(n+4) { animation-delay: 2.1s; }
.news svg { flex: none; inline-size: 18px; block-size: 18px; color: var(--gold); }
@keyframes od-news { from { opacity: 0; transform: translateX(-14px); } }
.news:has(li:nth-child(4)) { grid-template-columns: 1fr 1fr; }
.news:has(li:nth-child(4)) li { padding: 5px 8px; font-size: .78rem; }
#note .btn { margin-block-start: 8px; min-block-size: 38px; padding: 6px 16px; font-size: .9rem; }

/* sideways phones: cards go two columns so nothing needs scrolling */
.wide.short .screen.s-brief, .wide.short .screen.s-over, .wide.short .screen.s-paused { padding: 8px; }
.wide.short .card { padding: 12px 16px; }
.wide.short .card.brief, .wide.short .card.result { inline-size: min(100%, 640px); display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: center; }
.wide.short .side > :first-child { margin-block-start: 0; }
.wide.short .card h2 { font-size: 1.35rem; }
.wide.short .stars3 i { inline-size: 40px; block-size: 40px; }
.wide.short .stars3 i:nth-child(2) { inline-size: 52px; block-size: 52px; }
.wide.short .big { font-size: 2.2rem; }
.wide.short .actions { margin-block-start: 10px; }
.wide.short .actions .btn { min-block-size: 40px; padding-block: 6px; }
.wide.short .card.small .actions { gap: 6px; margin-block-start: 8px; }
.wide.short .threat { margin-block-start: 8px; padding: 7px 10px; }

/* hangar, medals, how to play, settings */
.grid { display: grid; gap: 8px; }
.grid.ships { grid-template-columns: repeat(3, 1fr); }
.grid.planets { grid-template-columns: repeat(4, 1fr); }
.wide .grid.ships, .roomy .grid.ships { grid-template-columns: repeat(6, 1fr); }
.item {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; min-inline-size: 0; border-radius: 16px; text-align: center;
    background: var(--panel); border: 1.5px solid var(--line); color: var(--text);
}
.item img { inline-size: min(60px, 100%); block-size: auto; aspect-ratio: 1; }
.item b { font-size: .86rem; max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { display: inline-flex; align-items: center; gap: 3px; font-size: .7rem; color: var(--muted); line-height: 1.2; }
.item small svg { flex: none; inline-size: 12px; block-size: 12px; }
.item.on { border-color: var(--wc); box-shadow: 0 0 18px color-mix(in srgb, var(--wc) 35%, transparent); background: var(--panel2); }
.item.on small { color: var(--wc); font-weight: 700; }
.item.locked img { filter: grayscale(1) brightness(.5); }
.item.locked b { color: var(--muted); }
.planets .item b { white-space: normal; line-height: 1.2; }
.roomy .item { padding: 12px 6px; }
.roomy .item img { inline-size: 76px; }
.roomy .item b { font-size: .98rem; }
.roomy .item small { font-size: .78rem; }
.roomy .card { inline-size: min(100%, 440px); padding: 22px; }
.roomy .card.small { inline-size: min(100%, 340px); }
.grid.medals, .grid.infos { grid-template-columns: 1fr; }
.wide .grid.medals, .roomy .grid.medals, .wide .grid.infos, .roomy .grid.infos { grid-template-columns: 1fr 1fr; }
.roomy .grid.medals { grid-template-columns: 1fr 1fr 1fr; }
.medal, .info { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); min-inline-size: 0; }
.medal > i { flex: none; inline-size: 40px; block-size: 40px; border-radius: 50%; display: grid; place-items: center; background: #12163c; color: #5a62a8; border: 2px solid #2b3170; }
.medal > i svg { inline-size: 20px; block-size: 20px; }
.medal b, .info b { display: block; font-size: .92rem; }
.medal small, .info small { display: block; font-size: .78rem; color: var(--muted); line-height: 1.3; }
.medal:not(.got) b { color: var(--muted); }
.medal.got { border-color: rgba(255, 200, 71, .5); background: linear-gradient(90deg, rgba(255, 200, 71, .12), var(--panel) 70%); }
[dir="rtl"] .medal.got { background: linear-gradient(270deg, rgba(255, 200, 71, .12), var(--panel) 70%); }
.medal.got > i { background: linear-gradient(180deg, #ffe08a, #ffad1f); color: #3a2400; border-color: #fff3c4; box-shadow: 0 0 14px rgba(255, 200, 71, .45); }
.info img { flex: none; }
.lines { display: grid; gap: 8px; }
.lines li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); font-size: .92rem; line-height: 1.4; }
.lines i { flex: none; inline-size: 34px; block-size: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(56, 225, 255, .12); color: var(--accent); }
.lines i svg { inline-size: 18px; block-size: 18px; }
.switch {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-radius: 15px; text-align: start;
    background: var(--panel); border: 1px solid var(--line); color: var(--text); font-weight: 700;
}
.switch i { position: relative; flex: none; inline-size: 48px; block-size: 28px; border-radius: 99px; background: #2b3170; transition: background-color .15s; }
.switch i::after { content: ""; position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 22px; block-size: 22px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.switch.on i { background: var(--ok); }
.switch.on i::after { inset-inline-start: 23px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { display: flex; flex-direction: column; gap: 3px; padding: 11px 12px; border-radius: 15px; text-align: start; background: var(--panel); border: 1.5px solid var(--line); color: var(--text); }
.opt small { font-size: .78rem; color: var(--muted); line-height: 1.3; }
.opt.on { border-color: var(--accent); background: var(--panel2); box-shadow: 0 0 16px rgba(56, 225, 255, .22); }

.nope { animation: od-nope .32s; }
@keyframes od-nope { 20% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 80% { transform: translateX(-3px); } }

/* small screens */
.narrow .stat { padding-inline: 8px; }
.narrow .stat.wave { min-inline-size: 58px; }
.narrow .stat.score b { font-size: 1.15rem; }
.narrow .grid.planets { grid-template-columns: repeat(2, 1fr); }
.short .hud { padding: 6px; }
.short .icon, .short .hbtn { inline-size: 38px; block-size: 38px; border-radius: 12px; }
.short .bossbar { inset-block-start: 54px; }
.short .nova { inline-size: 70px; block-size: 70px; inset-block-end: 10px; right: 10px; }
.short .head { padding-block: 5px; }
.short .body { padding-block: 8px; }
.short .world { padding: 7px 12px; row-gap: 5px; }
.short .world .pic { inline-size: 36px; block-size: 36px; }
.short .node .n { inline-size: 38px; block-size: 38px; font-size: 1rem; }
.short .nodes::before { inset-block-start: 18px; }
.short .banner { inset-block-start: 19%; }

@media (hover: hover) {
    .mode:hover, .tool:hover, .item:hover, .opt:hover, .switch:hover, .icon:hover, .hbtn:hover { border-color: var(--wc); }
    .node:not(.locked):hover .n { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
