/**
 * Pre-game instructions overlay — host TV + player phone.
 * Sharp corners, Space Grotesk headings, Space Mono labels.
 */

/* ── Host overlay (positioned over Phaser FIT canvas) ─────────────────── */
.host-instructions-chrome {
    --host-tv-scale: 1.4;
    --gi-scale: var(--host-tv-scale);
    position: fixed;
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: var(--void-deep, #0a0a0f);
    border: 1px solid color-mix(in srgb, var(--gi-accent, #00ffcc) 35%, transparent);
    box-shadow: 0 0 48px color-mix(in srgb, var(--gi-accent, #00ffcc) 12%, transparent);
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.host-instructions-chrome.is-visible {
    opacity: 1;
    visibility: visible;
}

.host-instructions-chrome::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gi-accent, #00ffcc);
    z-index: 2;
}

#host-instructions-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 36px 40px 28px;
    min-height: 0;
    overflow: hidden;
}

#host-instructions-inner .gi-col {
    overflow: hidden;
}

/* ── Player overlay (inside #view-game) ─────────────────────────────────── */
#player-instructions {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    background: var(--void-deep, #0a0a0f);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-top: 3px solid var(--gi-accent, #00ffcc);
}

#player-instructions.hidden {
    display: none;
}

#player-instructions-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 20px 24px;
    min-height: min-content;
}

/* ── Shared content blocks ────────────────────────────────────────────── */
.gi-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.gi-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border: 1px solid color-mix(in srgb, var(--gi-accent) 40%, #ffffff22);
    flex-shrink: 0;
}

.gi-eyebrow {
    font-family: var(--font-mono);
    font-size: clamp(12px, 1.05vw, 14px);
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--gi-accent, #00ffcc);
    margin-bottom: 6px;
}

