@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

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

/* Dark scrollbars */
::-webkit-scrollbar-track {
    background: #1a1a1c;
}

::-webkit-scrollbar-thumb {
    background: #3a3530;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4540;
}

/* Firefox */
* {
    scrollbar-color: #3a3530 #1a1a1c;
}

body {
    font-family: 'Crimson Text', Georgia, serif;
    background: #0a0a0c;
    color: #c4b998;
}

/* Graph mode: fixed viewport, no scroll */
body.graph-mode {
    overflow: hidden;
    height: 100vh;
}

/* Subtle texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(180, 140, 80, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(120, 80, 40, 0.03) 0%, transparent 50%),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
}

/* Upload screen */
#upload-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    background: #0a0a0c;
}

#upload-screen.hidden {
    display: none;
}

#upload-screen h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #d4c4a8;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
}

#upload-screen .subtitle {
    font-size: 1.1rem;
    color: #8a7d65;
    margin-bottom: 40px;
    font-style: italic;
}

#drop-zone {
    width: 500px;
    max-width: 90vw;
    padding: 60px 40px;
    border: 2px dashed #3a3020;
    background: rgba(30, 28, 24, 0.5);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

#drop-zone:hover,
#drop-zone.dragover {
    border-color: #6a5d45;
    background: rgba(40, 38, 32, 0.7);
}

#drop-zone .icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

#drop-zone p {
    font-size: 1.1rem;
    color: #9a8d75;
    margin-bottom: 10px;
}

#drop-zone .hint {
    font-size: 0.9rem;
    color: #6a5d45;
}

#file-input {
    display: none;
}

#error-message {
    margin-top: 20px;
    color: #c45a2c;
    font-size: 0.95rem;
    max-width: 500px;
    text-align: center;
}

#demo-section {
    margin-top: 30px;
    text-align: center;
}

.demo-separator {
    color: #5a5040;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

#demo-btn {
    background: linear-gradient(135deg, #2a2520 0%, #1a1814 100%);
    border: 1px solid #4a4030;
    color: #c4b998;
    padding: 12px 28px;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 0.05em;
}

#demo-btn:hover {
    border-color: #6a5d45;
    background: linear-gradient(135deg, #3a3530 0%, #2a2824 100%);
    color: #d4c4a8;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Upload footer */
#upload-footer {
    position: absolute;
    bottom: 30px;
    text-align: center;
    color: #5a5040;
    font-size: 0.85rem;
}

#upload-footer p {
    margin: 5px 0;
}

#upload-footer strong {
    color: #8a7d65;
    font-weight: 600;
}

#upload-footer .footer-links {
    margin-top: 8px;
}

#upload-footer .footer-links a {
    color: #7a6d55;
    text-decoration: none;
    transition: color 0.2s;
}

#upload-footer .footer-links a:hover {
    color: #c9a227;
}

#upload-footer .separator {
    margin: 0 10px;
    color: #3a3020;
}

/* Main UI */
#main-ui {
    display: none;
}

#main-ui.visible {
    display: block;
}

#header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 95px;
    padding: 16px 24px;
    background: linear-gradient(to bottom, rgba(10, 10, 12, 0.95), rgba(10, 10, 12, 0.7));
    z-index: 100;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 24px;
}

#header h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #d4c4a8;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Discovery progress bar below header */
.discovery-progress-bar {
    position: fixed;
    top: 95px;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(40, 36, 30, 0.6);
    z-index: 99;
}

.discovery-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4ade80, #60a5fa);
    transition: width 0.5s ease-out;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.subtitle {
    font-size: 1rem;
    color: #b8a990;
    margin-top: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* Streamer info in subtitle (for viewers) */
.streamer-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    margin-right: 12px;
    border-right: 1px solid #5a5040;
}

.streamer-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #5a5040;
}

.streamer-name {
    color: #d4c4a8;
    font-weight: 500;
    text-decoration: none;
}

.streamer-name:hover {
    text-decoration: underline;
}

.streamer-twitch-link {
    color: #6b6155;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.streamer-twitch-link:hover {
    color: #9146ff;
}

.header-left {
    justify-self: start;
    display: flex;
    flex-direction: column;
}

.header-center {
    width: 100%;
    max-width: 500px;
    justify-self: center;
}

.header-right {
    justify-self: end;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#search-container {
    position: relative;
}

#explorer-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Mode Selector - Toggle Switch */
#mode-selector {
    display: flex;
    gap: 0;
    background: #1a1814;
    padding: 3px;
    border-radius: 6px;
    border: 1px solid #3a3020;
}

.mode-btn {
    background: transparent;
    border: none;
    color: #6a5d45;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.mode-btn:hover:not(.active) {
    color: #9a8d75;
}

.mode-btn.active {
    background: #3a3020;
    color: #d4c4a8;
    font-weight: 500;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
}

#reset-exploration-btn {
    background: rgba(139, 69, 69, 0.3);
    border: 1px solid #8b4545;
    color: #d9a9a9;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

#reset-exploration-btn:hover {
    background: rgba(139, 69, 69, 0.5);
    border-color: #c96969;
    color: #ffcccc;
}

/* Stream button */
#stream-btn {
    background: rgba(145, 70, 180, 0.3);
    border: 1px solid #9046b4;
    color: #d0a0e8;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    position: relative;
}

#stream-btn:hover {
    background: rgba(145, 70, 180, 0.5);
    border-color: #b060d4;
    color: #e8c0ff;
}

#stream-btn.active {
    background: rgba(70, 180, 100, 0.3);
    border-color: #46b464;
    color: #a0e8b0;
}

/* Mod status indicator (minimalist label style) */
.mod-status {
    background: transparent;
    border: none;
    color: #6b6155;
    padding: 8px 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
}

.mod-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a4030;
    transition: all 0.3s;
}

.mod-status.mod-connected .mod-status-indicator {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
    animation: pulse 2s infinite;
}

.mod-status.mod-connected .mod-status-text {
    color: #a0e8b0;
}

/* Connection status indicator (minimalist label style) */
.connection-status {
    background: transparent;
    border: none;
    color: #6b6155;
    padding: 8px 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: default;
}

.connection-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4a4030;
    transition: all 0.3s;
}

.connection-status.connected .connection-status-indicator {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
    animation: pulse 2s infinite;
}

.connection-status.connected .connection-status-text {
    color: #a0e8b0;
}

/* Viewer count specific - blue tint when has viewers */
#viewer-count.has-viewers .connection-status-indicator {
    background: #60a5fa;
    box-shadow: 0 0 6px rgba(96, 165, 250, 0.5);
    animation: pulse 2s infinite;
}

#viewer-count.has-viewers .connection-status-text {
    color: #93c5fd;
}

/* Game Stats - under header-right buttons */
.game-stats {
    position: fixed;
    top: 70px;
    right: 20px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
}

.game-stats.hidden {
    display: none;
}

.game-stats-runes {
    display: flex;
    gap: 2px;
}

.rune-icon {
    width: 24px;
    height: 24px;
    transition: filter 0.3s, transform 0.2s;
}

.rune-icon.possessed {
    filter: drop-shadow(0 0 4px rgba(255, 200, 100, 0.6));
}

.rune-icon:hover {
    transform: scale(1.15);
}

.game-stats-counters {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #9a9080;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    width: 24px;
    height: 24px;
}

.stat-time {
    font-family: monospace;
    color: #7a7060;
}

/* Stream modal */
#stream-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

#stream-modal.visible {
    display: flex;
}

