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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.game-header {
    margin-bottom: 30px;
}

.back-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-size: 16px;
    margin-bottom: 15px;
    transition: color 0.3s;
}

.back-link:hover {
    color: #5568d3;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 0;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #4a5568;
    font-size: 1.05em;
    margin-bottom: 12px;
}

.hint {
    font-weight: 400;
    font-size: 0.85em;
    color: #718096;
}

/* Settings Panel */
.settings-panel {
    max-width: 560px;
    margin: 0 auto;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
}

.setting-group select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.setting-group select:focus {
    outline: none;
    border-color: #667eea;
}

.setting-help {
    background: #f7fafc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    color: #4a5568;
    font-size: 0.95em;
    line-height: 1.5;
}

.setting-help p + p {
    margin-top: 8px;
}

/* Buttons */
.btn-start,
.btn-submit,
.btn-new-game,
.btn-back-settings,
.btn-pay {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-start {
    background: #667eea;
    color: white;
}

.btn-start:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-submit,
.btn-pay {
    background: #48bb78;
    color: white;
}

.btn-submit:hover,
.btn-pay:hover {
    background: #38a169;
}

.btn-new-game {
    background: #f59e0b;
    color: white;
}

.btn-new-game:hover {
    background: #d97706;
}

.btn-back-settings {
    background: #667eea;
    color: white;
}

.btn-back-settings:hover {
    background: #5568d3;
}

.game-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 30px;
}

.button-row {
    display: flex;
    gap: 10px;
}

.button-row button {
    flex: 1;
}

/* Game Panel */
.game-panel {
    animation: fadeIn 0.5s;
}

.game-info {
    margin-bottom: 25px;
}

.score-display {
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #667eea;
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
}

/* Menu Board */
.menu-board {
    background: #2d3748;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 0 4px #4a5568;
}

.menu-board h2 {
    color: #fbd38d;
    margin-bottom: 15px;
}

.menu-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.stall-name {
    color: #fbd38d;
    font-weight: 700;
    font-size: 1.05em;
    margin-bottom: 8px;
    padding-left: 4px;
}

.stall-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.menu-item {
    background: #f7fafc;
    border-radius: 10px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.menu-emoji {
    font-size: 2em;
}

.menu-name {
    font-size: 0.95em;
    color: #2d3748;
    font-weight: 600;
}

.menu-price {
    font-size: 1.15em;
    color: #c53030;
    font-weight: 700;
}

/* Money input (shared) */
.money-input {
    display: inline-flex;
    align-items: center;
    border: 2px solid #cbd5e0;
    border-radius: 6px;
    background: white;
    overflow: hidden;
    transition: border-color 0.3s;
}

.money-input:focus-within {
    border-color: #667eea;
}

.money-input .currency {
    padding: 8px 10px;
    background: #edf2f7;
    color: #2d3748;
    font-weight: 700;
    font-size: 18px;
}

.money-input input {
    width: 110px;
    padding: 8px 10px;
    font-size: 18px;
    border: none;
    outline: none;
    font-family: inherit;
}

.money-input input:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
}

/* Total Cost Mode - orders */
.orders-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.order-card {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    transition: all 0.3s;
}

.order-card.correct {
    background: #c6f6d5;
    border-color: #48bb78;
}

.order-card.incorrect {
    background: #fed7d7;
    border-color: #f56565;
}

.order-title {
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 10px;
}

.order-lines {
    list-style: none;
    margin-bottom: 14px;
}

.order-lines li {
    display: flex;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px dashed #cbd5e0;
    font-size: 1.05em;
    color: #2d3748;
}

.line-qty {
    width: 36px;
    font-weight: 700;
    color: #805ad5;
}

.line-item {
    flex: 1;
}

.line-price {
    font-weight: 700;
    color: #c53030;
}

.order-answer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-answer label {
    font-weight: 600;
    color: #4a5568;
}

.correct-solution {
    margin-top: 10px;
    padding: 8px;
    background: #bee3f8;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    color: #2c5282;
    font-weight: 600;
}

