/* ── UCM Colors: Gold #dbaa00, Blue #0f2d52, Dark #071828 ── */

@font-face {
    font-family: 'PixelPurl';
    src: url('../assets/PixelPurl.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    background: #071828;
    min-height: 100%;
    font-family: 'PixelPurl', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: auto;
}

#gameContainer {
    width: 98%;
    height: 100vh;
    margin: 20px auto;
    border: 4px solid rgba(219, 170, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

#gameContainer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.gameAlign {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 0 auto;
}

.author-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    margin-bottom: 20px;
    background: rgba(219, 170, 0, 0.07);
    border: 1px solid rgba(219, 170, 0, 0.28);
    border-radius: 999px;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.6px;
}
.author-badge span {
    color: #dbaa00;
    font-weight: 600;
    letter-spacing: 0.4px;
}

h1 {
    color: #dbaa00;
    font-size: 3.2rem;
    border-bottom: rgba(219, 170, 0, 0.3) 2px solid;
}

a.back {
    border: 1px solid rgba(219, 170, 0, 0.4);
    border-radius: 6px;
    background-color: rgba(219, 170, 0, 0.1);
    padding: 8px 16px;
    text-decoration: none;
    color: #dbaa00;
    transition: background 0.2s;
}
a.back:hover { background: rgba(219, 170, 0, 0.22); }

.top {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 12px 20px 0 20px;
    position: relative;
}

.title-group {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
    max-width: 55%;
}
.top h1 { align-content: center; color: #ffffff; border-bottom: none; margin: 0; }
.game-teaches {
    margin: 0;
    font-size: 1.3rem;
    color: rgba(219, 170, 0, 0.6);
    font-family: 'PixelPurl', 'Segoe UI', system-ui, sans-serif;
    text-align: center;
}
.game-teaches:empty { display: none; }

.fullscreen-btn {
    background: rgba(219, 170, 0, 0.1);
    border: 1px solid rgba(219, 170, 0, 0.4);
    border-radius: 6px;
    color: #dbaa00;
    font-size: 2.3rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.fullscreen-btn:hover { background: rgba(219, 170, 0, 0.22); }

@media (max-width: 768px) {
    .top {
        flex-wrap: wrap;
    }
    .title-group {
        position: static;
        transform: none;
        pointer-events: auto;
        max-width: 100%;
        order: 4;
        flex: none;
        width: 100%;
    }
    .top h1 {
        width: 100%;
        text-align: center;
        font-size: 2.4rem;
        margin: 0;
    }
    .fullscreen-btn {
        order: 3;
    }
}

#gameContainer:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    border: none;
}

/* --- HOW TO PLAY BUTTON --- */
.htp-btn {
    background: rgba(219, 170, 0, 0.1);
    border: 1px solid rgba(219, 170, 0, 0.4);
    border-radius: 6px;
    color: #dbaa00;
    font-family: 'PixelPurl', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.4rem;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    order: 2;
}
.htp-btn:hover { background: rgba(219, 170, 0, 0.22); }
.htp-btn.hidden { display: none; }

@media (max-width: 768px) {
    .htp-btn { font-size: 1.1rem; padding: 6px 12px; order: 2; }
}

.light-mode .htp-btn {
    background: rgba(15, 45, 82, 0.08);
    border-color: rgba(15, 45, 82, 0.3);
    color: #0f2d52;
}
.light-mode .htp-btn:hover { background: rgba(15, 45, 82, 0.16); }

/* --- HOW TO PLAY OVERLAY --- */
.htp-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}
.htp-overlay.hidden { display: none; }

.htp-overlay-inner {
    background: #071828;
    border: 1px solid rgba(219, 170, 0, 0.35);
    border-radius: 14px;
    max-width: 1100px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    padding: clamp(20px, 3vw, 36px);
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.htp-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(219, 170, 0, 0.2);
}

.htp-overlay-title {
    color: #dbaa00;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin: 0;
}

.htp-overlay-close {
    background: rgba(219, 170, 0, 0.1);
    border: 1px solid rgba(219, 170, 0, 0.4);
    border-radius: 6px;
    color: #dbaa00;
    font-family: 'PixelPurl', 'Segoe UI', system-ui, sans-serif;
    font-size: 1.3rem;
    padding: 8px 18px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.htp-overlay-close:hover { background: rgba(219, 170, 0, 0.26); }

.htp-overlay-body { display: flex; flex-direction: column; gap: 32px; }

/* Inside overlay the section headings are redundant — hide them */
.htp-overlay .htp-heading { display: none; }
.htp-overlay .htp-section { margin: 0; width: 100%; }
.htp-overlay .htp-section.hidden { display: none; }

.light-mode .htp-overlay-inner {
    background: #ffffff;
    border-color: rgba(15, 45, 82, 0.3);
}
.light-mode .htp-overlay-title { color: #0f2d52; }
.light-mode .htp-overlay-close {
    background: rgba(15, 45, 82, 0.08);
    border-color: rgba(15, 45, 82, 0.3);
    color: #0f2d52;
}
.light-mode .htp-overlay-close:hover { background: rgba(15, 45, 82, 0.16); }

/* --- HOW TO PLAY / WHAT YOU'LL LEARN SECTIONS --- */
.htp-section {
    width: min(96%, 1400px);
    margin: 0 auto clamp(28px, 4vw, 56px);
}

.htp-section.hidden { display: none; }

/* Divider-style heading: line — label — line */
.htp-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: clamp(16px, 2.5vw, 28px);
}
.htp-heading::before,
.htp-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(219, 170, 0, 0.22);
}
.htp-heading-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(0.75rem, 1.4vw, 1.05rem);
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
}
.htp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(22px, 2.5vw, 30px);
    height: clamp(22px, 2.5vw, 30px);
    line-height: 1;
    background: rgba(219, 170, 0, 0.12);
    border: 1px solid rgba(219, 170, 0, 0.35);
    border-radius: 50%;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    font-weight: 800;
    color: #dbaa00;
    flex-shrink: 0;
}

