/* =============================================
   FONTS & CUSTOM PROPERTIES
============================================= */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,600;0,700;0,800;1,800&family=Manrope:wght@400;500;600;700&display=swap');

:root {
    --yellow:        #E1AD01;
    --yellow-dark:   #C49A00;
    --yellow-light:  #FFF3CC;
    --black:         #1a1a1a;
    --white:         #ffffff;
    --gray-100:      #f3f3f3;
    --gray-200:      #e8e8e8;
    --gray-300:      #d2c5ac;
    --gray-500:      #817661;
    --gray-700:      #4f4633;
    --red:           #e84040;
    --green:         #22c55e;

    --font-headline: 'Plus Jakarta Sans', sans-serif;
    --font-body:     'Manrope', sans-serif;

    --radius-sm:   4px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-full: 999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

/* =============================================
   RESET & BASE
============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--yellow);
    color: var(--black);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: var(--font-body);
}

img { display: block; }

/* =============================================
   SCREEN MANAGEMENT
============================================= */
.screen {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.screen.active { display: flex !important; }

/* =============================================
   SCREEN 1: SPLASH
============================================= */
#screen-splash {
    background-color: var(--yellow);
}

#screen-splash::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/Pattern2.png');
    background-repeat: repeat;
    background-size: 200px;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

.splash-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.splash-nub {
    width: 180px;
    height: 180px;
    object-fit: contain;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.15));
}

.splash-title {
    font-family: var(--font-headline);
    font-size: clamp(4rem, 10vw, 8rem);
    font-weight: 800;
    font-style: italic;
    line-height: 0.9;
    letter-spacing: -0.03em;
    color: var(--black);
    margin-bottom: 1.25rem;
}

.splash-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 500;
    color: var(--black);
    opacity: 0.75;
    max-width: 420px;
    line-height: 1.5;
    margin-bottom: 2.5rem;
}



/* Difficulty buttons */
.difficulty-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-difficulty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: var(--black);
    color: var(--white);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    border: 3px solid var(--black);
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-md);
    min-width: 130px;
}
.btn-difficulty:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.btn-difficulty:active:not(:disabled) { transform: scale(0.97); }
.btn-difficulty:disabled { opacity: 0.5; cursor: wait; }

.btn-difficulty--featured {
    background: var(--black);
    border-color: var(--yellow);
    box-shadow: 0 0 0 3px var(--yellow), var(--shadow-md);
}

.diff-icon { font-size: 1.75rem; line-height: 1; }

.btn-text {
    font-family: var(--font-headline);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--yellow);
}

.diff-sub {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.6;
    letter-spacing: 0.05em;
}

/* model status below */

/* Model loading status */
.model-status {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--black);
    opacity: 0.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--black);
    animation: pulse 1.2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.3); }
}

/* =============================================
   SCREEN 2: COUNTDOWN
============================================= */
#screen-countdown {
    background: var(--white);
}

.countdown-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    padding: 2rem;
}

.countdown-label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--gray-500);
}

.countdown-clue {
    font-family: var(--font-headline);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    color: var(--black);
    line-height: 1;
    position: relative;
    display: inline-block;
}
.countdown-clue::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0;
    width: 100%;
    height: 14px;
    background: var(--yellow);
    z-index: -1;
    border-radius: 4px;
    transform: rotate(-1deg);
}

.countdown-circle {
    width: 140px;
    height: 140px;
    background: var(--black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.countdown-circle span {
    font-family: var(--font-headline);
    font-size: 5rem;
    font-weight: 800;
    color: var(--yellow);
    line-height: 1;
}

/* =============================================
   SCREEN 3: GAME WORKSPACE
============================================= */
#screen-game {
    background: var(--gray-100);
    justify-content: flex-start;
}

/* Top bar */
.game-header {
    width: 100%;
    height: 64px;
    min-height: 64px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    z-index: 20;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.game-brand {
    font-family: var(--font-headline);
    font-size: 1.2rem;
    font-weight: 800;
    font-style: italic;
    color: var(--black);
    letter-spacing: -0.02em;
}

.stat-pill {
    background: var(--yellow-light);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-family: var(--font-headline);
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--yellow-dark);
}

.draw-label {
    font-family: var(--font-headline);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.draw-label strong {
    color: var(--black);
    font-size: 1rem;
}

.score-box {
    background: var(--black);
    color: var(--yellow);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-headline);
    font-size: 1rem;
    font-weight: 800;
}

/* Workspace body */
.game-main {
    flex: 1;
    display: flex;
    width: 100%;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 88px;
    min-width: 88px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.5rem;
    gap: 0.5rem;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-nub {
    width: 52px;
    height: 52px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.tool-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.tool-btn {
    width: 100%;
    padding: 0.6rem 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: var(--gray-500);
    transition: all 0.15s;
    background: none;
    border: none;
    cursor: pointer;
}
.tool-btn:hover { color: var(--yellow-dark); background: var(--yellow-light); }
.tool-btn.active {
    background: var(--yellow-light);
    color: var(--yellow-dark);
    border-bottom: 3px solid var(--yellow-dark);
}

.tool-icon { font-size: 1.3rem; line-height: 1; }
.tool-label {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.palette-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.palette-label {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    padding: 0.4rem;
    background: var(--gray-100);
    border-radius: var(--radius-md);
}

.color-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    cursor: pointer;
}
.color-swatch:hover    { transform: scale(1.15); }
.color-swatch.active   { border-color: var(--black); transform: scale(1.15); }
.swatch-white          { box-shadow: inset 0 0 0 1px var(--gray-200); }

/* Canvas area */
.canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.canvas-wrapper {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    background-image: radial-gradient(var(--gray-300) 0.5px, transparent 0.5px);
    background-size: 22px 22px;
    background-color: var(--white);
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
}

#main-canvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
    background: transparent;
    width: 100%;
    height: 100%;
}

/* Corner Nub — bottom left, bubble stacked above mascot */
.corner-nub-wrap {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    pointer-events: none;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.corner-nub-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
}

.corner-nub-wrap .guess-bubble {
    background: var(--yellow-light);
    border: 2px solid var(--yellow-dark);
    border-radius: var(--radius-full);
    padding: 0.4rem 1.25rem;
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--yellow-dark);
    white-space: nowrap;
    transform: rotate(-1.5deg);
    box-shadow: var(--shadow-sm);
}

/* Bottom bar */
.game-footer {
    width: 100%;
    height: 52px;
    min-height: 52px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    z-index: 20;
}

.brush-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brush-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--gray-500);
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    border-radius: 2px;
    background: var(--gray-200);
    outline: none;
    cursor: pointer;
    accent-color: var(--black);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--black);
    cursor: pointer;
}

