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

:root {
    --bg: #11131a;
    --panel: #191d27;
    --panel-2: #222735;
    --border: #31384b;
    --text: #eef2ff;
    --muted: #9ca8c3;
    --accent: #ef8354;
    --accent-2: #4f5d75;
    --danger: #cc2936;
    --success: #06d6a0;
    --role-instructor: #ef8354;
    --role-dispatcher: #4ea8de;
    --role-rtp: #06d6a0;
    --role-observer: #9ca8c3;
    --role-waiting: #6c757d;
    --fire-zone: #ff4444;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', "Segoe UI", system-ui, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(239, 131, 84, 0.12), transparent 32%),
        radial-gradient(circle at bottom left, rgba(78, 168, 222, 0.06), transparent 40%),
        linear-gradient(180deg, #0f1218 0%, #11131a 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.site-header,
.row,
.button-row,
.landing-actions,
.grid-cards,
.tool-grid {
    display: flex;
}

.grid-two,
.grid-three {
    display: grid;
    gap: 16px;
}

.grid-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.site-header,
.page-shell {
    width: min(1400px, calc(100vw - 32px));
    margin: 0 auto;
}

.site-header {
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.top-nav,
.button-row,
.row {
    gap: 12px;
}

.page-shell {
    padding-bottom: 32px;
}

.panel,
.hero-card,
.action-card,
.map-card {
    background: rgba(25, 29, 39, 0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.panel,
.hero-card {
    padding: 24px;
}

.panel.compact {
    padding: 16px;
}

.hero-card {
    display: grid;
    gap: 24px;
}

.landing-actions {
    gap: 16px;
    flex-wrap: wrap;
}

.action-card {
    flex: 1 1 240px;
    padding: 20px;
    min-height: 160px;
    display: grid;
    align-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.action-card:hover:not(.disabled) {
    transform: translateY(-2px);
    border-color: var(--accent);
}

.action-card.disabled {
    opacity: 0.7;
}

.action-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.action-caption,
.lead,
.muted {
    color: var(--muted);
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.76rem;
    letter-spacing: 0.12em;
    margin: 0 0 8px;
}

.stack {
    display: grid;
}

.gap-xs {
    gap: 6px;
}

.gap-s {
    gap: 10px;
}

.gap-m {
    gap: 16px;
}

.align-center {
    align-items: center;
}

.spread {
    justify-content: space-between;
}

.grow {
    flex: 1 1 auto;
}

.field {
    display: grid;
    gap: 8px;
}

.checkbox-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.field input,
.field textarea,
.field select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #0f141d;
    color: var(--text);
    padding: 12px 14px;
}

.button {
    border: 1px solid var(--border);
    background: var(--accent-2);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
}

.button.primary {
    background: var(--accent);
    border-color: rgba(255, 255, 255, 0.06);
    color: #161616;
    font-weight: 700;
}

.button:disabled,
.tool-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.button.xl {
    padding: 14px 18px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}

.pill.subtle {
    color: var(--muted);
}

.key-box,
.error-box,
.warning-note {
    border-radius: 14px;
    padding: 14px 16px;
}

.key-box {
    display: grid;
    gap: 6px;
    background: #11161f;
    border: 1px solid var(--border);
}

.key-box code {
    font-size: 0.95rem;
    overflow-wrap: anywhere;
}

.key-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.error-box {
    background: rgba(204, 41, 54, 0.18);
    border: 1px solid rgba(204, 41, 54, 0.4);
}

.warning-note {
    background: rgba(239, 131, 84, 0.12);
    border: 1px solid rgba(239, 131, 84, 0.25);
}

.qr-panel {
    display: grid;
    gap: 12px;
    align-items: start;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #11161f;
}

.qr-image {
    width: 180px;
    height: 180px;
    border-radius: 12px;
    background: white;
    padding: 8px;
}

.hidden {
    display: none;
}

.map-groups {
    display: grid;
    gap: 20px;
}

.grid-cards {
    gap: 12px;
    flex-wrap: wrap;
}

.map-card {
    min-width: 220px;
    padding: 14px;
    display: grid;
    gap: 6px;
}

.runtime-map-stage {
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
}

.runtime-map-grid-double {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.runtime-map-panel,
.runtime-side-panel {
    background: #11161f;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
}

.runtime-canvas-wrap {
    padding: 8px;
}

.runtime-map-canvas {
    display: block;
    width: 100%;
    height: auto;
    min-height: 320px;
    border-radius: 10px;
    background: #0b0e14;
}

.participant-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #11161f;
}

.role-actions {
    flex-wrap: wrap;
}

.editor-shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 18px;
}

.editor-sidebar,
.editor-main {
    display: grid;
    gap: 16px;
    align-content: start;
}

.editor-main .grow {
    min-height: 0;
}

.canvas-wrap {
    overflow: auto;
    border-radius: 14px;
    background: #0b0e14;
    padding: 8px;
}

#map-canvas,
#mini-map {
    display: block;
    border-radius: 10px;
    background: #0b0e14;
}

.mini-panel {
    width: fit-content;
}

.tool-grid {
    gap: 8px;
    flex-wrap: wrap;
}

.tool-btn {
    border: 1px solid var(--border);
    background: #11161f;
    color: var(--text);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
}

.tool-btn.active {
    border-color: var(--accent);
    background: rgba(239, 131, 84, 0.2);
}

.layer-row,
.level-row,
.palette-row {
    display: grid;
    gap: 8px;
}

.layer-row {
    grid-template-columns: auto 1fr auto auto auto auto;
    align-items: center;
}

.level-row {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.palette-list {
    display: grid;
    gap: 8px;
}

.palette-row {
    grid-template-columns: 18px 1fr;
    align-items: center;
    cursor: pointer;
}

.swatch {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.small-toggle {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: #11161f;
    cursor: pointer;
    position: relative;
}

.small-toggle:checked::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.layer-move {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

@media (max-width: 1100px) {
    .editor-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {

    .site-header,
    .page-shell {
        width: min(100vw - 20px, 100%);
    }

    .grid-two,
    .grid-three {
        grid-template-columns: 1fr;
    }

    .runtime-map-stage,
    .runtime-map-grid-double {
        grid-template-columns: 1fr;
    }

    .row,
    .button-row {
        flex-wrap: wrap;
    }
}

/* ──────── Role-specific pill colors ──────── */
.pill.role-instructor {
    background: rgba(239, 131, 84, 0.2);
    border-color: var(--role-instructor);
    color: var(--role-instructor);
}

.pill.role-dispatcher {
    background: rgba(78, 168, 222, 0.2);
    border-color: var(--role-dispatcher);
    color: var(--role-dispatcher);
}

.pill.role-rtp {
    background: rgba(6, 214, 160, 0.2);
    border-color: var(--role-rtp);
    color: var(--role-rtp);
}

.pill.role-observer {
    background: rgba(156, 168, 195, 0.15);
    border-color: var(--role-observer);
    color: var(--role-observer);
}

.pill.role-waiting {
    background: rgba(108, 117, 125, 0.15);
    border-color: var(--role-waiting);
    color: var(--role-waiting);
}

.pill.role-admin {
    background: rgba(239, 131, 84, 0.2);
    border-color: var(--role-instructor);
    color: var(--role-instructor);
}

/* ──────── Button hover & transition ──────── */
.button {
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.button.primary:hover:not(:disabled) {
    background: #f49a6e;
    box-shadow: 0 4px 20px rgba(239, 131, 84, 0.4);
}

/* ──────── Glow Start button ──────── */
.button.glow {
    animation: glow-pulse 2s ease-in-out infinite;
    font-size: 1.1rem;
    padding: 14px 24px;
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(239, 131, 84, 0.3);
    }

    50% {
        box-shadow: 0 0 24px rgba(239, 131, 84, 0.6), 0 0 48px rgba(239, 131, 84, 0.2);
    }
}

/* ──────── Fire zone pulse overlay (used in JS canvas) ──────── */
@keyframes fire-zone-pulse {

    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.65;
    }
}

/* ──────── Landing hero ──────── */
.landing-hero {
    text-align: center;
    padding: 48px 24px 40px;
}

.landing-hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--accent), #f7c59f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-hero .grid-three {
    justify-items: center;
    max-width: 640px;
    margin: 0 auto;
}

/* ──────── Map card hover ──────── */
.map-card {
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

a.map-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(239, 131, 84, 0.15);
}

/* ──────── Tool button hover ──────── */
.tool-btn {
    transition: background 0.15s ease, border-color 0.15s ease;
}

.tool-btn:hover:not(:disabled):not(.active) {
    background: rgba(239, 131, 84, 0.1);
    border-color: rgba(239, 131, 84, 0.3);
}

/* ──────── Key box glow ──────── */
.key-box code {
    color: var(--accent);
}