/* =========================================
   Allison's Wedding Puzzle Games
   Color Palette: Blue Hydrangea
   ========================================= */

:root {
    --breeze:    #c8daf5;
    --mist:      #acbedc;
    --drift:     #a3b7d8;
    --horizon:   #6b7eb2;
    --depths:    #405380;
    --navy:      #1b2a4a;
    --white:     #ffffff;
    --gold:      #f5d680;
    --gold-bright: #ffd700;
    --success:   #5cb85c;
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, var(--breeze) 0%, var(--mist) 100%);
    color: var(--navy);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

a { text-decoration: none; color: inherit; }

/* ---- Header ---- */
.site-header {
    background: var(--navy);
    padding: 16px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(27, 42, 74, 0.3);
}

.header-link { display: block; }

.site-title {
    color: var(--white);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ---- Main ---- */
.main-content {
    flex: 1;
    padding: 20px 16px 32px;
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Letter Banner ---- */
.letter-banner {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.letter-tile {
    width: 44px;
    height: 52px;
    border-radius: 10px;
    background: var(--white);
    border: 2px solid var(--drift);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease;
}

.letter-face {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--drift);
    transition: all 0.4s ease;
}

/* Unlocked / glowing letter */
.letter-tile.unlocked {
    background: var(--navy);
    border-color: var(--gold);
    box-shadow: 0 0 12px var(--gold), 0 0 24px rgba(245, 214, 128, 0.4);
    animation: letterGlow 2s ease-in-out infinite alternate;
}

.letter-tile.unlocked .letter-face {
    color: var(--gold);
    text-shadow: 0 0 8px var(--gold-bright);
}

@keyframes letterGlow {
    0%   { box-shadow: 0 0 8px var(--gold), 0 0 16px rgba(245, 214, 128, 0.3); }
    100% { box-shadow: 0 0 16px var(--gold-bright), 0 0 32px rgba(245, 214, 128, 0.6); }
}

/* ---- Hub Subtitle ---- */
.hub-subtitle {
    text-align: center;
    font-size: 0.9rem;
    color: var(--depths);
    margin-bottom: 24px;
    font-style: italic;
}

/* ---- Game Grid ---- */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.game-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--white) 0%, var(--breeze) 100%);
    border: 2px solid var(--drift);
    border-radius: 16px;
    padding: 24px 12px;
    min-height: 140px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.3s ease;
    box-shadow: 0 2px 8px rgba(64, 83, 128, 0.1);
}

.game-tile:active {
    transform: scale(0.96);
}

.game-tile:hover {
    border-color: var(--horizon);
    box-shadow: 0 4px 16px rgba(64, 83, 128, 0.2);
}

/* Last tile (odd count) spans full width */
.game-tile:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.game-emoji {
    font-size: 2.4rem;
    margin-bottom: 8px;
}

.game-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--depths);
}

.game-check {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--success);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Completed tile styling */
.game-tile.completed {
    border-color: var(--success);
    background: linear-gradient(135deg, var(--white) 0%, #eaf6ea 100%);
}

/* ---- Secret Modal ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(27, 42, 74, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--white);
    border-radius: 20px;
    padding: 32px 24px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(27, 42, 74, 0.4);
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.modal-overlay.active .modal-card {
    transform: translateY(0);
}

.modal-card h2 {
    font-size: 1.5rem;
    color: var(--navy);
    margin-bottom: 12px;
}

.modal-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gold-bright);
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.5);
    letter-spacing: 4px;
    margin-bottom: 16px;
}

.modal-message {
    font-size: 1.05rem;
    color: var(--depths);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-close {
    background: var(--horizon);
    color: var(--white);
    border: none;
    border-radius: 12px;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close:active {
    background: var(--depths);
}

/* ---- Unscramble Puzzle ---- */
#unscrambleModal .modal-card {
    max-width: 380px;
    width: 94%;
    padding: 28px 20px;
}

.unscramble-pool {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
    margin: 14px 0 10px;
    min-height: 50px;
}

.unscramble-tile {
    width: 38px;
    height: 46px;
    border-radius: 10px;
    background: var(--navy);
    border: 2px solid var(--gold);
    color: var(--gold);
    font-size: 1.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
    box-shadow: 0 0 8px rgba(245, 214, 128, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.unscramble-tile:active {
    transform: scale(0.88);
}

.unscramble-tile.used {
    opacity: 0.2;
    pointer-events: none;
    box-shadow: none;
}

.unscramble-answer {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin: 6px 0 18px;
}

.answer-slot {
    width: 36px;
    height: 46px;
    border-radius: 10px;
    border: 2px dashed var(--drift);
    background: transparent;
    color: var(--navy);
    font-size: 1.2rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.answer-slot[data-filled] {
    background: var(--breeze);
    border-style: solid;
    border-color: var(--horizon);
}

.answer-slot[data-filled]:active {
    transform: scale(0.88);
}

.answer-slot.correct {
    background: var(--success);
    border-color: var(--success);
    color: var(--white);
    animation: slotPop 0.3s ease forwards;
}

@keyframes slotPop {
    0%   { transform: scale(0.85); }
    60%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.modal-reset {
    background: transparent;
    color: var(--horizon);
    border: 2px solid var(--drift);
    border-radius: 12px;
    padding: 8px 28px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.modal-reset:active {
    background: var(--breeze);
    border-color: var(--horizon);
}

/* ---- Final Reveal ---- */
.secret-code {
    display: block;
    margin-top: 10px;
    font-size: 1.5rem;
    letter-spacing: 3px;
    color: var(--gold-bright);
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.6);
}

/* ---- Footer ---- */
.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: var(--depths);
    opacity: 0.7;
}

/* ---- Game Page Shared Styles ---- */
.game-header {
    text-align: center;
    margin-bottom: 24px;
}

.game-header h2 {
    font-size: 1.3rem;
    color: var(--navy);
}

.back-link {
    display: inline-block;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--horizon);
    font-weight: 600;
}

.back-link:active {
    color: var(--depths);
}
