/* Cipher Storm (/cipher-storm, v3.63.0). The playtested prototype's arcade cabinet inside the site shell:
   rain field + typing console on the left, the codebreaker's tool rack on the right. Phosphor green, amber for danger.
   Custom buttons carry data-plain so the site-wide button style leaves them alone. */
.storm-page {
    --st-void: #040906;
    --st-panel: #08120c;
    --st-panel-2: #0c1a11;
    --st-line: #1b3524;
    --st-phos: #6dff9a;
    --st-phos-dim: #2c7446;
    --st-text: #cde8d5;
    --st-muted: #7b9c86;
    --st-amber: #ffb547;
    --st-alarm: #ff6464;
}
.storm-admin-note, .storm-how { max-width: 1120px; margin: 0 auto 16px; }
.storm-how { margin-top: 22px; }
.storm { max-width: 1120px; margin: 0 auto; display: grid; gap: 14px; color: var(--st-text); font-size: 15px; line-height: 1.45;
    background: rgba(0, 6, 2, 0.94); border: 1px solid var(--st-line); border-radius: 8px; padding: 16px; }
.storm [hidden] { display: none !important; }

.st-bar { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.st-scored { flex: 1 1 300px; margin: 0 auto 0 0; padding: 8px 14px; border: 1px solid var(--st-muted); border-radius: 6px;
    color: var(--st-muted); font-size: 13px; line-height: 1.5; }
.st-scored strong { color: var(--st-phos); font-weight: normal; }
.st-scored a { color: inherit; }
.st-scored-touch { display: none; }
.st-stat { display: grid; gap: 2px; }
.st-stat b { font-weight: normal; font-size: 22px; color: var(--st-phos); font-variant-numeric: tabular-nums; line-height: 1.2; }
.st-stat span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--st-muted); }
.st-mode b { font-size: 16px; }
.st-pips { display: flex; gap: 5px; height: 22px; align-items: center; }
.st-pip { width: 14px; height: 14px; border: 1px solid var(--st-phos); background: var(--st-phos); box-shadow: 0 0 8px rgba(109,255,154,.5); }
.st-pip.is-off { background: transparent; border-color: var(--st-line); box-shadow: none; }

.st-stage { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 820px) { .st-stage { grid-template-columns: minmax(0,1fr); } }
.st-play { display: grid; gap: 10px; min-width: 0; }

.st-field { position: relative; height: clamp(340px, 60vh, 580px); overflow: hidden;
    background: radial-gradient(ellipse at 50% 0%, #0b1c12 0%, var(--st-void) 70%); border: 1px solid var(--st-line); }
.st-field canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .32; }
.st-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; opacity: .55;
    background: repeating-linear-gradient(90deg, var(--st-alarm) 0 10px, transparent 10px 18px); }
.st-field.is-hit { animation: st-jolt .35s; }
.st-field.is-stall .st-word .ct { animation: st-hold .6s ease-in-out infinite alternate; }   /* frozen after a hit (v3.64.3) */
@keyframes st-hold { to { opacity: .55; } }
@keyframes st-jolt { 0%,100% { box-shadow: none } 30% { box-shadow: inset 0 -40px 60px -20px rgba(255,100,100,.45) } }

