:root {
    color-scheme: dark;
    --bg: #050814;
    --panel: #091424;
    --panel-2: #0c1c31;
    --line: rgba(116, 211, 255, 0.28);
    --grid: rgba(172, 230, 255, 0.25);
    --text: #eef8ff;
    --muted: #7e9bb4;
    --cyan: #42ddff;
    --red: #ff3048;
    --blue: #245cff;
    --tie: #16d66a;
    --amber: #ffb11a;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
}

.app {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    background:
        radial-gradient(circle at 20% 0%, rgba(66, 221, 255, 0.14), transparent 34%),
        linear-gradient(135deg, #050814, #08172a 52%, #040813);
}

.stage {
    height: 100dvh;
    min-width: 0;
    display: grid;
    grid-template-rows: 36px minmax(0, 1fr) 74px 114px;
    padding: max(6px, env(safe-area-inset-top)) 6px max(14px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
    gap: 3px;
}

@supports (height: 100svh) {
    .app,
    .stage {
        height: 100svh;
        min-height: 100svh;
    }
}

.hud,
.score-strip,
.controls,
.drawer-card {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(12, 28, 49, 0.95), rgba(6, 14, 27, 0.95));
    box-shadow: inset 0 0 18px rgba(66, 221, 255, 0.08), 0 16px 34px rgba(0, 0, 0, 0.32);
}

.hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 7px 5px 10px;
    border-radius: 8px;
}

.hud strong {
    display: block;
    font-size: 14px;
    letter-spacing: 0;
}

