/* ============================================================
   RE:MARKET — sci-fi HUD theme
   Palette: neon cyan (#22d3ee) + neon orange (#fb923c) on cosmic dark
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

@keyframes hud-scan {
    0%   { background-position: 0 0; }
    100% { background-position: 0 200px; }
}
@keyframes glow-pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: 0.75; }
}

html, body {
    height: 100%;
    color: #cbd5e1;
    font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(ellipse at 20% 0%,   rgba(34, 211, 238, 0.10) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 100%, rgba(251, 146, 60, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%,  #06121f 0%, #02060d 70%, #000 100%);
    background-attachment: fixed;
    overflow-x: hidden;
    position: relative;
    /* --- Per-round theme variables (Round 1 = cyan, Round 2 = orange) --- */
    --accent:            #22d3ee;
    --accent-strong:     #67e8f9;
    --accent-value:      #f0f9ff;
    --accent-glow:       rgba(34, 211, 238, 0.35);
    --accent-glow-weak:  rgba(34, 211, 238, 0.14);
    --accent-tint:       rgba(34, 211, 238, 0.22);
    --accent-tint-strong:rgba(34, 211, 238, 0.4);
    transition: background 0.4s ease;
}
body.round-2 {
    --accent:            #fb923c;
    --accent-strong:     #fdba74;
    --accent-value:      #fff7ed;
    --accent-glow:       rgba(251, 146, 60, 0.35);
    --accent-glow-weak:  rgba(251, 146, 60, 0.14);
    --accent-tint:       rgba(251, 146, 60, 0.28);
    --accent-tint-strong:rgba(251, 146, 60, 0.45);
}
/* subtle scanning grid across the whole page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse at center, black 40%, transparent 90%);
    z-index: 0;
}

#app {
    max-width: 1040px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100%;
    position: relative;
    z-index: 1;
}

/* ---------- Top bar --------------------------------------- */
#topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 4px 10px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.15);
}

.brand { display: flex; align-items: baseline; gap: 14px; }
.brand .title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 6px;
    color: #22d3ee;
    text-shadow:
        0 0 8px rgba(34, 211, 238, 0.6),
        0 0 18px rgba(34, 211, 238, 0.4),
        0 0 36px rgba(8, 145, 178, 0.35);
}
.brand .tagline {
    font-size: 10px;
    color: #64748b;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.status { display: flex; gap: 10px; }

/* ---------- Glass chip / panel shared style --------------- */
.chip {
    font-size: 10px;
    padding: 6px 12px;
    letter-spacing: 2px;
    color: var(--accent-strong);
    background: rgba(3, 12, 24, 0.4);
    border: 1px solid var(--accent-tint);
    border-radius: 2px;
    text-transform: uppercase;
    transition: color 0.3s, border-color 0.3s;
}
#chip-round {
    animation: glow-pulse 3s ease-in-out infinite;
}

/* ---------- Chart shell ----------------------------------- */
#stage-wrapper {
    position: relative;
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--accent-tint);
    background: rgba(3, 12, 24, 0.5);
    box-shadow: inset 0 0 60px rgba(2, 20, 40, 0.5);
    transition: border-color 0.3s, box-shadow 0.3s;
}

/* Electric current traveling around the chart border ------- */
@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes border-current {
    to { --border-angle: 360deg; }
}
#stage-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: 3px;
    background: conic-gradient(
        from var(--border-angle),
        transparent 0deg,
        var(--accent-strong) 14deg,
        var(--accent) 28deg,
        transparent 70deg,
        transparent 360deg
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
            mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    z-index: 10;   /* above overlay (5) so it shows on start screen too */
    animation: border-current 3.5s linear infinite;
    filter: drop-shadow(0 0 5px var(--accent-strong));
    opacity: 0.9;
}

#chart {
    display: block;
    width: 100%;
    height: auto;
    background: transparent;
}

