/* ============================================
   npc.quest — Surreal Jewel-Toned HUD
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --pale-jade: #D8E8E0;
    --muted-jade: #90B0A0;
    --emerald-glow: #40C8A0;
    --sapphire-deep: #4060C0;
    --ruby-pulse: #C04060;
    --amethyst-haze: #8040C0;
    --void-dark: #060410;
    --panel-glass: rgba(10,8,24,0.75);
    --panel-border: rgba(100,200,160,0.2);
    --panel-border-hover: rgba(100,200,160,0.45);
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--emerald-glow) var(--void-dark);
}

body {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.8;
    color: var(--muted-jade);
    background: var(--void-dark);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Particle Canvas Background --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* --- Cultural Mythological Symbols Layer --- */
#symbols-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.myth-symbol {
    position: absolute;
    color: var(--emerald-glow);
    opacity: 0;
    transition: opacity 2s ease;
}

.myth-symbol.visible {
    opacity: 0.1;
}

.symbol-compass {
    width: 140px;
    height: 140px;
    top: 8%;
    left: 5%;
    animation: symbolDrift 30s ease-in-out infinite;
}

.symbol-ouroboros {
    width: 110px;
    height: 110px;
    top: 12%;
    right: 8%;
    animation: symbolDrift 25s ease-in-out infinite reverse;
}

.symbol-labyrinth {
    width: 120px;
    height: 120px;
    bottom: 15%;
    left: 10%;
    animation: symbolDrift 35s ease-in-out infinite;
}

.symbol-tree {
    width: 100px;
    height: 100px;
    bottom: 10%;
    right: 12%;
    animation: symbolDrift 28s ease-in-out infinite reverse;
}

@keyframes symbolDrift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(10px, -8px) rotate(3deg); }
    50% { transform: translate(-5px, 12px) rotate(-2deg); }
    75% { transform: translate(8px, 5px) rotate(4deg); }
}

/* --- Blur-Focus Depth Field --- */
#blur-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
    background: radial-gradient(
        ellipse 60% 50% at 50% 50%,
        transparent 0%,
        rgba(6,4,16,0.3) 70%,
        rgba(6,4,16,0.7) 100%
    );
    transition: filter 600ms ease;
}

#blur-field.shift-active {
    filter: blur(2px);
}

/* --- HUD Container --- */
#hud-container {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 100vh;
}

/* --- HUD Sections --- */
.hud-section {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(2rem, 4vw, 4rem);
    position: relative;
}

/* --- Hero Section --- */
#hero {
    flex-direction: column;
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1.5s ease 0.5s forwards;
}

.hero-title-group {
    text-align: center;
}

.hero-title {
    font-family: 'Jost', sans-serif;
    font-weight: 600;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--pale-jade);
    letter-spacing: 0.15em;
    line-height: 1.1;
    text-shadow:
        0 0 40px rgba(64, 200, 160, 0.3),
        0 0 80px rgba(64, 200, 160, 0.1);
}

.title-dot {
    color: var(--emerald-glow);
    text-shadow:
        0 0 20px rgba(64, 200, 160, 0.6),
        0 0 60px rgba(64, 200, 160, 0.3);
}

.hero-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 1.2vw, 0.95rem);
    color: var(--muted-jade);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-top: 1rem;
    opacity: 0.7;
}

.hero-status-bar {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.status-item {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: var(--muted-jade);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: statusActivate 0.8s ease forwards;
}

.status-item:nth-child(1) { animation-delay: 1.5s; }
.status-item:nth-child(2) { animation-delay: 2s; }
.status-item:nth-child(3) { animation-delay: 2.5s; }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.emerald {
    background: var(--emerald-glow);
    box-shadow: 0 0 8px var(--emerald-glow);
}

.status-dot.sapphire {
    background: var(--sapphire-deep);
    box-shadow: 0 0 8px var(--sapphire-deep);
}

.status-dot.ruby {
    background: var(--ruby-pulse);
    box-shadow: 0 0 8px var(--ruby-pulse);
}

/* --- Quest Label (monospace readouts) --- */
.quest-label {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--emerald-glow);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 0.5rem;
}

/* --- HUD Panel Base --- */
.hud-panel {
    background: var(--panel-glass);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.hud-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.hud-panel:hover {
    border-color: var(--panel-border-hover);
    box-shadow: 0 0 30px rgba(64, 200, 160, 0.06), inset 0 0 30px rgba(64, 200, 160, 0.02);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid rgba(100, 200, 160, 0.1);
    background: rgba(64, 200, 160, 0.03);
}

.panel-icon {
    color: var(--emerald-glow);
    font-size: 0.85rem;
}

.panel-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    color: var(--emerald-glow);
    letter-spacing: 0.15em;
    flex: 1;
}