.st-word { position: absolute; top: 0; left: 0; white-space: nowrap; pointer-events: none; display: grid; justify-items: center; gap: 1px; will-change: transform; }
.st-word .ct { font-size: 22px; letter-spacing: .12em; color: var(--st-phos); text-shadow: 0 0 10px rgba(109,255,154,.55); font-family: 'Courier New', monospace; font-weight: bold; }
.st-word .pt { font-size: 12px; letter-spacing: .16em; color: var(--st-phos-dim); visibility: hidden; }
.st-field.is-cracked .st-word .pt { visibility: visible; color: #b9f5cc; }
.st-word.is-lowest .ct::before { content: "▸ "; color: var(--st-muted); }
.st-word.is-danger .ct { color: var(--st-amber); text-shadow: 0 0 12px rgba(255,181,71,.6); }
.st-word.is-pop { animation: st-pop .32s forwards; }
@keyframes st-pop { to { opacity: 0; transform: var(--t) scale(1.6); filter: blur(2px); } }

.st-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4,9,6,.86); text-align: center; z-index: 5; overflow-y: auto; }
.st-card { max-width: 460px; display: grid; gap: 12px; justify-items: center; }
.st-card h2 { margin: 0; color: var(--st-phos); font-size: 30px; letter-spacing: .04em; text-transform: lowercase; }
.st-card p { margin: 0; color: var(--st-text); }
.st-small { color: var(--st-muted); font-size: 13px; }
.st-small a, .st-device a, .st-save a { color: #0ff; }
.st-device { color: var(--st-amber) !important; border: 1px solid var(--st-amber); padding: 8px 12px; font-size: 14px; }
.st-banner { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; z-index: 4;
    font-size: clamp(22px, 4vw, 32px); color: var(--st-phos); text-shadow: 0 0 20px rgba(109,255,154,.6); transition: opacity .4s; letter-spacing: .06em; }
.st-banner small { display: block; font-size: 14px; color: var(--st-muted); margin-top: 6px; letter-spacing: .06em; padding: 0 12px; }
.st-banner.is-hide { opacity: 0; }

.st-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.st-modebtn { font: inherit; cursor: pointer; text-align: left; display: grid; gap: 2px; padding: 10px 12px; border-radius: 0;
    background: var(--st-panel-2); color: var(--st-text); border: 1px solid var(--st-line); }
.st-modebtn small { color: var(--st-muted); font-size: 12px; }
.st-modebtn[aria-pressed="true"] { border-color: var(--st-phos); box-shadow: 0 0 0 1px var(--st-phos); }
.st-modebtn[aria-pressed="true"] b { color: var(--st-phos); }
.st-modebtn:focus-visible { outline: 2px solid var(--st-phos); outline-offset: 2px; }

.st-console { display: grid; gap: 8px; padding: 12px; background: var(--st-panel); border: 1px solid var(--st-line); }
.st-lens { font-size: 14px; color: var(--st-muted); min-height: 1.45em; overflow-wrap: anywhere; }
.st-lens .c { color: var(--st-phos); letter-spacing: .1em; }
.st-lens .p { color: var(--st-text); letter-spacing: .1em; }
.st-typerow { display: flex; gap: 8px; }
#stTyped { flex: 1; min-width: 0; font: inherit; font-size: 22px; letter-spacing: .14em; text-transform: uppercase; border-radius: 0;
    background: var(--st-void); color: var(--st-phos); border: 1px solid var(--st-phos-dim); padding: 8px 12px; caret-color: var(--st-phos); }
#stTyped:focus { outline: none; border-color: var(--st-phos); box-shadow: 0 0 0 2px rgba(109,255,154,.18); }
#stTyped.is-miss { animation: st-shake .3s; }
#stTyped { transition: none; }
#stTyped.is-wrong { border-color: var(--st-alarm); color: var(--st-alarm); box-shadow: 0 0 0 2px rgba(255,100,100,.18); }
@keyframes st-shake { 25% { transform: translateX(-5px) } 75% { transform: translateX(5px) } }

.st-btn { font: inherit; font-size: 14px; letter-spacing: .06em; cursor: pointer; border-radius: 0;
    background: var(--st-panel-2); color: var(--st-text); border: 1px solid var(--st-line); padding: 8px 12px; }
.st-btn:hover { border-color: var(--st-phos-dim); color: var(--st-phos); }
.st-btn:focus-visible { outline: 2px solid var(--st-phos); outline-offset: 2px; }
.st-btn:disabled { opacity: .45; cursor: default; }
.st-primary { background: var(--st-phos); color: var(--st-void); border-color: var(--st-phos); }
.st-primary:hover { color: var(--st-void); filter: brightness(1.08); }

