/* css/fantome.css — Vânătoare de Fantome (spirit box + EMF).
   The page keeps its own dark "night hunt" palette in both site themes: a ghost app
   in bright daylight colors would kill the mood. */

#fantome-section .container { max-width: 780px; }

.fantome-disclaimer {
    margin-bottom: 1.5rem;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.6rem;
    background: rgba(100, 116, 139, 0.12);
    color: var(--secondary-text-color);
    font-size: 0.86rem;
    line-height: 1.4;
}

/* ─── Start screen ─────────────────────────────────────────────────────── */
.fantome-start {
    padding: 2.5rem 1.25rem 3rem;
    border-radius: 1rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(88, 28, 135, 0.25) 0%, rgba(2, 6, 23, 0) 70%);
}

.fantome-ghost-icon {
    font-size: 4.5rem;
    color: #a78bfa;
    margin-bottom: 1rem;
    animation: fantome-float 3.5s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(167, 139, 250, 0.55);
}

@keyframes fantome-float {
    0%, 100% { transform: translateY(0) rotate(-2deg); opacity: 0.85; }
    50% { transform: translateY(-12px) rotate(2deg); opacity: 1; }
}

.fantome-btn-start {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    border: 0;
    color: #fff;
    font-weight: 700;
    padding: 0.7rem 2rem;
    border-radius: 999px;
    box-shadow: 0 0.6rem 1.8rem rgba(124, 58, 237, 0.4);
}
.fantome-btn-start:hover { color: #fff; filter: brightness(1.1); }
.fantome-btn-start:disabled { opacity: 0.6; }

.fantome-error {
    color: #fca5a5;
    font-size: 0.9rem;
}

/* ─── Panels ───────────────────────────────────────────────────────────── */
.fantome-hunt {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fantome-panel {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.9rem;
    background: linear-gradient(160deg, #0f172a 0%, #16121f 100%);
    color: #e2e8f0;
}

.fantome-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    /* înălțime fixă: eticheta din dreapta se schimbă tot timpul, iar dacă ar trece pe două
       rânduri ar împinge spectrul în sus și în jos la fiecare comutare de bandă */
    min-height: 1.4rem;
}
.fantome-panel-header h5 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #cbd5e1;
}
.fantome-status {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a78bfa;
    white-space: nowrap;      /* niciodată pe două rânduri — altfel sare tot panoul */
    flex-shrink: 0;
}
/* Intervalul în Hz e un detaliu: apare lângă numele benzii doar dacă încape. */
.fantome-status[data-range]::after {
    content: ' · ' attr(data-range);
    opacity: 0.7;
}
@media (max-width: 575.98px) {
    .fantome-status[data-range]::after { content: none; }
}

/* ─── Location panel ───────────────────────────────────────────────────── */
.fantome-location.is-haunted {
    border-color: rgba(239, 68, 68, 0.55);
    background: linear-gradient(160deg, #2a0f16 0%, #1b1024 100%);
    box-shadow: 0 0 26px rgba(239, 68, 68, 0.2);
}
.fantome-location-body { font-size: 0.9rem; }
.fantome-location-title {
    margin: 0 0 0.35rem;
    font-weight: 700;
    color: #e2e8f0;
}
.fantome-location.is-haunted .fantome-location-title { color: #fecaca; }
.fantome-location-legend {
    margin: 0;
    color: #94a3b8;
    line-height: 1.45;
    font-size: 0.86rem;
}
.fantome-location-note {
    margin: 0.45rem 0 0;
    font-size: 0.8rem;
    color: #fca5a5;
    font-weight: 600;
}

/* ─── Places with a story ──────────────────────────────────────────────── */
.fantome-places-toggle {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 0.5rem;
    background: rgba(88, 28, 135, 0.2);
    color: #ddd6fe;
    font-size: 0.84rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.fantome-places-toggle:hover { border-color: #a78bfa; }
.fantome-places-toggle.is-open .fa-chevron-down { transform: rotate(180deg); }
.fantome-places-toggle .fa-chevron-down { transition: transform 0.2s ease; float: right; }

.fantome-places {
    margin-top: 0.5rem;
    max-height: 20rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.fantome-place {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--card-border, rgba(148, 163, 184, 0.25));
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.fantome-place:hover { border-color: #a78bfa; background: rgba(88, 28, 135, 0.25); }
.fantome-place.is-playing {
    border-color: #ef4444;
    background: rgba(127, 29, 29, 0.35);
}
.fantome-place-head {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.fantome-place-head i { color: #a78bfa; font-size: 0.8em; }
.fantome-place.is-playing .fantome-place-head i { color: #fca5a5; }
.fantome-place-name { font-weight: 700; font-size: 0.9rem; }
.fantome-place-area { font-size: 0.75rem; color: #94a3b8; }
.fantome-place-legend {
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.fantome-place-count {
    font-size: 0.7rem;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.fantome-place-reset { border-style: dashed; }

/* ─── EMF meter ────────────────────────────────────────────────────────── */
.fantome-emf {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.fantome-emf-bars {
    display: flex;
    gap: 0.4rem;
    flex-grow: 1;
}
.fantome-emf-bar {
    flex: 1 1 0;
    height: 2.1rem;
    border-radius: 0.3rem;
    background: rgba(148, 163, 184, 0.16);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.fantome-emf-bar:nth-child(1).is-lit { background: #22c55e; box-shadow: 0 0 14px rgba(34, 197, 94, 0.7); }
.fantome-emf-bar:nth-child(2).is-lit { background: #84cc16; box-shadow: 0 0 14px rgba(132, 204, 22, 0.7); }
.fantome-emf-bar:nth-child(3).is-lit { background: #eab308; box-shadow: 0 0 14px rgba(234, 179, 8, 0.7); }
.fantome-emf-bar:nth-child(4).is-lit { background: #f97316; box-shadow: 0 0 14px rgba(249, 115, 22, 0.7); }
.fantome-emf-bar:nth-child(5).is-lit { background: #ef4444; box-shadow: 0 0 18px rgba(239, 68, 68, 0.85); }

.fantome-emf-value {
    flex-shrink: 0;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: #f8fafc;
}
.fantome-emf-value small { font-size: 0.9rem; color: #94a3b8; }

.fantome-readouts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-top: 0.75rem;
    font-size: 0.82rem;
    color: #94a3b8;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.fantome-readouts strong { color: #e2e8f0; }

.fantome-emf-source {
    margin: 0.55rem 0 0;
    font-size: 0.74rem;
    color: #64748b;
    letter-spacing: 0.02em;
}

/* ─── Spectrum ─────────────────────────────────────────────────────────── */
.fantome-spectrum {
    width: 100%;
    height: 120px;
    display: block;
    border-radius: 0.5rem;
    background: rgba(2, 6, 23, 0.7);
}

/* ─── Spirit box ───────────────────────────────────────────────────────── */
.fantome-panel-box {
    background: linear-gradient(160deg, #1e1b3a 0%, #2a1035 100%);
    border-color: rgba(167, 139, 250, 0.4);
}

.fantome-word {
    min-height: 4.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.8rem, 8vw, 3rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #f5f3ff;
    text-shadow: 0 0 24px rgba(167, 139, 250, 0.8);
    text-align: center;
    word-break: break-word;
}
.fantome-word.is-phrase { font-size: clamp(1.2rem, 5.5vw, 2rem); }
.fantome-word.is-flash { animation: fantome-flash 0.55s ease-out; }

@keyframes fantome-flash {
    0% { opacity: 0; transform: scale(0.9); filter: blur(6px); }
    35% { opacity: 1; transform: scale(1.06); filter: blur(0); }
    100% { opacity: 1; transform: scale(1); }
}

.fantome-word-meta {
    text-align: center;
    font-size: 0.78rem;
    color: #a5b4fc;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin-bottom: 0.9rem;
}

/* ─── Mode selector ────────────────────────────────────────────────────── */
.fantome-modes {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.fantome-mode {
    padding: 0.35rem 0.85rem;
    border: 1px solid rgba(167, 139, 250, 0.4);
    border-radius: 999px;
    background: transparent;
    color: #cbd5e1;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.fantome-mode:hover { border-color: #a78bfa; color: #ede9fe; }
.fantome-mode.is-active {
    background: linear-gradient(135deg, #7c3aed, #4c1d95);
    border-color: #a78bfa;
    color: #fff;
}
.fantome-mode-hint {
    margin: 0 0 0.6rem;
    text-align: center;
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* ─── Listening ────────────────────────────────────────────────────────── */
.fantome-listen {
    margin: 0.25rem 0 1rem;
    padding: 0.7rem 0.85rem;
    border: 1px dashed rgba(167, 139, 250, 0.45);
    border-radius: 0.6rem;
    background: rgba(88, 28, 135, 0.18);
}
.fantome-listen-note {
    margin: 0.4rem 0 0;
    font-size: 0.74rem;
    color: #a5b4fc;
    line-height: 1.4;
}
.fantome-heard {
    margin: 0.5rem 0 0;
    min-height: 1.2rem;
    font-size: 0.85rem;
    font-style: italic;
    color: #64748b;
}
.fantome-heard.is-active { color: #c4b5fd; }

/* ─── Ședința: scrii direct spiritului ──────────────────────────────────── */
.fantome-say {
    display: flex;
    gap: 0.4rem;
    width: min(28rem, 100%);
    margin: 0.7rem auto 0;
}
.fantome-say input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;                    /* ≥1rem: sub atât, iOS mărește pagina la focus */
    color: #ede9fe;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.55rem;
}
.fantome-say input::placeholder { color: #64748b; }
.fantome-say input:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 0.15rem rgba(167, 139, 250, 0.25);
}
.fantome-say-btn {
    flex: 0 0 auto;
    width: 2.9rem;
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 0.55rem;
    background: rgba(88, 28, 135, 0.35);
    color: #ede9fe;
    cursor: pointer;
}
.fantome-say-btn:hover { background: rgba(88, 28, 135, 0.6); }
.fantome-say-status {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    font-style: italic;
    color: #c4b5fd;
    text-align: center;
}
.fantome-key {
    width: min(32rem, 100%);
    margin: 0.6rem auto 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.55rem;
    background: rgba(15, 23, 42, 0.45);
    text-align: left;
}
.fantome-key summary {
    cursor: pointer;
    font-size: 0.82rem;
    color: #c4b5fd;
}
.fantome-key-note {
    margin: 0.5rem 0 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: #94a3b8;
}
.fantome-key-note a { color: #a78bfa; }
.fantome-key-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.55rem;
}
.fantome-key-row select,
.fantome-key-row input {
    flex: 1 1 9rem;
    min-width: 0;
    padding: 0.45rem 0.6rem;
    font-size: 1rem;                    /* ≥1rem: sub atât, iOS mărește pagina la focus */
    color: #ede9fe;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.45rem;
}
.fantome-key-btn {
    flex: 0 0 auto;
    padding: 0.45rem 0.9rem;
    border: 1px solid rgba(167, 139, 250, 0.45);
    border-radius: 0.45rem;
    background: rgba(88, 28, 135, 0.35);
    color: #ede9fe;
    cursor: pointer;
}
.fantome-key-btn:hover { background: rgba(88, 28, 135, 0.6); }
.fantome-key-status {
    margin: 0.45rem 0 0;
    font-size: 0.76rem;
    color: #c4b5fd;
}

.fantome-say-note {
    margin: 0.45rem auto 0;
    max-width: 32rem;
    font-size: 0.74rem;
    line-height: 1.45;
    color: #fbbf24;
    text-align: center;
}

.fantome-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #cbd5e1;
}
.fantome-controls .form-range { flex-grow: 1; }
.fantome-controls span { min-width: 1.5rem; text-align: right; font-weight: 700; }

.fantome-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.9rem;
    flex-wrap: wrap;
}

.fantome-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.82rem;
    color: #cbd5e1;
    cursor: pointer;
}
.fantome-switch input { width: 1.05rem; height: 1.05rem; cursor: pointer; }

/* Everything glows red when the reading is high. */
.fantome-hunt.is-hot .fantome-panel-box {
    border-color: rgba(239, 68, 68, 0.6);
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.25);
}
.fantome-hunt.is-hot .fantome-word { text-shadow: 0 0 26px rgba(248, 113, 113, 0.9); }

/* ─── Log ──────────────────────────────────────────────────────────────── */
.fantome-log {
    max-height: 16rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.fantome-log-empty {
    margin: 0;
    color: #64748b;
    font-size: 0.86rem;
}
.fantome-log-row {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}
.fantome-log-row:last-child { border-bottom: 0; }
/* Ce s-a auzit în cameră, spre deosebire de ce a spus cutia: retras spre dreapta și în altă
   culoare, ca într-o conversație — altfel nu se vede la ce anume a răspuns spiritul. */
.fantome-log-row.is-voice {
    padding-left: 1.1rem;
    border-left: 2px solid rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.06);
}
.fantome-log-row.is-voice .fantome-log-word {
    color: #7dd3fc;
    font-weight: 400;
    font-style: italic;
}
.fantome-log-note {
    margin: 0.6rem 0 0;
    font-size: 0.72rem;
    color: #64748b;
}
.fantome-log-time {
    flex-shrink: 0;
    font-size: 0.74rem;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.fantome-log-word {
    flex-grow: 1;
    font-weight: 700;
    color: #e9d5ff;
}
.fantome-log-meta {
    flex-shrink: 0;
    font-size: 0.72rem;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (max-width: 575.98px) {
    .fantome-readouts { font-size: 0.76rem; gap: 0.6rem; }
    .fantome-emf-value { font-size: 1.6rem; }
    .fantome-log-meta { display: none; }
}