.panel-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    color: var(--emerald-glow);
    letter-spacing: 0.1em;
    padding: 0.15rem 0.5rem;
    border: 1px solid rgba(64, 200, 160, 0.25);
    border-radius: 3px;
}

.panel-status.blink {
    animation: statusBlink 2s ease-in-out infinite;
}

.panel-body {
    padding: 1.2rem;
}

/* --- Dashboard Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 2.5fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.panel-main {
    grid-column: 2;
    grid-row: 1 / 3;
}

.panel-tl { grid-column: 1; grid-row: 1; }
.panel-tr { grid-column: 3; grid-row: 1; }
.panel-bl { grid-column: 1; grid-row: 2; }
.panel-br { grid-column: 3; grid-row: 2; }

/* --- Quest Log Entries --- */
.quest-entry {
    display: grid;
    grid-template-columns: 70px 1fr 120px 40px;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(100, 200, 160, 0.06);
    transition: background 0.3s ease;
}

.quest-entry:last-child {
    border-bottom: none;
}

.quest-entry:hover {
    background: rgba(64, 200, 160, 0.04);
}

.quest-id {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    color: var(--sapphire-deep);
    letter-spacing: 0.05em;
}

.quest-name {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--pale-jade);
}

.quest-progress {
    height: 4px;
    background: rgba(100, 200, 160, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    width: var(--progress);
    background: linear-gradient(90deg, var(--emerald-glow), var(--sapphire-deep));
    border-radius: 2px;
    transition: width 1.5s ease;
}

.quest-pct {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.68rem;
    color: var(--emerald-glow);
    text-align: right;
}

/* --- Stat Rows (Side Panels) --- */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(100, 200, 160, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.62rem;
    color: var(--muted-jade);
    letter-spacing: 0.15em;
    opacity: 0.7;
}

.stat-value {
    font-family: 'Jost', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--pale-jade);
}

.cycle-counter {
    font-family: 'Share Tech Mono', monospace;
    color: var(--emerald-glow);
}

.phase-value {
    color: var(--amethyst-haze);
}

.flux-value {
    color: var(--sapphire-deep);
    font-size: 1.1rem;
}

/* Entropy bar */
.entropy-bar {
    width: 60px;
    height: 4px;
    background: rgba(100, 200, 160, 0.1);
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
}

.bar-fill {
    display: block;
    height: 100%;
    width: var(--fill);
    background: linear-gradient(90deg, var(--ruby-pulse), var(--amethyst-haze));
    border-radius: 2px;
}

/* --- Artifact Grid --- */
.artifact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.artifact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    background: rgba(64, 200, 160, 0.03);
    border: 1px solid rgba(100, 200, 160, 0.08);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.artifact:hover {
    border-color: rgba(100, 200, 160, 0.25);
}

.artifact-glyph {
    font-size: 1rem;
}

.artifact[data-rarity="emerald"] .artifact-glyph { color: var(--emerald-glow); }
.artifact[data-rarity="sapphire"] .artifact-glyph { color: var(--sapphire-deep); }
.artifact[data-rarity="ruby"] .artifact-glyph { color: var(--ruby-pulse); }
.artifact[data-rarity="amethyst"] .artifact-glyph { color: var(--amethyst-haze); }

.artifact[data-rarity="emerald"]:hover { box-shadow: 0 0 12px rgba(64, 200, 160, 0.15); }
.artifact[data-rarity="sapphire"]:hover { box-shadow: 0 0 12px rgba(64, 96, 192, 0.15); }
.artifact[data-rarity="ruby"]:hover { box-shadow: 0 0 12px rgba(192, 64, 96, 0.15); }
.artifact[data-rarity="amethyst"]:hover { box-shadow: 0 0 12px rgba(128, 64, 192, 0.15); }

.artifact-name {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: var(--muted-jade);
    letter-spacing: 0.05em;
}

/* --- Transmission Feed --- */
.transmission-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.transmission {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(100, 200, 160, 0.04);
}

.transmission:last-child {
    border-bottom: none;
}

.tx-time {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: var(--sapphire-deep);
    white-space: nowrap;
    opacity: 0.7;
}

.tx-msg {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    color: var(--muted-jade);
    line-height: 1.5;
}

/* --- Focus Shift Section --- */
#focus-shift {
    padding: clamp(2rem, 4vw, 4rem);
}

.shift-container {
    width: 100%;
    max-width: 1200px;
}

.panel-wide {
    width: 100%;
}

.cartography-display {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(6, 4, 16, 0.5);
}

#cartography-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.map-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.map-marker {
    position: absolute;
    left: var(--mx);
    top: var(--my);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.marker-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: relative;
}