/* 3-column grid → 2-col → 1-col */
.htp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(12px, 2vw, 22px);
}
@media (max-width: 860px) {
    .htp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
    .htp-grid { grid-template-columns: 1fr; }
}

/* Card — accent color driven by --card-accent CSS variable set inline per card */
.htp-card {
    background: linear-gradient(160deg, rgba(15, 45, 82, 0.35), rgba(7, 24, 40, 0.6));
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-top: 3px solid var(--card-accent, #dbaa00);
    border-radius: 12px;
    padding: clamp(18px, 2.5vw, 32px) clamp(16px, 2.2vw, 28px);
    transition: background 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}
/* subtle glow strip at top matching the accent */
.htp-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 70px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--card-accent, #dbaa00) 10%, transparent), transparent);
    pointer-events: none;
}
.htp-card:hover {
    background: linear-gradient(160deg, rgba(15, 45, 82, 0.55), rgba(7, 24, 40, 0.75));
    transform: translateY(-3px);
}

/* Title — white, reads naturally */
.htp-card-title {
    font-size: clamp(1.3rem, 2.2vw, 1.7rem);
    font-weight: 700;
    color: #ffffff;
    margin-bottom: clamp(6px, 1vw, 10px);
    letter-spacing: 0.2px;
    position: relative;
}

/* Coloured category tag under the title */
.htp-card-tag {
    display: inline-block;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--card-accent, #dbaa00);
    background: color-mix(in srgb, var(--card-accent, #dbaa00) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--card-accent, #dbaa00) 35%, transparent);
    border-radius: 4px;
    padding: 3px 10px;
    margin-bottom: clamp(10px, 1.5vw, 16px);
    position: relative;
}

.htp-card-body {
    font-size: clamp(1.05rem, 1.9vw, 1.35rem);
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.7;
    margin: 0;
    position: relative;
}

.theme-toggle {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(219, 170, 0, 0.45);
    background: rgba(255, 255, 255, 0.06);
    color: #dbaa00;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    margin-left: auto;
}

@media (max-width: 768px) {
    .theme-toggle {
        /* Leave absolute positioning — join the .top flex row */
        position: static;
        width: 32px;
        height: 32px;
        order: 3;         
        margin-left: auto; /* shunts the theme+fullscreen pair to the right */
        flex-shrink: 0;
    }
    .theme-toggle svg {
        width: 16px;
        height: 16px;
    }
    .fullscreen-btn {
        order: 3;          /* same row as theme-toggle, right next to it */
        margin-left: 0;
        font-size: 1rem;
        width: 32px;
        height: 32px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .back {
        order: 1;
    }
}
.theme-toggle:hover {
    background: rgba(219, 170, 0, 0.14);
    border-color: rgba(219, 170, 0, 0.75);
    transform: scale(1.08);
}
.theme-toggle svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}
.icon-sun  { display: block; }
.icon-moon { display: none;  }
.light-mode .icon-sun  { display: none;  }
.light-mode .icon-moon { display: block; }

.light-mode body { background: #e8eef5; color: #071828; }
.light-mode h1 { color: #0f2d52; }
.light-mode .top h1 { color: #071828; }
.light-mode a.back {
    color: #0f2d52;
    background-color: rgba(15, 45, 82, 0.08);
    border-color: rgba(15, 45, 82, 0.3);
}
.light-mode a.back:hover { background: rgba(15, 45, 82, 0.16); }
.light-mode .fullscreen-btn {
    background: rgba(15, 45, 82, 0.08);
    border-color: rgba(15, 45, 82, 0.3);
    color: #0f2d52;
}
.light-mode .fullscreen-btn:hover { background: rgba(15, 45, 82, 0.16); }
.light-mode .author-badge {
    background: rgba(15, 45, 82, 0.08);
    border-color: rgba(15, 45, 82, 0.22);
    color: rgba(7, 24, 40, 0.55);
}
.light-mode .author-badge span { color: #0f2d52; }
.light-mode #gameContainer { border-color: rgba(15, 45, 82, 0.22); }
.light-mode .theme-toggle {
    border-color: rgba(15, 45, 82, 0.45);
    background: rgba(15, 45, 82, 0.06);
    color: #0f2d52;
}
.light-mode .theme-toggle:hover {
    background: rgba(15, 45, 82, 0.14);
    border-color: rgba(15, 45, 82, 0.75);
}