.hud span {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.icon-button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(66, 221, 255, 0.12);
    border: 1px solid rgba(66, 221, 255, 0.35);
    color: var(--cyan);
    font-size: 20px;
    line-height: 1;
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.logout-link,
.agent-link,
.vip-link {
    min-width: 36px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0 8px;
    border: 1px solid rgba(66, 221, 255, 0.28);
    border-radius: 8px;
    color: #a7d8e9;
    background: rgba(66, 221, 255, 0.08);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.vip-link {
    color: #211500;
    border-color: rgba(255, 177, 26, 0.72);
    background: linear-gradient(180deg, #ffe29a, #ffb11a);
    box-shadow: 0 0 16px rgba(255, 177, 26, 0.26);
}

.login-shell {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        radial-gradient(circle at 20% 8%, rgba(66, 221, 255, 0.2), transparent 30%),
        radial-gradient(circle at 78% 70%, rgba(255, 48, 72, 0.12), transparent 28%),
        linear-gradient(135deg, #050814, #08172a 52%, #040813);
}

.login-card {
    width: min(100%, 360px);
    padding: 18px;
    border: 1px solid rgba(66, 221, 255, 0.38);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(12, 28, 49, 0.96), rgba(4, 12, 24, 0.98));
    box-shadow: inset 0 0 24px rgba(66, 221, 255, 0.11), 0 24px 58px rgba(0, 0, 0, 0.44);
}

.login-brand {
    margin-bottom: 16px;
}

.login-brand strong {
    display: block;
    color: #f0fbff;
    font-size: 24px;
    line-height: 1.15;
}

.login-brand span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 13px;
}

.login-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 14px;
    padding: 4px;
    border: 1px solid rgba(66, 221, 255, 0.2);
    border-radius: 8px;
    background: rgba(2, 10, 19, 0.7);
}

.login-switch a {
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #8fb2c8;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
}

.login-switch a.active {
    color: #00131c;
    background: linear-gradient(180deg, #95efff, #1ec7f2);
    box-shadow: 0 0 16px rgba(66, 221, 255, 0.28);
}

.login-form {
    display: grid;
    gap: 12px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: #9bb8cc;
    font-size: 12px;
    font-weight: 800;
}

.login-form input {
    width: 100%;
    height: 44px;
    border: 1px solid rgba(116, 211, 255, 0.28);
    border-radius: 8px;
    padding: 0 12px;
    color: #eef8ff;
    background: rgba(2, 10, 19, 0.78);
    outline: none;
}

.login-form input:focus {
    border-color: rgba(66, 221, 255, 0.7);
    box-shadow: 0 0 0 2px rgba(66, 221, 255, 0.12);
}

.login-form button {
    height: 44px;
    border-radius: 8px;
    color: #00131c;
    background: linear-gradient(180deg, #95efff, #1ec7f2);
    box-shadow: 0 0 22px rgba(66, 221, 255, 0.32);
    font-size: 16px;
    font-weight: 900;
}

.login-error {
    margin: 0;
    padding: 9px 10px;
    border: 1px solid rgba(255, 77, 96, 0.42);
    border-radius: 8px;
    color: #ffb7c0;
    background: rgba(255, 48, 72, 0.1);
    font-size: 12px;
}

.road-area {
    min-height: 0;
    border: 1px solid rgba(66, 221, 255, 0.34);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(2, 10, 19, 0.92);
    box-shadow: inset 0 0 24px rgba(66, 221, 255, 0.1);
}

.road-layout {
    height: 100%;
    display: grid;
    grid-template-rows: 19% 45% 36%;
    gap: 2px;
    padding: 2px;
}

.road-panel {
    min-height: 0;
    display: grid;
    grid-template-rows: 22px 1fr;
    overflow: hidden;
    border: 1px solid rgba(66, 221, 255, 0.26);
    border-radius: 4px;
    background:
        linear-gradient(90deg, rgba(66, 221, 255, 0.05), transparent 22%, transparent 78%, rgba(66, 221, 255, 0.04)),
        rgba(1, 8, 16, 0.78);
}

.derived-layout {
    min-height: 0;
    display: grid;
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
}

.derived-layout .road-panel {
    grid-template-rows: 18px 1fr;
}

.road-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    border-bottom: 1px solid rgba(66, 221, 255, 0.28);
    background: rgba(2, 10, 19, 0.86);
}

.mini-head {
    display: flex;
    align-items: center;
    padding: 0 7px;
    border-bottom: 1px solid rgba(66, 221, 255, 0.18);
    color: #7ee8ff;
    font-size: 11px;
    font-weight: 900;
    background: rgba(2, 10, 19, 0.72);
}

.road-head span {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
}

.road-head strong {
    color: var(--muted);
    font-size: 11px;
}

.road-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    grid-template-rows: repeat(var(--rows), 1fr);
    grid-auto-flow: column;
    overflow: hidden;
    scrollbar-width: none;
}

.road-grid::-webkit-scrollbar {
    display: none;
}

.road-cell {
    min-width: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    border-right: 1px solid rgba(172, 230, 255, 0.2);
    border-bottom: 1px solid rgba(172, 230, 255, 0.2);
    background: rgba(0, 7, 14, 0.24);
}

.bead {
    position: relative;
    width: min(7.3vw, 28px);
    height: min(7.3vw, 28px);
    max-width: 92%;
    max-height: 92%;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: inset 0 2px 7px rgba(255, 255, 255, 0.28), 0 0 8px rgba(255, 255, 255, 0.16);
}

.bead-grid .bead {
    width: min(5.8vw, 22px);
    height: min(5.8vw, 22px);
    font-size: 10px;
}

.big-road-grid .bead {
    width: min(7.8vw, 30px);
    height: min(7.8vw, 30px);
    font-size: 13px;
}

.derived-mark {
    width: auto;
    height: 78%;
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: 50%;
}

.derived-mark.eye {
    width: auto;
    height: 92%;
    aspect-ratio: 1 / 1;
    background: transparent;
    border: 1px solid currentColor;
    box-shadow: none;
}

.derived-mark.small {
    width: auto;
    height: 62%;
    aspect-ratio: 1 / 1;
    background: currentColor;
    border: 0;
}

.derived-mark.roach {
    width: 92%;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
    transform: rotate(-35deg);
}

.derived-mark.red:not(.eye) {
    color: #ff4058;
    box-shadow: 0 0 6px rgba(255, 64, 88, 0.45);
}

.derived-mark.blue:not(.eye) {
    color: #4d86ff;
    box-shadow: 0 0 6px rgba(77, 134, 255, 0.42);
}

.derived-mark.eye.red {
    color: #ff4058;
    box-shadow: none;
}

.derived-mark.eye.blue {
    color: #4d86ff;
    box-shadow: none;
}

.bead em {
    position: absolute;
    right: -2px;
    bottom: -2px;
    min-width: 12px;
    width: 12px;
    height: 12px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 1px solid #d8ffe5;
    background: var(--tie);
    color: #03160a;
    font-size: 9px;
    font-weight: 900;
    font-style: normal;
    line-height: 1;
}

.bead em:empty {
    min-width: 12px;
    width: 12px;
    height: 12px;
}

.bead.red,
.round.red,
.score.red span {
    background: radial-gradient(circle at 35% 24%, #ff8b96, var(--red) 58%, #810516);
}

.bead.blue,
.round.blue,
.score.blue span {
    background: radial-gradient(circle at 35% 24%, #7cabff, var(--blue) 58%, #071c88);
}

.bead.tie,
.round.tie,
.score.tie span {
    background: radial-gradient(circle at 35% 24%, #7cffaa, var(--tie) 58%, #086c34);
}

.score span {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 900;
}

.score-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr) 1.4fr;
    gap: 5px;
    padding: 8px 7px;
    border-radius: 8px;
}

.score {
    min-width: 0;
    display: grid;
    grid-template-rows: 42px 24px;
    place-items: center;
    gap: 2px;
    color: var(--muted);
}

.score span {
    width: 40px;
    height: 40px;
    color: #fff;
    background: #4a5d73;
    font-size: 18px;
}

.score strong {
    color: #fff;
    font-size: 22px;
    line-height: 1;
}

.score.wide strong {
    color: var(--cyan);
    font-size: 22px;
}

.controls {
    min-height: 0;
    display: grid;
    grid-template-columns: 45% 1fr;
    gap: 6px;
    padding: 6px;
    border-radius: 8px;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.number-pad button,
.pill,
.delete-key,
.round {
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
    box-shadow: inset 0 2px 10px rgba(255, 255, 255, 0.08), 0 8px 14px rgba(0, 0, 0, 0.28);
    font-weight: 850;
}

.number-pad button {
    min-height: 28px;
    color: #eef8ff;
    font-size: 20px;
}

.number-pad button.active {
    color: #00131c;
    background: linear-gradient(180deg, #95efff, #1ec7f2);
    box-shadow: 0 0 18px rgba(66, 221, 255, 0.38);
}

.action-pad {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: 32px 1fr;
    gap: 6px;
    align-items: center;
}

.pill {
    height: 32px;
    color: var(--cyan);
    font-size: 17px;
}

.action-pad .pill {
    grid-column: span 3;
}

.pill.ai {
    border-color: rgba(66, 221, 255, 0.54);
    background: linear-gradient(180deg, rgba(66, 221, 255, 0.22), rgba(23, 65, 95, 0.22));
    font-size: 15px;
}

.round {
    width: min(13vw, 54px);
    height: min(13vw, 54px);
    justify-self: center;
    grid-column: span 2;
    border-radius: 50%;
    font-size: 26px;
    font-weight: 900;
}

.round.dark {
    background: radial-gradient(circle at 36% 24%, #bdc6d0, #475261 58%, #171c24);
}

.delete-key {
    height: 32px;
    grid-column: span 3;
    color: #fff1f1;
    background: linear-gradient(180deg, rgba(255, 76, 92, 0.42), rgba(110, 10, 22, 0.64));
    border-color: rgba(255, 97, 112, 0.52);
    font-size: 16px;
    font-weight: 900;
}

.delete-key:disabled {
    opacity: 0.38;
    color: #91a0ad;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.side-rail {
    height: 100dvh;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: max(10px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) 10px 4px;
    background: rgba(0, 0, 0, 0.55);
    border-left: 1px solid rgba(66, 221, 255, 0.2);
}

.rail-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--cyan);
    font-size: 23px;
    font-weight: 900;
}

.tie-rail {
    color: #fff;
    background: rgba(22, 214, 106, 0.18);
}

.drawer {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: end center;
    padding: 12px;
    background: rgba(1, 5, 12, 0.72);
    backdrop-filter: blur(10px);
}

.drawer.hidden {
    display: none;
}

.feedback {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 14px;
    background: rgba(1, 5, 12, 0.66);
    backdrop-filter: blur(10px);
}

.analysis-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(1, 5, 12, 0.72);
    backdrop-filter: blur(12px);
}

.analysis-overlay.hidden {
    display: none;
}

.force-logout {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(1, 5, 12, 0.82);
    backdrop-filter: blur(14px);
}

.force-logout.hidden {
    display: none;
}

.payment-modal {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(1, 5, 12, 0.78);
    backdrop-filter: blur(14px);
}

.payment-modal.hidden {
    display: none;
}

.payment-card {
    width: min(100%, 340px);
    padding: 18px;
    border: 1px solid rgba(255, 177, 26, 0.62);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(35, 27, 8, 0.98), rgba(4, 11, 21, 0.98));
    box-shadow: inset 0 0 26px rgba(255, 177, 26, 0.14), 0 28px 64px rgba(0, 0, 0, 0.58);
}

.payment-card small {
    display: block;
    color: #ffcc65;
    font-size: 12px;
    font-weight: 800;
}

.payment-card strong {
    display: block;
    margin-top: 8px;
    color: #fff;
    font-size: 23px;
    line-height: 1.25;
}

.payment-card p {
    margin: 12px 0 16px;
    color: #d6e7f5;
    font-size: 14px;
    line-height: 1.55;
}

.payment-card button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    font-size: 17px;
    font-weight: 900;
}