/* ---------- Overlay --------------------------------------- */
#overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(34, 211, 238, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(251, 146, 60, 0.10) 0%, transparent 50%),
        rgba(2, 8, 16, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: opacity 0.3s ease;
    z-index: 5;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

.overlay-inner {
    text-align: center;
    padding: 32px 56px;
    max-width: 680px;
    border: 1px solid rgba(34, 211, 238, 0.25);
    background: rgba(6, 18, 32, 0.5);
    border-radius: 4px;
    box-shadow:
        0 0 40px rgba(34, 211, 238, 0.2),
        inset 0 0 40px rgba(0, 0, 0, 0.6);
    position: relative;
}
.overlay-inner::before,
.overlay-inner::after {
    content: '';
    position: absolute;
    width: 22px; height: 22px;
    border: 1px solid #22d3ee;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
}
.overlay-inner::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.overlay-inner::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

#overlay-title {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 10px;
    color: #67e8f9;
    text-shadow:
        0 0 10px rgba(34, 211, 238, 0.8),
        0 0 24px rgba(34, 211, 238, 0.5),
        0 0 48px rgba(8, 145, 178, 0.4);
    margin-bottom: 10px;
}
#overlay-sub {
    font-size: 12px;
    color: #94a3b8;
    letter-spacing: 3px;
    margin-bottom: 22px;
    text-transform: uppercase;
}
#overlay-body {
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.9;
    letter-spacing: 0.5px;
    margin-bottom: 28px;
    white-space: pre-line;
    text-align: left;
    display: inline-block;
}
#overlay-body .num.pos { color: #22d3ee; text-shadow: 0 0 6px rgba(34, 211, 238, 0.6); }
#overlay-body .num.neg { color: #fb923c; text-shadow: 0 0 6px rgba(251, 146, 60, 0.6); }
#overlay-body .big-num {
    display: inline-block;
    font-size: 44px;
    font-weight: 900;
    letter-spacing: 3px;
    padding: 4px 0;
    margin: 4px 0;
    text-shadow: 0 0 14px currentColor;
}
#overlay-body .big-num.pos { color: #22d3ee; }
#overlay-body .big-num.neg { color: #fb923c; }
#overlay-body .reaction {
    display: inline-block;
    font-size: 20px;
    letter-spacing: 6px;
    color: #cbd5e1;
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 6px;
}
#overlay-body .key-hint {
    display: inline-block;
    min-width: 30px;
    padding: 2px 8px;
    background: linear-gradient(180deg, rgba(255,255,255,0.15), rgba(0,0,0,0.35));
    border: 1px solid var(--accent);
    color: var(--accent-strong);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    margin-right: 8px;
    text-shadow: 0 0 6px var(--accent-glow);
    box-shadow: 0 2px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
}

/* ---------- Cinematic reveal text (SAME MARKET / etc.) --- */
#reveal-text {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    z-index: 40;
    transition: opacity 0.35s ease;
}
#reveal-text.visible { opacity: 1; }
#reveal-text-inner {
    font-family: inherit;
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 14px;
    color: var(--accent-strong);
    text-transform: uppercase;
    padding: 22px 44px;
    background: rgba(2, 8, 16, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-top: 1px solid var(--accent-tint-strong);
    border-bottom: 1px solid var(--accent-tint-strong);
    text-shadow:
        0 0 22px var(--accent-glow),
        0 0 46px var(--accent-glow);
}

/* ---------- Glitch swap animations ---------------------- */
@keyframes glitch-out {
    0%   { opacity: 1; transform: translate(0);   filter: none; }
    20%  { opacity: 0.55; transform: translate(-3px, 0);  filter: hue-rotate(90deg) contrast(1.4); }
    40%  { opacity: 0.75; transform: translate(3px, 0);   filter: contrast(1.8); }
    60%  { opacity: 0.25; transform: translate(-2px, 1px); }
    80%  { opacity: 0.4;  transform: translate(2px, -1px); filter: blur(1px); }
    100% { opacity: 0;    transform: translate(0);   filter: blur(2px); }
}
.glitching { animation: glitch-out 0.4s ease-in forwards; }

