* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(150deg, #fff5e6 0%, #ffe0cc 40%, #ffd6e0 100%);
    min-height: 100vh;
    padding: 12px;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    max-width: 600px;
    margin: 0 auto;
}

/* Widen for landscape */
@media (orientation: landscape) {
    #app {
        max-width: 960px;
    }
}

/* === TABS === */
#tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 16px 12px;
    font-family: 'Nunito', sans-serif;
    font-size: 22px;
    font-weight: 900;
    border: 4px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tab[data-mode="mix"] {
    background: #ffeb3b;
    color: #5d4037;
}

.tab[data-mode="test"] {
    background: #7c4dff;
    color: white;
}

.tab.active {
    border-color: #333;
    transform: scale(1.03);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.tab:not(.active) {
    opacity: 0.6;
}

/* === MODE PANELS === */
.mode-panel {
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === PICKER === */
.picker {
    background: rgba(255,255,255,0.7);
    border-radius: 24px;
    padding: 16px;
    margin-bottom: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.picker-label {
    font-size: 20px;
    font-weight: 800;
    color: #5d4037;
    margin-bottom: 12px;
    text-align: center;
}

/* === COLOUR GRID === */
.colour-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 14px;
}

.colour-swatch {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 4px solid rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 2px;
    position: relative;
}

.colour-swatch:active {
    transform: scale(0.9);
}

.colour-swatch.selected {
    border-color: #333;
    border-width: 5px;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1;
}

.swatch-label {
    font-size: 9px;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* Make label dark on light swatches */
.colour-swatch.light-swatch .swatch-label {
    color: #333;
    text-shadow: none;
}

/* === AMOUNT BAR === */
.amount-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.amount-btn {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    border: 3px solid #ccc;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.15s;
    background: white;
    color: #5d4037;
    white-space: nowrap;
}

.amount-btn.size-small {
    padding: 8px 14px;
    font-size: 14px;
}

.amount-btn.size-medium {
    padding: 10px 18px;
    font-size: 17px;
}

.amount-btn.size-large {
    padding: 13px 22px;
    font-size: 20px;
}

.amount-btn:active {
    transform: scale(0.93);
}

.amount-btn.active {
    background: #ff9800;
    color: white;
    border-color: #e65100;
    box-shadow: 0 3px 10px rgba(255,152,0,0.4);
}

/* === PLUS / EQUALS === */
.plus-sign, .equals-sign {
    text-align: center;
    font-size: 42px;
    font-weight: 900;
    color: #e91e63;
    margin: 4px 0;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

/* === RESULT === */
#mix-result {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

#result-swatch {
    width: 100%;
    height: 140px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15);
    transition: background-color 0.4s, transform 0.15s;
    border: 5px solid rgba(0,0,0,0.1);
}

#result-swatch:active {
    transform: scale(0.97);
}

#result-name {
    font-size: 32px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* === DIFFICULTY PICK === */
#difficulty-pick {
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.difficulty-label {
    font-size: 26px;
    font-weight: 900;
    color: #333;
    margin-bottom: 20px;
}

.difficulty-btn {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 12px auto;
    padding: 22px 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 28px;
    font-weight: 900;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.15s;
}

.difficulty-btn:active {
    transform: scale(0.95);
}

.easy-btn {
    background: #66bb6a;
    color: white;
    box-shadow: 0 4px 15px rgba(102,187,106,0.4);
}

.hard-btn {
    background: #ef5350;
    color: white;
    box-shadow: 0 4px 15px rgba(239,83,80,0.4);
}

/* === QUESTION SWATCHES === */
.q-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    border: 3px solid rgba(0,0,0,0.15);
    cursor: pointer;
    margin-right: 2px;
}

.q-swatch:active {
    transform: scale(0.9);
}

.q-part {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.q-plus {
    font-size: 28px;
    font-weight: 900;
    color: #e91e63;
    vertical-align: middle;
    margin: 0 4px;
}

/* === RESULT SWATCHES === */
.result-swatches {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.result-plus {
    font-size: 14px;
    font-weight: 900;
    color: #999;
}

.result-swatch-out {
    border-radius: 8px !important;
}

/* === TEST MODE === */
#quiz-area {
    text-align: center;
}

#question-counter {
    font-size: 20px;
    font-weight: 800;
    color: #5d4037;
    margin-bottom: 10px;
}

#question-text {
    font-size: 24px;
    font-weight: 900;
    color: #333;
    margin-bottom: 20px;
    padding: 18px;
    background: rgba(255,255,255,0.8);
    border-radius: 20px;
    line-height: 1.4;
    cursor: pointer;
}

#question-text:active {
    transform: scale(0.98);
}

#options-grid {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.option-btn {
    width: 140px;
    height: 140px;
    border-radius: 24px;
    border: 5px solid rgba(0,0,0,0.1);
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    transition: all 0.15s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.option-btn:active {
    transform: scale(0.93);
}

