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

body {
    font-family: system-ui, Arial, sans-serif;
    background: linear-gradient(45deg, #4a235a 0%, #6c3483 45%, #2e86c1 110%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: white;
    overflow-x: hidden;
    padding: 1rem;
}

.game-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
}

.header {
    position: relative;
    z-index: 20;
}

@font-face {
    font-family: 'Righteous';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/righteous.woff2') format('woff2');
}

@font-face {
    font-family: 'Silkscreen';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/silkscreen-700.woff2') format('woff2');
}

.nav-mini {
    display: flex;
    width: max-content;
    align-items: center;
    gap: 5px;
    background: linear-gradient(90deg, #ffb700, #ffd700);
    border: none;
    border-radius: 999px;
    padding: 7px 13px 7px 9px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #241a3d;
    text-decoration: none;
    margin-bottom: 0.6rem;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
}

.nav-mini svg path {
    stroke: #241a3d;
}

.nav-mini:hover {
    background: linear-gradient(90deg, #ffc61a, #ffe14d);
}

.lockup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-bottom: 0.9rem;
}

.badge {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex: none;
}

.lockup-text {
    text-align: left;
}

.game-name {
    font-family: 'Righteous', 'Arial Rounded MT Bold', Arial, sans-serif;
    font-size: 23px;
    font-weight: 400;
    letter-spacing: 1.5px;
    line-height: 1;
    margin: 0;
    text-shadow: 1px 2px 5px rgba(0, 0, 0, 0.45);
}

.game-tag {
    font-family: 'Silkscreen', 'Courier New', monospace;
    font-weight: 700;
    font-size: 8px;
    letter-spacing: 2px;
    margin-top: 3px;
    color: #ffe36e;
}

.button-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.new-game-button,
.share-button,
.control-button {
    border: none;
    border-radius: 999px;
    color: #ffffff;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.share-button { background: linear-gradient(45deg, #27ae60, #2ecc71); }
.control-button { background: linear-gradient(45deg, #8e44ad, #b06ee0); }
.new-game-button { background: linear-gradient(45deg, #d94a3a, #ff7a6e); }

.new-game-button:active,
.share-button:active,
.control-button:active {
    transform: scale(0.95);
}

.game-mode-selector {
    display: flex;
    background: rgba(10, 10, 25, 0.32);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 0.8rem;
}

.mode-button {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 8px 4px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.2s ease, color 0.2s ease;
}

.mode-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mode-button.active {
    background: linear-gradient(90deg, #ffb700, #ffd700);
    color: #241a3d;
}

.mode-button.active:hover {
    background: linear-gradient(90deg, #ffb700, #ffd700);
}

/* The target */
.target-banner {
    background: rgba(10, 10, 25, 0.4);
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 16px;
    padding: 0.7rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.target-label {
    font-family: 'Silkscreen', 'Courier New', monospace;
    font-weight: 700;
    font-size: 9px;
    letter-spacing: 2px;
    color: #ffe36e;
}

.target-value {
    font-size: 34px;
    font-weight: 700;
    color: #ffd700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    text-shadow: 1px 2px 5px rgba(0, 0, 0, 0.4);
}

.ops-count {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
}

.message {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.6rem;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
}

.message.success {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.message.error {
    background: rgba(244, 67, 54, 0.3);
    border-color: rgba(244, 67, 54, 0.5);
    animation: shake 0.4s ease-in-out;
}

.message.info {
    background: rgba(255, 193, 7, 0.3);
    border-color: rgba(255, 193, 7, 0.5);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Number chips */
.num-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 0.8rem;
}

.num-chip {
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 14px;
    padding: 16px 6px;
    font-size: 23px;
    font-weight: 700;
    color: #ffffff;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.num-chip.selected {
    background: linear-gradient(90deg, #ffb700, #ffd700);
    border-color: transparent;
    color: #241a3d;
    transform: scale(1.05);
}

.num-chip.spent {
    visibility: hidden;
    pointer-events: none;
}

.num-chip.win {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    border-color: transparent;
}

/* Operations */
.op-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0.8rem;
}

.op-button {
    flex: 1;
    background: rgba(10, 10, 25, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 11px 4px;
    font-size: 21px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.op-button.selected {
    background: linear-gradient(90deg, #ffb700, #ffd700);
    border-color: transparent;
    color: #241a3d;
}

.tool-row {
    display: flex;
    gap: 10px;
    margin-bottom: 0.8rem;
}

.tool-button {
    flex: 1;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 10px 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
    cursor: pointer;
    touch-action: manipulation;
}

.tool-button:active {
    transform: scale(0.97);
}

.tool-button:disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Bottom stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 70px;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffd700;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.65rem;
    color: #e0e0e0;
    margin-top: 0.25rem;
}

/* Stats modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #2c2c2e;
    color: #fff;
    padding: 25px;
    border-radius: 12px;
    width: 90%;
    max-width: 480px;
    position: relative;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
}

.modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

/* Mobile */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .game-container {
        border-radius: 0;
        max-width: none;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 0.8rem;
    }

    .num-chip {
        padding: 14px 4px;
        font-size: 21px;
    }
}

@media (max-width: 360px) {
    .num-chip {
        font-size: 19px;
        padding: 12px 4px;
    }

    .target-value {
        font-size: 29px;
    }

    .stats-grid {
        gap: 10px;
    }
}
