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

:root {
    --bg: #000000;
    --bg-elev: #070a0c;
    --line: rgba(0, 229, 255, 0.28);
    --cyan: #00e5ff;
    --cyan-hot: #7affff;
    --cyan-dim: #007a8a;
    --text: #e8fdff;
    --muted: #7a9aa3;
    --danger: #ff4d6d;
    --ok: #2bffb0;
    --radius: 16px;
    --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
    --glow: 0 0 12px rgba(0, 229, 255, 0.55), 0 0 28px rgba(0, 229, 255, 0.25);
    --tap: 48px;
}

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

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

.pb-body {
    background:
        radial-gradient(ellipse 80% 40% at 50% -10%, rgba(0, 229, 255, 0.12), transparent 60%),
        #000;
    min-height: 100dvh;
}

/* --- داستان تمام‌صفحه ایرس --- */
.iris-story {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}
.iris-story.is-done { display: none !important; }
.iris-story__bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 60% at 50% 20%, rgba(0, 229, 255, 0.18), transparent 55%),
        radial-gradient(ellipse 70% 50% at 50% 100%, rgba(255, 40, 60, 0.12), transparent 50%),
        linear-gradient(180deg, #000 0%, #021014 50%, #000 100%);
}
.iris-story__panel {
    position: relative;
    width: min(440px, 100%);
    min-height: 52vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px 22px 22px;
    border: 1px solid rgba(0, 229, 255, 0.4);
    border-radius: 18px;
    background: rgba(0, 10, 14, 0.92);
    box-shadow: 0 0 40px rgba(0, 229, 255, 0.2), inset 0 0 40px rgba(0, 229, 255, 0.06);
}
.iris-story__brand {
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--cyan-hot);
    text-shadow: var(--glow);
    font-weight: 800;
}
.iris-story__text {
    flex: 1;
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.85;
    font-weight: 600;
    min-height: 7.5rem;
}
.iris-story__actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.iris-story__actions .btn-neon { flex: 1; }
.iris-story__skip {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 0.85rem;
    padding: 10px;
    cursor: pointer;
}
.iris-story__progress {
    height: 3px;
    background: rgba(0, 229, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
}
.iris-story__progress > i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--cyan-dim), var(--cyan-hot));
    transition: width 0.25s ease;
}
body.iris-story-lock .operator-bar--global,
body.iris-story-lock .bottom-nav {
    visibility: hidden;
}

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    padding: 0 14px 24px;
    padding-top: env(safe-area-inset-top, 0px);
}
body:has(.bottom-nav) .app-shell {
    padding-bottom: calc(var(--nav-h) + 12px);
}

/* Brand */
.top-brand {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 10px 0 8px;
}
.brand-logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.55));
}
.brand-team { font-weight: 800; font-size: 1rem; color: var(--cyan-hot); text-shadow: var(--glow); }
.brand-sub { font-size: 0.72rem; color: var(--muted); }
.bomb-code-inline { color: var(--cyan-hot); letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.logout-link {
    color: var(--cyan);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
}

.bomb-id-banner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 14px;
    align-items: center;
    margin: 0 0 14px;
    padding: 12px 14px;
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(0, 60, 72, 0.85), rgba(0, 0, 0, 0.92));
}
.bomb-id-banner__label {
    font-size: 0.75rem;
    color: var(--muted);
}
.bomb-id-banner__code {
    grid-row: 1 / span 2;
    grid-column: 2;
    font-size: 1.55rem;
    letter-spacing: 0.22em;
    color: var(--cyan-hot);
    text-shadow: var(--glow);
    font-variant-numeric: tabular-nums;
}
.bomb-id-banner__hint {
    font-size: 0.72rem;
    color: var(--cyan);
}
.bomb-id-banner--compact {
    grid-template-columns: 1fr auto;
    margin-bottom: 12px;
}
.bomb-id-banner--compact .bomb-id-banner__code {
    grid-row: 1;
    font-size: 1.25rem;
}

