/* ============================================================
   MIND PALACE — PERSONALITY LAYER
   The mansion's soul: gold crystals, cyan portals, bloom glows.
   Loaded AFTER base styles — only re-skins, never re-lays-out.
   ============================================================ */

/* ── The palace palette ─────────────────────────────────── */
:root {
    --palace-void:      #05070f;   /* deepest night        */
    --palace-stone:     #1a2032;   /* hallway walls        */
    --palace-fog:       #2a3450;   /* distance haze        */
    --palace-cyan:      #00e5ff;   /* public repos / ports */
    --palace-pink:      #ff4fd8;   /* private repos         */
    --palace-gold:      #ffd166;   /* TODO crystals         */
    --palace-gold-hot:  #ffb703;   /* quorum APPROVED flare */
    --palace-ice:       #8fd3ff;   /* quorum REJECTED dip   */
    --palace-ink:       #e8ecf4;   /* readable text         */
    --palace-dim:       #7a86a3;   /* secondary text         */
    --palace-success:   #6ee7a0;   /* passing tests          */
    --palace-danger:    #ff5d73;   /* failing tests         */

    /* The bloom signature: everything alive glows a little. */
    --glow-cyan:   0 0 6px rgba(0, 229, 255, 0.55), 0 0 18px rgba(0, 229, 255, 0.25);
    --glow-gold:   0 0 6px rgba(255, 209, 102, 0.55), 0 0 20px rgba(255, 183, 3, 0.30);
    --glow-pink:   0 0 6px rgba(255, 79, 216, 0.50), 0 0 18px rgba(255, 79, 216, 0.22);
    --glow-soft:   0 0 10px rgba(143, 211, 255, 0.12);
}

/* ── Body: the void the palace floats in ─────────────────── */
body {
    background:
        radial-gradient(ellipse at 50% -20%,
            rgba(0, 229, 255, 0.06) 0%,
            transparent 55%),
        radial-gradient(ellipse at 50% 120%,
            rgba(255, 209, 102, 0.05) 0%,
            transparent 60%),
        var(--palace-void) !important;
    color: var(--palace-ink);
    font-family: "Cascadia Code", "JetBrains Mono", "Fira Code",
                 "Courier New", monospace;
}

/* ── Panels become palace glass ─────────────────────────── */
.creation-form, .panel, .modal, .overlay, .hud,
.room-info, .telemetry, .map-overlay, .info-box {
    background: linear-gradient(
        160deg,
        rgba(26, 32, 50, 0.92) 0%,
        rgba(10, 14, 26, 0.94) 100%) !important;
    border: 1px solid rgba(0, 229, 255, 0.22) !important;
    border-radius: 14px !important;
    box-shadow:
        var(--glow-soft),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 18px 48px rgba(0, 0, 0, 0.55) !important;
    backdrop-filter: blur(6px) saturate(1.15);
}

/* ── Headings: engraved gold signage ─────────────────────── */
h1, h2, h3, .form-group label, .panel-title {
    background: linear-gradient(
        180deg,
        var(--palace-gold) 0%,
        var(--palace-gold-hot) 60%,
        #b8860b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.04em;
    text-shadow: none;
    filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.35));
}

/* ── Neon door signs: public vs private ─────────────────── */
.sign, .repo-name, .neon {
    text-shadow: var(--glow-cyan);
}
.sign.private, .repo-name.private, .neon.private {
    text-shadow: var(--glow-pink);
}

/* ── TODO crystals: gold, breathing ─────────────────────── */
.crystal, .todo-crystal, .book-crystal {
    filter: drop-shadow(0 0 6px rgba(255, 209, 102, 0.45));
    animation: crystal-breathe 3.4s ease-in-out infinite;
}
@keyframes crystal-breathe {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 209, 102, 0.35)); }
    50%      { filter: drop-shadow(0 0 12px rgba(255, 209, 102, 0.75)); }
}

/* ── Quorum server effects: the mansion reacts to votes ──── */
@keyframes quorum-approve {
    0%   { box-shadow: var(--glow-gold); }
    30%  { box-shadow: 0 0 24px rgba(255, 183, 3, 0.85), 0 0 64px rgba(255, 183, 3, 0.35); }
    100% { box-shadow: var(--glow-gold); }
}
@keyframes quorum-reject {
    0%   { box-shadow: var(--glow-soft); }
    30%  { box-shadow: 0 0 18px rgba(143, 211, 255, 0.55), 0 0 44px rgba(143, 211, 255, 0.20); }
    100% { box-shadow: var(--glow-soft); }
}
.quorum-approved  { animation: quorum-approve 2s ease-out 1; }
.quorum-rejected  { animation: quorum-reject  2s ease-out 1; }

