* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
}

html {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

/* Splash Screen */
#splash-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    background: linear-gradient(135deg, #1a0a2e 0%, #2a1a3a 50%, #1a0a2e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

#splash-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#splash-content {
    text-align: center;
}

#splash-title {
    font-family: 'Glass Antiqua', cursive;
    font-size: 48px;
    color: #b485d1;
    letter-spacing: 3px;
    margin-bottom: 8px;
    text-shadow: 0 2px 12px rgba(180, 133, 209, 0.4);
}

#splash-sub {
    font-size: 18px;
    color: #e8d5f5;
    margin-bottom: 40px;
}

#splash-start {
    background: #b485d1;
    color: #fff;
    border: none;
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    animation: pulse-text 1.5s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   CSS Custom Properties — theme-aware colors
   ============================================ */
:root {
    --accent: #b485d1;
    --accent-light: #e8d5f5;
    --accent-bg: #2a1a3a;
    --font-display: 'Glass Antiqua', cursive;
    --font-body: 'Helvetica Neue', Arial, sans-serif;
    --tile-empty-bg: rgba(255, 255, 255, 0.33);
    --tile-empty-border: rgba(255, 255, 255, 0.40);
    --header-bg: rgba(18, 18, 19, 0.85);
}

body {
    background: #121213 url('photos/alameda.jpg') center/cover no-repeat scroll;
    color: #fff;
    font-family: var(--font-body);
    min-height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    --subtitle-color: #FF4444;
}

#app {
    position: relative;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Header */
header {
    text-align: center;
    padding: 10px 0 6px;
    border-bottom: 1px solid #3a3a3c;
    width: 100%;
    margin-bottom: 4px;
    position: relative;
    background: linear-gradient(to bottom, var(--header-bg), transparent);
    border-radius: 12px 12px 0 0;
}

#theme-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent-bg);
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    padding: 0;
    color: var(--accent);
}

#theme-btn svg {
    width: 18px;
    height: 24px;
}

#theme-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#theme-btn.pulse {
    animation: theme-pulse 1.5s ease-in-out infinite;
    border-color: var(--accent);
    color: var(--accent);
}

#theme-btn .nudge-label {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#theme-btn.pulse .nudge-label {
    opacity: 1;
}

@keyframes theme-pulse {
    0%, 100% { transform: translateY(-50%) scale(1); box-shadow: 0 0 0 0 var(--accent); }
    50% { transform: translateY(-50%) scale(1.15); box-shadow: 0 0 12px 4px var(--accent); }
}

/* Theme Picker */
#theme-picker {
    width: 100%;
    background: rgba(20, 20, 35, 0.95);
    border: 1px solid #3a3a3c;
    border-radius: 12px;
    padding: 12px;
    margin: 4px 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#theme-picker.hidden {
    display: none;
}

.theme-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #8c97a8;
    margin: 8px 0 6px;
}

.theme-section-label:first-child {
    margin-top: 0;
}