/* Operator / AI */
.operator-bar {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(0, 40, 48, 0.9), rgba(0, 0, 0, 0.95));
    box-shadow: inset 0 0 24px rgba(0, 229, 255, 0.08), var(--glow);
    overflow: hidden;
}
.operator-timer {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 6px 8px;
    border: 1px solid rgba(255, 80, 80, 0.45);
    border-radius: 10px;
    background: rgba(40, 0, 0, 0.55);
    color: #ff6b6b;
    animation: timerPulse 1s ease-in-out infinite;
}
.operator-timer.is-hidden,
.operator-timer[hidden] { display: none !important; }
.operator-timer.is-critical {
    border-color: #ff3030;
    color: #fff;
    background: rgba(120, 0, 0, 0.75);
    animation-duration: 0.45s;
}
.operator-timer__label { font-size: 0.58rem; opacity: 0.85; }
.operator-timer__value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}
.operator-timer__unit { font-size: 0.62rem; opacity: 0.8; }
@keyframes timerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 60, 60, 0.35); }
    50% { box-shadow: 0 0 14px 2px rgba(255, 60, 60, 0.45); }
}
.operator-audio-btn {
    position: relative;
    z-index: 2;
    grid-column: 1 / -1;
    justify-self: stretch;
    margin-top: 2px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 229, 255, 0.45);
    border-radius: 10px;
    background: rgba(0, 60, 72, 0.85);
    color: var(--cyan-hot);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}
.operator-audio-btn.is-on {
    display: none;
}
.operator-bar--global {
    position: sticky;
    top: 0;
    z-index: 40;
    margin-bottom: 12px;
}
.operator-live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 8px #ff3b3b;
    animation: liveBlink 1.1s ease-in-out infinite;
    vertical-align: middle;
}
@keyframes liveBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
@media (max-width: 420px) {
    .operator-bar { grid-template-columns: auto 1fr; }
    .operator-timer {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: 8px;
        justify-content: center;
        min-width: 0;
    }
}
.operator-arch {
    position: absolute;
    inset: -40% -20% auto;
    height: 120%;
    background:
        radial-gradient(circle at 50% 120%, transparent 42%, rgba(0, 229, 255, 0.15) 43%, transparent 56%),
        radial-gradient(circle at 50% 120%, transparent 52%, rgba(0, 229, 255, 0.1) 53%, transparent 66%);
    pointer-events: none;
}
.operator-label {
    position: relative;
    font-weight: 800;
    color: var(--cyan);
    text-shadow: var(--glow);
    min-width: 40px;
}
.operator-text {
    position: relative;
    min-height: 2.6em;
    line-height: 1.7;
    font-size: 0.95rem;
    white-space: pre-wrap;
    color: var(--text);
}

/* Panels + bottom nav */
.hub-panels { position: relative; }
.hub-panel { display: none; animation: fadein .22s ease; }
.hub-panel.is-active { display: block; }
@keyframes fadein {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}
.panel-title {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--cyan-hot);
    text-shadow: var(--glow);
}
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.panel-head .panel-title { margin: 0; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, 100%);
    height: var(--nav-h);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.92);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
    z-index: 100;
}
.nav-item {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.7rem;
    font-weight: 600;
    min-height: var(--tap);
    border-radius: 12px;
}
.nav-item .nav-ico { font-size: 1.05rem; line-height: 1; color: inherit; }
.nav-item.is-active {
    color: var(--cyan);
    text-shadow: var(--glow);
    background: rgba(0, 229, 255, 0.08);
    box-shadow: inset 0 0 0 1px var(--line);
}

/* Cards / fields / buttons */
.neon-card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(0, 30, 36, 0.9), rgba(0, 0, 0, 0.95));
    box-shadow: inset 0 0 20px rgba(0, 229, 255, 0.05);
    padding: 16px;
}
.neon-text {
    color: var(--cyan-hot);
    text-shadow: var(--glow);
}
.field, .form-control, .form-select {
    width: 100%;
    min-height: var(--tap);
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #050808 !important;
    color: var(--text) !important;
    padding: 12px 14px;
    font-size: 16px; /* prevent iOS zoom */
}
.field:focus, .form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: var(--glow);
}
.btn-neon {
    appearance: none;
    border: 1px solid var(--cyan);
    background: rgba(0, 229, 255, 0.12);
    color: var(--cyan-hot);
    font-weight: 800;
    border-radius: 12px;
    min-height: var(--tap);
    padding: 0 16px;
    box-shadow: var(--glow);
}
.btn-neon:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-ghost {
    appearance: none;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--cyan);
    border-radius: 999px;
    min-height: 36px;
    padding: 0 12px;
    font-size: 0.8rem;
}
.muted { color: var(--muted); }
.small { font-size: 0.78rem; }
.ok { color: var(--ok); }