@keyframes appear-in {
    0%   { opacity: 0; transform: translateY(4px); filter: blur(2px); }
    100% { opacity: 1; transform: translateY(0);   filter: none; }
}
.appearing { animation: appear-in 0.5s ease-out; }

#overlay-btn {
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.9), rgba(8, 145, 178, 0.85));
    color: #041019;
    border: 1px solid #67e8f9;
    padding: 12px 40px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 4px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
        0 0 20px rgba(34, 211, 238, 0.5),
        inset 0 0 12px rgba(255, 255, 255, 0.2);
    transition: filter 0.15s, transform 0.05s;
    text-transform: uppercase;
}
#overlay-btn:hover  { filter: brightness(1.15) saturate(1.2); }
#overlay-btn:active { transform: translateY(1px); }

/* ---------- HUD (single-line terminal strip) -------------- */
.hud {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 0;
    padding: 8px 20px;
    background: rgba(2, 10, 20, 0.35);
    border-top: 1px solid var(--accent-tint);
    border-bottom: 1px solid var(--accent-tint);
    border-radius: 0;
    transition: border-color 0.3s;
}
.hud.hidden { display: none; }

.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 10px;
    padding: 2px 20px;
    background: none;
    border: none;
    box-shadow: none;
    flex: 0 1 auto;
    position: relative;
}
.stat + .stat {
    border-left: 1px solid var(--accent-tint);
}
.stat::before, .stat::after { content: none; }