.marker-emerald .marker-pulse {
    background: var(--emerald-glow);
    box-shadow: 0 0 12px var(--emerald-glow);
    animation: markerPulse 3s ease-in-out infinite;
}

.marker-sapphire .marker-pulse {
    background: var(--sapphire-deep);
    box-shadow: 0 0 12px var(--sapphire-deep);
    animation: markerPulse 3s ease-in-out infinite 0.5s;
}

.marker-ruby .marker-pulse {
    background: var(--ruby-pulse);
    box-shadow: 0 0 12px var(--ruby-pulse);
    animation: markerPulse 3s ease-in-out infinite 1s;
}

.marker-amethyst .marker-pulse {
    background: var(--amethyst-haze);
    box-shadow: 0 0 12px var(--amethyst-haze);
    animation: markerPulse 3s ease-in-out infinite 1.5s;
}

.marker-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.58rem;
    color: var(--muted-jade);
    letter-spacing: 0.1em;
    white-space: nowrap;
    opacity: 0.7;
}

@keyframes markerPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.6); opacity: 0.5; }
}

/* --- Contemplation Section --- */
.contemplation-inner {
    width: 100%;
    max-width: 800px;
}

.panel-center {
    width: 100%;
}

.koan-display {
    text-align: center;
    padding: 2rem 1rem;
}

.koan-text {
    font-family: 'Jost', sans-serif;
    font-weight: 300;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--pale-jade);
    line-height: 1.7;
    font-style: italic;
    opacity: 0.85;
    transition: opacity 0.8s ease;
}

.cycle-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
}

.breathing-ring {
    width: 120px;
    height: 120px;
}

.breathing-ring svg {
    width: 100%;
    height: 100%;
}

.breathing-circle {
    transition: stroke-dashoffset 4s ease-in-out;
    transform-origin: center;
}

/* --- Terminal Section --- */
.terminal-inner {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-terminal {
    width: 100%;
}

.terminal-output {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.72rem;
    line-height: 1.8;
    max-height: 300px;
    overflow-y: auto;
}

.terminal-line {
    padding: 0.15rem 0;
    opacity: 0;
    transform: translateX(-8px);
    animation: terminalLineIn 0.4s ease forwards;
}

.terminal-line:nth-child(1) { animation-delay: 3s; }
.terminal-line:nth-child(2) { animation-delay: 3.3s; }
.terminal-line:nth-child(3) { animation-delay: 3.6s; }
.terminal-line:nth-child(4) { animation-delay: 3.9s; }
.terminal-line:nth-child(5) { animation-delay: 4.2s; }
.terminal-line:nth-child(6) { animation-delay: 4.5s; }
.terminal-line:nth-child(7) { animation-delay: 4.8s; }
.terminal-line:nth-child(8) { animation-delay: 5.1s; }

.term-prompt {
    color: var(--emerald-glow);
    margin-right: 0.5rem;
}

.term-emerald { color: var(--emerald-glow); }
.term-sapphire { color: var(--sapphire-deep); }
.term-ruby { color: var(--ruby-pulse); }
.term-amethyst { color: var(--amethyst-haze); }

.cursor {
    color: var(--emerald-glow);
    animation: cursorBlink 1s step-end infinite;
}

.footer-bar {
    text-align: center;
    padding: 1rem;
    opacity: 0.4;
}

/* --- Keyframe Animations --- */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes statusActivate {
    0% { opacity: 0; transform: translateX(-10px); }
    100% { opacity: 0.8; transform: translateX(0); }
}

@keyframes statusBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes terminalLineIn {
    to {
        opacity: 0.9;
        transform: translateX(0);
    }
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Scrollbar Styling (Webkit) --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--void-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(64, 200, 160, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(64, 200, 160, 0.4);
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
    }

    .panel-main {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .panel-tl { grid-column: 1; grid-row: 2; }
    .panel-tr { grid-column: 2; grid-row: 2; }
    .panel-bl { grid-column: 1; grid-row: 3; }
    .panel-br { grid-column: 2; grid-row: 3; }
}

@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .panel-main {
        grid-column: 1;
        grid-row: 1;
    }

    .panel-tl { grid-column: 1; grid-row: 2; }
    .panel-tr { grid-column: 1; grid-row: 3; }
    .panel-bl { grid-column: 1; grid-row: 4; }
    .panel-br { grid-column: 1; grid-row: 5; }

    .quest-entry {
        grid-template-columns: 60px 1fr 80px 35px;
        gap: 0.4rem;
    }

    .hero-status-bar {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    .cartography-display {
        height: 260px;
    }

    .hud-section {
        padding: clamp(1.5rem, 3vw, 3rem);
    }
}