.theme-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.theme-swatch {
    background: rgba(40, 40, 60, 0.8);
    border: 1px solid #3a3a3c;
    border-radius: 8px;
    color: #ccc;
    font-size: 10px;
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.theme-swatch:hover {
    border-color: var(--accent);
    background: rgba(60, 60, 80, 0.8);
}

.theme-swatch.active {
    border-color: var(--accent);
    background: rgba(80, 50, 100, 0.5);
}

.swatch-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Swatch dot colors */
.default-dot  { background: #121213; border: 1px solid #3a3a3c; }
.napa-dot     { background: linear-gradient(135deg, #8B6914, #722F37); }
.flathead-dot { background: linear-gradient(135deg, #1B4D6E, #2D5A3D); }
.paris-dot    { background: linear-gradient(135deg, #E8C4C8, #4A4453); }
.newport-dot  { background: linear-gradient(135deg, #1A8FA5, #E8A960); }
.tahoe-dot    { background: linear-gradient(135deg, #2E86AB, #E8E8E8); }
.hermes-dot   { background: #FF6B00; }
.valentino-dot{ background: #B30000; }
.lv-dot       { background: linear-gradient(135deg, #5C3D2E, #C8A95E); }
.chanel-dot   { background: linear-gradient(135deg, #000, #fff); }
.gucci-dot    { background: linear-gradient(135deg, #C8B68E, #8B6914); }
.prada-dot    { background: linear-gradient(135deg, #CC0000, #1A1A1A); }
.ysl-dot      { background: linear-gradient(135deg, #1A1A1A, #D4AF37); }
.goyard-dot   { background: linear-gradient(135deg, #1A1A1A, #444); }
.louboutin-dot{ background: #FF0000; }
.dg-dot       { background: linear-gradient(135deg, #1A1A1A, #fff); }
.dior-dot     { background: linear-gradient(135deg, #E8A0B0, #8B2040); }
.cartier-dot  { background: linear-gradient(135deg, #8B0000, #D4AF37); }

header h1 {
    font-family: var(--font-display);
    font-size: 28px;
    letter-spacing: 2px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.subtitle {
    font-size: 14px;
    font-weight: 700;
    color: var(--subtitle-color, var(--accent));
    margin-top: 2px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* Message Bar — overlays header area, no layout shift */
#message-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    text-align: center;
    padding: 10px 16px;
    background: var(--accent);
    border-radius: 0 0 8px 8px;
    border: none;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#message-bar.hidden {
    display: none;
}

#message-text {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #000;
    text-shadow: none;
}

/* Photo Reveal — centered on screen, no layout shift */
#photo-reveal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 280px;
    z-index: 60;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--accent);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#photo-reveal.hidden {
    display: none;
}

#photo-reveal img {
    width: 100%;
    display: block;
}

#photo-caption {
    padding: 8px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--accent-light);
    background: rgba(20, 20, 35, 0.9);
    font-style: italic;
}

/* Photo Fullscreen */
#photo-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#photo-fullscreen.visible {
    opacity: 1;
}

#photo-fullscreen.hidden {
    display: none;
}

#photo-fullscreen-close {
    position: absolute;
    top: calc(16px + env(safe-area-inset-top, 0px));
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 201;
    line-height: 1;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

#photo-fullscreen-img {
    max-width: 90%;
    max-height: 75%;
    object-fit: contain;
    border-radius: 12px;
}

#photo-fullscreen-caption {
    margin-top: 16px;
    font-size: 16px;
    color: var(--accent-light);
    font-style: italic;
    text-align: center;
    padding: 0 20px;
}

#photo-fullscreen-counter {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    letter-spacing: 2px;
}

/* Board */
#board {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 8px 0;
}

.row {
    display: flex;
    gap: 5px;
}

.tile {
    width: 58px;
    height: 58px;
    border: 2px solid var(--tile-empty-border);
    background: var(--tile-empty-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    transition: transform 0.1s ease;
    user-select: none;
}

.tile.filled {
    border-color: var(--accent);
    background: var(--accent-bg);
    animation: pop 0.1s ease;
}

.tile.reveal {
    animation: flip 0.5s ease forwards;
}

.tile.correct {
    background: #6aaa64;
    border-color: #6aaa64;
}

.tile.present {
    background: #c9b458;
    border-color: #c9b458;
}

.tile.absent {
    background: #3a3a3c;
    border-color: #3a3a3c;
}

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes flip {
    0% { transform: rotateX(0deg); }
    50% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Acrostic Row — sits between board and keyboard */
#acrostic-row {
    width: 100%;
    height: 32px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* The backdrop bar — semi-transparent stage for hints */
#acrostic-row.showing {
    background: var(--accent-bg);
    border-radius: 8px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 0.5px solid var(--accent);
}

#acrostic-toggle {
    background: var(--accent-bg);
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent-light);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 4px 10px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.4s ease, background 0.3s ease;
    z-index: 2;
}

/* When showing hints, button slides to left */
#acrostic-row.showing #acrostic-toggle {
    position: absolute;
    left: 4px;
    background: transparent;
    border-color: transparent;
}

/* Acrostic Bar */
#acrostic-bar {
    text-align: center;
    padding: 4px 0;
}

#acrostic-bar.hidden {
    display: none;
}

#acrostic-words {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
}

.acrostic-word {
    color: #3a3a3c;
    transition: color 0.5s ease, opacity 0.5s ease;
}

.acrostic-word.hidden-word {
    opacity: 0.3;
}

.acrostic-word.hidden-word .first-letter {
    color: #565758;
}

.acrostic-word.revealed {
    color: var(--subtitle-color, var(--accent));
    opacity: 1;
}

.acrostic-word .first-letter {
    font-size: 18px;
}

/* Keyboard */
#keyboard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: 500px;
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    height: 52px;
    min-width: 32px;
    padding: 0 6px;
    border: none;
    border-radius: 4px;
    background: #818384;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.key.wide {
    min-width: 56px;
    font-size: 12px;
}

.key.correct {
    background: #6aaa64;
}

.key.present {
    background: #c9b458;
}

.key.absent {
    background: #3a3a3c;
}

/* Keep Playing Overlay */
#keep-playing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#keep-playing-overlay.hidden {
    display: none;
    opacity: 0;
}

#keep-playing-overlay.visible {
    opacity: 1;
}

#keep-playing-content {
    text-align: center;
    padding: 30px 20px;
    max-width: 360px;
}

#keep-playing-title {
    font-family: var(--font-display);
    font-size: 28px;
    color: var(--accent);
    margin-bottom: 16px;
}

#keep-playing-msg {
    font-size: 16px;
    color: var(--accent-light);
    margin-bottom: 30px;
    line-height: 1.5;
}

#keep-playing-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

#keep-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
}

#keep-btn:hover {
    filter: brightness(1.15);
}

#answer-btn {
    background: none;
    color: var(--accent);
    border: 2px solid var(--accent);
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
}

#answer-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Celebration Overlay */
#celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#celebration-overlay.hidden {
    display: none;
    opacity: 0;
}

#celebration-overlay.visible {
    opacity: 1;
}

#celebration-content {
    text-align: center;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    max-width: 400px;
    z-index: 101;
    max-height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#celeb-title {
    font-family: var(--font-display);
    font-size: 32px;
    margin-bottom: 20px;
    color: var(--accent);
}

#celeb-acrostic {
    margin: 20px 0;
    font-size: 20px;
    line-height: 1.8;
}

#celeb-acrostic .acrostic-line {
    display: block;
}

#celeb-acrostic .acrostic-line .highlight {
    color: #6aaa64;
    font-weight: 700;
    font-size: 24px;
}

#celeb-photos {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
}

#celeb-photos img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--accent);
}

