/* ============================================
   HT HUB GAME STYLES
   Theme-aware via CSS custom properties (--t-*)
   Set by js/game-themes.js
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&display=swap');

/* Gold theme defaults - overridden by game-themes.js */
:root {
    --t-bg: #f5f0e3;
    --t-bg-grad: radial-gradient(ellipse at 50% -20%, #fdfbf5 0%, #f5f0e3 70%);
    --t-text: #1a1207;
    --t-text-muted: #5a4a2a;
    --t-text-subtle: #8a7a5a;
    --t-primary: #d4a017;
    --t-primary-dark: #8b6914;
    --t-primary-mid: #b8860b;
    --t-glass-bg: rgba(139,105,20,0.06);
    --t-glass-border: rgba(139,105,20,0.15);
    --t-card-bg: rgba(139,105,20,0.05);
    --t-card-border: rgba(139,105,20,0.12);
    --t-btn-grad: linear-gradient(135deg, #d4a017, #b8860b);
    --t-correct: #6aaa64;
    --t-present: #c9b458;
    --t-absent: #787c7e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--t-bg);
    color: var(--t-text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Back Link ---- */
.back-link {
    position: fixed; top: 1rem; left: 1rem;
    display: flex; align-items: center; gap: 0.4rem;
    color: var(--t-text-muted); text-decoration: none;
    font-size: 0.85rem; font-weight: 500; z-index: 100;
    transition: color 0.3s;
}
.back-link:hover { color: var(--t-primary); }

/* ---- Header ---- */
.hub-header {
    position: relative; text-align: center; padding: 5rem 1rem 2rem;
}
.header-glow {
    position: absolute; top: -80px; left: 50%; transform: translateX(-50%);
    width: 500px; height: 300px;
    background: radial-gradient(ellipse, rgba(212,160,23,0.12) 0%, transparent 70%);
    pointer-events: none;
}
.hub-title {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
    background: linear-gradient(135deg, var(--t-primary) 0%, var(--t-primary-mid) 50%, var(--t-primary-dark) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hub-subtitle {
    margin-top: 0.5rem; color: var(--t-text-muted);
    font-size: 1.1rem; font-weight: 300;
}

/* ---- Games Grid ---- */
.games-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem; max-width: 1000px; margin: 2rem auto; padding: 0 1.5rem;
}

/* ---- Game Card ---- */
.game-card {
    position: relative; display: flex; flex-direction: column;
    align-items: center; text-align: center;
    padding: 2.5rem 1.5rem 2rem; border-radius: 20px;
    text-decoration: none; color: var(--t-text); overflow: hidden;
    cursor: pointer; transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), box-shadow 0.35s;
}
.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(139,105,20,0.15);
}
.card-bg {
    position: absolute; inset: 0;
    background: var(--t-glass-bg); border: 1px solid var(--t-glass-border);
    border-radius: 20px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.game-card:hover .card-bg {
    border-color: rgba(212,160,23,0.4);
    box-shadow: 0 0 20px rgba(212,160,23,0.08);
}
.card-category {
    position: relative; z-index: 1;
    font-family: 'Orbitron', monospace; font-size: 0.6rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em;
    color: var(--t-primary); margin-bottom: 1rem;
}
.card-icon {
    position: relative; z-index: 1; font-size: 3.5rem; margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(139,105,20,0.15));
}
.card-title {
    position: relative; z-index: 1; font-size: 1.5rem;
    font-weight: 600; margin-bottom: 0.5rem; color: var(--t-text);
}
.card-desc {
    position: relative; z-index: 1; font-size: 0.85rem;
    color: var(--t-text-muted); line-height: 1.5; margin-bottom: 1.2rem;
}
.card-play {
    position: relative; z-index: 1; font-size: 0.85rem;
    font-weight: 600; color: var(--t-primary); transition: letter-spacing 0.3s;
}
.game-card:hover .card-play { letter-spacing: 0.05em; }

/* Category accent colors */
[data-category="puzzle"] .card-category,
[data-category="puzzle"] .card-play { color: var(--t-primary-mid); }
[data-category="puzzle"]:hover .card-bg { border-color: rgba(184,134,11,0.4); }

[data-category="arcade"] .card-category,
[data-category="arcade"] .card-play { color: #2d8a4e; }
[data-category="arcade"]:hover .card-bg { border-color: rgba(45,138,78,0.4); }

[data-category="strategy"] .card-category,
[data-category="strategy"] .card-play { color: var(--t-primary-dark); }
[data-category="strategy"]:hover .card-bg { border-color: rgba(139,105,20,0.4); }

[data-category="ai"] .card-category,
[data-category="ai"] .card-play { color: #a67c00; }
[data-category="ai"]:hover .card-bg { border-color: rgba(166,124,0,0.5); }

[data-category="word"] .card-category,
[data-category="word"] .card-play { color: var(--t-present); }
[data-category="word"]:hover .card-bg { border-color: rgba(201,180,88,0.4); }

/* ---- Footer ---- */
.hub-footer {
    text-align: center; padding: 3rem 1rem;
    color: var(--t-text-subtle); font-size: 0.85rem;
}
.hub-footer a { color: var(--t-text-muted); text-decoration: none; transition: color 0.3s; }
.hub-footer a:hover { color: var(--t-primary); }

/* ---- Shared Game Page Layout ---- */
.game-page {
    display: flex; flex-direction: column; align-items: center;
    min-height: 100vh; padding: 1rem;
    background: var(--t-bg-grad);
    touch-action: manipulation; /* prevent double-tap zoom on mobile */
}
.game-nav {
    width: 100%; max-width: 700px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 0; margin-bottom: 0.5rem;
}
.game-nav a {
    color: var(--t-text-muted); text-decoration: none;
    font-size: 0.85rem; font-weight: 500;
    display: flex; align-items: center; gap: 0.4rem;
    transition: color 0.3s;
}
.game-nav a:hover { color: var(--t-primary); }
.game-name {
    font-family: 'Orbitron', monospace; font-size: 1.1rem; font-weight: 600;
    background: linear-gradient(135deg, var(--t-primary), var(--t-primary-dark));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.game-container {
    background: var(--t-glass-bg); border: 1px solid var(--t-glass-border);
    border-radius: 20px; padding: 1.5rem;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    position: relative;
}

.game-score-bar {
    display: flex; justify-content: center; gap: 2rem; margin-bottom: 1rem;
}
.score-item { text-align: center; }
.score-label {
    font-family: 'Orbitron', monospace; font-size: 0.6rem;
    text-transform: uppercase; letter-spacing: 0.12em; color: var(--t-text-subtle);
}
.score-value {
    font-family: 'Orbitron', monospace; font-size: 1.5rem; font-weight: 700;
    background: linear-gradient(135deg, var(--t-primary), var(--t-primary-mid));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}

.game-btn {
    display: inline-block; padding: 0.6rem 1.5rem; border: none;
    border-radius: 30px; font-family: inherit; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    color: #fff; background: var(--t-btn-grad); text-decoration: none;
}
.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(212,160,23,0.35);
}
.game-btn-secondary {
    background: var(--t-glass-bg); color: var(--t-primary-dark); margin-left: 0.5rem;
    border: 1px solid var(--t-glass-border);
}

.game-over-overlay {
    position: fixed; inset: 0;
    background: rgba(245,240,227,0.85);
    backdrop-filter: blur(12px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.game-over-overlay.active { opacity: 1; pointer-events: auto; }
.game-over-box {
    text-align: center; padding: 2.5rem;
    background: rgba(255,255,255,0.6);
    border: 1px solid var(--t-glass-border);
    border-radius: 20px; backdrop-filter: blur(20px);
}
.game-over-box h2 {
    font-family: 'Orbitron', monospace; font-size: 1.8rem; margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--t-primary), var(--t-primary-dark));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.game-over-box .final-score {
    font-family: 'Orbitron', monospace; font-size: 3rem; font-weight: 700;
    background: linear-gradient(135deg, var(--t-primary), var(--t-primary-mid));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    margin: 0.5rem 0;
}
.game-over-box p { color: var(--t-text-muted); margin-bottom: 1.5rem; }

/* ---- Theme Bar ---- */
.theme-bar {
    display: flex; align-items: center; gap: 0.4rem;
    justify-content: center; margin-bottom: 0.8rem;
}
.theme-label {
    font-family: 'Orbitron', monospace; font-size: 0.5rem;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--t-text-subtle); margin-right: 0.2rem;
}
.theme-btn {
    padding: 0.25rem 0.6rem; border: 1px solid var(--t-card-border);
    border-radius: 20px; font-family: inherit; font-size: 0.65rem;
    font-weight: 600; cursor: pointer; background: transparent;
    color: var(--t-text-muted); transition: all 0.2s;
}
.theme-btn:hover { border-color: var(--t-primary); color: var(--t-primary); }
.theme-btn.active {
    background: var(--t-btn-grad); color: #fff; border-color: transparent;
    box-shadow: 0 2px 6px rgba(212,160,23,0.3);
}

/* ---- Audio Toggle ---- */
.audio-toggle {
    position: fixed; top: 0.8rem; right: 0.8rem;
    display: flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--t-card-border);
    border-radius: 30px;
    background: rgba(245,240,227,0.95);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    cursor: pointer; font-family: 'Poppins', sans-serif;
    font-size: 0.7rem; font-weight: 600; z-index: 200;
    transition: all 0.2s; color: var(--t-text-muted);
    box-shadow: 0 2px 8px rgba(139,105,20,0.08);
}
.audio-toggle svg { width: 16px; height: 16px; flex-shrink: 0; }
.audio-toggle:hover {
    border-color: rgba(212,160,23,0.4);
    background: rgba(212,160,23,0.1);
}
.audio-toggle.muted { opacity: 0.6; text-decoration: line-through; }

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .games-grid { grid-template-columns: 1fr; padding: 0 1rem; }
    .game-container { padding: 1rem; }
    .game-nav { padding: 0.5rem 0; }
    .game-score-bar { gap: 1rem; }
    .hub-header { padding: 3.5rem 1rem 1.5rem; }
    .theme-bar { flex-wrap: wrap; }
    .game-over-box { padding: 1.5rem; margin: 0 1rem; }
    .game-over-box .final-score { font-size: 2.2rem; }
    .game-over-box h2 { font-size: 1.4rem; }
}