.stream-modal-content,
.modal-content {
    position: relative;
    background: linear-gradient(145deg, #1a1815 0%, #12100d 100%);
    border: 1px solid #3a3530;
    border-radius: 12px;
    padding: 24px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.stream-modal-content.stream-modal-wide {
    max-width: 520px;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #6a5a4a;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close-btn:hover {
    color: #c9a227;
}

.stream-modal-content h3,
.modal-content h3 {
    font-family: 'Cinzel', serif;
    color: #c9a227;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.modal-hint {
    color: #6a5a4a;
    font-size: 0.85rem;
    margin-bottom: 16px;
    font-style: italic;
}

.stream-section {
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #2a2520;
}

.stream-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.stream-section h4 {
    font-family: 'Cinzel', serif;
    color: #d4c4a0;
    font-size: 1rem;
    margin-bottom: 4px;
}

.stream-section-desc {
    color: #6a5a4a;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.stream-preview {
    text-align: center;
}

.stream-preview img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid #3a3530;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stream-preview-label {
    color: #6a5a4a;
    font-size: 0.8rem;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stream-modal-content p {
    color: #9a8d75;
    margin-bottom: 16px;
    line-height: 1.5;
}

.stream-modal-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.stream-modal-buttons button {
    flex: 1;
    min-width: 120px;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.stream-modal-content code {
    background: #0a0908;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #c9a227;
}

/* Base button styles */
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.1s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    font-family: 'Cinzel', serif;
    background: linear-gradient(135deg, #c9a227 0%, #8b7355 100%);
    border: none;
    border-radius: 4px;
    color: #1a1a1a;
    font-weight: 600;
}

.btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid #5a5040;
    border-radius: 2px;
    color: #9a8d75;
}

.btn-secondary:hover {
    border-color: #8a7050;
    color: #c4b998;
    background: rgba(90, 80, 64, 0.2);
}

.btn-viewer {
    background: linear-gradient(135deg, #4682b4 0%, #2c5a7c 100%);
    border: none;
    color: #fff;
}

.btn-viewer:hover {
    box-shadow: 0 2px 10px rgba(70, 130, 180, 0.4);
}

.btn-disconnect {
    background: rgba(180, 70, 70, 0.3);
    border: 1px solid #b44646;
    color: #e8a0a0;
}

.btn-disconnect:hover {
    background: rgba(180, 70, 70, 0.5);
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(70, 180, 100, 0.1);
    border-radius: 6px;
    color: #a0e8b0;
    font-size: 0.85rem;
}

.sync-status.disconnected {
    background: rgba(180, 70, 70, 0.1);
    color: #e8a0a0;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #46b464;
    animation: pulse 2s infinite;
}

.sync-status.disconnected .sync-dot {
    background: #b44646;
    animation: none;
}

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

/* Overlay mode (OBS browser source) */
body.overlay-mode {
    background: transparent !important;
}

body.overlay-mode::before {
    display: none;
}

body.overlay-mode #header,
body.overlay-mode .discovery-progress-bar {
    display: none !important;
}

body.overlay-mode #legend,
body.overlay-mode #stats {
    display: none !important;
}

body.overlay-mode .tooltip {
    display: none !important;
}

body.overlay-mode #graph-container {
    background: transparent !important;
}

/* Improve text rendering in overlay mode */
body.overlay-mode .node text {
    paint-order: stroke fill;
    stroke: #000;
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-linejoin: round;
    font-weight: 600;
}

body.overlay-mode svg {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selected node indicator in overlay mode (target appearance) */
body.overlay-mode .node.viewer-selected circle {
    stroke: #fff !important;
    stroke-width: 3px !important;
    filter: drop-shadow(0 0 8px #c9a227) drop-shadow(0 0 16px #c9a227);
}

/* Boss nodes get orange stroke when selected */
body.overlay-mode .node.boss.viewer-selected circle {
    stroke: #ff6b35 !important;
    filter: drop-shadow(0 0 8px #ff6b35) drop-shadow(0 0 16px #ff6b35);
}

/* Animated ring around selected node */
body.overlay-mode .node.viewer-selected .selection-ring {
    fill: none;
    stroke: #c9a227;
    stroke-width: 2px;
    opacity: 0.8;
    animation: pulse-ring 1.5s ease-in-out infinite;
}

/* Orange ring for boss nodes */
body.overlay-mode .node.boss.viewer-selected .selection-ring {
    stroke: #ff6b35;
}

@keyframes pulse-ring {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.3;
    }
}

/* Viewer mode discovery counter - OBS overlay */
#viewer-discovery-counter {
    position: fixed;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-weight: 600;
    color: #e8d5a3;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(201, 162, 39, 0.5);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    z-index: 1000;
    transition:
        opacity 0.3s,
        transform 0.3s;
    min-width: 120px;
}

/* Size variants (?size=sm/md/lg/xl) */
#viewer-discovery-counter.size-sm {
    font-size: 1rem;
    padding: 8px 12px;
    min-width: 100px;
}

#viewer-discovery-counter.size-md {
    font-size: 1.4rem;
    padding: 12px 18px;
    min-width: 140px;
}

#viewer-discovery-counter.size-lg {
    font-size: 2rem;
    padding: 16px 24px;
    min-width: 180px;
}

#viewer-discovery-counter.size-xl {
    font-size: 2.8rem;
    padding: 20px 32px;
    min-width: 240px;
}

/* Counter text layout */
#viewer-discovery-counter .counter-text {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3em;
    white-space: nowrap;
}

#viewer-discovery-counter #viewer-discovered {
    color: #c9a227;
    font-weight: 700;
}

#viewer-discovery-counter .counter-percent {
    color: #9a8d75;
    font-size: 0.7em;
    font-weight: 500;
}

/* Progress bar */
#viewer-discovery-counter .counter-progress {
    margin-top: 0.5em;
    height: 6px;
    background: rgba(60, 50, 30, 0.8);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(201, 162, 39, 0.3);
}

#viewer-discovery-counter.size-sm .counter-progress {
    height: 4px;
    margin-top: 0.4em;
}

#viewer-discovery-counter.size-lg .counter-progress,
#viewer-discovery-counter.size-xl .counter-progress {
    height: 8px;
    margin-top: 0.6em;
}

#viewer-discovery-counter .counter-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b6914, #c9a227, #e8c547);
    border-radius: 2px;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 8px rgba(201, 162, 39, 0.5);
}

/* Position classes (?counter=tl/tr/bl/br/t/b/l/r) */
#viewer-discovery-counter.pos-br {
    bottom: 24px;
    right: 24px;
}

#viewer-discovery-counter.pos-bl {
    bottom: 24px;
    left: 24px;
}

#viewer-discovery-counter.pos-tr {
    top: 24px;
    right: 24px;
}

#viewer-discovery-counter.pos-tl {
    top: 24px;
    left: 24px;
}

/* Centered positions */
#viewer-discovery-counter.pos-t {
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
}

#viewer-discovery-counter.pos-b {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

#viewer-discovery-counter.pos-l {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

#viewer-discovery-counter.pos-r {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

#viewer-discovery-counter.hidden {
    display: none;
}

/* Only show in overlay mode when exploration is active */
body:not(.overlay-mode) #viewer-discovery-counter {
    display: none !important;
}

/* Subtle pulse animation when count changes */
@keyframes counter-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.6);
    }
    50% {
        box-shadow: 0 0 12px 4px rgba(201, 162, 39, 0.4);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 162, 39, 0);
    }
}

#viewer-discovery-counter.updated {
    animation: counter-pulse 0.4s ease-out;
}

label {
    font-size: 0.9rem;
    color: #9a8d75;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

label:hover {
    color: #c4b998;
}

input[type='checkbox'] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #5a4d35;
    background: #1a1a1c;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

input[type='checkbox']:checked {
    background: #3a3020;
    border-color: #8a7d55;
}

input[type='checkbox']:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    color: #c4a960;
}