/* Puzzle map */
.puzzle-map {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.puzzle-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 14px 12px;
    min-height: 110px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(0, 20, 24, 0.85);
    transition: border-color .15s, box-shadow .15s;
}
.puzzle-card .num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cyan);
    text-shadow: var(--glow);
}
.puzzle-card .title { font-size: 0.82rem; margin-top: 6px; line-height: 1.35; }
.puzzle-card .st { margin-top: 10px; font-size: 0.7rem; color: var(--muted); }
.puzzle-card.open {
    border-color: var(--cyan);
    box-shadow: var(--glow);
}
.puzzle-card.decision {
    border-color: #ffe566;
    box-shadow: 0 0 14px rgba(255, 229, 102, 0.35);
}
.puzzle-card.solved { opacity: 0.65; }
.puzzle-card.locked { opacity: 0.35; pointer-events: none; }

/* Score / board / abilities */
.score-big {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin: 8px 0 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chips span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.75rem;
    color: var(--cyan);
}
.score-log, .echo-list, .leaderboard {
    list-style: none;
    padding: 0;
    margin: 0;
}
.score-log li, .leaderboard li {
    display: grid;
    grid-template-columns: 52px 1fr auto;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
    font-size: 0.86rem;
}
.score-log .plus > span:first-child { color: var(--ok); }
.score-log .minus > span:first-child { color: var(--danger); }
.leaderboard .rank { color: var(--cyan); font-weight: 800; }
.leaderboard .ghost { opacity: 0.5; font-style: italic; }
.ability-list { display: grid; gap: 10px; }
.ability-item {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(0, 16, 20, 0.9);
}
.ability-item .qty { color: var(--cyan-hot); }
.sub-title { color: var(--cyan); font-size: 0.95rem; margin-top: 18px; }
.echo-list li { padding: 8px 0; border-bottom: 1px dashed rgba(0, 229, 255, 0.15); font-size: 0.84rem; }

/* Login */
.login-screen {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: 24px 0 40px;
}
.login-hero { text-align: center; }
.login-logo {
    width: min(240px, 70vw);
    height: auto;
    filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.55));
}
.login-tag {
    margin: 10px 0 0;
    color: var(--cyan);
    text-shadow: var(--glow);
    font-weight: 700;
    letter-spacing: 0.04em;
}
.login-form { display: grid; gap: 8px; }
.login-form label { color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* Play / decision */
.play-screen { padding: 12px 0 24px; }
.play-title { font-size: 1.25rem; font-weight: 800; margin: 8px 0 12px; }
.back-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    color: var(--cyan);
    text-decoration: none;
}
.operator-inline {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    margin: 12px 0;
    background: rgba(0, 40, 48, 0.35);
    line-height: 1.7;
}
.answer-form { display: grid; gap: 8px; margin-top: 16px; }
.answer-form label { color: var(--muted); font-size: 0.85rem; }
.prompt { color: var(--text); line-height: 1.7; margin-bottom: 14px; }
.decision-options { display: grid; gap: 12px; }
.decision-card h3 { margin: 0 0 6px; color: var(--cyan-hot); }
.decision-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; }

/* Wider tablets: still centered phone column */
@media (min-width: 768px) {
    .app-shell { padding-left: 20px; padding-right: 20px; }
    .puzzle-map { grid-template-columns: repeat(2, 1fr); }
}

/* Hide default bootstrap light leftovers on toast host */
.notyf { font-family: 'Vazirmatn', Tahoma, sans-serif; }