.stat .k {
    font-size: 10px;
    color: var(--accent-strong);
    letter-spacing: 2px;
    opacity: 0.85;
    text-transform: uppercase;
}
.stat .v {
    font-size: 15px;
    color: var(--accent-value);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat + .stat.score,
.stat.past + .stat.score { border-left-color: rgba(253, 224, 71, 0.28); }

.stat.past .k { color: #fdba74; }
.stat.past .v { color: #fed7aa; text-shadow: 0 0 6px rgba(251, 146, 60, 0.3); }

.stat.score .k { color: #fde68a; }
.stat.score .v { color: #fef3c7; text-shadow: 0 0 8px rgba(253, 224, 71, 0.5); }

/* ---------- Influence panel ------------------------------- */
#influence-panel {
    position: relative;
    background: linear-gradient(180deg, rgba(60, 20, 8, 0.32) 0%, rgba(20, 8, 4, 0.32) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(251, 146, 60, 0.35);
    padding: 12px 16px;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow:
        0 0 16px rgba(251, 146, 60, 0.12),
        inset 0 0 12px rgba(251, 146, 60, 0.04);
}
#influence-panel::before,
#influence-panel::after {
    content: '';
    position: absolute;
    width: 6px; height: 6px;
    border: 1px solid rgba(251, 146, 60, 0.9);
}
#influence-panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
#influence-panel::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }
#influence-panel.hidden { display: none; }

.influence-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.influence-row .k {
    font-size: 10px;
    letter-spacing: 2px;
    color: #fdba74;
    min-width: 160px;
    text-transform: uppercase;
}
.influence-row .v {
    font-size: 12px;
    color: #fed7aa;
    min-width: 40px;
    text-align: right;
    font-weight: 700;
}

.bar-outer {
    flex: 1;
    background: rgba(2, 6, 12, 0.6);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 2px;
    height: 14px;
    overflow: hidden;
    position: relative;
}
.bar-outer::after {
    content: '';
    position: absolute; inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0, transparent 8px, rgba(0,0,0,0.25) 8px, rgba(0,0,0,0.25) 9px);
    pointer-events: none;
}
.bar-inner {
    height: 100%;
    background: linear-gradient(90deg, #fb923c 0%, #fbbf24 60%, #fde68a 100%);
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.7);
    transition: width 0.1s linear;
}
.next-action {
    font-size: 11px;
    color: #cbd5e1;
    letter-spacing: 2px;
    text-align: center;
    padding-top: 2px;
    text-transform: uppercase;
}
.next-action .up   { color: #22d3ee; font-weight: 800; text-shadow: 0 0 6px rgba(34,211,238,0.7); }
.next-action .down { color: #fb923c; font-weight: 800; text-shadow: 0 0 6px rgba(251,146,60,0.7); }

/* --- Past You timeline --- */
.timeline-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.timeline-row .k {
    font-size: 10px;
    letter-spacing: 2px;
    color: #fdba74;
    min-width: 160px;
    text-transform: uppercase;
}
.timeline-track {
    flex: 1;
    position: relative;
    height: 28px;
    background: rgba(2, 6, 12, 0.55);
    border: 1px solid rgba(251, 146, 60, 0.3);
    border-radius: 2px;
    overflow: visible;
}
.timeline-track .tick {
    position: absolute;
    top: 0;
    height: 100%;
    width: 1px;
    background: rgba(251, 146, 60, 0.18);
    pointer-events: none;
}
.timeline-track .tick span {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 1px;
    padding-top: 1px;
    white-space: nowrap;
}
.timeline-track .now {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: #fde68a;
    box-shadow: 0 0 8px rgba(253, 224, 71, 0.9);
    z-index: 2;
}
.timeline-track .marker {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 0 8px currentColor;
    z-index: 3;
}
.timeline-track .marker.up   { color: #22d3ee; }
.timeline-track .marker.down { color: #fb923c; }
.timeline-track .marker.imminent {
    animation: glow-pulse 0.6s ease-in-out infinite;
    font-size: 20px;
}

/* ---------- Buttons (angular HUD keys) -------------------- */
#controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 6px;
}
#r1-controls, #r2-controls {
    display: flex;
    gap: 32px;
    justify-content: center;
}
#r1-controls.hidden, #r2-controls.hidden { display: none; }

/* Octagonal clip so the shape reads as a HUD action key, not a web CTA.
   drop-shadow works with clip-path where box-shadow doesn't. */
.btn {
    flex: 0 0 auto;
    min-width: 220px;
    padding: 16px 26px;
    background: linear-gradient(180deg, rgba(8, 32, 58, 0.7), rgba(2, 12, 24, 0.7));
    color: #cbd5e1;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 5px;
    cursor: pointer;
    border: 0;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-transform: uppercase;
    transition: filter 0.15s, transform 0.05s;
    clip-path: polygon(
        14px 0, calc(100% - 14px) 0,
        100% 14px, 100% calc(100% - 14px),
        calc(100% - 14px) 100%, 14px 100%,
        0 calc(100% - 14px), 0 14px
    );
    filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.2));
}
.btn::before, .btn::after { content: none; }
.btn:hover:not(:disabled)  { filter: drop-shadow(0 0 22px currentColor) brightness(1.15) saturate(1.15); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.25; cursor: not-allowed; filter: grayscale(0.7); }

/* Short flash on successful action */
@keyframes btn-flash {
    0%   { filter: drop-shadow(0 0 34px currentColor) brightness(2) saturate(1.4); }
    60%  { filter: drop-shadow(0 0 22px currentColor) brightness(1.4) saturate(1.2); }
    100% { filter: drop-shadow(0 0 14px currentColor) brightness(1)   saturate(1); }
}
.btn.flash { animation: btn-flash 0.16s ease-out; }

/* Hotkey rendered as a raised keycap */
.btn .hotkey {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(0,0,0,0.4));
    border: 1px solid currentColor;
    border-radius: 3px;
    color: currentColor;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-shadow: none;
    box-shadow:
        0 2px 0 rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.18);
}

/* Round 1 actions: BUY cyan / SELL orange (cyan-world with orange contrast) */
.btn.buy {
    color: #67e8f9;
    background: linear-gradient(180deg, rgba(14, 74, 105, 0.9), rgba(3, 26, 45, 0.85));
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
    filter: drop-shadow(0 0 14px rgba(34, 211, 238, 0.45));
}
.btn.sell {
    color: #fdba74;
    background: linear-gradient(180deg, rgba(105, 47, 14, 0.9), rgba(45, 20, 3, 0.85));
    text-shadow: 0 0 10px rgba(251, 146, 60, 0.7);
    filter: drop-shadow(0 0 14px rgba(251, 146, 60, 0.45));
}
/* Round 2 actions: PUSH↑ amber / PUSH↓ red (fully warm palette, no cyan) */
.btn.push-up {
    color: #fde68a;
    background: linear-gradient(180deg, rgba(146, 64, 14, 0.9), rgba(69, 26, 3, 0.85));
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.75);
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.5));
}
.btn.push-down {
    color: #fca5a5;
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.9), rgba(45, 8, 8, 0.85));
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.75);
    filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.5));
}