.payment-card #paymentConfirm {
    color: #211500;
    background: linear-gradient(180deg, #ffe29a, #ffb11a);
    border: 1px solid rgba(255, 244, 204, 0.34);
    box-shadow: 0 0 22px rgba(255, 177, 26, 0.32), inset 0 2px 10px rgba(255, 255, 255, 0.28);
}

.payment-card #paymentCancel {
    margin-top: 10px;
    color: #a7d8e9;
    background: rgba(66, 221, 255, 0.08);
    border: 1px solid rgba(66, 221, 255, 0.24);
}

.force-card {
    width: min(100%, 340px);
    padding: 18px;
    border: 1px solid rgba(255, 79, 96, 0.58);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(38, 10, 20, 0.98), rgba(4, 9, 18, 0.98));
    box-shadow: inset 0 0 26px rgba(255, 79, 96, 0.12), 0 28px 64px rgba(0, 0, 0, 0.58);
}

.force-card small {
    display: block;
    color: #ff9aa7;
    font-size: 12px;
    font-weight: 700;
}

.force-card strong {
    display: block;
    margin-top: 8px;
    color: #fff;
    font-size: 24px;
    line-height: 1.2;
}

.force-card p {
    margin: 12px 0 16px;
    color: #ffd9de;
    font-size: 14px;
    line-height: 1.55;
}