#celeb-message {
    font-size: 18px;
    color: var(--accent-light);
    margin: 20px 0;
    line-height: 1.5;
}

/* Mission Progress in Celebration */
#celeb-progress {
    margin: 20px 0;
}

.progress-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 12px;
}

.progress-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.progress-dot.completed {
    background: #6aaa64;
    border-color: #6aaa64;
    color: #fff;
}

.progress-text {
    font-size: 14px;
    color: var(--accent-light);
    font-style: italic;
    line-height: 1.5;
}

#next-mission-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    margin-top: 10px;
}

#next-mission-btn:hover {
    filter: brightness(1.15);
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 102;
}

/* Shake animation for invalid words */
.shake {
    animation: shake 0.5s ease;
}

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

/* Toast for invalid word */
#toast {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #121213;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
}

/* ============================================
   THEMES — background images + accent colors
   ============================================ */

/* --- Destinations --- */
body.theme-napa {
    --accent: #C8956A;
    --accent-light: #F5E6D8;
    --accent-bg: rgba(90, 50, 20, 0.7);
    --header-bg: rgba(30, 20, 10, 0.85);
    --font-display: 'Playfair Display SC', 'Georgia', serif;
    background: linear-gradient(rgba(15, 10, 5, 0.65), rgba(30, 15, 10, 0.75)),
        url('https://images.pexels.com/photos/11566340/pexels-photo-11566340.jpeg?auto=compress&cs=tinysrgb&w=1920') center/cover no-repeat scroll;
}

body.theme-flathead {
    --accent: #6EAAB5;
    --subtitle-color: #A8D8E2;
    --accent-light: #D4EEF2;
    --accent-bg: rgba(15, 50, 60, 0.7);
    --header-bg: rgba(10, 25, 30, 0.85);
    --font-display: 'Ewert', cursive;
    background: linear-gradient(rgba(5, 15, 20, 0.6), rgba(10, 25, 20, 0.7)),
        url('https://images.pexels.com/photos/9017829/pexels-photo-9017829.jpeg?auto=compress&cs=tinysrgb&w=1920') center/cover no-repeat scroll;
}