#search {
    background: #1a1a1c;
    border: 1px solid #3a3020;
    color: #c4b998;
    padding: 8px 28px 8px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s;
}

#search:focus {
    outline: none;
    border-color: #6a5d45;
    background: #1e1e20;
}

#search::placeholder {
    color: #5a5040;
}

.search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #5a5040;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    transition: color 0.2s;
}

.search-clear:hover {
    color: #c4b998;
}

.search-clear.hidden {
    display: none;
}

#search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1c;
    border: 1px solid #3a3020;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

#search-dropdown.visible {
    display: block;
}

.search-result {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2520;
    transition: background 0.2s;
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: rgba(100, 90, 70, 0.2);
}

.search-result-name {
    color: #c4b998;
    font-size: 0.9rem;
}

.search-result-status {
    font-size: 0.75rem;
    color: #6a6050;
    margin-left: 8px;
}

.search-result-btn {
    background: linear-gradient(135deg, #4a7c59 0%, #3a5a45 100%);
    border: none;
    color: #e0f0e0;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    white-space: nowrap;
    transition: all 0.2s;
}

.search-result-btn:hover {
    background: linear-gradient(135deg, #5a9c69 0%, #4a7a55 100%);
    transform: scale(1.05);
}

#new-file-btn {
    background: transparent;
    border: 1px solid #3a3020;
    color: #9a8d75;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

#new-file-btn:hover {
    border-color: #6a5d45;
    color: #c4b998;
}

#graph-container {
    width: 100%;
    height: 100vh;
    position: relative;
}

/* Loading overlay */
.graph-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #c4b998;
    font-size: 16px;
    z-index: 100;
}

.graph-loading.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #3a3530;
    border-top-color: #c4b998;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

svg {
    width: 100%;
    height: 100%;
}

/* Link styles */
.link {
    fill: none;
    stroke-opacity: 0.6;
    transition:
        stroke-opacity 0.2s,
        stroke-width 0.2s;
}

.link.random {
    stroke: #8a8070;
    stroke-width: 2.5px;
}

.link.preexisting {
    stroke: #5a6a7a;
    stroke-width: 1.5px;
    stroke-dasharray: 6, 4;
}

.link.requires-item {
    stroke: #e0a020 !important;
    stroke-width: 3.5px !important;
    filter: drop-shadow(0 0 5px rgba(224, 160, 32, 0.7));
}

.link.requires-item.preexisting {
    stroke: #d09018 !important;
    stroke-width: 3px !important;
}

.link.highlighted {
    stroke-opacity: 1;
    stroke-width: 4px;
}

.link.dimmed {
    stroke-opacity: 0.1;
}

/* Arrow markers */
marker path {
    fill: inherit;
}

/* Node styles */
.node circle {
    stroke-width: 2px;
    transition: all 0.2s;
    cursor: pointer;
}

/* Base colors by node type - passage nodes have same fill and stroke */
.node.normal circle {
    fill: #6a6050;
    stroke: #6a6050;
}

.node.boss circle {
    fill: #a85030;
    stroke: #a85030;
}

.node.start circle {
    fill: #40a080;
    stroke: #40a080;
}

.node.end circle {
    fill: #c0a040;
    stroke: #c0a040;
}

/* Hub/interchange nodes: hollow with thicker border */
.node.hub circle {
    fill-opacity: 0.3;
    stroke-width: 3px;
}

.node.hub.normal circle {
    fill: #1a1810;
    stroke: #8a8060;
}

.node.hub.boss circle {
    fill: #2a1010;
    stroke: #c86040;
}

.node.hub.start circle {
    fill: #102020;
    stroke: #50c090;
}

.node.hub.end circle {
    fill: #201810;
    stroke: #d0b050;
}

.node:hover circle,
.node.highlighted circle {
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px currentColor);
}

.node.hub:hover circle,
.node.hub.highlighted circle {
    stroke-width: 4px;
}

.node.normal:hover circle,
.node.normal.highlighted circle {
    fill: #a0906a;
    stroke: #a0906a;
}

.node.boss:hover circle,
.node.boss.highlighted circle {
    fill: #d06040;
    stroke: #d06040;
}

.node.start:hover circle,
.node.start.highlighted circle {
    fill: #60d0a0;
    stroke: #60d0a0;
}

.node.end:hover circle,
.node.end.highlighted circle {
    fill: #e0c060;
    stroke: #e0c060;
}

/* Hub nodes keep distinct fill/stroke on hover */
.node.hub.normal:hover circle,
.node.hub.normal.highlighted circle {
    fill: #1a1810;
    stroke: #a0906a;
}

.node.hub.boss:hover circle,
.node.hub.boss.highlighted circle {
    fill: #2a1010;
    stroke: #d06040;
}

.node.hub.start:hover circle,
.node.hub.start.highlighted circle {
    fill: #102020;
    stroke: #60d0a0;
}

.node.hub.end:hover circle,
.node.hub.end.highlighted circle {
    fill: #201810;
    stroke: #e0c060;
}

.node.dimmed circle {
    opacity: 0.2;
}

/* Frontier highlight styles */
.node.frontier-highlight circle {
    fill: #60a0d0 !important;
    stroke: #80c0f0 !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px #60a0d0);
    /* Animation disabled for performance */
}

/*
.node.access-highlight circle {
    fill: #50c080 !important;
    stroke: #70e0a0 !important;
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px #50c080);
}
    */

.node.frontier-highlight text,
.node.access-highlight text {
    fill: #ffffff !important;
    opacity: 1 !important;
}

.link.frontier-highlight {
    stroke-opacity: 1 !important;
    stroke-width: 4px !important;
}

/* When dimmed is applied on top of frontier highlighting (e.g., when clicking a node) */
.node.frontier-highlight.dimmed circle,
.node.access-highlight.dimmed circle {
    opacity: 0.2 !important;
    filter: none !important;
}

.node.frontier-highlight.dimmed text,
.node.access-highlight.dimmed text {
    fill: #a09080 !important;
    opacity: 0.2 !important;
}

.link.frontier-highlight.dimmed {
    stroke-opacity: 0.1 !important;
    stroke-width: 2px !important;
    filter: none !important;
}

/* pulse-frontier removed for performance */

.node text {
    font-family: 'Crimson Text', serif;
    font-size: 11px;
    fill: #a09080;
    pointer-events: none;
    text-shadow:
        -1px -1px 2px #0a0a0c,
        1px -1px 2px #0a0a0c,
        -1px 1px 2px #0a0a0c,
        1px 1px 2px #0a0a0c;
    transition:
        fill 0.2s,
        opacity 0.2s;
}

.node:hover text,
.node.highlighted text {
    fill: #d4c4a8;
}

.node.dimmed text {
    opacity: 0.2;
}

/* Exploration Mode - Undiscovered nodes */
.node.undiscovered circle {
    fill: #2a2520 !important;
    stroke: #4a4030 !important;
    stroke-dasharray: 3 2;
}

.node.undiscovered text {
    fill: #6a5a4a !important;
    font-style: italic;
}

.node.undiscovered.accessible circle {
    stroke: #6a5a4a !important;
    stroke-opacity: 0.8;
    /* Animation disabled for performance - was causing constant repaints */
}

.node.undiscovered.highlighted circle {
    fill: #3a3530 !important;
    stroke: #d4c4a8 !important;
    stroke-width: 2.5px;
    stroke-dasharray: 3 2;
    filter: drop-shadow(0 0 4px rgba(201, 162, 39, 0.5));
}

.node.undiscovered.highlighted text {
    fill: #d4c4a8 !important;
    font-style: italic;
}