.gi-title {
    font-family: var(--font-display);
    font-size: clamp(30px, 4.2vw, 54px);
    font-weight: 700;
    line-height: 1.05;
    color: var(--on-surface, #e5e2e1);
    margin-bottom: 8px;
}

.gi-tagline {
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.55vw, 18px);
    line-height: 1.5;
    color: var(--on-surface-variant, #b9cbc2);
    letter-spacing: 0.04em;
    max-width: 58ch;
}

.gi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 28px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.gi-grid-compact {
    grid-template-columns: 1fr;
    gap: 16px;
    overflow: visible;
}

.gi-col {
    min-height: 0;
    overflow-y: auto;
}

.gi-section {
    margin-bottom: 20px;
}

.gi-section:last-child {
    margin-bottom: 0;
}

.gi-label {
    font-family: var(--font-mono);
    font-size: clamp(13px, 1.1vw, 14px);
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--gi-accent, #00ffcc);
    margin-bottom: 10px;
}

.gi-body,
.gi-scoring-compact {
    font-family: var(--font-mono);
    font-size: clamp(16px, 1.25vw, 17px);
    line-height: 1.65;
    color: var(--on-surface, #e5e2e1);
}

.gi-bullets,
.gi-bullets-compact,
.gi-tips,
.gi-tips-compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gi-bullets li,
.gi-bullets-compact li {
    font-family: var(--font-mono);
    font-size: clamp(16px, 1.25vw, 17px);
    line-height: 1.65;
    color: var(--on-surface, #e5e2e1);
    padding-left: 16px;
    position: relative;
    margin-bottom: 8px;
}

.gi-bullets li::before,
.gi-bullets-compact li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--gi-accent, #00ffcc);
    font-size: clamp(11px, 0.95vw, 12px);
    top: 4px;
}

.gi-bullets-compact li {
    font-size: clamp(15px, 1.15vw, 16px);
    margin-bottom: 6px;
}

.gi-phase-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gi-phase-item {
    display: flex;
    gap: 14px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ffffff12;
}

.gi-phase-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.gi-phase-num {
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.15vw, 16px);
    font-weight: 700;
    color: var(--gi-accent, #00ffcc);
    flex-shrink: 0;
    padding-top: 2px;
    min-width: 1.6em;
}

.gi-phase-name {
    font-family: var(--font-display);
    font-size: clamp(18px, 1.4vw, 19px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--on-surface, #e5e2e1);
    margin-bottom: 4px;
}

.gi-phase-detail,
.gi-phase-host,
.gi-phase-player {
    font-family: var(--font-mono);
    font-size: clamp(14px, 1.1vw, 15px);
    line-height: 1.6;
    color: var(--on-surface-variant, #b9cbc2);
    margin-bottom: 2px;
}

.gi-phase-role {
    font-weight: 700;
    color: var(--gi-accent, #00ffcc);
    margin-right: 6px;
    font-size: clamp(11px, 0.95vw, 12px);
    letter-spacing: 0.1em;
}

.gi-tips li,
.gi-tips-compact li {
    font-family: var(--font-mono);
    font-size: clamp(15px, 1.15vw, 16px);
    line-height: 1.6;
    color: var(--on-surface-variant, #b9cbc2);
    padding-left: 16px;
    position: relative;
    margin-bottom: 6px;
}

.gi-tips li::before,
.gi-tips-compact li::before {
    content: '★';
    position: absolute;
    left: 0;
    color: var(--gi-accent, #00ffcc);
    font-size: clamp(10px, 0.9vw, 11px);
    top: 3px;
}

.gi-footer {
    flex-shrink: 0;
    margin-top: 20px;
    padding-top: 16px;
    padding-bottom: 8px;
    border-top: 1px solid #ffffff15;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: linear-gradient(transparent, rgba(5, 8, 10, 0.92) 28%);
}

.gi-host-cta-hint {
    font-family: var(--font-mono);
    font-size: clamp(12px, 1vw, 13px);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--warn-yellow, #ffee00);
    text-align: center;
    margin: 0;
}

.gi-continue {
    min-width: 280px;
    font-size: clamp(19px, 1.5vw, 22px);
    letter-spacing: 0.14em;
    padding: 16px 36px;
    border: 2px solid var(--gi-accent, #00ffcc);
    box-shadow: none;
    animation: none;
}

.gi-skip-self {
    min-width: 200px;
    font-size: clamp(13px, 1.1vw, 14px);
    letter-spacing: 0.12em;
    padding: 10px 20px;
    border: 1px solid var(--border-medium, rgba(255, 255, 255, 0.25));
    background: transparent;
    color: var(--on-surface-variant, #b9cbc2);
}

#player-instructions .gi-continue {
    min-width: min(100%, 280px);
    font-size: 1rem;
    padding: 14px 24px;
}

.gi-wait-host {
    font-family: var(--font-mono);
    font-size: clamp(13px, 1.05vw, 14px);
    letter-spacing: 0.15em;
    color: var(--on-surface-variant, #b9cbc2);
    text-align: center;
    animation: gi-pulse 2s ease-in-out infinite;
}

@keyframes gi-pulse {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.gi-missing {
    font-family: var(--font-mono);
    color: var(--on-surface-variant);
    padding: 24px;
}

/* Player compact tweaks */
#player-instructions .gi-title {
    font-size: clamp(24px, 6vw, 28px);
}

#player-instructions .gi-header {
    margin-bottom: 16px;
    gap: 14px;
}

#player-instructions .gi-thumb {
    width: 56px;
    height: 56px;
}

#player-instructions .gi-section-compact {
    margin-bottom: 12px;
}

#view-game {
    position: relative;
}

@media (max-width: 900px) {
    .gi-grid:not(.gi-grid-compact) {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    #host-instructions-inner {
        padding: 28px 24px 20px;
        overflow-y: auto;
    }
}

/* Host TV — scale pre-game instructions with in-game chrome */
.host-instructions-chrome .gi-eyebrow {
    font-size: clamp(calc(12px * var(--gi-scale)), calc(1.05vw * var(--gi-scale)), calc(14px * var(--gi-scale)));
}
.host-instructions-chrome .gi-title {
    font-size: clamp(calc(30px * var(--gi-scale)), calc(4.2vw * var(--gi-scale)), calc(54px * var(--gi-scale)));
}
.host-instructions-chrome .gi-tagline {
    font-size: clamp(calc(14px * var(--gi-scale)), calc(1.55vw * var(--gi-scale)), calc(18px * var(--gi-scale)));
}
.host-instructions-chrome .gi-label {
    font-size: clamp(calc(13px * var(--gi-scale)), calc(1.1vw * var(--gi-scale)), calc(14px * var(--gi-scale)));
}
.host-instructions-chrome .gi-body,
.host-instructions-chrome .gi-scoring-compact,
.host-instructions-chrome .gi-bullets li,
.host-instructions-chrome .gi-bullets-compact li {
    font-size: clamp(calc(16px * var(--gi-scale)), calc(1.25vw * var(--gi-scale)), calc(17px * var(--gi-scale)));
}
.host-instructions-chrome .gi-thumb {
    width: calc(72px * var(--gi-scale));
    height: calc(72px * var(--gi-scale));
}