body.theme-paris {
    --accent: #D4A0B0;
    --accent-light: #F5E0E8;
    --accent-bg: rgba(60, 30, 45, 0.7);
    --header-bg: rgba(20, 15, 25, 0.85);
    --subtitle-color: #F0D8DE;
    --font-display: 'Josefin Slab', serif;
    background: linear-gradient(rgba(15, 10, 15, 0.6), rgba(25, 15, 25, 0.7)),
        url('https://images.pexels.com/photos/338515/pexels-photo-338515.jpeg?auto=compress&cs=tinysrgb&w=1920') center/cover no-repeat scroll;
}

body.theme-newport {
    --accent: #E8A960;
    --accent-light: #FFF0D8;
    --accent-bg: rgba(40, 60, 70, 0.85);
    --header-bg: rgba(20, 40, 60, 0.85);
    --subtitle-color: #F5E8C8;
    --font-display: 'Cinzel', serif;
    background: url('photos/newport background.jpg') center/cover no-repeat scroll;
}

body.theme-tahoe {
    --accent: #5BAEC9;
    --subtitle-color: #A0D8E8;
    --accent-light: #D4EEF8;
    --accent-bg: rgba(15, 35, 55, 0.7);
    --header-bg: rgba(10, 20, 35, 0.85);
    --font-display: 'IM Fell DW Pica SC', serif;
    background: linear-gradient(rgba(5, 10, 20, 0.55), rgba(10, 20, 35, 0.65)),
        url('https://images.pexels.com/photos/15504968/pexels-photo-15504968.jpeg?auto=compress&cs=tinysrgb&w=1920') center/cover no-repeat scroll;
}

/* Theme-specific h1 overrides */
body.theme-newport header h1,
body.theme-newport .subtitle {
    text-transform: uppercase;
}
body.theme-tahoe header h1 {
    text-transform: uppercase;
}
body.theme-gucci header h1 {
    font-weight: 900;
}

/* --- Maisons — real brand wallpapers --- */
/* Hermès: Didot-style high-contrast serif */
body.theme-hermes {
    --accent: #FF8C42;
    --accent-light: #FFE0C4;
    --accent-bg: rgba(80, 40, 10, 0.85);
    --header-bg: rgba(120, 60, 0, 0.85);
    --subtitle-color: #FFE0C4;
    --font-display: 'Playfair Display', 'Didot', 'Georgia', serif;
    background: url('photos/brands/hermes box wallpaper.jpg') center/cover no-repeat scroll;
}

/* Valentino: clean modern uppercase serif */
body.theme-valentino {
    --accent: #E0E0E0;
    --accent-light: #F8F8F8;
    --accent-bg: rgba(20, 20, 20, 0.85);
    --header-bg: rgba(5, 5, 5, 0.9);
    --font-display: 'DM Serif Display', 'Georgia', serif;
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)),
        url('photos/brands/valentino wall paper.jpg') center/cover no-repeat scroll;
}

/* Louis Vuitton: Futura-inspired geometric sans */
body.theme-lv {
    --accent: #C8A95E;
    --accent-light: #F5ECD0;
    --accent-bg: rgba(40, 30, 10, 0.85);
    --header-bg: rgba(30, 20, 8, 0.9);
    --subtitle-color: #F5ECD0;
    --font-display: 'Josefin Sans', 'Futura', 'Helvetica Neue', sans-serif;
    background: url('photos/brands/LV wallpaper gold on brown.jpg') center/cover no-repeat scroll;
}

/* Chanel: high-contrast Didot serif */
body.theme-chanel {
    --accent: #D4AF37;
    --accent-light: #F5E8C0;
    --accent-bg: rgba(10, 10, 10, 0.85);
    --header-bg: rgba(5, 5, 5, 0.9);
    --font-display: 'Playfair Display', 'Didot', 'Georgia', serif;
    background: url('photos/brands/Chanel wallpaper.jpg') center/cover no-repeat scroll;
}

/* Gucci: classic Granjon/Garamond serif */
body.theme-gucci {
    --accent: #8B6914;
    --accent-light: #F5ECD0;
    --accent-bg: rgba(60, 50, 30, 0.85);
    --header-bg: rgba(180, 170, 150, 0.85);
    --subtitle-color: #FFFFFF;
    --tile-empty-bg: rgba(255, 255, 255, 0.50);
    --tile-empty-border: rgba(255, 255, 255, 0.55);
    --font-display: 'Cormorant Garamond', 'Garamond', serif;
    background: url('photos/brands/gucci wallpaper.jpg') center/cover no-repeat scroll;
}