/* Tags */
.node-tags {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.node-tag {
    font-size: 1.1rem;
    padding: 4px;
    border-radius: 4px;
    cursor: default;
    transition: all 0.2s;
    opacity: 1;
}

.node-tag.inactive {
    opacity: 0.3;
    filter: grayscale(0.8);
}

.node-tag.clickable {
    cursor: pointer;
}

.node-tag.clickable:hover {
    transform: scale(1.2);
    opacity: 1;
    filter: none;
}

/* Tag selector styles removed - tags now inline */

/* Discover button */
.discover-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: linear-gradient(135deg, #c9a227 0%, #8b7355 100%);
    border: none;
    border-radius: 6px;
    color: #1a1a1a;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.discover-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.4);
}

/* Undiscover button */
.undiscover-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    background: linear-gradient(135deg, #5a5040 0%, #3a3020 100%);
    border: 1px solid #6a5a4a;
    border-radius: 6px;
    color: #a09080;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
}

.undiscover-btn:hover {
    background: linear-gradient(135deg, #6a5040 0%, #4a3020 100%);
    color: #c0a080;
    border-color: #8a6a4a;
}

/* Discovery notification */
#discovery-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #2a4030 0%, #1a2820 100%);
    border: 1px solid #4a8060;
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 1000;
    color: #a0e0c0;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

#discovery-notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Tooltip */
#tooltip {
    position: fixed;
    background: linear-gradient(135deg, #1a1814 0%, #0e0d0a 100%);
    border: 1px solid #4a4030;
    padding: 14px 18px;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
    max-width: 450px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#tooltip.visible {
    opacity: 1;
}

#tooltip h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: move;
    color: #d4c4a8;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #3a3020;
}

#tooltip .boss-badge {
    display: inline-block;
    background: #4a2020;
    color: #d08060;
    font-size: 0.7rem;
    padding: 2px 8px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: 'Cinzel', serif;
}

#tooltip p {
    color: #9a8d75;
    line-height: 1.5;
    margin: 4px 0;
}

#tooltip .scaling {
    color: #7a9a7a;
}

#tooltip .connections {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #2a2520;
}

#tooltip .conn-title {
    font-size: 0.8rem;
    color: #6a5d45;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

#tooltip .conn-item .requires-info {
    font-size: 0.75rem;
    color: #b89040;
    margin-top: 2px;
    padding-left: 16px;
    display: none;
}

#tooltip .conn-item:hover .requires-info {
    display: block;
}

#tooltip .conn-item.has-requirement {
    border-left: 2px solid #b89040;
    padding-left: 8px;
}

#tooltip .zones-hint {
    color: #7a8a9a;
    font-size: 0.7rem;
    cursor: help;
    text-decoration: underline dotted;
}

#tooltip .conn-item {
    font-size: 0.85rem;
    padding: 4px 6px;
    margin: 2px 0;
    cursor: default;
    border-radius: 3px;
    transition: background 0.15s;
}

#tooltip .conn-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

#tooltip .conn-item.random {
    color: #a09080;
}

#tooltip .conn-item.preexisting {
    color: #7a8a9a;
}

#tooltip .conn-details {
    font-size: 0.8rem;
    color: #a09080;
    font-style: italic;
    margin-top: 2px;
    padding-left: 16px;
    display: none;
}

#tooltip .conn-item:hover .conn-details,
#tooltip .conn-details.expanded {
    display: block;
}

#tooltip.pinned {
    pointer-events: auto;
}

#tooltip .close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    cursor: pointer;
    color: #6a5d45;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.15s;
    display: none;
}

#tooltip.pinned .close-btn {
    display: block;
}

#tooltip .close-btn:hover {
    color: #c4b998;
}

/* Legend */
#legend {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid #3a3020;
    padding: 14px 18px;
    z-index: 100;
}

#legend h4 {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: #9a8d75;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
    font-size: 0.85rem;
}

.legend-line {
    width: 30px;
    height: 3px;
}

.legend-line.random {
    background: #8a8070;
}

.legend-line.preexisting {
    background: repeating-linear-gradient(90deg, #5a6a7a 0px, #5a6a7a 6px, transparent 6px, transparent 10px);
}

.legend-node {
    width: 14px;
    height: 14px;
    border-radius: 50%;
}

.legend-node.normal {
    background: #6a6050;
    border: 2px solid #6a6050;
}

.legend-node.boss {
    background: #a85030;
    border: 2px solid #a85030;
}

.legend-node.start {
    background: #40a080;
    border: 2px solid #40a080;
}

.legend-node.end {
    background: #c0a040;
    border: 2px solid #c0a040;
}

.legend-node.hub {
    background: rgba(26, 24, 16, 0.3);
    border-width: 3px;
}

.legend-node.hub.normal {
    border-color: #8a8060;
}

/* Legend requires-item line */
.legend-line.requires-item {
    background: #e0a020;
}

/* Legend separator (for passage/hub distinction) */
.legend-item.legend-separator {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2a2520;
}

/* Hidden elements (controlled by JS) */
.hidden {
    display: none !important;
}

/* URL row: input + copy button inline */
.stream-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.stream-url-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: #0a0908;
    border: 1px solid #3a3530;
    border-radius: 4px;
    color: #c9a227;
    font-size: 0.85rem;
    font-family: monospace;
}

.stream-url-input:focus {
    outline: none;
    border-color: #6a5d45;
}

/* OBS help section (screenshot + instructions) */
.obs-help {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    align-items: stretch;
}

.obs-help .stream-preview {
    flex: 1;
    display: flex;
}

.obs-help .stream-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.obs-help .obs-instructions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 12px;
    font-size: 0.8rem;
}

.obs-help .obs-instructions-title {
    margin-bottom: 8px;
}

.obs-help .obs-instructions ol {
    font-size: 0.8rem;
}

.obs-help .obs-instructions li {
    margin-bottom: 2px;
}

@media (max-width: 500px) {
    .obs-help {
        flex-direction: column;
    }
}

/* OBS instructions */
.obs-instructions {
    background: rgba(201, 162, 39, 0.08);
    border: 1px solid rgba(201, 162, 39, 0.2);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.85rem;
}

.obs-instructions-title {
    font-family: 'Cinzel', serif;
    color: #c9a227;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.obs-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #9a8d75;
    font-size: 0.85rem;
    line-height: 1.8;
}

.obs-instructions li {
    margin-bottom: 4px;
}

.obs-instructions strong {
    color: #c4b998;
}

/* Stream button active indicator (green dot) */
#stream-btn.active::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #46b464;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Stats */
#stats {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 10, 12, 0.9);
    border: 1px solid #3a3020;
    padding: 14px 18px;
    z-index: 100;
    text-align: right;
    max-width: 200px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#stats-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #3a3020;
    text-align: left;
}

#stats-options label {
    font-size: 0.85rem;
}

/* Stats tags section */
#stats-tags {
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #3a3020;
    text-align: left;
}

.stats-tags-title {
    font-size: 0.75rem;
    color: #6a5d45;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

#stats-tags-list {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 4px;
    justify-content: start;
}

.stats-tag {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.stats-tag:hover {
    background: rgba(80, 70, 50, 0.4);
    border-color: #6a5d45;
}

.stats-tag.active {
    background: rgba(100, 90, 60, 0.5);
    border-color: #8a7d55;
    box-shadow: 0 0 4px rgba(140, 120, 80, 0.3);
}

.stats-tag .tag-emoji {
    font-size: 0.8rem;
}

.stats-tag .tag-count {
    color: #9a8d75;
    font-size: 0.7rem;
}

/* Tag highlight for nodes */
.node.tag-highlighted circle {
    filter: drop-shadow(0 0 8px #c9a227) drop-shadow(0 0 12px #c9a227);
}

.node.tag-highlighted text {
    fill: #ffffff !important;
    opacity: 1 !important;
}

#stats-numbers p {
    font-size: 0.85rem;
    color: #7a6d55;
    margin: 3px 0;
}

#stats-numbers span {
    color: #b4a488;
    font-weight: 600;
}

