/* ── Tattacan Global Styles ─────────────────────────────────────────── */
:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-panel: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --text: #eee;
    --text-muted: #aaa;
    --gold: #f4c430;
    --green: #2ecc71;
    --blue: #3498db;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior: none;
}

/* ── Portal ────────────────────────────────────────────────────────── */
.portal-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

.portal-hero {
    margin-bottom: 28px;
    text-align: left;
}

.portal-title {
    color: var(--gold);
    font-size: clamp(2.8rem, 7vw, 5rem);
    line-height: 0.96;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.portal-caption {
    color: var(--text-muted);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.45;
}

.portal-home {
    margin-bottom: 28px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.portal-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-section-title {
    color: var(--text);
    font-size: clamp(1.05rem, 2.2vw, 1.3rem);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.portal-section-meta {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
    justify-content: flex-start;
    gap: 14px;
}

.game-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    background: linear-gradient(160deg, #1e2a4a 0%, #16213e 50%, #121a32 100%);
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.game-tile:hover {
    transform: translateY(-4px);
    border-color: rgba(244, 196, 48, 0.45);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.game-tile-soon {
    cursor: not-allowed;
    opacity: 0.7;
    background: linear-gradient(160deg, #1a2138 0%, #131a2e 60%, #0f1426 100%);
}

.game-tile-soon:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.game-tile-status {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: 999px;
    line-height: 1;
}

.status-live {
    background: rgba(46, 204, 113, 0.18);
    color: var(--green);
    border: 1px solid rgba(46, 204, 113, 0.4);
}

.status-soon {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-tile-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 196, 48, 0.08);
    color: var(--gold);
    border: 1px dashed rgba(244, 196, 48, 0.35);
    font-weight: 700;
    letter-spacing: 0.08em;
    font-size: 1rem;
}

.game-tile-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 0;
    padding: 0;
}

.game-tile-logo {
    display: block;
    max-width: min(72%, 108px);
    max-height: 84px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.22));
}

.game-tile-copy h2,
.game-tile-copy h3 {
    color: var(--gold);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.game-tile-soon .game-tile-copy h3 {
    color: var(--text-muted);
}

.portal-footer {
    margin-top: 48px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.portal-footer-brand {
    color: var(--gold);
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    font-weight: 700;
}

.portal-footer-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.game-hub-toolbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 18px;
}

.portal-back-btn {
    min-width: 148px;
}

/* ── Lobby ─────────────────────────────────────────────────────────── */
.lobby-container {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.game-launcher {
    padding: 10px 0 0;
}

.logo h1 {
    font-size: 3rem;
    letter-spacing: 6px;
    color: var(--gold);
    text-shadow: 2px 2px 8px rgba(244, 196, 48, 0.3);
    margin-bottom: 4px;
}

.logo .subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 30px;
}

.lobby-card, .rules-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    text-align: left;
}

.lobby-card h2, .rules-card h3 {
    margin-bottom: 16px;
    color: var(--gold);
}

.player-setup {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.player-input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.optional { color: #666; font-size: 0.75rem; }

.player-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #333;
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.player-input:focus {
    outline: none;
    border-color: var(--accent);
}

.rules-card ul {
    list-style: none;
    padding: 0;
}

.rules-card li {
    padding: 6px 0;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
}

.rules-card li:last-child {
    border-bottom: none;
}

.detail-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.detail-block {
    background: var(--bg-dark);
    border: 1px solid #24304b;
    border-radius: 12px;
    padding: 16px;
}

.detail-block h4 {
    color: var(--gold);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

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

.detail-list li {
    padding: 8px 0;
    border-bottom: 1px solid #222;
    font-size: 0.92rem;
    line-height: 1.5;
}

.detail-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-cost-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.detail-cost-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.detail-cost-item strong {
    color: var(--text);
    font-size: 0.92rem;
}

.detail-cost-item span {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.4;
}

.error-banner {
    background: var(--accent);
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: #333;
    color: var(--text);
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.2);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
    font-weight: bold;
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.back-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.back-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.btn-action {
    width: 100%;
    margin-bottom: 6px;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.9rem;
    background: var(--bg-card);
    border: 1px solid #333;
}

.btn-action:hover {
    border-color: var(--accent);
    background: #1a1a3e;
}

.btn-action.active {
    border-color: var(--gold);
    background: rgba(244, 196, 48, 0.1);
}

.btn-end {
    background: var(--green);
    color: #111;
    font-weight: bold;
    text-align: center;
    margin-top: 8px;
}

@media (max-width: 720px) {
    .portal-container {
        padding: 28px 16px 40px;
    }

    .portal-hero {
        text-align: center;
        margin-bottom: 22px;
    }

    .portal-caption {
        margin: 0 auto;
    }

    .game-grid {
        grid-template-columns: repeat(2, minmax(128px, 148px));
        justify-content: center;
        gap: 12px;
    }

    .game-grid > :only-child {
        grid-column: 1 / -1;
        justify-self: center;
    }

    .game-tile {
        width: min(100%, 148px);
        padding: 12px 10px;
        gap: 10px;
        border-radius: 16px;
    }

    .game-tile-logo-wrap {
        min-height: 0;
        padding: 0;
    }

    .game-tile-logo {
        max-width: min(76%, 92px);
        max-height: 70px;
    }

    .game-tile-placeholder {
        width: 54px;
        height: 54px;
        font-size: 0.9rem;
    }

    .game-tile-status {
        font-size: 0.55rem;
        padding: 2px 6px;
    }

    .game-tile-copy h2,
    .game-tile-copy h3 {
        font-size: 0.92rem;
        line-height: 1.15;
    }

    .portal-section-head {
        margin-bottom: 12px;
    }

    .portal-footer {
        margin-top: 36px;
    }

    .lobby-container {
        padding: 24px 0 0;
    }
}