/* Prada: geometric sans-serif */
body.theme-prada {
    --accent: #FF4444;
    --accent-light: #FFD4D4;
    --accent-bg: rgba(60, 10, 10, 0.85);
    --header-bg: rgba(140, 10, 10, 0.85);
    --subtitle-color: #FFD4D4;
    --font-display: 'Josefin Sans', 'Futura', 'Helvetica Neue', sans-serif;
    background: url('photos/brands/prada red black.jpg') center/cover no-repeat scroll;
}

/* YSL: Bodoni-style serif */
body.theme-ysl {
    --accent: #D4AF37;
    --accent-light: #F5E8C0;
    --accent-bg: rgba(10, 8, 5, 0.85);
    --header-bg: rgba(5, 5, 3, 0.9);
    --font-display: 'Bodoni Moda', 'Didot', 'Georgia', serif;
    background: url('photos/brands/YSL wallpaper.jpg') center/cover no-repeat scroll;
}

/* Goyard: refined classic serif */
body.theme-goyard {
    --accent: #A0A0A8;
    --accent-light: #E0E0E5;
    --accent-bg: rgba(15, 15, 15, 0.85);
    --header-bg: rgba(10, 10, 10, 0.9);
    --subtitle-color: #D0D0D5;
    --font-display: 'Cormorant Garamond', 'Garamond', serif;
    background: url('photos/brands/goyard black wallpaper.jpg') center/cover no-repeat scroll;
}

/* Louboutin: elegant italic serif */
body.theme-louboutin {
    --accent: #FF2020;
    --accent-light: #FFD0D0;
    --accent-bg: rgba(80, 0, 0, 0.85);
    --header-bg: rgba(200, 0, 0, 0.85);
    --subtitle-color: #FFD0D0;
    --font-display: 'Playfair Display', 'Georgia', serif;
    font-style: italic;
    background: url('photos/brands/loubitan wallpaper.jpg') center/cover no-repeat scroll;
}

/* D&G: bold serif display */
body.theme-dg {
    --accent: #E0E0E0;
    --accent-light: #F8F8F8;
    --accent-bg: rgba(15, 15, 15, 0.85);
    --header-bg: rgba(5, 5, 5, 0.9);
    --subtitle-color: #F8F8F8;
    --tile-empty-bg: rgba(255, 255, 255, 0.50);
    --tile-empty-border: rgba(255, 255, 255, 0.55);
    --font-display: 'DM Serif Display', 'Georgia', serif;
    background: url('photos/brands/DG wallpaper.jpg') center/cover no-repeat scroll;
}

/* Dior: Bodoni-style high fashion serif */
body.theme-dior {
    --accent: #C85070;
    --accent-light: #F5D0D8;
    --accent-bg: rgba(80, 20, 30, 0.85);
    --header-bg: rgba(160, 50, 60, 0.85);
    --subtitle-color: #FAF0F2;
    --tile-empty-bg: rgba(255, 255, 255, 0.50);
    --tile-empty-border: rgba(255, 255, 255, 0.55);
    --font-display: 'Bodoni Moda', 'Didot', 'Georgia', serif;
    background: url('photos/brands/dior wallpaper.jpg') center/cover no-repeat scroll;
}

/* Cartier: elegant italic Garamond */
body.theme-cartier {
    --accent: #D4AF37;
    --accent-light: #F5E8C0;
    --accent-bg: rgba(50, 10, 10, 0.85);
    --header-bg: rgba(60, 10, 10, 0.9);
    --font-display: 'Cormorant Garamond', 'Garamond', serif;
    background: url('photos/brands/cartier wallpaper.jpg') center/cover no-repeat scroll;
}

/* ============================================
   MINI-GAME OVERLAY
   ============================================ */
#minigame-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 150;
    background: #1a0a2e;
}

#minigame-overlay.hidden {
    display: none;
}

#minigame-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#minigame-instructions {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    padding: 12px 24px;
    border-radius: 12px;
    animation: pulse-text 1.5s ease-in-out infinite;
    z-index: 151;
    transition: opacity 0.4s ease;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#open-gift-btn {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    background: #D4AF37;
    color: #1a0a2e;
    border: none;
    padding: 16px 40px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    z-index: 151;
    animation: pulse-text 1s ease-in-out infinite;
}

#open-gift-btn.hidden {
    display: none;
}

/* ============================================
   GIFT REVEAL OVERLAY
   ============================================ */
