/* ══════════════════════════════════════════════════════════════════
   Qala'ab Khaybar v8.0 — Operator Access Gate
   Obsidian / gold production theme
   ══════════════════════════════════════════════════════════════════ */
@import url('/static/fonts/fonts.css'); /* self-hosted, works offline */

:root {
    --ob-bg: #070a12;
    --ob-bg2: #0b1020;
    --ob-panel: rgba(14, 20, 36, 0.82);
    --ob-border: #1c2740;
    --ob-border-soft: #162034;
    --gold: #e2b455;
    --gold-bright: #f7d98a;
    --cyan: #37e2cf;
    --text: #dfe6f5;
    --text-dim: #7d8aa6;
    --danger: #ff5470;
    --ok: #35e08a;
    --mono: 'JetBrains Mono', 'Tajawal', monospace;
    --display: 'Orbitron', 'Tajawal', monospace;
    --ar: 'Tajawal', 'Segoe UI', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: var(--mono);
    background: var(--ob-bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* ── Background layers ─────────────────────────────────────────── */
.bg-grid,
.bg-glow,
.bg-scan {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.bg-grid {
    background-image:
        linear-gradient(rgba(55, 226, 207, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(55, 226, 207, 0.045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
    animation: gridpan 26s linear infinite;
}

@keyframes gridpan {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 44px 88px, 44px 88px; }
}

.bg-glow {
    background:
        radial-gradient(600px 380px at 18% 12%, rgba(226, 180, 85, 0.13), transparent 70%),
        radial-gradient(680px 420px at 84% 88%, rgba(55, 226, 207, 0.11), transparent 72%);
}

.bg-scan {
    background: repeating-linear-gradient(
        to bottom, transparent 0 2px, rgba(0, 0, 0, 0.16) 2px 4px);
    opacity: 0.35;
    mix-blend-mode: overlay;
}

/* ── Card ──────────────────────────────────────────────────────── */
.gate {
    position: relative;
    z-index: 3;
    width: min(430px, 92vw);
    background: var(--ob-panel);
    border: 1px solid var(--ob-border);
    border-radius: 14px;
    padding: 34px 32px 26px;
    backdrop-filter: blur(14px);
    box-shadow:
        0 0 0 1px rgba(226, 180, 85, 0.06),
        0 26px 70px rgba(0, 0, 0, 0.62),
        0 0 90px rgba(226, 180, 85, 0.05);
    animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(16px) scale(0.985); }
    to   { opacity: 1; transform: none; }
}

.gate::before {
    content: "";
    position: absolute;
    top: 0; left: 18%; right: 18%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.9;
}

.gate-logo {
    text-align: center;
    margin-bottom: 6px;
}

.gate-logo .glyph {
    font-size: 40px;
    line-height: 1;
    color: var(--gold);
    text-shadow: 0 0 22px rgba(226, 180, 85, 0.45);
    display: block;
}

.gate-logo h1 {
    font-family: var(--ar);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 0.5px;
    margin-top: 8px;
    direction: rtl;
}

.gate-logo h1 .accent {
    background: linear-gradient(120deg, var(--gold-bright), var(--gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gate-tag {
    font-family: var(--display);
    font-size: 10.5px;
    letter-spacing: 3px;
    color: var(--text-dim);
    text-align: center;
    text-transform: uppercase;
    margin-top: 4px;
}

.gate-rule {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--ob-border), transparent);
    margin: 20px 0 22px;
}

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    font-size: 11px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 7px;
}

.field .wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.field .lead {
    position: absolute;
    left: 12px;
    color: var(--text-dim);
    font-size: 14px;
    pointer-events: none;
}

.field input {
    width: 100%;
    background: #0a0f1c;
    border: 1px solid var(--ob-border);
    border-radius: 8px;
    padding: 12px 12px 12px 36px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input::placeholder { color: #4c5871; }

.field input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(226, 180, 85, 0.13);
}

.reveal {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 12px;
    padding: 6px;
    font-family: var(--mono);
}

.reveal:hover { color: var(--gold); }

.gate-btn {
    width: 100%;
    margin-top: 6px;
    padding: 13px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(120deg, var(--gold), #c99a34);
    color: #1a1406;
    font-family: var(--display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 2px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}

.gate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(226, 180, 85, 0.28);
}

.gate-btn:disabled { opacity: 0.6; cursor: wait; }

.msg {
    display: none;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 7px;
    font-size: 12.5px;
    line-height: 1.5;
    direction: rtl;
    font-family: var(--ar);
}

.msg.error { display: block; background: rgba(255, 84, 112, 0.1); border: 1px solid rgba(255, 84, 112, 0.4); color: #ffb3c1; }
.msg.ok    { display: block; background: rgba(53, 224, 138, 0.1); border: 1px solid rgba(53, 224, 138, 0.4); color: #9ff2c6; }

.gate-foot {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid var(--ob-border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    color: var(--text-dim);
    letter-spacing: 0.6px;
}

.gate-foot .lock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.gate-foot .lock::before {
    content: "";
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 8px var(--ok);
}

/* ── v8.0: day theme for the access gate ─────────────────────────── */
[data-theme="light"] {
    --ob-bg: #e9eef6;
    --ob-bg2: #dde5f0;
    --ob-panel: rgba(255, 255, 255, 0.92);
    --ob-border: #c6d2e3;
    --ob-border-soft: #d9e1ec;
    --gold: #a8751a;
    --gold-bright: #875f0f;
    --cyan: #0d9488;
    --text: #1b2637;
    --text-dim: #67788f;
    --danger: #d6336c;
    --ok: #0ca678;
}
[data-theme="light"] body { background: var(--ob-bg); }
[data-theme="light"] .bg-grid {
    background-image:
        linear-gradient(rgba(27, 38, 55, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(27, 38, 55, 0.05) 1px, transparent 1px);
}
[data-theme="light"] .bg-glow { opacity: .55; }
[data-theme="light"] .gate {
    box-shadow: 0 0 0 1px rgba(27, 38, 55, 0.06), 0 24px 60px rgba(20, 30, 55, 0.14);
}
[data-theme="light"] .field input { background: #f5f8fc; color: #1b2637; }
[data-theme="light"] .gate-tag { color: #67788f; }

/* Utility buttons shared with the console */
.gate-controls {
    position: fixed;
    top: 18px;
    inset-inline-end: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 30;
}

.gate-logo .glyph svg {
    width: 42px;
    height: 42px;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 0 16px rgba(226, 180, 85, 0.45));
}

.tb-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    font-size: 11.5px;
    font-family: var(--mono);
    color: var(--text-dim);
    background: var(--ob-bg2);
    border: 1px solid var(--ob-border);
    border-radius: 7px;
    cursor: pointer;
    transition: all .16s ease;
    white-space: nowrap;
}
.tb-btn:hover {
    color: var(--gold-bright);
    border-color: var(--gold);
    transform: translateY(-1px);
}
.tb-btn:active { transform: translateY(0); }