.force-card button {
    width: 100%;
    min-height: 48px;
    border-radius: 8px;
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    background: linear-gradient(180deg, #ff6677, #d31831);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 22px rgba(255, 79, 96, 0.32), inset 0 2px 10px rgba(255, 255, 255, 0.22);
}

.analysis-card {
    width: min(100%, 310px);
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 18px;
    border: 1px solid rgba(66, 221, 255, 0.44);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(8, 28, 48, 0.98), rgba(2, 9, 18, 0.98));
    box-shadow: inset 0 0 28px rgba(66, 221, 255, 0.12), 0 24px 58px rgba(0, 0, 0, 0.54);
}

.analysis-card strong {
    font-size: 20px;
}

.analysis-card small {
    color: var(--muted);
    font-size: 12px;
}

.scanner {
    position: relative;
    width: 112px;
    height: 112px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(66, 221, 255, 0.1), transparent 58%),
        conic-gradient(from 0deg, transparent, rgba(66, 221, 255, 0.92), transparent 34%);
    animation: scanSpin 1.1s linear infinite;
}

.scanner::after {
    content: "";
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 1px solid rgba(66, 221, 255, 0.42);
    background: rgba(2, 9, 18, 0.92);
    box-shadow: inset 0 0 18px rgba(66, 221, 255, 0.16);
}

.scanner span {
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(66, 221, 255, 0.24);
    border-radius: 50%;
}

.scanner span:nth-child(2) {
    inset: 30px;
}

.scanner span:nth-child(3) {
    inset: 44px;
}

@keyframes scanSpin {
    to {
        transform: rotate(360deg);
    }
}

.feedback.hidden {
    display: none;
}