/* Last discovery indicator */
p#last-discovery {
    font-size: 0.85rem;
    border-bottom: 1px solid #3a3530;
    padding-left: 5px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

#last-discovery .last-discovery-label {
    color: #7a6d55;
    text-align: left;
}

#last-discovery .last-discovery-name {
    color: #c9a227;
    font-weight: 500;
}

#discovered-stat {
    color: #c9a227;
    font-weight: 500;
}

#discovered-stat span {
    color: #e8d5a3;
}

@media (max-width: 1300px) {
    .graph-mode h1 {
        font-size: 1.0rem !important;
    }
}

/* Mobile responsive styles */
@media (max-width: 1000px) {
    /* Hide legend, stats, help hints, path option and load button on mobile */
    #legend,
    #stats,
    .header-right,
    .header-center,
    #new-file-btn,
    #reset-exploration-btn,
    #stream-btn,
    #game-stats,
    #discovery-progress-bar,
    #mod-status {
        display: none !important;
    }

    /* Mode selector compact on mobile */
    #mode-selector {
        padding: 2px;
    }

    .mode-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Make header stack vertically on mobile */
    #header {
        grid-template-columns: 1fr;
        padding: 12px 16px;
        gap: 10px;
    }

    .header-left {
        justify-self: stretch;
    }

    /* Smaller title to fit on one line */
    #header h1 {
        font-size: 1rem;
        letter-spacing: 0.1em;
    }

    .subtitle {
        font-size: 0.85rem;
        margin-top: 4px;
    }

    .streamer-avatar {
        width: 20px;
        height: 20px;
    }

    #search-container {
        width: 100%;
    }

    #search {
        width: 100%;
        box-sizing: border-box;
    }

    .control-group {
        width: 100%;
        justify-content: space-between;
    }

    /* Tooltip fixed at bottom on mobile */
    #tooltip {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: 50vh;
        border-radius: 16px 16px 0 0;
        border-left: none;
        border-right: none;
        border-bottom: none;
        padding: 16px;
        box-sizing: border-box;
    }

    #tooltip h3 {
        cursor: default; /* Disable drag cursor on mobile */
        padding-right: 30px;
    }

    #tooltip .close-btn {
        font-size: 1.5rem;
        top: 12px;
        right: 16px;
    }
}

/* ============================================================
   Toast notifications
   ============================================================ */

#toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(30, 28, 24, 0.95);
    border: 1px solid #3a3020;
    border-radius: 6px;
    padding: 12px 40px 12px 16px;
    color: #c4b998;
    font-size: 0.95rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.3s,
        transform 0.3s;
    pointer-events: auto;
    max-width: 500px;
    position: relative;
}

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

.toast-hiding {
    opacity: 0;
    transform: translateY(-10px);
}

.toast-message {
    line-height: 1.4;
}

.toast-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6a5d45;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #c4b998;
}

.toast-error {
    border-color: #8b3a3a;
    background: rgba(50, 25, 25, 0.95);
}

.toast-error .toast-message {
    color: #e08080;
}

.toast-warning {
    border-color: #8b6a3a;
    background: rgba(50, 40, 25, 0.95);
}

.toast-warning .toast-message {
    color: #e0b060;
}

.toast-update {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 40px;
}

.toast-action-btn {
    background: #3a5030;
    border: 1px solid #4a6040;
    color: #c4b998;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    transition: background 0.2s;
}

.toast-action-btn:hover {
    background: #4a6040;
}

/* ============================================================
   Overlay mode - transparent background for stream overlay
   ============================================================ */

.overlay-mode #upload-screen {
    background: transparent;
}

.overlay-mode #toast-container {
    display: none; /* No toasts in overlay mode */
}

/* ============================================================
   Interactive viewer mode - read-only, no mode switching
   ============================================================ */

/* Hide Reset button and mode toggle for interactive viewers */
.viewer-interactive #explorer-controls,
.viewer-interactive #mode-selector {
    display: none !important;
}

/* Viewer status display */
#viewer-status {
    text-align: center;
}

#viewer-status h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: #c9a227;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

#viewer-status .viewer-status-session {
    color: #9a8d75;
    font-size: 1rem;
    margin-bottom: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#viewer-status .viewer-status-session strong {
    color: #c9a227;
}

#viewer-status .viewer-status-message {
    color: #7a6d55;
    font-size: 0.95rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#viewer-status .viewer-status-message.error {
    color: #e08080;
}

/* ============================================================
   Page system
   ============================================================ */

.page {
    display: block;
}

.page.hidden {
    display: none !important;
}

/* ============================================================
   Landing page
   ============================================================ */

#landing-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #0a0a0c;
    z-index: 500;
    overflow-y: auto;
    padding-top: 40px;
}

.landing-content {
    text-align: center;
    width: 100%;
    max-width: 1100px;
    padding: 40px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 80px);
}

.landing-content h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #d4c4a8;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
}

.landing-content .subtitle {
    font-size: 1rem;
    color: #9a8d75;
    margin-bottom: 64px;
    line-height: 1.5;
}

.landing-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.landing-links {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 48px;
}

.btn-twitch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #9146ff 0%, #6441a5 100%);
    border: none;
    color: #fff;
    padding: 14px 32px;
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

.btn-twitch:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(145, 70, 255, 0.4);
}

.btn-twitch .twitch-icon {
    width: 16px;
    height: 16px;
}

.landing-actions .btn-secondary {
    padding: 12px 32px;
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.landing-actions .btn-secondary:hover {
    transform: scale(1.02);
}

.landing-footer {
    text-align: center;
    color: #5a5040;
    font-size: 0.85rem;
    margin-top: auto;
    padding-top: 40px;
    padding-bottom: 20px;
}

.landing-footer p {
    margin: 5px 0;
}

.landing-footer strong {
    color: #8a7d65;
}

.landing-footer .footer-links a {
    color: #7a6d55;
    text-decoration: none;
    transition: color 0.2s;
}

.landing-footer .footer-links a:hover {
    color: #c9a227;
}

.landing-footer .separator {
    margin: 0 10px;
    color: #3a3020;
}

.btn-discord-landing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #5865f2;
    color: #7c8af2;
    padding: 10px 22px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.03em;
}

.btn-discord-landing:hover {
    border-color: #7c8af2;
    color: #a0aaf5;
    background: rgba(88, 101, 242, 0.1);
}

.btn-discord-landing:focus,
.btn-discord-landing:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.3);
}

.btn-discord-landing .discord-icon {
    width: 18px;
    height: 18px;
}

.btn-setup-guide {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #c9a227;
    color: #c9a227;
    padding: 10px 22px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.03em;
}

.btn-setup-guide:hover {
    border-color: #d4b44a;
    color: #d4b44a;
    background: rgba(201, 162, 39, 0.1);
}

.btn-setup-guide:focus,
.btn-setup-guide:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.3);
}

.btn-setup-guide svg {
    width: 18px;
    height: 18px;
}

.btn-offline-landing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: 1px solid #6b6b6b;
    color: #8a8a8a;
    padding: 10px 22px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.03em;
}

.btn-offline-landing:hover {
    border-color: #8a8a8a;
    color: #a8a8a8;
    background: rgba(107, 107, 107, 0.1);
}

.btn-offline-landing:focus,
.btn-offline-landing:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(107, 107, 107, 0.3);
}

.btn-offline-landing svg {
    width: 18px;
    height: 18px;
}