.option-btn.correct {
    border-color: #4caf50;
    border-width: 7px;
    box-shadow: 0 0 25px rgba(76,175,80,0.5);
}

.option-btn.wrong {
    border-color: #f44336;
    border-width: 7px;
    opacity: 0.6;
}

.option-btn.reveal {
    border-color: #4caf50;
    border-width: 7px;
    box-shadow: 0 0 25px rgba(76,175,80,0.5);
}

.option-label {
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    pointer-events: none;
}

#feedback {
    font-size: 28px;
    font-weight: 900;
    padding: 14px;
    border-radius: 18px;
    margin-top: 10px;
}

#feedback.correct-feedback {
    background: #c8e6c9;
    color: #2e7d32;
}

#feedback.wrong-feedback {
    background: #ffcdd2;
    color: #c62828;
}

/* === RESULTS === */
#results-area {
    text-align: center;
    animation: fadeIn 0.4s ease;
}

#score-display {
    font-size: 36px;
    font-weight: 900;
    color: #333;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.8);
    border-radius: 24px;
}

#results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
}

.result-row .mini-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
    cursor: pointer;
}

.result-row .mini-swatch:active {
    transform: scale(0.9);
}

.result-row .result-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 32px;
}

.result-row .result-detail {
    flex: 1;
    text-align: left;
    color: #555;
}

#play-again-btn {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 900;
    padding: 18px 40px;
    background: #7c4dff;
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(124,77,255,0.4);
    transition: all 0.15s;
}

#play-again-btn:active {
    transform: scale(0.95);
}

/* === RESPONSIVE === */
@media (max-width: 420px) {
    .colour-swatch {
        width: 52px;
        height: 52px;
    }
    .swatch-label {
        font-size: 8px;
    }
    .option-btn {
        width: 110px;
        height: 110px;
    }
    .tab {
        font-size: 18px;
        padding: 14px 8px;
    }
    #result-name {
        font-size: 26px;
    }
}

@media (min-width: 500px) {
    .colour-swatch {
        width: 70px;
        height: 70px;
    }
    .option-btn {
        width: 155px;
        height: 155px;
    }
}

/* === LANDSCAPE === */
@media (orientation: landscape) {
    body {
        padding: 8px 12px;
    }

    #tabs {
        margin-bottom: 8px;
    }

    .tab {
        padding: 10px 12px;
        font-size: 18px;
    }

    /* Mix mode: pickers side by side */
    #mix-mode {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto auto;
        gap: 0 8px;
        align-items: start;
    }

    #mix-mode .picker {
        margin-bottom: 0;
        padding: 10px;
    }

    #mix-mode .plus-sign {
        align-self: center;
        font-size: 36px;
        margin: 0;
    }

    #mix-result {
        grid-column: 1 / -1;
        margin-top: 8px;
    }

    .picker-label {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .colour-grid {
        gap: 6px;
        margin-bottom: 8px;
    }

    .colour-swatch {
        width: 48px;
        height: 48px;
    }

    .swatch-label {
        font-size: 7px;
    }

    .amount-btn.size-small {
        padding: 5px 10px;
        font-size: 12px;
    }
    .amount-btn.size-medium {
        padding: 7px 14px;
        font-size: 14px;
    }
    .amount-btn.size-large {
        padding: 9px 18px;
        font-size: 16px;
    }

    #result-swatch {
        height: 90px;
        border-radius: 20px;
    }

    #result-name {
        font-size: 26px;
    }

    .equals-sign {
        font-size: 32px;
        margin: 2px 0;
    }

    /* Test mode: question + options side by side */
    #quiz-area {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 8px;
        align-items: start;
    }

    #question-counter {
        grid-column: 1 / -1;
        margin-bottom: 4px;
        font-size: 16px;
    }

    #question-text {
        font-size: 20px;
        padding: 14px;
        margin-bottom: 0;
        align-self: center;
    }

    #options-grid {
        margin-bottom: 0;
        align-self: center;
    }

    .option-btn {
        width: 110px;
        height: 110px;
    }

    #feedback {
        grid-column: 1 / -1;
        font-size: 22px;
        padding: 10px;
        margin-top: 4px;
    }

    /* Results in landscape */
    #score-display {
        font-size: 28px;
        padding: 14px;
        margin-bottom: 12px;
    }

    #results-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }

    .result-row {
        flex: 1 1 45%;
        min-width: 200px;
        padding: 8px;
        font-size: 13px;
    }

    #play-again-btn {
        font-size: 20px;
        padding: 14px 32px;
    }
}

/* Larger landscape tablets - restore swatch sizes */
@media (orientation: landscape) and (min-height: 600px) {
    .colour-swatch {
        width: 56px;
        height: 56px;
    }
    .swatch-label {
        font-size: 8px;
    }
    #result-swatch {
        height: 110px;
    }
    .option-btn {
        width: 130px;
        height: 130px;
    }
}