/* ── Buttons: chiseled portal glass ──────────────────────── */
button, .btn, input[type="submit"] {
    background: linear-gradient(
        180deg,
        rgba(0, 229, 255, 0.16) 0%,
        rgba(0, 229, 255, 0.06) 100%) !important;
    border: 1px solid rgba(0, 229, 255, 0.35) !important;
    border-radius: 8px !important;
    color: var(--palace-ink) !important;
    text-shadow: 0 0 4px rgba(0, 229, 255, 0.4);
    transition: all 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
    cursor: pointer;
}
button:hover, .btn:hover {
    background: linear-gradient(
        180deg,
        rgba(0, 229, 255, 0.30) 0%,
        rgba(0, 229, 255, 0.12) 100%) !important;
    box-shadow: var(--glow-cyan) !important;
    transform: translateY(-1px);
}
button:active, .btn:active { transform: translateY(0); }

/* ── Inputs: etched stone fields ────────────────────────── */
input, select, textarea {
    background: rgba(5, 7, 15, 0.75) !important;
    border: 1px solid rgba(122, 134, 163, 0.35) !important;
    border-radius: 8px !important;
    color: var(--palace-ink) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none !important;
    border-color: rgba(0, 229, 255, 0.65) !important;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12), var(--glow-cyan) !important;
}

/* ── Links: cyan conduits ───────────────────────────────── */
a { color: var(--palace-cyan); text-decoration: none; transition: all 0.15s ease; }
a:hover { text-shadow: var(--glow-cyan); }

/* ── Scrollbars: gold rails in the dark ──────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--palace-void); }
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--palace-gold), #8a6d1d);
    border-radius: 6px;
    border: 2px solid var(--palace-void);
}
::-webkit-scrollbar-thumb:hover { background: var(--palace-gold-hot); }

/* ── Loading: the palace assembles ──────────────────────── */
#loading-screen, .loading {
    background:
        radial-gradient(ellipse at center,
            rgba(0, 229, 255, 0.08) 0%,
            var(--palace-void) 70%) !important;
}
#loading-screen h1, .loading h1 { letter-spacing: 0.12em; }
.loading-bar, #loading-bar, .progress-bar {
    background: rgba(0, 229, 255, 0.10) !important;
    border: 1px solid rgba(0, 229, 255, 0.30) !important;
    border-radius: 6px !important;
    overflow: hidden;
}
.loading-bar > div, #loading-bar > div, .progress-bar > div {
    background: linear-gradient(90deg, var(--palace-cyan), var(--palace-gold)) !important;
    box-shadow: var(--glow-cyan) !important;
    transition: width 0.25s ease;
}

/* ── Toasts: crystal chimes ─────────────────────────────── */
.toast, .notification, .message {
    border-left: 3px solid var(--palace-gold) !important;
    background: linear-gradient(
        90deg,
        rgba(255, 209, 102, 0.10),
        rgba(26, 32, 50, 0.92) 40%) !important;
    border-radius: 10px !important;
    box-shadow: var(--glow-soft), 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}
.toast.error, .notification.error   { border-left-color: var(--palace-danger) !important; }
.toast.success, .notification.ok   { border-left-color: var(--palace-success) !important; }

/* ── Tables: hall of records ────────────────────────────── */
table { border-collapse: collapse; }
th {
    color: var(--palace-gold) !important;
    border-bottom: 1px solid rgba(255, 209, 102, 0.35) !important;
    letter-spacing: 0.06em;
}
td { border-bottom: 1px solid rgba(122, 134, 163, 0.15); }
tr:hover td { background: rgba(0, 229, 255, 0.05); }

/* ── Selection: mark with cyan light ─────────────────────── */
::selection { background: rgba(0, 229, 255, 0.30); color: var(--palace-ink); }

/* ── Agent chat: two voices, two glows ───────────────────── */
.agent-explorer, .msg-tool {
    border-left: 2px solid var(--palace-cyan);
    text-shadow: 0 0 3px rgba(0, 229, 255, 0.25);
}
.agent-critic, .msg-critic {
    border-left: 2px solid var(--palace-pink);
    text-shadow: 0 0 3px rgba(255, 79, 216, 0.25);
}

/* ── Reduced motion: the palace stands still politely ───── */
@media (prefers-reduced-motion: reduce) {
    .crystal, .todo-crystal, .book-crystal { animation: none; }
    .quorum-approved, .quorum-rejected { animation: none; }
    * { transition-duration: 0.01s !important; }
}