.landing-screenshots {
    display: flex;
    width: 100%;
    gap: 20px;
    justify-content: center;
    margin-bottom: 64px;
}

.landing-screenshots a {
    flex: 1;
    max-width: 520px;
    text-decoration: none;
}

.landing-screenshots figure {
    margin: 0;
    height: 282px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
    border: 1px solid #3a3530;
}

.landing-screenshots a:hover figure {
    transform: scale(1.02);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.6);
}

.landing-screenshots img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.landing-about {
    text-align: left;
    color: #9a8d75;
    line-height: 1.5;
    margin-bottom: 64px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.landing-about p {
    margin-bottom: 0.7em;
}

.landing-about a {
    color: #c9a227;
    text-decoration: none;
}

.landing-about a:hover {
    text-decoration: underline;
}

.landing-about h3 {
    color: #d4c4a8;
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    margin-top: 1.8em;
    margin-bottom: 0.5em;
    padding-top: 1.2em;
    border-top: 1px solid #2a2520;
}

.landing-about ul {
    margin: 0;
    padding-left: 1.5em;
}

.landing-about li {
    margin-bottom: 0.3em;
}

.landing-about strong {
    color: #c9a227;
}

@media (max-width: 768px) {
    .landing-screenshots {
        flex-direction: column;
        align-items: center;
    }

    .landing-screenshots figure {
        max-width: 100%;
        height: 200px;
    }

    .landing-content {
        padding: 20px;
    }

    .landing-about {
        text-align: left;
    }

    .landing-actions {
        flex-direction: column;
        gap: 12px;
    }

    .landing-links {
        flex-direction: column;
        gap: 12px;
    }
}

/* ============================================================
   Dashboard page
   ============================================================ */

#dashboard-page {
    min-height: 100vh;
    background: #0a0a0c;
}

/* Common page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px 48px;
    border-bottom: 1px solid #2a2520;
    background: rgba(0, 0, 0, 0.3);
}

.page-header h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: #d4c4a8;
    letter-spacing: 0.1em;
    margin: 0;
}

/* Dashboard header specifics */
.dashboard-header {
    justify-content: space-between;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #3a3530;
    background: #2a2520;
    object-fit: cover;
}

#dashboard-username {
    color: #c9a227;
    font-weight: 500;
}

.btn-small {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
}

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Mod Setup Banner */
.mod-setup-banner {
    background: linear-gradient(145deg, #1a1815 0%, #12100d 100%);
    border: 1px solid #4a4030;
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.mod-setup-banner:hover {
    border-color: #6a5d45;
}

.mod-setup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.mod-setup-header:hover {
    background: rgba(201, 162, 39, 0.08);
}

.mod-setup-icon {
    font-size: 1.2rem;
}

.mod-setup-title {
    flex: 1;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #c9a227;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mod-setup-chevron {
    color: #6a5d45;
    font-size: 0.9rem;
    transition: transform 0.3s;
}

.mod-setup-banner.collapsed .mod-setup-chevron {
    transform: rotate(180deg);
}

.mod-setup-content {
    max-height: 500px;
    overflow: hidden;
    transition:
        max-height 0.3s ease,
        opacity 0.3s ease,
        padding 0.3s ease;
    opacity: 1;
    padding: 0 20px 20px 20px;
    border-top: 1px solid #2a2520;
}

.mod-setup-banner.collapsed .mod-setup-content {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-color: transparent;
}

.mod-setup-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 16px;
}

.mod-setup-step {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.step-number {
    color: #c9a227;
    font-size: 1.1rem;
    font-weight: 600;
}

.step-text {
    color: #9a8d75;
    font-size: 0.95rem;
}

.step-tip {
    width: 100%;
    margin-left: 32px;
    margin-top: -4px;
    color: #7a6d55;
    font-size: 0.85rem;
    font-style: italic;
}

.mod-setup-help {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #2a2520;
    text-align: center;
}

.mod-setup-help a {
    color: #9a8d75;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.mod-setup-help a:hover {
    color: #c9a227;
}

.btn-download {
    margin-left: auto;
}

.mod-setup-credentials {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    margin-left: 28px;
}

@media (max-width: 700px) {
    .mod-setup-credentials {
        grid-template-columns: 1fr;
        margin-left: 0;
    }
}

.credential-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.credential-field label {
    font-size: 0.85rem;
    color: #7a6d55;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.credential-input-row {
    display: flex;
    gap: 6px;
}

.credential-input-row input {
    flex: 1;
    padding: 10px 12px;
    background: #0a0908;
    border: 1px solid #3a3530;
    color: #c9a227;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.credential-input-row input:focus {
    outline: none;
    border-color: #6a5d45;
}

.btn-icon {
    background: transparent;
    border: 1px solid #3a3530;
    color: #9a8d75;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: #6a5d45;
    background: rgba(90, 80, 64, 0.2);
    color: #c4b998;
}

.btn-regenerate {
    align-self: flex-start;
}

/* Games grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.games-empty,
.games-loading {
    text-align: center;
    color: #6a5d45;
    padding: 40px;
}

/* Game card */
.game-card {
    background: linear-gradient(145deg, #1a1815 0%, #12100d 100%);
    border: 1px solid #3a3530;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.game-card:hover {
    border-color: #5a5040;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid #2a2520;
}

.game-label {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #d4c4a8;
    font-weight: 500;
}

.game-delete-btn {
    background: none;
    border: none;
    color: #6a5a4a;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.game-delete-btn:hover {
    color: #c45a2c;
}

.game-card-body {
    padding: 16px;
}

.game-seed {
    font-size: 0.85rem;
    color: #7a6d55;
    margin-bottom: 12px;
}

.game-progress {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 1.1rem;
    color: #c9a227;
    font-weight: 600;
}

.progress-percent {
    font-size: 0.85rem;
    color: #7a6d55;
}

.game-progress-bar {
    height: 6px;
    background: rgba(60, 50, 30, 0.5);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.game-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b6914, #c9a227);
    border-radius: 3px;
    transition: width 0.3s;
}

.game-updated {
    font-size: 0.75rem;
    color: #5a5040;
}

.game-card-footer {
    padding: 12px 16px;
    border-top: 1px solid #2a2520;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.game-card-footer a {
    text-decoration: none;
}

/* Mod connection indicator */
.mod-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 8px;
    vertical-align: middle;
}

.mod-indicator.mod-connected {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}

/* Placeholder card (new game) */
.game-card-placeholder {
    border: 2px dashed #3a3530;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-card-placeholder:hover {
    border-color: #5a5040;
    background: rgba(26, 24, 21, 0.5);
}

.game-card-placeholder.drag-over {
    border-color: #c9a227;
    background: rgba(201, 162, 39, 0.1);
}

.placeholder-content {
    text-align: center;
    padding: 20px;
}

.placeholder-icon {
    font-size: 3rem;
    color: #5a5040;
    line-height: 1;
    margin-bottom: 12px;
}

.game-card-placeholder:hover .placeholder-icon {
    color: #c9a227;
}

.placeholder-text {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: #9a8d75;
    margin-bottom: 4px;
}

.placeholder-hint {
    font-size: 0.8rem;
    color: #5a5040;
}

/* New game section (deprecated, kept for compatibility) */
.new-game-section {
    background: linear-gradient(145deg, #1a1815 0%, #12100d 100%);
    border: 1px solid #3a3530;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    margin: 0 auto;
}

.new-game-section h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    color: #c9a227;
    margin-bottom: 20px;
}

.new-game-form {
    margin-top: 20px;
}

.form-row {
    margin-bottom: 16px;
}

.form-row label {
    display: block;
    font-size: 0.9rem;
    color: #9a8d75;
    margin-bottom: 6px;
}

.form-row input[type='text'] {
    width: 100%;
    padding: 10px 12px;
    background: #0a0908;
    border: 1px solid #3a3530;
    border-radius: 6px;
    color: #c4b998;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-row input[type='text']:focus {
    outline: none;
    border-color: #6a5d45;
}

.form-row .seed-info {
    color: #7a6d55;
    font-size: 0.9rem;
}

.form-row .seed-info span {
    color: #c9a227;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.error-message {
    color: #c45a2c;
    font-size: 0.9rem;
    margin-top: 12px;
}

.btn-icon {
    padding: 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.eye-icon {
    display: block;
}

.eye-icon.hidden {
    display: none;
}

/* Drop zone in dashboard */
.drop-zone {
    width: 100%;
    padding: 40px;
    border: 2px dashed #3a3020;
    background: rgba(30, 28, 24, 0.3);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #6a5d45;
    background: rgba(40, 38, 32, 0.5);
}

.drop-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    opacity: 0.6;
}

.drop-zone p {
    font-size: 1rem;
    color: #9a8d75;
    margin-bottom: 8px;
}

.drop-zone .hint {
    font-size: 0.85rem;
    color: #6a5d45;
}

/* ============================================================
   User games page (public)
   ============================================================ */

#user-games-page {
    min-height: 100vh;
    background: #0a0a0c;
}

/* User games header specifics */
.user-games-header .user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #7a6d55;
}