.feedback-card {
    width: min(100%, 380px);
    padding: 16px;
    border: 1px solid rgba(66, 221, 255, 0.42);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(10, 24, 43, 0.98), rgba(3, 10, 20, 0.98));
    box-shadow: inset 0 0 22px rgba(66, 221, 255, 0.1), 0 24px 52px rgba(0, 0, 0, 0.48);
}

.feedback-card small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.feedback-card > strong {
    display: block;
    margin-top: 6px;
    font-size: 24px;
}

.prediction-summary {
    margin-top: 10px;
    display: grid;
    gap: 7px;
    padding: 10px;
    border: 1px solid rgba(66, 221, 255, 0.26);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(66, 221, 255, 0.12), transparent 42%),
        rgba(2, 12, 23, 0.78);
    box-shadow: inset 0 0 18px rgba(66, 221, 255, 0.08);
}

.prediction-summary p {
    margin: 0;
    color: #b8d3e8;
    font-size: 12px;
    line-height: 1.45;
}

.prediction-summary strong {
    display: block;
    color: #65e9ff;
    font-size: 13px;
    line-height: 1.35;
}

#feedbackPick.red {
    color: var(--red);
}

#feedbackPick.blue {
    color: #6f91ff;
}

#feedbackPick.tie {
    color: var(--tie);
}

.feedback-actions {
    display: grid;
    grid-template-columns: 1fr 86px;
    gap: 10px;
    margin-top: 16px;
}

.feedback-hit,
.feedback-skip {
    min-height: 50px;
    border-radius: 8px;
    font-weight: 850;
}

.feedback-hit:disabled {
    opacity: 0.48;
    color: #8ea2ad;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.feedback-hit {
    color: #06131c;
    background: linear-gradient(180deg, #9cf4ff, #33d6ff);
    font-size: 18px;
    box-shadow: 0 0 24px rgba(66, 221, 255, 0.42), inset 0 2px 10px rgba(255, 255, 255, 0.3);
}

.feedback-skip {
    color: var(--muted);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.actual-title {
    margin-top: 18px;
    color: #d7e8f4;
    font-size: 15px;
    font-weight: 800;
}

.actual-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
    padding: 0;
    justify-items: center;
}

.actual-actions.is-filtered {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 4px;
}

.actual-button {
    width: 100%;
    min-height: 92px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 3px 16px rgba(255, 255, 255, 0.18), 0 12px 24px rgba(0, 0, 0, 0.35);
}

.actual-button[data-actual="blue"] {
    grid-column: 1;
}

.actual-button[data-actual="red"] {
    grid-column: 2;
}

.actual-button[data-actual="tie"] {
    grid-column: 3;
}

.actual-actions.is-filtered .actual-button {
    grid-column: auto;
}

.actual-button.hidden {
    display: none;
}

.actual-button span {
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: 34px;
    font-weight: 950;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.42);
}

.actual-button.blue {
    border-color: rgba(90, 136, 255, 0.72);
    background: linear-gradient(180deg, rgba(43, 88, 238, 0.28), rgba(10, 20, 66, 0.88));
    box-shadow: 0 0 22px rgba(36, 92, 255, 0.28), inset 0 3px 16px rgba(255, 255, 255, 0.13);
}

.actual-button.blue span {
    background: radial-gradient(circle at 35% 24%, #88b2ff, var(--blue) 58%, #071c88);
}

.actual-button.red {
    border-color: rgba(255, 79, 96, 0.72);
    background: linear-gradient(180deg, rgba(255, 48, 72, 0.26), rgba(72, 8, 18, 0.9));
    box-shadow: 0 0 22px rgba(255, 48, 72, 0.28), inset 0 3px 16px rgba(255, 255, 255, 0.13);
}

.actual-button.red span {
    background: radial-gradient(circle at 35% 24%, #ff9aa3, var(--red) 58%, #810516);
}

.actual-button.tie {
    border-color: rgba(48, 236, 126, 0.72);
    background: linear-gradient(180deg, rgba(22, 214, 106, 0.26), rgba(4, 65, 31, 0.9));
    box-shadow: 0 0 22px rgba(22, 214, 106, 0.26), inset 0 3px 16px rgba(255, 255, 255, 0.13);
}

.actual-button.tie span {
    background: radial-gradient(circle at 35% 24%, #8dffba, var(--tie) 58%, #086c34);
}

.continue-card {
    text-align: center;
}

.continue-card > strong {
    margin-bottom: 12px;
}

#continuePick.red {
    color: var(--red);
}

#continuePick.blue {
    color: #6f91ff;
}

#continuePick.tie {
    color: var(--tie);
}