.hint {
    text-align: center;
    color: #475569;
    font-size: 10px;
    letter-spacing: 2px;
    padding: 4px;
    text-transform: uppercase;
}

/* ---------- Rules chip-button ----------------------------- */
.chip-btn {
    font-family: inherit;
    cursor: pointer;
    transition: filter 0.15s, transform 0.05s;
}
.chip-btn:hover  { filter: brightness(1.3) saturate(1.15); }
.chip-btn:active { transform: translateY(1px); }
.chip-btn.muted  { opacity: 0.5; color: #64748b; border-color: rgba(148,163,184,0.25); }

/* ---------- Full-screen fade-to-black transition --------- */
#fade-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    opacity: 0;
    pointer-events: none;
    z-index: 60;   /* above overlay/modal/reveal so it covers everything */
    transition: opacity 0.32s ease-in-out;
}
#fade-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Rules modal ----------------------------------- */
#rules-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(34, 211, 238, 0.10) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(251, 146, 60, 0.10) 0%, transparent 55%),
        rgba(2, 8, 16, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 50;
    padding: 24px;
    transition: opacity 0.2s ease;
}
#rules-modal.hidden { opacity: 0; pointer-events: none; }

#rules-modal .modal-inner {
    position: relative;
    width: 100%;
    max-width: 760px;
    max-height: 92vh;
    overflow-y: auto;
    padding: 32px 40px 28px;
    background: rgba(6, 18, 32, 0.7);
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 4px;
    box-shadow:
        0 0 40px rgba(34, 211, 238, 0.22),
        inset 0 0 40px rgba(0, 0, 0, 0.6);
    color: #cbd5e1;
}
#rules-modal .modal-inner::before,
#rules-modal .modal-inner::after {
    content: '';
    position: absolute;
    width: 22px; height: 22px;
    border: 1px solid #22d3ee;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
}
#rules-modal .modal-inner::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
#rules-modal .modal-inner::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

#rules-modal .modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid rgba(34, 211, 238, 0.4);
    color: #67e8f9;
    font-size: 18px;
    line-height: 1;
    font-family: inherit;
    cursor: pointer;
    border-radius: 2px;
    transition: background 0.15s;
}
#rules-modal .modal-close:hover {
    background: rgba(34, 211, 238, 0.15);
    color: #f0f9ff;
}

#rules-modal .modal-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 6px;
    color: #67e8f9;
    text-shadow:
        0 0 10px rgba(34, 211, 238, 0.7),
        0 0 24px rgba(34, 211, 238, 0.4);
    margin-bottom: 6px;
    text-align: center;
}
#rules-modal .modal-sub {
    font-size: 11px;
    letter-spacing: 3px;
    color: #94a3b8;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 22px;
}

#rules-modal .modal-body { display: flex; flex-direction: column; gap: 18px; }

#rules-modal .rules-section h3 {
    font-size: 12px;
    letter-spacing: 3px;
    color: #cbd5e1;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(34, 211, 238, 0.18);
    text-transform: uppercase;
}
#rules-modal .rules-section h3.s-trader {
    color: #67e8f9; border-color: rgba(34, 211, 238, 0.4);
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.5);
}
#rules-modal .rules-section h3.s-market {
    color: #fdba74; border-color: rgba(251, 146, 60, 0.4);
    text-shadow: 0 0 6px rgba(251, 146, 60, 0.5);
}
#rules-modal .rules-section h3.s-score {
    color: #fde68a; border-color: rgba(253, 224, 71, 0.4);
    text-shadow: 0 0 6px rgba(253, 224, 71, 0.5);
}