.user-games-header h1 {
    flex: 1;
}

.user-games-header .twitch-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #9146ff;
    border-radius: 8px;
    transition:
        background 0.2s,
        color 0.2s;
}

.user-games-header .twitch-link:hover {
    background: rgba(145, 70, 255, 0.15);
    color: #a970ff;
}

.user-games-header .twitch-icon {
    width: 24px;
    height: 24px;
}

.user-games-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Back link */
.back-link {
    color: #b8a990;
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: #c9a227;
    text-decoration: none;
}

.back-btn {
    font-size: 0.95rem;
    color: #9a8d75;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid #4a4035;
    border-radius: 4px;
    background: rgba(90, 80, 64, 0.1);
    transition: all 0.2s;
}

.back-btn:hover {
    color: #c9a227;
    border-color: #c9a227;
    background: rgba(201, 162, 39, 0.15);
}

.offline-back {
    position: absolute;
    top: 24px;
    left: 24px;
}

/* Header back link */
.header-left {
    display: flex;
    align-items: flex-start;
}

.title-link {
    text-decoration: none;
}

.title-link:hover h1 {
    color: #c9a227;
}

#header-back-link {
    margin-right: 12px;
    padding-right: 12px;
    border-right: 1px solid #5a5040;
}

/* ============================================================
   Stream modal updates
   ============================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal:not(.hidden) {
    display: flex;
}

.stream-options {
    margin-top: 12px;
}

.stream-options .form-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stream-options label {
    flex: 0 0 120px;
    margin-bottom: 0;
}

.stream-options select {
    flex: 1;
    padding: 8px 12px;
    background: #0a0908;
    border: 1px solid #3a3530;
    color: #c4b998;
    font-family: inherit;
    font-size: 0.9rem;
}

.stream-options select:focus {
    outline: none;
    border-color: #6a5d45;
}

/* Counter position classes for main UI (used in /play mode) */
#viewer-discovery-counter.counter-pos-br {
    bottom: 24px;
    right: 24px;
}
#viewer-discovery-counter.counter-pos-bl {
    bottom: 24px;
    left: 24px;
}
#viewer-discovery-counter.counter-pos-tr {
    top: 24px;
    right: 24px;
}
#viewer-discovery-counter.counter-pos-tl {
    top: 24px;
    left: 24px;
}
#viewer-discovery-counter.counter-pos-t {
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
}
#viewer-discovery-counter.counter-pos-b {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}
#viewer-discovery-counter.counter-pos-l {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}
#viewer-discovery-counter.counter-pos-r {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

#viewer-discovery-counter.counter-size-sm {
    font-size: 1rem;
    padding: 8px 12px;
}
#viewer-discovery-counter.counter-size-md {
    font-size: 1.4rem;
    padding: 12px 18px;
}
#viewer-discovery-counter.counter-size-lg {
    font-size: 2rem;
    padding: 16px 24px;
}
#viewer-discovery-counter.counter-size-xl {
    font-size: 2.8rem;
    padding: 20px 32px;
}

/* ============================================================
   Help Page
   ============================================================ */

#help-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1815 0%, #0d0c0a 100%);
}

.help-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 48px;
}

.help-toc {
    background: rgba(58, 53, 47, 0.3);
    border: 1px solid #3a352f;
    border-radius: 8px;
    padding: 20px 24px 20px 48px;
    margin-bottom: 32px;
}

.help-toc ol {
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, auto);
    grid-auto-flow: column;
    gap: 8px 32px;
}

.help-toc li {
    color: #9a8d75;
    font-size: 0.95rem;
}

.help-toc a {
    color: #d4c4a0;
    text-decoration: none;
    transition: color 0.2s;
}

.help-toc a:hover {
    color: #c9a227;
}

.help-section {
    margin-bottom: 48px;
}

.help-section h2 {
    font-family: 'Cinzel', serif;
    color: #c9a227;
    font-size: 1.5rem;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #3a352f;
}

.help-subsection {
    margin-bottom: 32px;
    padding-left: 16px;
}

.help-subsection h3 {
    font-family: 'Cinzel', serif;
    color: #d4c4a0;
    font-size: 1.15rem;
    margin-bottom: 12px;
}

.help-subsection h4 {
    color: #b0a080;
    font-size: 0.95rem;
    margin: 20px 0 10px;
}

.help-subsection p {
    color: #9a8d75;
    line-height: 1.6;
    margin-bottom: 12px;
}

.help-subsection ul,
.help-subsection ol {
    color: #9a8d75;
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 24px;
}

.help-subsection li {
    margin-bottom: 6px;
}

.help-subsection a:not(.btn-primary):not(.btn-secondary) {
    color: #c9a227;
    text-decoration: none;
}

.help-subsection a:not(.btn-primary):not(.btn-secondary):hover {
    text-decoration: underline;
}

.help-subsection code {
    background: #0a0908;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #c4b998;
}

