:root {
    --bg: #04050b;
    --panel: #0f1730;
    --line: #304b84;
    --text: #e9f1ff;
    --muted: #9eb1da;
    --cyan: #56f6ff;
    --pink: #ff64dd;
    --amber: #ffc66d;
    --good: #7dffab;
    --bad: #ff7aa1;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 8%, rgba(86, 246, 255, 0.14), transparent 45%),
        radial-gradient(circle at 84% 12%, rgba(255, 100, 221, 0.14), transparent 42%),
        linear-gradient(165deg, #020307, #060a16 50%, #04050b);
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.app {
    width: min(980px, 100%);
    display: grid;
    gap: 0.85rem;
}

.panel {
    background: linear-gradient(180deg, rgba(15, 23, 48, 0.95), rgba(7, 12, 25, 0.95));
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
}

.topbar {
    padding: 0.95rem 1rem;
}

.back {
    color: var(--amber);
    font-weight: 700;
    text-decoration: none;
}

h1 {
    margin: 0.65rem 0 0.32rem;
    font-size: clamp(1.35rem, 3vw, 2rem);
}

.topbar p {
    margin: 0;
    color: var(--muted);
}

.hud {
    padding: 0.78rem;
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 0.54rem;
}

.hud div {
    border: 1px solid #2f477c;
    border-radius: 8px;
    padding: 0.4rem 0.52rem;
    background: rgba(4, 8, 18, 0.75);
    display: grid;
    gap: 0.1rem;
}

.hud span {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.67rem;
    color: var(--muted);
}

.hud strong {
    font-size: 0.96rem;
}

.rush-panel {
    padding: 0.8rem;
}

.rush-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    justify-content: space-between;
}

h2 {
    margin: 0;
    font-size: 1rem;
}

.rush-head p {
    margin: 0.28rem 0 0;
    color: var(--muted);
}

.timer-wrap {
    position: relative;
    width: min(340px, 52vw);
    height: 16px;
    border: 1px solid #3a5da2;
    border-radius: 999px;
    overflow: hidden;
    background: #111d3a;
}

#timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #42f3ff, #66ffa7);
    transition: width 0.25s linear, background 0.25s linear;
}

.status {
    margin: 0.65rem 0 0;
    padding-top: 0.6rem;
    border-top: 1px dashed #2f477c;
    color: var(--muted);
    min-height: 1.4rem;
}

.status.good { color: var(--good); }
.status.bad { color: var(--bad); }

.counter {
    padding: 0.8rem;
    display: grid;
    gap: 0.72rem;
}

.items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.55rem;
}

.item-btn,
button {
    border: 1px solid #4062ac;
    border-radius: 9px;
    background: #13234b;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 640;
    padding: 0.54rem 0.62rem;
    transition: transform 110ms ease, border-color 110ms ease;
}

.item-btn {
    display: grid;
    gap: 0.14rem;
    text-align: left;
}

.item-btn .name {
    font-size: 0.88rem;
}

.item-btn .price {
    color: var(--cyan);
    font-size: 0.82rem;
}

.item-btn:hover,
button:hover {
    transform: translateY(-1px);
    border-color: #74a0ff;
}

.item-btn:active,
button:active {
    transform: translateY(1px);
}

.actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 0.5rem;
}

button.accent {
    border-color: #9e61f0;
    background: linear-gradient(180deg, #7646c9, #532f93);
}

button:disabled,
.item-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.tray {
    padding: 0.8rem;
}

#tray-list {
    margin: 0.6rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.38rem;
}

#tray-list li {
    border: 1px solid #2f477c;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    background: rgba(4, 8, 18, 0.73);
    display: flex;
    justify-content: space-between;
    font-size: 0.89rem;
}

#tray-list li.empty {
    color: var(--muted);
    justify-content: center;
}

@media (max-width: 850px) {
    .hud {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }

    .actions {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .rush-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .timer-wrap {
        width: 100%;
    }
}