.history-btns {
    display: flex;
    gap: 0.5rem;
}
.history-btns button {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    line-height: 1;
}
.history-btns button:hover { background: var(--gray-100); }

/* =============================================
   SCREEN 4: RESULT
============================================= */
.result-screen {
    background: rgba(249,249,249,0.97);
    gap: 1.25rem;
    text-align: center;
    padding: 2rem;
}

.result-nub {
    width: 200px;
    height: 200px;
    object-fit: contain;
    filter: drop-shadow(0 12px 32px rgba(0,0,0,0.12));
}

.result-badge {
    display: inline-block;
    padding: 0.4rem 1.25rem;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    background: var(--yellow-light);
    color: var(--yellow-dark);
}

.result-headline {
    font-family: var(--font-headline);
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 800;
    color: var(--black);
    line-height: 1.05;
    max-width: 700px;
}

.result-sub {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--gray-500);
    font-weight: 500;
}

.result-clue-word {
    font-weight: 800;
    color: var(--black);
    text-transform: uppercase;
}

.btn-primary-dark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-headline);
    font-size: 1rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--white);
    background: var(--black);
    padding: 1rem 2.5rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-md);
    margin-top: 0.5rem;
}
.btn-primary-dark:hover  { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary-dark:active { transform: scale(0.97); }

/* =============================================
   SCREEN 5: SUMMARY
============================================= */
.summary-screen {
    background: var(--white);
    justify-content: flex-start;
    overflow: hidden;
}

.summary-header {
    width: 100%;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-shrink: 0;
}

.summary-title-group {}

.summary-title {
    font-family: var(--font-headline);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    font-style: italic;
    color: var(--black);
}

.summary-score-label {
    font-family: var(--font-headline);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--yellow-dark);
    margin-top: 0.2rem;
}

.summary-score-value {
    color: var(--green);
}

.summary-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-headline);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--black);
    background: var(--gray-200);
    border: 2px solid var(--gray-200);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-secondary:hover { background: var(--gray-300); border-color: var(--gray-300); }

/* Upsell banner */
.upsell-banner {
    width: 100%;
    padding: 0.85rem 2rem;
    background: var(--yellow-light);
    border-bottom: 2px solid var(--yellow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--black);
    line-height: 1.4;
}

.upsell-text strong {
    font-family: var(--font-headline);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 0.1rem;
}

.btn-upsell {
    font-family: var(--font-headline);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
    background: var(--black);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    transition: background 0.15s;
}
.btn-upsell:hover { background: var(--gray-700); }

/* Summary grid */
.summary-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    padding: 1.5rem 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    overflow-y: auto;
    align-content: start;
}

/* Drawing cards (injected by script.js) */
.drawing-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 3px solid var(--red);
    display: flex;
    flex-direction: column;
    align-items: center;
}
.drawing-card.correct { border-color: var(--green); }
.drawing-card img {
    width: 100%;
    border-radius: 6px;
    background: var(--gray-100);
    margin-bottom: 0.5rem;
}
.card-label {
    font-weight: 800;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}

/* Summary floating Nub */
.summary-nub {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    height: 160px;
    object-fit: contain;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.15));
    pointer-events: none;
    z-index: 50;
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 900px) {
    .sidebar        { width: 72px; min-width: 72px; }
    .sidebar-nub    { width: 44px; height: 44px; }
    .color-swatch   { width: 18px; height: 18px; }
    .game-brand     { display: none; }
    .summary-grid   { grid-template-columns: repeat(4, 1fr); }
    .upsell-banner  { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 768px) {
    .splash-title   { font-size: 3.5rem; }
    .splash-badges  { gap: 1.5rem; }
    .summary-grid   { grid-template-columns: repeat(3, 1fr); }
    .draw-label     { display: none; }
}