.help-subsection kbd {
    background: linear-gradient(180deg, #3a352f, #2a2520);
    border: 1px solid #4a453f;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 0.85em;
    color: #d4c4a0;
    box-shadow: 0 2px 0 #1a1815;
}

/* Help tip box */
.help-tip {
    display: flex;
    gap: 10px;
    background: rgba(201, 162, 39, 0.1);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 6px;
    padding: 12px 16px;
    margin: 16px 0;
}

.help-tip .tip-icon {
    flex-shrink: 0;
}

.help-tip .tip-text {
    color: #c9a227;
    font-size: 0.9rem;
    font-style: italic;
}

/* Help table */
.help-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.help-table td {
    padding: 8px 12px;
    border: 1px solid #2a2520;
    color: #9a8d75;
}

.help-table td:first-child {
    width: 140px;
    background: rgba(0, 0, 0, 0.2);
    color: #c4b998;
}

/* Code blocks */
.help-code {
    background: #0a0908;
    border: 1px solid #2a2520;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.help-code code {
    background: none;
    padding: 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: #c4b998;
    line-height: 1.6;
    white-space: pre;
}

/* Screenshots */
.help-screenshot {
    margin: 16px 0;
    text-align: center;
}

.help-screenshot img {
    height: auto;
    border-radius: 8px;
    max-width: 100%;
    border: 1px solid #3a352f;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Limit height for tall/vertical images (e.g. launcher screenshots) */
.help-screenshot.vertical img {
    max-height: 500px;
    width: auto;
}

.help-screenshot.already-fit img {
    object-fit: none;
}

.help-screenshot figcaption {
    margin-top: 8px;
    color: #6a5a4a;
    font-size: 0.85rem;
    font-style: italic;
}

/* FAQ Section */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid #2a2520;
    border-radius: 6px;
    overflow: hidden;
}

.faq-question {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    color: #d4c4a0;
    font-weight: 500;
    transition: background 0.2s;
}

.faq-question:hover {
    background: rgba(201, 162, 39, 0.05);
}

.faq-icon {
    color: #c9a227;
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.faq-item.open .faq-icon {
    transform: rotate(90deg);
}

.faq-answer {
    display: none;
    padding: 0 16px 16px 40px;
}

.faq-item.open .faq-answer {
    display: block;
}

.faq-answer p,
.faq-answer ul {
    color: #9a8d75;
    line-height: 1.6;
    margin-bottom: 12px;
}

.faq-answer ul {
    padding-left: 20px;
}

.faq-answer li {
    margin-bottom: 6px;
}

.faq-answer p:last-child,
.faq-answer ul:last-child {
    margin-bottom: 0;
}

.faq-answer a {
    color: #c9a227;
    text-decoration: none;
}

.faq-answer a:hover {
    text-decoration: underline;
}

/* Help footer */
.help-footer {
    text-align: center;
    padding: 32px;
    border-top: 1px solid #2a2520;
    color: #6a5a4a;
}

.help-footer a {
    color: #c9a227;
    text-decoration: none;
}

.help-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .page-header {
        padding: 16px 24px;
    }

    .help-content {
        padding: 24px;
    }

    .help-subsection {
        padding-left: 0;
    }

    .help-toc {
        padding: 16px 16px 16px 40px;
    }

    .help-toc ol {
        grid-template-columns: 1fr;
    }

    .help-table td:first-child {
        width: auto;
    }
}

/* ============================================================
   Feedback Button & Modal
   ============================================================ */

/* Floating feedback button */
.feedback-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #2a2520 0%, #1a1814 100%);
    border: 1px solid #4a4030;
    color: #c4b998;
    padding: 10px 16px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.feedback-btn:hover {
    border-color: #6a5d45;
    background: linear-gradient(135deg, #3a3530 0%, #2a2824 100%);
    color: #d4c4a8;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

.feedback-btn-icon {
    font-size: 1.1rem;
}

.feedback-btn-text {
    font-family: 'Cinzel', serif;
    letter-spacing: 0.03em;
}

/* Feedback dropdown */
.feedback-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: linear-gradient(145deg, #1a1815 0%, #12100d 100%);
    border: 1px solid #3a3020;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    min-width: 260px;
    overflow: hidden;
}

.feedback-dropdown.hidden {
    display: none;
}

.feedback-option {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    text-decoration: none;
    color: #c4b998;
    border-bottom: 1px solid #2a2520;
    transition: background 0.2s;
}

.feedback-option:last-child {
    border-bottom: none;
}

.feedback-option:hover {
    background: rgba(201, 162, 39, 0.1);
}

.feedback-option-discord:hover {
    background: rgba(88, 101, 242, 0.15);
}

.feedback-option-icon {
    display: inline;
    margin-right: 8px;
}

.feedback-option-text {
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    color: #d4c4a8;
}

.feedback-option-desc {
    font-size: 0.8rem;
    color: #7a6d55;
    margin-top: 4px;
    padding-left: 26px;
}

/* Hide feedback button in overlay mode, on graph page, and on landing/upload pages */
.overlay-mode .feedback-btn,
#main-ui.visible ~ .feedback-btn,
#landing-page:not(.hidden) ~ .feedback-btn,
#upload-screen:not(.hidden) ~ .feedback-btn {
    display: none;
}

/* Stats panel feedback links */
.stats-feedback {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #2a2520;
    font-size: 0.8rem;
}

.stats-feedback a {
    color: #6a5d45;
    text-decoration: none;
    transition: color 0.2s;
}

.stats-feedback a:hover {
    color: #c9a227;
}

.stats-feedback-sep {
    color: #3a3020;
    margin: 0 6px;
}

/* Feedback modal */
.feedback-modal-content {
    max-width: 420px;
    text-align: center;
}

.feedback-modal-header {
    margin-bottom: 16px;
}

.feedback-modal-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 8px;
}

.feedback-modal-content h3 {
    margin-top: 0;
}

.feedback-modal-message {
    color: #9a8d75;
    line-height: 1.6;
    margin-bottom: 24px;
}

.feedback-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.feedback-modal-actions .btn-primary {
    width: 100%;
    max-width: 280px;
    justify-content: center;
}

.feedback-modal-actions .btn-secondary {
    background: transparent;
    border: none;
    color: #6a5d45;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.9rem;
}

.feedback-modal-actions .btn-secondary:hover {
    color: #9a8d75;
}

.btn-discord {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
    border: none;
    color: #fff;
}

/* =============================================================================
   Users List Page (/watch)
   ============================================================================= */

.users-list-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.users-list-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #1a1814;
    border: 1px solid #3a3530;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
}

.user-row:hover {
    background: #242018;
    border-color: #4a4540;
}

.user-row.user-playing {
    border-color: #4a7a4a;
    background: linear-gradient(135deg, #1a2418 0%, #1a1814 100%);
}

.user-row.user-playing:hover {
    border-color: #5a9a5a;
    background: linear-gradient(135deg, #1a2a18 0%, #242018 100%);
}

.user-row .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3a3530;
    flex-shrink: 0;
}

.user-row.user-playing .user-avatar {
    border-color: #4a7a4a;
}

.user-row .user-name {
    flex: 1;
    font-weight: 500;
    color: #e8e0d5;
    font-size: 1rem;
}

.user-row .user-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-row .status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-row .status-playing {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.user-row .status-online {
    background: rgba(100, 149, 237, 0.2);
    color: #90caf9;
    border: 1px solid rgba(100, 149, 237, 0.3);
}

.user-row .viewer-count {
    font-size: 0.85rem;
    color: #9a8d75;
}

.user-row .last-seen {
    font-size: 0.85rem;
    color: #6a5d45;
    font-style: italic;
}

.user-row .user-arrow {
    color: #6a5d45;
    font-size: 1.2rem;
    transition: transform 0.15s ease;
}

.user-row:hover .user-arrow {
    transform: translateX(4px);
    color: #9a8d75;
}

.users-loading,
.users-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9a8d75;
}

.users-empty p {
    margin: 0;
}

/* =============================================================================
   Game Card Status (for /watch/:username)
   ============================================================================= */

.game-card-playing {
    border-color: #4a7a4a;
    background: linear-gradient(135deg, #1a2418 0%, #1a1814 100%);
}

.game-card-playing:hover {
    border-color: #5a9a5a;
}

.game-card-header .game-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-card .status-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-card .status-playing {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.game-card .status-online {
    background: rgba(100, 149, 237, 0.2);
    color: #90caf9;
    border: 1px solid rgba(100, 149, 237, 0.3);
}

.game-card .viewer-count {
    font-size: 0.8rem;
    color: #9a8d75;
}

/* ============================================================
   Not Found Page
   ============================================================ */

#not-found-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #1a1815 0%, #0d0c0a 100%);
}

.not-found-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 100px);
    padding: 40px;
}

.not-found-content {
    text-align: center;
    max-width: 400px;
}

.not-found-icon {
    font-size: 6rem;
    color: #4a4030;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    margin-bottom: 24px;
    line-height: 1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#not-found-message {
    color: #9a8d75;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

#not-found-action {
    display: inline-block;
    text-decoration: none;
}