.st-tools { display: grid; gap: 12px; min-width: 0; }
.st-tool { background: var(--st-panel); border: 1px solid var(--st-line); padding: 12px; display: grid; gap: 10px; }
.st-tool h3 { margin: 0; font-size: 12px; flex-wrap: wrap; font-weight: normal; letter-spacing: .16em; text-transform: uppercase; color: var(--st-muted); display: flex; justify-content: space-between; gap: 8px; }
.st-tool h3 em { font-style: normal; color: var(--st-phos-dim); }
#stAssist.is-off { color: var(--st-amber); }
.st-freq { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px 2px; }
.st-fcol { display: grid; grid-template-rows: 46px auto; justify-items: center; }
.st-fbar { align-self: end; width: 70%; background: var(--st-phos-dim); min-height: 1px; transition: height .2s; }
.st-fcol.is-top .st-fbar { background: var(--st-phos); box-shadow: 0 0 8px rgba(109,255,154,.6); }
.st-fcol span { font-size: 11px; color: var(--st-muted); }
.st-fcol.is-top span { color: var(--st-phos); }
.st-note { font-size: 12.5px; color: var(--st-muted); margin: 0; }
.st-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.st-seg .st-btn[aria-pressed="true"] { background: var(--st-phos-dim); color: #eafff0; border-color: var(--st-phos-dim); }
.st-dial { display: grid; grid-template-columns: 44px 1fr 44px; align-items: stretch; gap: 6px; }
.st-dial output { display: grid; place-items: center; background: var(--st-void); border: 1px solid var(--st-line); font-size: 18px; color: var(--st-phos); font-variant-numeric: tabular-nums; padding: 4px 0; }
.st-dial output small { display: block; font-size: 12px; color: var(--st-muted); }
.st-dial.is-off { opacity: .4; pointer-events: none; }
#stLock.is-done { background: var(--st-phos); color: var(--st-void); border-color: var(--st-phos); opacity: 1; }
#stLock.is-ready { background: var(--st-phos); color: var(--st-void); border-color: var(--st-phos); animation: st-beckon 1s ease-in-out infinite; }
@keyframes st-beckon { 50% { box-shadow: 0 0 0 6px rgba(109,255,154,.25), 0 0 20px rgba(109,255,154,.6); } }
.st-coach { font-size: 14px; color: var(--st-void); background: var(--st-phos); padding: 8px 12px; line-height: 1.4; }
.st-coach b { font-weight: normal; opacity: .7; margin-right: 6px; }
.is-spot { border-color: var(--st-phos) !important; box-shadow: 0 0 0 1px var(--st-phos), 0 0 22px rgba(109,255,154,.35); }
.st-keys { font-size: 12px; color: var(--st-muted); line-height: 1.7; }
.st-keys { display: block; }
.st-keys kbd { display: inline-block; width: auto; margin: 0 1px; font-family: inherit; font-size: 12px; line-height: 1.5; border: 1px solid var(--st-line); border-radius: 2px; padding: 0 5px; color: var(--st-text); background: var(--st-panel-2); box-shadow: none; }

.st-share { width: 100%; box-sizing: border-box; text-align: left; white-space: pre; background: var(--st-void); border: 1px solid var(--st-line); padding: 10px 12px; color: var(--st-phos); font-size: 14px; overflow-x: auto; margin: 0; }
.st-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
    .st-word.is-pop, #stTyped.is-miss, .st-field.is-hit, .st-field.is-stall .st-word .ct { animation: none; }
    .st-banner { transition: none; }
    #stLock.is-ready { animation: none; }
}
@media (max-width: 600px) {
    .storm { padding: 10px; }
    .st-modes { grid-template-columns: 1fr; }
}
.st-ach { margin: 6px 0 0 !important; color: #ffd23f !important; }

/* ---------------------------------------------------------------- touch (v3.64.1)
   body.st-touch on touch-only devices. The phone keyboard never opens (the typing box is read-only);
   the game's own key rows sit under the console. While a storm runs (.storm.is-live) the cabinet is
   stacked field → frequency bars → dial → lens/typing → keys and sized to one screen. */
.st-kb { display: grid; gap: 6px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.st-kbrow { display: flex; gap: 4px; justify-content: center; }
.st-key { flex: 1 1 0; max-width: 46px; min-width: 0; height: 44px; padding: 0; font: inherit; font-size: 17px; border-radius: 4px; cursor: pointer;
    background: var(--st-panel-2); color: var(--st-phos); border: 1px solid var(--st-line); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.st-key.is-down { background: var(--st-phos); color: var(--st-void); }
.st-back { flex-grow: 1.6; max-width: 72px; color: var(--st-amber); }

.st-touch .st-keys, .st-touch .st-tool .st-note { display: none !important; }
.st-touch .st-btn, .st-touch .st-modebtn { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.st-touch #stTyped { caret-color: transparent; font-size: 20px; padding: 6px 10px; }
.st-touch .st-field { height: 520px; }
.st-touch .storm.is-live .st-field { height: max(190px, calc(100vh - 416px)); height: max(190px, calc(100svh - 416px)); }
.st-touch .storm.is-live { padding: 8px; gap: 8px; }

@media (max-width: 820px) {
    /* one column: the tool rack moves between the field and the typing console */
    .st-touch .st-stage { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
    .st-touch .st-play, .st-touch .st-tools { display: contents; }
    .st-touch .st-field { order: 1; }
    .st-touch #stToolFreq { order: 2; }
    .st-touch #stToolKey { order: 3; }
    .st-touch .st-console { order: 4; }
    .st-touch .storm.is-live { gap: 6px; }
    /* the site's floating rain buttons would sit on the field: tucked away while a storm runs, back after */
    .st-touch.st-live #matrix-controls { display: none; }
    .st-touch .st-bar { gap: 10px; justify-content: space-between; flex-wrap: nowrap; }
    .st-touch .st-scored { display: none; }          /* no room beside the stats; the start card says it instead */
    .st-touch .st-scored-touch { display: block; }
    .st-touch .st-stat b { font-size: 17px; }
    .st-touch .st-stat span { font-size: 9px; letter-spacing: .1em; }
    .st-touch .st-pip { width: 11px; height: 11px; }
    .st-touch .st-pips { height: 20px; }
    .st-touch .st-mode { display: none; }
    .st-touch #stPauseBtn { padding: 6px 10px; font-size: 13px; }
    .st-touch .st-tool, .st-touch .st-console { padding: 6px 8px; gap: 6px; }
    .st-touch .st-tool h3 { display: none; }
    /* frequency: one thin row of 26 */
    .st-touch .st-freq { grid-template-columns: repeat(26, 1fr); gap: 0 1px; }
    .st-touch .st-fcol { grid-template-rows: 22px auto; }
    .st-touch .st-fcol span { font-size: 9px; line-height: 1.2; }
    /* key dial: cipher type and shift on one row */
    .st-touch #stToolKey { grid-template-columns: 1fr 1.3fr; }
    .st-touch .st-seg .st-btn, .st-touch .st-dial .st-btn { min-height: 40px; padding: 4px 2px; font-size: 13px; }
    .st-touch .st-dial { grid-template-columns: 38px 1fr 38px; gap: 4px; }
    .st-touch .st-dial output { font-size: 15px; padding: 1px 0; line-height: 1.15; }
    .st-touch .st-dial output small { font-size: 10px; }
    /* Lock sits beside the typing box */
    .st-touch .st-typerow #stLock { flex: 0 0 auto; width: 42%; padding: 4px 6px; font-size: 12.5px; line-height: 1.2; white-space: normal; }
    .st-touch .st-lens { font-size: 12.5px; min-height: 0; }
    .st-touch #stTyped { min-height: 40px; }
    /* the coach floats over the top of the field */
    .st-touch .st-field .st-coach { position: absolute; left: 6px; right: 6px; top: 6px; z-index: 3; font-size: 12.5px; padding: 5px 8px; opacity: .93; pointer-events: none; }
    .st-touch .st-word .ct { font-size: 19px; letter-spacing: .08em; }
    .st-touch .st-key { height: 42px; }
}

/* ---------------------------------------------------------------- Elite modes (part C, v3.65.0) */
.st-elite-head { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #ffd23f !important; margin-top: 2px !important; }
.st-modes-elite { grid-template-columns: repeat(3, 1fr); }
.st-modes-elite .st-modebtn { border-color: #4a4320; }
.st-modes-elite .st-modebtn[aria-pressed="true"] { border-color: #ffd23f; box-shadow: 0 0 0 1px #ffd23f; }
.st-modes-elite .st-modebtn[aria-pressed="true"] b { color: #ffd23f; }
.st-modebtn.is-locked { opacity: .6; }
.st-modebtn.is-locked:hover { opacity: .85; }
.st-keys-adv { display: none; }
.storm.is-adv .st-keys-adv { display: inline; }
.st-dial-a output { font-size: 15px; }
@media (max-width: 600px) { .st-modes-elite { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
    .st-touch #stToolKey.is-adv .st-seg { grid-column: 1 / -1; }
    .st-touch #stToolKey.is-adv .st-seg .st-btn { font-size: 12px; }
}
/* Between storms the start and end cards sit in the flow, so the field grows to fit them (the start card
   is taller with the Elite modes); during a storm the field keeps its fixed height. */
.storm:not(.is-live) .st-field { height: auto; min-height: clamp(340px, 60vh, 580px); }
.storm:not(.is-live) .st-overlay:not([hidden]) { position: relative; inset: auto; min-height: clamp(340px, 60vh, 580px); }
/* phones, Advanced: the four-cipher row needs a little more room */
.st-touch .storm.is-live.is-adv .st-field { height: max(180px, calc(100vh - 466px)); height: max(180px, calc(100svh - 466px)); }

/* ---------------------------------------------------------------- seasons (part D, v3.66.0)
   body.storm-accent-<accent> (the season's site accent, SEASON_ACCENTS) recolours the cabinet; the field's
   own rain reads --st-rain / --st-rain-hi and mixes in the season's glyphs (cipher-storm.js). */
.storm-page { --st-rain: #3fbf6a; --st-rain-hi: #c9ffd9; }
.storm-accent-orange  { --st-phos: #ffad4d; --st-phos-dim: #8f5a1f; --st-line: #3d2a14; --st-rain: #c7731f; --st-rain-hi: #ffe0b0; }
.storm-accent-harvest { --st-phos: #ffc65a; --st-phos-dim: #8c6a24; --st-line: #3b3016; --st-rain: #b7852c; --st-rain-hi: #ffeec2; }
.storm-accent-ice     { --st-phos: #9fe6ff; --st-phos-dim: #3d7d99; --st-line: #1a3442; --st-rain: #5aa9cc; --st-rain-hi: #e8f9ff; }
.storm-accent-cyan    { --st-phos: #6ff6ff; --st-phos-dim: #2b7e86; --st-line: #163a3e; --st-rain: #3cb6c0; --st-rain-hi: #d8fdff; }
.storm-accent-blue    { --st-phos: #8cb4ff; --st-phos-dim: #3a5a99; --st-line: #1b2a48; --st-rain: #4f78c9; --st-rain-hi: #e0eaff; }
.storm-accent-red     { --st-phos: #ff8a8a; --st-phos-dim: #8f3a3a; --st-line: #3f1c1c; --st-rain: #c24d4d; --st-rain-hi: #ffdcdc; }
.storm-accent-yellow  { --st-phos: #ffe066; --st-phos-dim: #8a7a2a; --st-line: #3a3416; --st-rain: #bfa53a; --st-rain-hi: #fff6cc; }
.storm-accent-magenta { --st-phos: #ff8ef0; --st-phos-dim: #8f3f86; --st-line: #3d1a3a; --st-rain: #c255b3; --st-rain-hi: #ffe0fa; }
.storm-season .st-word .ct { text-shadow: 0 0 10px color-mix(in srgb, var(--st-phos) 55%, transparent); }
.storm-season .st-field { background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--st-phos) 10%, #050806) 0%, var(--st-void) 70%); }
.st-season-line { color: var(--st-phos) !important; font-size: 14px; letter-spacing: .04em; }
