:root {
  color-scheme: dark;
  --bg: #080f1b;
  --panel: #101a2a;
  --panel-soft: #131f31;
  --line: rgba(169, 196, 224, 0.12);
  --text: #edf6ff;
  --muted: #8295ac;
  --mint: #6ee7c8;
  --mint-dark: #153e3a;
  --danger: #ff7185;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 12% 0%, rgba(63, 111, 143, 0.12), transparent 34rem),
    radial-gradient(circle at 100% 90%, rgba(63, 179, 154, 0.07), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

.app-shell { width: min(1240px, 100%); margin: 0 auto; padding: 0 28px; }

.topbar { height: 88px; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 23px; font-weight: 850; letter-spacing: 0.15em; }
.brand-mark { width: 38px; height: 38px; fill: none; stroke: var(--mint); stroke-width: 3.2; stroke-linecap: round; }
.tagline { margin: 3px 0 0; color: var(--muted); font-size: 13px; letter-spacing: 0.03em; }
.header-actions { margin-left: auto; display: flex; gap: 9px; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: rgba(16, 26, 42, 0.75); color: #b7c9db; cursor: pointer; transition: 160ms ease; }
.icon-button:hover:not(:disabled) { color: var(--mint); border-color: rgba(110, 231, 200, 0.35); transform: translateY(-1px); }
.icon-button:disabled { opacity: 0.35; cursor: default; }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound-off { display: none; }
.icon-button.muted .sound-on { display: none; }
.icon-button.muted .sound-off { display: block; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 20px; align-items: stretch; }
.arena-card { min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 25px; background: rgba(16, 26, 42, 0.7); box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25); }
.arena { position: relative; width: 100%; height: clamp(560px, calc(100vh - 168px), 720px); min-height: 480px; overflow: hidden; border-radius: 18px; background: #0c1625; isolation: isolate; touch-action: none; user-select: none; }
#gameCanvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
#gameCanvas.targeting { cursor: cell; }
.arena-topline { position: absolute; z-index: 2; top: 18px; left: 20px; display: flex; align-items: center; gap: 8px; pointer-events: none; color: #7990a8; font-size: 10px; font-weight: 750; letter-spacing: 0.13em; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #61768c; box-shadow: 0 0 0 4px rgba(97, 118, 140, 0.09); }
.status-dot.live { background: var(--mint); box-shadow: 0 0 0 4px rgba(110, 231, 200, 0.09); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 113, 133, 0.1); animation: pulse 1s infinite; }
.active-effects { position: absolute; z-index: 3; top: 43px; left: 18px; display: grid; gap: 7px; pointer-events: none; }
.effect-chip { position: relative; min-width: 164px; display: grid; grid-template-columns: 17px 1fr auto; align-items: center; gap: 7px; overflow: hidden; padding: 7px 10px 9px; border: 1px solid color-mix(in srgb, var(--effect) 36%, transparent); border-radius: 9px; background: rgba(7, 17, 29, .82); color: var(--effect); box-shadow: 0 0 18px color-mix(in srgb, var(--effect) 10%, transparent); backdrop-filter: blur(6px); animation: effect-chip-pulse 2.2s ease-in-out infinite; }
.effect-chip[hidden] { display: none; }
.effect-chip svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px currentColor); }
.effect-chip span { color: #d6e5f2; font-size: 10px; font-weight: 750; }
.effect-chip strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.effect-chip i { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: rgba(255,255,255,.06); }
.effect-chip b { display: block; width: 100%; height: 100%; background: var(--effect); box-shadow: 0 0 7px var(--effect); transform-origin: left; }
@keyframes effect-chip-pulse { 50% { border-color: color-mix(in srgb, var(--effect) 65%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--effect) 18%, transparent); } }

.side-panel { display: flex; flex-direction: column; gap: 12px; }
.score-card, .meter-card, .how-card, .fusion-card { border: 1px solid var(--line); border-radius: 18px; background: rgba(16, 26, 42, 0.72); }
.score-card { padding: 21px 22px 17px; }
.score-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.12em; }
.level-badge { display: inline-block; padding: 5px 7px; border-radius: 6px; background: rgba(110, 231, 200, 0.08); color: var(--mint); font-size: 9px; letter-spacing: 0.08em; transform-origin: center; }
.score-value { display: block; margin: 8px 0 10px; font-size: clamp(38px, 4vw, 52px); line-height: 1.1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.best-row { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.best-row strong { color: #c4d4e3; font-variant-numeric: tabular-nums; }
.meter-card { padding: 16px 18px; }
.meter-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; color: #b7c7d8; }
.meter-label strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.meter-track { height: 5px; overflow: hidden; border-radius: 99px; background: rgba(143, 169, 194, 0.11); }
.meter-fill { width: 100%; height: 100%; border-radius: inherit; background: var(--mint); transform-origin: left; transition: background 180ms; }
.danger-track .meter-fill { width: 0; }
.meter-card p { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.occupancy-card { position: relative; overflow: hidden; transition: border-color 220ms, box-shadow 220ms, background 220ms; }
.occupancy-card .meter-label { margin-bottom: 7px; }
.occupancy-card .meter-label > span { color: #d4e2ee; font-weight: 750; }
.occupancy-card #occupancyValue { font-size: 24px; line-height: 1; letter-spacing: -.04em; }
.occupancy-card .danger-track { height: 8px; }
.occupancy-card .occupancy-goal { margin-top: 8px; color: #8fa8bc; font-size: 8px; font-weight: 800; letter-spacing: .09em; }
.occupancy-card.warning { border-color: rgba(255, 183, 101, .45); background: rgba(62, 42, 25, .42); box-shadow: 0 0 22px rgba(255, 183, 101, .08); }
.occupancy-card.warning #occupancyValue { color: #ffb765; }
.occupancy-card.critical { border-color: rgba(255, 113, 133, .7); background: rgba(67, 25, 38, .52); box-shadow: 0 0 26px rgba(255, 82, 119, .18); animation: occupancy-critical 1s ease-in-out infinite; }
.occupancy-card.critical #occupancyValue { color: #ff8da0; text-shadow: 0 0 15px rgba(255, 113, 133, .45); }
.occupancy-card.critical .danger-track { box-shadow: 0 0 10px rgba(255, 82, 119, .3); }
@keyframes occupancy-critical { 50% { border-color: #ff9aac; box-shadow: 0 0 34px rgba(255, 82, 119, .3); } }
.ink-card { position: relative; padding-top: 13px; padding-bottom: 13px; }
.ink-title { display: inline-flex; align-items: center; gap: 8px; }
.meter-label .ink-power { --class-color: #b8ff61; --class-secondary: #ffe16a; --class-ink: #26300c; display: inline-grid; place-items: center; min-width: 31px; padding: 3px 7px; border: 1px solid color-mix(in srgb, var(--class-color) 70%, transparent); border-radius: 7px; background: linear-gradient(135deg, var(--class-color), var(--class-secondary)); background-size: 180% 180%; color: var(--class-ink); font-size: 9px; font-weight: 950; line-height: 1.2; letter-spacing: .025em; box-shadow: 0 0 12px color-mix(in srgb, var(--class-color) 30%, transparent); animation: ink-power-pulse 1.65s ease-in-out infinite; }
.meter-label .ink-power[hidden] { display: none; }
.ink-power[data-class="silver"], .ink-power[data-class="platinum"], .ink-power[data-class="diamond"] { animation: class-shimmer 2.2s linear infinite, ink-power-pulse 2s ease-in-out infinite; }
.ink-power[data-class="gold"] { animation: ink-power-pulse 1.05s ease-in-out infinite; }
.ink-power[data-class="master"], .ink-power[data-class="legend"] { animation: class-shimmer 1.5s linear infinite, ink-power-pulse 1.15s ease-in-out infinite; }
.ink-gain { position: absolute; top: -9px; right: 18px; color: #ffe16a; font-size: 13px; font-weight: 900; opacity: 0; pointer-events: none; text-shadow: 0 0 12px rgba(255, 225, 106, .65); }
@keyframes ink-power-pulse { 50% { box-shadow: 0 0 21px color-mix(in srgb, var(--class-color) 60%, transparent), 0 0 5px var(--class-secondary); filter: brightness(1.16); } }
@keyframes class-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 180% 50%; } }
.shake-button { display: grid; grid-template-columns: 24px 1fr auto 26px; align-items: center; gap: 9px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(16, 26, 42, .72); color: #61768b; text-align: left; cursor: default; transition: 160ms ease; }
.shake-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shake-button span { font-size: 12px; font-weight: 750; }
.shake-button strong { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: rgba(255,255,255,.06); font-size: 11px; }
.shake-button.charged { border-color: rgba(255,214,110,.32); background: rgba(255,214,110,.08); color: #ffd66e; cursor: pointer; box-shadow: 0 0 20px rgba(255,214,110,.05); }
.shake-button.charged:hover { transform: translateY(-1px); background: rgba(255,214,110,.13); }
.shake-button.charged strong { background: #ffd66e; color: #332806; }

.how-card { padding: 17px 18px 14px; }
.how-card h2 { margin: 0 0 14px; font-size: 12px; letter-spacing: 0.02em; }
.how-card ol { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; }
.how-card li { display: flex; align-items: center; gap: 11px; }
.how-card li > span { flex: 0 0 24px; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid rgba(110, 231, 200, 0.15); border-radius: 50%; color: var(--mint); font-size: 10px; font-weight: 750; }
.how-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.how-card p strong { color: #c5d6e5; font-weight: 650; }

.fusion-card { margin-top: auto; padding: 15px 16px 17px; }
.fusion-title { display: flex; justify-content: space-between; align-items: center; color: #b7c7d8; font-size: 10px; }
.fusion-title span:last-child { color: #647a91; font-size: 8px; }
.fusion-ladder { display: flex; align-items: center; justify-content: space-between; height: 49px; padding: 0 3px; }
.fusion-ladder i { width: var(--size); height: var(--size); border-radius: 50%; background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.7), transparent 20%), var(--orb); box-shadow: 0 0 14px color-mix(in srgb, var(--orb) 18%, transparent); }
.fusion-ladder b { color: #3f5369; font-size: 10px; font-weight: 400; }

.overlay { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(5, 12, 22, 0.72); backdrop-filter: blur(9px); transition: opacity 180ms; }
.overlay.hidden { display: none; }
.overlay-card { width: min(430px, 100%); text-align: center; }
.overlay-card h1, .overlay-card h2 { margin: 8px 0 13px; font-size: clamp(35px, 5vw, 52px); line-height: 1.05; letter-spacing: -0.045em; }
.overlay-card h2 { font-size: 36px; }
.eyebrow { margin: 0; color: var(--mint); font-size: 9px; font-weight: 800; letter-spacing: 0.17em; }
.overlay-copy { max-width: 370px; margin: 0 auto 25px; color: #9bafc3; font-size: 14px; line-height: 1.65; }
.story-card { width: min(455px, 100%); }
.story-card > .overlay-copy { margin-bottom: 18px; }
.story-signal { position: relative; width: 94px; height: 94px; margin: 0 auto 18px; display: grid; place-items: center; }
.story-signal span { width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #efffff, #8ff7ff 35%, #5274b9); box-shadow: 0 0 24px rgba(143, 247, 255, .55); }
.story-signal i { position: absolute; inset: 12px; border: 1px solid rgba(143, 247, 255, .35); border-radius: 50%; animation: story-signal 2.4s ease-out infinite; }
.story-signal i:nth-child(2) { animation-delay: .8s; }
.story-signal i:nth-child(3) { animation-delay: 1.6s; }
.story-mission { margin: 0 auto 24px; padding: 15px 18px; border: 1px solid rgba(110, 231, 200, .28); border-radius: 13px; background: rgba(110, 231, 200, .07); box-shadow: inset 0 0 25px rgba(110, 231, 200, .025); }
.story-mission strong { color: var(--mint); font-size: 9px; letter-spacing: .15em; }
.story-mission p { margin: 7px 0 0; color: #d4e4ef; font-size: 13px; line-height: 1.55; }
.story-mission .story-tip { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(110, 231, 200, .14); color: #9fb6c7; font-size: 11px; }
@keyframes story-signal { from { transform: scale(.45); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }
.primary-button { min-width: 190px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 24px; border: 0; border-radius: 12px; background: var(--mint); color: #08231f; font-weight: 800; font-size: 14px; cursor: pointer; box-shadow: 0 10px 30px rgba(110, 231, 200, 0.15); transition: 160ms ease; }
.primary-button:hover { background: #8bf0d6; transform: translateY(-2px); box-shadow: 0 13px 34px rgba(110, 231, 200, 0.22); }
.primary-button:active { transform: translateY(0); }
.primary-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.input-note { margin: 16px 0 0; color: #5f748a; font-size: 10px; }
.secondary-button { min-width: 190px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 13px 20px; border: 1px solid rgba(110,231,200,.35); border-radius: 12px; background: rgba(110,231,200,.07); color: #baf7e6; font-weight: 750; font-size: 13px; cursor: pointer; transition: 160ms ease; }
.secondary-button:hover { border-color: #6ee7c8; background: rgba(110,231,200,.13); transform: translateY(-2px); }
.secondary-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.result-actions .primary-button, .result-actions .secondary-button { min-width: 0; flex: 1 1 170px; }
.share-card { width: min(450px,100%); max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
.share-card h2 { font-size: 31px; }
.share-card .overlay-copy { margin-bottom: 12px; }
.share-message { margin: 0 auto 18px; padding: 11px 14px; border-left: 2px solid #6ee7c8; border-radius: 7px; background: rgba(110,231,200,.06); color: #d4e4ef; font-size: 12px; line-height: 1.5; text-align: left; }
.share-networks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.share-network { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px; border: 1px solid color-mix(in srgb, var(--network) 35%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--network) 8%, transparent); color: #e5f0f7; font-size: 12px; font-weight: 700; text-decoration: none; transition: 150ms ease; }
.share-network:hover { border-color: var(--network); background: color-mix(in srgb, var(--network) 15%, transparent); transform: translateY(-2px); }
.share-network svg { width: 19px; height: 19px; fill: none; stroke: var(--network); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-link-label { display: block; margin-bottom: 6px; color: #829aaf; font-size: 9px; text-align: left; }
.share-copy-row { display: flex; gap: 8px; }
.share-copy-row input { min-width: 0; flex: 1; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: rgba(5,14,25,.75); color: #a9bdcd; font: 11px monospace; }
.share-copy-row input:focus { border-color: #6ee7c8; }
.share-copy-row .secondary-button { min-width: 0; padding: 9px 12px; font-size: 11px; }
.share-copy-status { min-height: 17px; margin: 7px 0 5px; color: #8dffdf; font-size: 10px; }
.share-card > .text-button { margin-top: 5px; }
.mini-loop { position: relative; width: 105px; height: 85px; margin: 0 auto 15px; }
.mini-loop svg { width: 100%; height: 100%; fill: none; stroke: var(--mint); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 0 7px rgba(110,231,200,.25)); }
.mini-loop i { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #70b7ff; box-shadow: inset 3px 3px 4px rgba(255,255,255,.4); }
.mini-loop i:nth-of-type(1) { left: 37px; top: 32px; }
.mini-loop i:nth-of-type(2) { left: 53px; top: 40px; background: #70b7ff; }
.text-button { display: block; margin: 15px auto 0; padding: 5px 10px; border: 0; background: none; color: #849aaf; font-size: 12px; cursor: pointer; }
.text-button:hover { color: var(--text); }
.danger-text { color: var(--danger); }
.final-score { margin: 23px auto 15px; }
.final-score span { display: block; color: var(--muted); font-size: 11px; }
.final-score strong { display: block; margin-top: 2px; font-size: 52px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.final-stats { display: flex; justify-content: center; gap: 25px; margin-bottom: 24px; color: var(--muted); font-size: 11px; }
.final-stats strong { color: #c8d8e7; }

.combo-toast { position: absolute; z-index: 3; top: 52px; left: 50%; display: grid; justify-items: center; pointer-events: none; opacity: 0; transform: translate(-50%, -8px) scale(.92); transition: 180ms ease; }
.combo-toast.visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.combo-toast strong { color: #ffe16a; font-size: 25px; font-style: italic; letter-spacing: -0.03em; text-shadow: 0 3px 18px rgba(255, 225, 106, 0.25); }
.combo-toast span { margin-top: 1px; color: #b6c4d1; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.special-toast { position: absolute; z-index: 4; right: 18px; bottom: 20px; width: min(290px, 72%); padding: 12px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 12px; background: rgba(7, 16, 28, .9); box-shadow: 0 12px 35px rgba(0,0,0,.35); backdrop-filter: blur(8px); display: grid; justify-items: start; gap: 3px; pointer-events: none; opacity: 0; transform: translateY(12px) scale(.94); transition: 180ms ease; }
.special-toast.visible { opacity: 1; transform: translateY(0) scale(1); }
.special-toast strong { color: #ff766f; font-size: 17px; font-style: italic; letter-spacing: .045em; }
.special-toast span { color: #b7c9d9; font-size: 10px; text-align: left; line-height: 1.4; }

.mode-badge { margin-left: 5px; padding: 3px 6px; border: 1px solid rgba(110,231,200,.18); border-radius: 5px; color: #a4b9c9; font-size: 8px; }
.mode-timer { color: #ffe16a; font-size: 12px; font-variant-numeric: tabular-nums; }
.battle-status { position: absolute; z-index: 3; top: 62px; right: 16px; display: grid; justify-items: end; gap: 7px; pointer-events: none; }
.flow-chip { position: relative; min-width: 105px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; overflow: hidden; padding: 7px 10px 9px; border: 1px solid rgba(255,225,106,.42); border-radius: 9px; background: rgba(28,23,10,.82); color: #ffe16a; box-shadow: 0 0 20px rgba(255,225,106,.12); }
.flow-chip span { font-size: 9px; font-weight: 850; letter-spacing: .14em; }
.flow-chip strong { font-size: 18px; font-style: italic; text-shadow: 0 0 12px currentColor; }
.flow-chip i, .event-chip i { position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: rgba(255,255,255,.08); }
.flow-chip b, .event-chip b { display: block; height: 100%; background: currentColor; transform-origin: left; }
.event-chip { position: relative; width: 220px; overflow: hidden; padding: 9px 11px 11px; border: 1px solid rgba(165,140,255,.35); border-radius: 10px; background: rgba(11,15,32,.88); backdrop-filter: blur(6px); }
.event-chip.warning { border-color: rgba(255,183,101,.65); animation: event-warning .65s ease-in-out infinite alternate; }
.event-chip > span { display: block; color: #c9b9ff; font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.event-chip > strong { position: absolute; top: 8px; right: 10px; color: #edf6ff; font-size: 11px; }
.event-chip > small { display: block; margin-top: 4px; padding-right: 4px; color: #91a6ba; font-size: 9px; line-height: 1.35; }
.event-chip i { margin-top: 7px; }
@keyframes event-warning { to { box-shadow: 0 0 24px rgba(255,183,101,.22); } }
.objective-toggle { position: absolute; z-index: 5; top: 10px; right: 12px; width: 40px; height: 40px; padding: 9px; border: 1px solid rgba(110,231,200,.32); border-radius: 11px; background: rgba(7,17,29,.88); color: #8dffdf; box-shadow: 0 5px 18px rgba(0,0,0,.2); backdrop-filter: blur(6px); cursor: pointer; touch-action: manipulation; transition: 160ms ease; }
.objective-toggle[hidden] { display: none; }
.objective-toggle svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; }
.objective-toggle::after { content: '+'; position: absolute; right: -3px; bottom: -4px; display: grid; place-items: center; width: 15px; height: 15px; border: 2px solid #0c1625; border-radius: 50%; background: #6ee7c8; color: #09231e; font-size: 12px; font-weight: 900; line-height: 1; }
.objective-toggle.expanded { border-color: rgba(110,231,200,.62); background: rgba(13,42,41,.9); }
.objective-toggle.expanded::after { content: '−'; }
.objective-toggle:hover { border-color: #6ee7c8; box-shadow: 0 0 18px rgba(110,231,200,.16); }
.objective-toggle:focus-visible { outline: 2px solid #edf6ff; outline-offset: 3px; }
.objective-chip { position: relative; width: 220px; margin-top: 8px; padding: 8px 10px; border-left: 2px solid #6ee7c8; border-radius: 7px; background: rgba(7,17,29,.75); text-align: left; transform-origin: top right; transition: opacity 160ms ease, transform 160ms ease, visibility 160ms; }
.objective-chip.minimized { visibility: hidden; opacity: 0; transform: translateY(-6px) scale(.96); }
.objective-chip > span { display: block; color: #6ee7c8; font-size: 7px; font-weight: 850; letter-spacing: .12em; }
.objective-chip > strong { display: block; margin-top: 3px; color: #d6e5f2; font-size: 9px; line-height: 1.3; }
.objective-chip > small { color: #8da2b5; font-size: 8px; }
.lasso-preview { position: absolute; z-index: 4; bottom: 20px; left: 50%; min-width: 205px; padding: 9px 14px; border: 1px solid rgba(110,231,200,.3); border-radius: 10px; background: rgba(6,16,27,.88); text-align: center; pointer-events: none; transform: translateX(-50%); backdrop-filter: blur(5px); }
.lasso-preview strong { display: block; color: #dffcf4; font-size: 12px; }
.lasso-preview span { display: block; margin-top: 2px; color: #829aaf; font-size: 8px; }
.lasso-preview.ready { border-color: #ffe16a; box-shadow: 0 0 24px rgba(255,225,106,.16); }
.lasso-preview.empty { border-color: rgba(255,113,133,.35); }
.collapse-warning { position: absolute; z-index: 4; top: 83px; left: 50%; min-width: 190px; padding: 9px 16px; border: 1px solid rgba(255,113,133,.65); border-radius: 10px; background: rgba(61,10,25,.88); text-align: center; pointer-events: none; transform: translateX(-50%); box-shadow: 0 0 30px rgba(255,82,119,.2); animation: collapse-pulse .55s ease-in-out infinite alternate; }
.collapse-warning span, .collapse-warning small { display: block; color: #ffb3bf; font-size: 8px; font-weight: 850; letter-spacing: .11em; }
.collapse-warning strong { display: block; color: #fff0f3; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.collapse-warning small { font-size: 7px; }
@keyframes collapse-pulse { to { transform: translateX(-50%) scale(1.035); box-shadow: 0 0 40px rgba(255,82,119,.35); } }
.stability-toast { position: absolute; z-index: 3; bottom: 18px; left: 18px; display: grid; gap: 2px; padding: 8px 11px; border-left: 2px solid #6ee7c8; border-radius: 7px; background: rgba(8,34,31,.82); opacity: 0; transform: translateY(8px); transition: 160ms ease; pointer-events: none; }
.stability-toast.visible { opacity: 1; transform: translateY(0); }
.stability-toast strong { color: #8dffdf; font-size: 10px; }
.stability-toast span { color: #82aa9f; font-size: 8px; }

.start-card, .results-card, .options-card, .upgrade-card { max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
.start-card { width: min(540px, 100%); }
.start-card h1 { font-size: clamp(31px,4vw,43px); }
.start-card .overlay-copy { margin-bottom: 15px; }
.start-card .mini-loop { height: 58px; margin-bottom: 4px; transform: scale(.75); }
.mode-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 auto 16px; }
.mode-option { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(16,26,42,.7); color: #91a6ba; text-align: left; cursor: pointer; }
.mode-option strong, .mode-option span { display: block; }
.mode-option strong { color: #d5e4f0; font-size: 11px; }
.mode-option span { margin-top: 2px; font-size: 8px; }
.mode-option.selected { border-color: #6ee7c8; background: rgba(110,231,200,.09); box-shadow: inset 0 0 15px rgba(110,231,200,.04); }
.mode-option.selected strong { color: #8dffdf; }
.results-card { width: min(460px,100%); }
.results-card h2 { margin-bottom: 5px; font-size: 29px; }
.final-score { margin: 12px auto 9px; }
.final-score strong { font-size: 42px; }
.final-score small { display: block; margin-top: 3px; color: #ffe16a; font-size: 10px; }
.final-stats { margin-bottom: 12px; }
.run-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-bottom: 12px; }
.run-stats > span { padding: 7px 4px; border: 1px solid rgba(169,196,224,.09); border-radius: 7px; background: rgba(18,31,48,.55); }
.run-stats small, .run-stats strong { display: block; }
.run-stats small { min-height: 20px; color: #758ca2; font-size: 7px; line-height: 1.3; }
.run-stats strong { color: #dce9f4; font-size: 13px; }
.run-advice { margin: 0 auto 14px; padding: 8px 11px; border-left: 2px solid #6ee7c8; background: rgba(110,231,200,.05); color: #a8bdcd; font-size: 10px; line-height: 1.45; text-align: left; }
.upgrade-card { width: min(570px,100%); }
.upgrade-card h2 { font-size: 30px; }
.upgrade-card .overlay-copy { margin-bottom: 15px; font-size: 11px; }
.upgrade-choices { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.upgrade-choice { min-height: 155px; padding: 14px 12px; border: 1px solid rgba(110,231,200,.2); border-radius: 11px; background: linear-gradient(145deg,rgba(26,43,59,.92),rgba(12,24,38,.92)); color: #a9bdcd; cursor: pointer; text-align: left; transition: 150ms ease; }
.upgrade-choice:hover { border-color: #ffe16a; transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.upgrade-choice i { display: grid; place-items: center; width: 29px; height: 29px; margin-bottom: 10px; border: 1px solid currentColor; border-radius: 50%; color: #ffe16a; font-style: normal; font-weight: 900; }
.upgrade-choice strong { display: block; margin-bottom: 6px; color: #edf6ff; font-size: 12px; }
.upgrade-choice span { font-size: 9px; line-height: 1.5; }
.options-card { width: min(470px,100%); text-align: left; }
.options-card > .eyebrow, .options-card > h2 { text-align: center; }
.options-card h2 { font-size: 30px; }
.options-card h3 { margin: 17px 0 8px; color: #b8c9d7; font-size: 11px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.settings-grid label, .cosmetic-settings label { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid rgba(169,196,224,.09); border-radius: 8px; background: rgba(18,31,48,.6); color: #afc1d0; font-size: 10px; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: #6ee7c8; }
.cosmetic-settings { display: grid; gap: 6px; }
.cosmetic-settings select { max-width: 170px; padding: 5px 7px; border: 1px solid #34465a; border-radius: 6px; background: #101c2c; color: #dce9f4; font: inherit; }
.cosmetic-progress { color: #758ca2; font-size: 9px; line-height: 1.5; }
.options-card > .primary-button { display: flex; margin: 12px auto 0; }

.contamination-card .meter-fill { width: 0; background: #a6d95b; transition: width 160ms,background 160ms; }
.contamination-card.warning { border-color: rgba(199,125,255,.4); }
.contamination-card.armed { border-color: #c77dff; box-shadow: 0 0 20px rgba(199,125,255,.14); animation: contamination-pulse .8s ease-in-out infinite alternate; }
.contamination-card.armed .meter-fill { background: #c77dff; box-shadow: 0 0 10px #c77dff; }
@keyframes contamination-pulse { to { background: rgba(70,31,83,.4); } }
.objective-card { padding: 11px 14px; border: 1px solid rgba(110,231,200,.16); border-radius: 13px; background: rgba(16,26,42,.72); }
.objective-card > span { color: #6ee7c8; font-size: 7px; font-weight: 850; letter-spacing: .13em; }
.objective-card > strong { display: block; margin-top: 4px; color: #d2e1ec; font-size: 10px; line-height: 1.35; }
.objective-card > small { color: #8295ac; font-size: 9px; }
.perk-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; color: #61798f; font-size: 8px; }
.perk-list span { padding: 3px 5px; border-radius: 4px; background: rgba(255,225,106,.07); color: #c8b976; }
.side-panel .how-card { display: none; }

body.reduced-motion *, body.reduced-motion *::before, body.reduced-motion *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
.guide-card { width: min(480px, 100%); max-height: 100%; overflow-y: auto; text-align: left; scrollbar-width: thin; }
.guide-card > .eyebrow, .guide-card > h2 { text-align: center; }
.guide-card > h2 { margin-bottom: 20px; font-size: 30px; }
.special-guide { display: grid; gap: 8px; margin-bottom: 20px; }
.special-guide-item { display: grid; grid-template-columns: 34px 1fr; gap: 11px; align-items: start; padding: 9px 11px; border: 1px solid rgba(169,196,224,.09); border-radius: 10px; background: rgba(18,31,48,.65); }
.special-guide-item > i { display: grid; place-items: center; width: 30px; height: 30px; margin-top: 1px; border: 1px dashed var(--special); border-radius: 50%; background: radial-gradient(circle at 35% 28%, rgba(255,255,255,.65), transparent 23%), var(--special); box-shadow: 0 0 12px color-mix(in srgb, var(--special) 22%, transparent); color: var(--icon, #102331); }
.special-guide-item > i svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.special-guide-item strong { color: #dce9f4; font-size: 12px; }
.special-guide-item p { margin: 3px 0 0; color: #8198ae; font-size: 10px; line-height: 1.45; }
.infection-guide-item { margin-bottom: 20px; border-color: rgba(166,217,91,.2); }
.guide-card > .primary-button { display: flex; margin: 0 auto; }
.guide-card > .input-note { text-align: center; }

.footer { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #52687e; font-size: 10px; }
.footer span:nth-child(2) { color: #849aaf; }
.site-footer { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 0 20px; border-top: 1px solid var(--line); color: #71869b; font-size: 11px; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { color: #b7c9db; font-weight: 700; text-decoration: none; cursor: pointer; }
.site-footer a:hover { color: var(--mint); text-decoration: none; }
kbd { padding: 3px 5px; border: 1px solid #293a4e; border-radius: 4px; background: #111d2c; color: #7e94aa; font-family: inherit; font-size: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@keyframes pulse { 50% { opacity: .45; } }

@media (max-width: 900px) {
  .app-shell { padding: 0 18px; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; }
  .arena { height: clamp(540px, calc(100vh - 164px), 690px); }
  .tagline { display: none; }
  .score-card { padding: 18px; }
  .fusion-title span:last-child { display: none; }
  .footer span:last-child { display: none; }
}

@media (max-width: 680px) {
  .app-shell { padding: 0 12px; }
  .topbar { height: 66px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 32px; height: 32px; }
  .icon-button { width: 38px; height: 38px; }
  .game-layout { display: flex; flex-direction: column; }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; order: -1; }
  .score-card { grid-row: span 2; padding: 14px 16px; }
  .score-heading { align-items: flex-start; gap: 5px; }
  .score-heading > span:first-child { padding-top: 5px; }
  .score-value { margin: 7px 0 8px; font-size: 36px; }
  .best-row { padding-top: 9px; }
  .meter-card { padding: 12px 14px; }
  .meter-card p { display: none; }
  .occupancy-card .occupancy-goal { display: block; font-size: 7px; letter-spacing: .04em; }
  .occupancy-card #occupancyValue { font-size: 21px; }
  .story-card { max-height: 100%; overflow-y: auto; }
  .story-signal { display: none; }
  .story-card > .overlay-copy { display: none; }
  .story-mission { margin-bottom: 18px; padding: 12px 14px; }
  .story-mission p { font-size: 12px; }
  .ink-card { padding: 12px 14px; }
  .shake-button { grid-column: 1 / -1; padding: 9px 14px; }
  .how-card, .fusion-card { display: none; }
  .arena { height: min(66dvh, 650px); min-height: 420px; }
  .arena-card { padding: 5px; border-radius: 20px; }
  .arena { border-radius: 15px; }
  .footer { min-height: 43px; }
  .overlay { padding: 22px; }
  .overlay-card h1 { font-size: 39px; }
  .overlay-copy { font-size: 13px; }
  .mini-loop { margin-bottom: 10px; transform: scale(.85); }
  .header-actions { gap: 5px; }
  .contamination-card { grid-column: 1 / -1; padding: 9px 14px; }
  .contamination-card .meter-label { margin-bottom: 6px; }
  .objective-card { display: none; }
  .battle-status { top: 60px; right: 10px; }
  .event-chip { width: 178px; }
  .objective-chip { width: 178px; }
  .active-effects { top: 38px; left: 10px; gap: 4px; }
  .effect-chip { min-width: 135px; padding: 5px 8px 7px; }
  .effect-chip span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .arena-topline { top: 13px; left: 13px; }
  #statusText { max-width: 135px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .combo-toast { top: 43px; }
  .special-toast { right: 10px; bottom: 10px; width: min(225px,65%); }
  .lasso-preview { bottom: 10px; min-width: 175px; padding: 7px 10px; }
  .stability-toast { bottom: 9px; left: 10px; }
  .collapse-warning { top: 72px; }
  .upgrade-choices { grid-template-columns: 1fr; }
  .upgrade-choice { min-height: 0; }
  .run-stats { grid-template-columns: repeat(4,1fr); }
  .start-card .mini-loop { display: none; }
  .start-card h1 { font-size: 31px; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .arena { min-height: 390px; }
  .level-badge { font-size: 8px; }
  .score-card { padding: 12px; }
  .meter-card { padding: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