.prob-ring {
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    margin: 8px auto 10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 28px;
    font-weight: 900;
    background:
        radial-gradient(circle at center, rgba(5, 12, 24, 0.96) 55%, transparent 57%),
        conic-gradient(var(--cyan), rgba(66, 221, 255, 0.18));
    box-shadow: inset 0 0 18px rgba(66, 221, 255, 0.1), 0 0 22px rgba(66, 221, 255, 0.18);
}

.prob-ring.hot {
    background:
        radial-gradient(circle at center, rgba(5, 12, 24, 0.96) 55%, transparent 57%),
        conic-gradient(#28f7a2, #56e8ff, rgba(66, 221, 255, 0.22));
    box-shadow: inset 0 0 20px rgba(40, 247, 162, 0.16), 0 0 26px rgba(40, 247, 162, 0.28);
}

.prob-ring.cold {
    background:
        radial-gradient(circle at center, rgba(5, 12, 24, 0.96) 55%, transparent 57%),
        conic-gradient(#ffb11a, rgba(255, 177, 26, 0.14));
    box-shadow: inset 0 0 20px rgba(255, 177, 26, 0.1), 0 0 18px rgba(255, 177, 26, 0.18);
}

.continue-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.drawer-card {
    width: min(100%, 480px);
    max-height: 86dvh;
    overflow: auto;
    padding: 12px;
    border-radius: 8px;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.drawer-head strong {
    font-size: 18px;
}

.full {
    width: 100%;
}

.warning {
    margin: 12px 0 0;
    color: #ffd36c;
    font-size: 12px;
    line-height: 1.6;
}

.reasoning {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

@media (orientation: portrait) {
    .app {
        grid-template-columns: minmax(0, 1fr);
        height: 100svh;
        min-height: 100svh;
    }

    .stage {
        height: 100svh;
        grid-template-rows: 38px minmax(0, 1fr) 82px 160px;
        padding: max(6px, env(safe-area-inset-top)) 6px max(8px, env(safe-area-inset-bottom)) 6px;
        gap: 4px;
    }

    .side-rail {
        display: none;
    }

    .hud strong {
        font-size: 13px;
    }

    .hud span {
        font-size: 10px;
    }

    .road-layout {
        grid-template-rows: 20% 38% 42%;
    }

    .road-panel {
        grid-template-rows: 24px 1fr;
    }

    .derived-layout .road-panel {
        grid-template-rows: 19px 1fr;
    }

    .road-head span {
        font-size: 13px;
    }

    .road-head strong {
        font-size: 11px;
    }

    .mini-head {
        font-size: 11px;
    }

    .bead {
        width: min(7.4vw, 28px);
        height: min(7.4vw, 28px);
        font-size: 12px;
    }

    .bead-grid .bead {
        width: min(6vw, 23px);
        height: min(6vw, 23px);
        font-size: 11px;
    }

    .bead em {
        right: -1px;
        bottom: -1px;
        min-width: 11px;
        height: 11px;
        font-size: 8px;
    }

    .action-pad {
        grid-template-rows: 34px 1fr;
        gap: 7px;
    }

    .round {
        width: clamp(54px, 16vw, 64px);
        height: clamp(54px, 16vw, 64px);
        font-size: 26px;
    }

    .pill {
        height: 34px;
    }

    .delete-key {
        height: 34px;
        font-size: 17px;
    }

    .number-pad {
        gap: 6px;
    }

    .number-pad button {
        min-height: 42px;
        font-size: 20px;
        white-space: nowrap;
    }

    #clearBtn,
    #recalcBtn {
        font-size: 15px;
        letter-spacing: 0;
    }
}

@media (max-width: 370px) {
    .stage {
        grid-template-rows: 36px minmax(0, 1fr) 76px 146px;
    }

    .score span {
        width: 36px;
        height: 36px;
    }

    .number-pad button {
        min-height: 38px;
        font-size: 18px;
    }

    .round {
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}