#rules-modal .rules-section p,
#rules-modal .rules-section li {
    font-size: 13px;
    line-height: 1.7;
    color: #cbd5e1;
}
#rules-modal .rules-section b { color: #f0f9ff; }
#rules-modal .rules-section ul { list-style: none; padding: 0; }
#rules-modal .rules-section ul li {
    padding-left: 18px;
    position: relative;
    margin-bottom: 4px;
}
#rules-modal .rules-section ul li::before {
    content: '›';
    position: absolute;
    left: 4px;
    top: 0;
    color: #22d3ee;
    font-weight: 800;
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.6);
}

/* Action grid: 2×2 cards for BUY/SELL/PUSH↑/PUSH↓ */
.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.action {
    padding: 12px 14px;
    background: rgba(2, 12, 24, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    position: relative;
}
.action .a-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-bottom: 2px;
}
.action .a-key {
    display: inline-block;
    background: rgba(2, 8, 16, 0.85);
    color: #94a3b8;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 2px;
    margin-left: 6px;
    letter-spacing: 1px;
    vertical-align: middle;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.action .a-round {
    font-size: 9px;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.action .a-text { font-size: 12px; line-height: 1.6; color: #cbd5e1; }

.action.buy {
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.15) inset;
}
.action.buy .a-name {
    color: #67e8f9;
    text-shadow: 0 0 6px rgba(34, 211, 238, 0.5);
}
.action.sell {
    border-color: rgba(251, 146, 60, 0.45);
    box-shadow: 0 0 12px rgba(251, 146, 60, 0.15) inset;
}
.action.sell .a-name {
    color: #fdba74;
    text-shadow: 0 0 6px rgba(251, 146, 60, 0.5);
}
.action.push-up {
    border-color: rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.15) inset;
}
.action.push-up .a-name {
    color: #fde68a;
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.55);
}
.action.push-down {
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.15) inset;
}
.action.push-down .a-name {
    color: #fca5a5;
    text-shadow: 0 0 6px rgba(239, 68, 68, 0.55);
}

/* Round 1: show simple; hide full. Round 2+: show full; hide simple. */
body.round-1 #rules-modal .full-only { display: none; }
body.round-2 #rules-modal .simple-body { display: none; }

/* Simple rules body (Round 1) */
#rules-modal .simple-body {
    text-align: center;
    padding: 8px 40px 4px;
}
.simple-controls {
    display: inline-flex;
    flex-direction: column;
    gap: 14px;
    margin: 28px auto 32px;
}
.simple-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 15px;
    color: #e2e8f0;
    letter-spacing: 3px;
    justify-content: flex-start;
}
.simple-row .key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(0,0,0,0.4));
    border: 1px solid var(--accent);
    color: var(--accent-strong);
    border-radius: 4px;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 0 8px var(--accent-glow);
}
.simple-info p {
    font-size: 13px;
    color: #cbd5e1;
    margin-bottom: 10px;
    letter-spacing: 2px;
    line-height: 1.6;
}
.simple-info p.emphasis {
    margin-top: 18px;
    font-size: 14px;
    color: var(--accent-strong);
    text-shadow: 0 0 8px var(--accent-glow);
    letter-spacing: 3px;
    font-weight: 800;
    text-transform: uppercase;
}

#rules-ok {
    display: block;
    margin: 22px auto 0;
    background: linear-gradient(180deg, rgba(34, 211, 238, 0.9), rgba(8, 145, 178, 0.85));
    color: #041019;
    border: 1px solid #67e8f9;
    padding: 10px 36px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 4px;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    box-shadow:
        0 0 18px rgba(34, 211, 238, 0.4),
        inset 0 0 10px rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    transition: filter 0.15s, transform 0.05s;
}
#rules-ok:hover  { filter: brightness(1.15) saturate(1.15); }
#rules-ok:active { transform: translateY(1px); }
