/* ==========================================================================
   Hue Hunt - Find the Odd Colour Out
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

/* Hide shared template elements */
#btn-account, #btn-stats, #btn-leaderboard, #btn-help, .language-selector {
    display: none !important;
}
.game-header {
    background: transparent !important;
    border-bottom: none !important;
    position: absolute; top: 0; left: 0; right: 0; z-index: 30;
}
.game-header__title { color: rgba(255,255,255,0.9) !important; font-weight: 700 !important; }
.game-header__back svg { color: rgba(255,255,255,0.9) !important; }
.game-main { padding-top: 0 !important; }
.word-game-wrapper { background: #1a1a2e !important; height: 100dvh !important; }

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
.hh-game {
    position: relative;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Nunito', system-ui, sans-serif;
    color: #fff;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* --------------------------------------------------------------------------
   Welcome
   -------------------------------------------------------------------------- */
.hh-welcome {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.hh-welcome.active { display: flex; }

.hh-welcome-inner {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.hh-welcome-grid {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}

.hh-demo-tile {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.hh-demo-odd {
    animation: hh-blink 1.5s ease-in-out infinite;
}

@keyframes hh-blink {
    0%, 70%, 100% { opacity: 1; }
    85% { opacity: 0.5; }
}

.hh-title {
    font-size: 2.8rem;
    font-weight: 900;
    margin: 0 0 4px;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #e74c3c, #f39c12, #2ecc71, #3498db, #9b59b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hh-subtitle {
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    margin: 0 0 28px;
    font-weight: 600;
}

.hh-stats-row {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 28px;
}

.hh-stat { text-align: center; }
.hh-stat-val {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
}
.hh-stat-lbl {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hh-play-btn {
    display: inline-block;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 16px 56px;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: inherit;
    letter-spacing: 3px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(231,76,60,0.4);
    transition: all 0.2s;
    margin-bottom: 16px;
}

.hh-play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(231,76,60,0.5);
}

.hh-hint {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    margin: 0;
}

/* --------------------------------------------------------------------------
   Play Area
   -------------------------------------------------------------------------- */
.hh-play-area {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 52px 16px 16px;
    box-sizing: border-box;
}

.hh-top-bar {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    margin-bottom: 8px;
}

.hh-level-display, .hh-score-display, .hh-timer-display {
    text-align: center;
}

.hh-level-label, .hh-score-label, .hh-timer-label {
    display: block;
    font-size: 0.55rem;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.hh-level-num, .hh-score-num, .hh-timer-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 800;
}

.hh-level-num { color: #e74c3c; }
.hh-score-num { color: #f39c12; }
.hh-timer-num { color: #2ecc71; }
.hh-timer-num.warning { color: #e74c3c; animation: hh-blink 0.5s infinite; }

/* Timer Bar */
.hh-timer-bar {
    width: 100%;
    max-width: 480px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.hh-timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f39c12, #e74c3c);
    border-radius: 2px;
    transition: width 0.1s linear;
    width: 100%;
}

/* Streak */
.hh-streak {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f39c12;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(243,156,18,0.5);
}

/* Grid Container */
.hh-grid-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 480px;
    min-height: 0;
}

.hh-grid {
    display: grid;
    gap: 4px;
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1;
}

.hh-tile {
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.3s;
    aspect-ratio: 1;
}

.hh-tile:active {
    transform: scale(0.92);
}

.hh-tile.correct {
    animation: hh-correct 0.5s ease-out;
}

.hh-tile.wrong {
    animation: hh-wrong 0.4s ease;
}

.hh-tile.reveal {
    opacity: 0.3;
}

.hh-tile.reveal-answer {
    opacity: 1;
    box-shadow: 0 0 0 3px #fff, 0 0 20px rgba(255,255,255,0.5);
    transform: scale(1.05);
}

@keyframes hh-correct {
    0% { transform: scale(1); }
    30% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 0; }
}

@keyframes hh-wrong {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* Feedback */
.hh-feedback {
    font-size: 1rem;
    font-weight: 700;
    min-height: 32px;
    margin-top: 8px;
    text-align: center;
    transition: opacity 0.3s;
}

.hh-feedback.good { color: #2ecc71; }
.hh-feedback.great { color: #f39c12; font-size: 1.2rem; }
.hh-feedback.amazing { color: #e74c3c; font-size: 1.4rem; text-shadow: 0 0 10px rgba(231,76,60,0.5); }
.hh-feedback.miss { color: #e74c3c; }

/* --------------------------------------------------------------------------
   Game Over
   -------------------------------------------------------------------------- */
.hh-gameover {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hh-gameover.active { display: flex; }

.hh-gameover-inner {
    text-align: center;
    max-width: 360px;
    width: 100%;
    padding: 0 24px;
}

.hh-go-title {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hh-go-score { margin-bottom: 16px; }
.hh-go-label {
    display: block;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
    text-transform: uppercase;
}
.hh-go-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #f39c12;
}

.hh-go-details {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 16px;
}

.hh-go-detail {
    text-align: center;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}
.hh-go-detail span:last-child {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.hh-go-high {
    color: #f39c12;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 16px;
    animation: hh-blink 1s infinite;
}

.hh-go-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.hh-retry-btn, .hh-home-btn {
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 1px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.hh-retry-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    box-shadow: 0 4px 16px rgba(231,76,60,0.4);
}
.hh-home-btn {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.2);
}

.hh-retry-btn:hover { box-shadow: 0 6px 24px rgba(231,76,60,0.5); }
.hh-home-btn:hover { background: rgba(255,255,255,0.2); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
    .hh-title { font-size: 2.2rem; }
    .hh-grid { max-width: 320px; }
}

@media (min-width: 600px) {
    .hh-grid { max-width: 450px; }
}