/* Cashier Mode */
.round-header {
    text-align: center;
    font-size: 1.3em;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 15px;
}

.notice {
    background: #fefcbf;
    border: 2px solid #f6e05e;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    color: #744210;
    font-weight: 600;
    margin-bottom: 15px;
}

.order-to-buy {
    background: #fff5f5;
    border: 2px solid #feb2b2;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.buy-items {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.buy-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 1.1em;
}

.buy-item .menu-emoji {
    font-size: 1.6em;
}

.money-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.money-box {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    min-height: 180px;
}

.counter-box {
    background: #ebf8ff;
    border-color: #90cdf4;
}

.coins {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 60px;
}

.empty-hint {
    color: #a0aec0;
    font-size: 0.9em;
}

.coin {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 3px solid;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    user-select: none;
}

.coin:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.coin:disabled {
    cursor: default;
    opacity: 0.85;
}

.coin-large {
    width: 60px;
    height: 60px;
    font-size: 15px;
}

.coin-small {
    width: 44px;
    height: 44px;
    font-size: 12px;
}

.coin-gold {
    background: radial-gradient(circle at 35% 35%, #fde68a, #d69e2e 70%);
    border-color: #b7791f;
    color: #5f370e;
}

.coin-silver {
    background: radial-gradient(circle at 35% 35%, #f7fafc, #a0aec0 70%);
    border-color: #718096;
    color: #2d3748;
}

/* Notes ($2 and $5) */
.coin.note {
    width: 88px;
    height: 46px;
    border-radius: 6px;
    border-width: 2px;
    font-size: 16px;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0 4px, transparent 4px 8px);
}

.note-two {
    background-color: #b794f4;
    border-color: #6b46c1;
    color: #322659;
}

.note-five {
    background-color: #68d391;
    border-color: #276749;
    color: #1c4532;
}

.pay-message {
    margin-top: 10px;
    padding: 8px;
    background: #fed7d7;
    border-radius: 6px;
    color: #9b2c2c;
    font-weight: 600;
    text-align: center;
}

.change-questions {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    animation: fadeIn 0.4s;
}

.question-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.question-row label {
    flex: 1 1 260px;
    font-weight: 600;
    color: #4a5568;
    font-size: 1.05em;
}

.feedback {
    flex-basis: 100%;
    font-weight: 600;
    min-height: 1.2em;
}

.feedback.good {
    color: #2f855a;
}

.feedback.bad {
    color: #c53030;
}

.change-result {
    background: #c6f6d5;
    border: 2px solid #48bb78;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.4s;
}

.change-result h3 {
    color: #22543d;
}

.change-result .coins {
    justify-content: center;
    margin-bottom: 10px;
}

/* Results Panel */
.results-panel {
    text-align: center;
    animation: fadeIn 0.5s;
}

.results-score {
    margin: 30px 0;
}

.results-score p {
    font-size: 24px;
    margin: 15px 0;
    color: #2d3748;
}

.percentage {
    font-size: 48px;
    font-weight: 700;
    color: #667eea;
}

.wallet-summary {
    font-size: 20px !important;
    color: #4a5568 !important;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Congratulations Overlay */
.congrats-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s;
}

.congrats-overlay.hidden {
    display: none !important;
}

.congrats-content {
    background: white;
    padding: 60px 80px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.6s;
}

.congrats-content h2 {
    font-size: 3em;
    color: #667eea;
    margin-bottom: 20px;
    animation: pulse 1s infinite;
}

.congrats-content p {
    font-size: 1.5em;
    color: #555;
}

/* Fireworks Container */
.fireworks {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.firework {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    animation: explode 1s ease-out forwards;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1em;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes explode {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .stall-items {
        grid-template-columns: repeat(2, 1fr);
    }

    .orders-container {
        grid-template-columns: 1fr;
    }

    .money-area {
        grid-template-columns: 1fr;
    }

    .footer {
        font-size: 0.9em;
    }

    .congrats-content {
        padding: 40px 50px;
    }

    .congrats-content h2 {
        font-size: 2em;
    }
}