#gift-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 160;
    background: linear-gradient(135deg, #1a0a2e 0%, #4a1a6b 50%, #2a0a3e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    overflow-y: auto;
}

#gift-overlay.hidden {
    display: none;
    opacity: 0;
}

#gift-overlay.visible {
    opacity: 1;
}

#gift-content {
    text-align: center;
    padding: 30px 20px;
    max-width: 420px;
    width: 100%;
    z-index: 161;
}

#gift-title {
    font-family: var(--font-display);
    font-size: 28px;
    color: #D4AF37;
    margin-bottom: 12px;
}

#gift-subtitle {
    font-size: 16px;
    color: #e8d5f5;
    margin-bottom: 24px;
    line-height: 1.5;
}

#gift-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

.gift-card {
    background: none;
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 14px;
    padding: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.gift-card:hover, .gift-card:active {
    border-color: #D4AF37;
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.gift-img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.gift-label {
    padding: 10px 8px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    text-align: center;
}

.gift-name {
    font-size: 14px;
    font-weight: 700;
    color: #D4AF37;
    display: block;
}

.gift-desc {
    font-size: 11px;
    color: #c8a0d0;
    display: block;
    margin-top: 2px;
}

/* --- Trip Detail Modal --- */
#trip-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 170;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#trip-modal.hidden {
    display: none;
    opacity: 0;
}

#trip-modal-content {
    max-width: 400px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 18px;
    background: linear-gradient(170deg, #1a0a2e 0%, #2a1248 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

#trip-modal-gallery {
    position: relative;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    cursor: pointer;
}

#trip-modal-gallery img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s ease;
}

#trip-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px 0 0;
}

#trip-gallery-dots .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.25);
    transition: background 0.3s ease;
}

#trip-gallery-dots .dot.active {
    background: #D4AF37;
}

#trip-modal-body {
    padding: 6px 20px 20px;
}

#trip-modal-title {
    font-family: var(--font-display);
    font-size: 24px;
    color: #D4AF37;
    margin-bottom: 16px;
}

#trip-modal-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 15px;
    line-height: 1.7;
    color: #dcc8e8;
    margin-bottom: 24px;
}

#trip-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#trip-confirm-btn {
    background: linear-gradient(135deg, #D4AF37, #b8942e);
    color: #1a0a2e;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

#trip-confirm-btn:active {
    transform: scale(0.97);
}

#trip-back-btn {
    background: none;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 12px;
    font-size: 14px;
    color: #c8a0d0;
    cursor: pointer;
    transition: all 0.2s ease;
}

#trip-back-btn:active {
    background: rgba(255, 255, 255, 0.05);
}

#cash-option {
    background: none;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    color: #D4AF37;
    font-size: 14px;
    padding: 12px 24px;
    cursor: pointer;
    margin-top: 4px;
    width: 100%;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

#cash-option:hover {
    background: rgba(212, 175, 55, 0.1);
}

#gift-chosen {
    position: relative;
    padding: 40px 20px;
}

#gift-chosen.hidden {
    display: none;
}

#gift-chosen-title {
    font-family: var(--font-display);
    font-size: 28px;
    color: #D4AF37;
    margin-bottom: 16px;
}

#gift-chosen-msg {
    font-size: 18px;
    color: #e8d5f5;
    line-height: 1.5;
}

#gift-confetti-canvas {
    position: absolute;
    top: -200px;
    left: -50%;
    width: 200%;
    height: 600px;
    pointer-events: none;
}

/* Narrow / short viewport — tighten spacing so keyboard isn't clipped */
@media (max-height: 700px) {
    #board {
        margin: 4px 0;
    }
    header {
        padding: 6px 0 4px;
    }
    #message-bar {
        padding: 6px 12px;
        min-height: 36px;
        margin: 2px 0;
    }
    #keyboard {
        gap: 4px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    /* Tighten celebration for short screens */
    #celeb-title {
        font-size: 24px;
        margin-bottom: 10px;
    }
    #celeb-acrostic {
        margin: 10px 0;
        font-size: 16px;
    }
    #celeb-photos img {
        width: 60px;
        height: 60px;
    }
    #celeb-photos {
        margin: 10px 0;
    }
    #celeb-message {
        font-size: 14px;
        margin: 10px 0;
    }
    .progress-dot {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    #next-mission-btn {
        padding: 10px 28px;
        font-size: 14px;
    }
}
