@import url("https://fonts.googleapis.com/css2?family=Creepster&family=Roboto:wght@400;500;700&display=swap");

:root {
    --haunt-bg: #08060e;
    --haunt-bg-secondary: #120d1f;
    --haunt-panel: rgba(26, 18, 43, 0.92);
    --haunt-panel-border: rgba(255, 117, 24, 0.45);
    --haunt-text: #f2ecff;
    --haunt-muted: #c0b7d0;
    --haunt-orange: #ff7518;
    --haunt-orange-dark: #d95e0b;
    --haunt-purple: #7f39fb;
    --haunt-green: #8be98b;
    --haunt-shadow: 0 0 25px rgba(127, 57, 251, 0.35);
}

body {
    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(127, 57, 251, 0.18),
            transparent 55%
        ),
        radial-gradient(
            circle at 85% 15%,
            rgba(255, 117, 24, 0.25),
            transparent 50%
        ),
        radial-gradient(
            circle at 50% 80%,
            rgba(139, 233, 139, 0.18),
            transparent 55%
        ),
        var(--haunt-bg);
    color: var(--haunt-text);
    font-family: "Roboto", Arial, sans-serif;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        url("https://www.transparenttextures.com/patterns/asfalt-dark.png"),
        linear-gradient(
            135deg,
            rgba(255, 117, 24, 0.07),
            transparent 40%,
            rgba(127, 57, 251, 0.08)
        );
    mix-blend-mode: screen;
    opacity: 0.6;
}

body::after {
    content: "";
    position: fixed;
    top: 0;
    right: 0;
    width: clamp(180px, 24vw, 320px);
    height: clamp(174px, 23vw, 310px);
    background: url("../cobweb.png") no-repeat top right / contain;
    transform: scaleX(-1);
    transform-origin: top right;
    filter: invert(1) brightness(1.15)
        drop-shadow(0 0 18px rgba(255, 255, 255, 0.2));
    opacity: 0.85;
    pointer-events: none;
    display: block;
    z-index: 5000;
}

.page-wrapper {
    background: linear-gradient(
        135deg,
        rgba(18, 13, 31, 0.95),
        rgba(8, 6, 14, 0.85)
    );
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
    border-radius: 1.25rem;
    border: 1px solid rgba(127, 57, 251, 0.25);
}

.sidebar,
.container {
    background: var(--haunt-panel);
    color: var(--haunt-text);
    border: 1px solid var(--haunt-panel-border);
    box-shadow: var(--haunt-shadow);
}

.sidebar h3,
.sidebar-quest h3,
.container h2,
.container h3,
.container h4 {
    font-family: "Creepster", "Roboto", sans-serif;
    letter-spacing: 0.04em;
    color: var(--haunt-orange);
    text-shadow: 0 0 10px rgba(255, 117, 24, 0.15);
}

.sidebar-stats div,
.quest-message,
label,
p,
li,
span,
table,
input,
button {
    color: var(--haunt-text);
}

#dailyQuestStatus {
    color: var(--haunt-text) !important;
}

.sidebar-quest {
    background: linear-gradient(
        160deg,
        rgba(127, 57, 251, 0.2),
        rgba(255, 117, 24, 0.12)
    );
    border: 1px solid rgba(255, 117, 24, 0.35);
    box-shadow: 0 0 18px rgba(255, 117, 24, 0.35);
}

.sidebar-quest.complete {
    border-color: rgba(139, 233, 139, 0.6);
    box-shadow: 0 0 25px rgba(139, 233, 139, 0.35);
}

.quest-progress {
    background: rgba(255, 255, 255, 0.12);
}

.quest-progress-fill {
    background: linear-gradient(
        90deg,
        var(--haunt-orange),
        var(--haunt-purple)
    );
}

.sidebar label {
    color: var(--haunt-muted);
}

label.theme-toggle {
    background: rgba(255, 117, 24, 0.16);
    border: 1px solid rgba(255, 168, 89, 0.45);
    box-shadow:
        0 0 26px rgba(255, 191, 102, 0.75),
        0 0 12px rgba(255, 117, 24, 0.55);
    border-radius: 0.75rem;
    padding: 0.35rem 0.75rem;
    color: var(--haunt-text);
    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

label.theme-toggle:hover {
    transform: translateY(-1px);
    box-shadow:
        0 0 32px rgba(255, 204, 128, 0.85),
        0 0 18px rgba(255, 117, 24, 0.65);
}

.sidebar input[type="checkbox"] {
    accent-color: var(--haunt-orange);
}

.article h2,
.article h3 {
    font-family: "Creepster", "Roboto", sans-serif;
    color: var(--haunt-orange);
}

#content {
    color: var(--haunt-text);
}

#content p::first-letter,
#content div::first-letter,
#content::first-letter {
    color: var(--haunt-orange);
    text-shadow: 0 0 12px rgba(255, 117, 24, 0.75);
}

.halloween-bat-wrapper {
    pointer-events: none;
    z-index: 9999;
}

.halloween-bat {
    width: 48px;
    height: auto;
    filter: invert(1);
}

.highlight {
    background-color: #884700;
    color: #ffffff;
    padding: 0.05em 0.15em;
}

.highlight:hover {
    background-color: rgba(255, 168, 89, 0.85);
    color: #ffffff;
}

.highlight-single-word {
    background-color: #ff9d3d;
    color: #ffffff;
}

.highlight-single-word:hover {
    background-color: #ffae5d;
}

.keyword-highlight {
    background-color: #db8300;
    border-bottom: 2px solid #fb8c00;
}

.stars .star {
    color: rgba(255, 255, 255, 0.15);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

.stars .star.selected {
    color: var(--haunt-orange);
    text-shadow: 0 0 10px rgba(255, 117, 24, 0.8);
}

#topicsTable {
    border-collapse: separate;
    border-spacing: 0;
    overflow: visible;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.35);
}

#topicsTable th {
    background: rgba(127, 57, 251, 0.3);
    color: var(--haunt-text);
}

#topicsTable td {
    background: rgba(18, 13, 31, 0.7);
    border-bottom: 1px solid rgba(255, 117, 24, 0.25);
}

.topic-name {
    color: var(--haunt-orange);
    font-weight: 600;
}

.topic-tooltip-icon {
    background: rgba(255, 117, 24, 0.35);
    border: 1px solid rgba(255, 117, 24, 0.5);
}

.topic-tooltip {
    background: rgba(26, 18, 43, 0.95);
    border: 1px solid rgba(127, 57, 251, 0.4);
    box-shadow: 0 0 25px rgba(127, 57, 251, 0.35);
    color: var(--haunt-text);
    z-index: 4000;
}

.topic-tooltip::after {
    border-top-color: rgba(26, 18, 43, 0.95);
}

.topic-note-input,
input[type="text"],
input[type="number"],
input[type="password"] {
    background: rgba(12, 9, 18, 0.85);
    border: 1px solid rgba(127, 57, 251, 0.45);
    color: var(--haunt-text);
    box-shadow: inset 0 0 12px rgba(127, 57, 251, 0.25);
}

.topic-note-input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
    border-color: var(--haunt-orange);
    outline: none;
    box-shadow: 0 0 10px rgba(255, 117, 24, 0.4);
}

.keyword-chip {
    background: rgba(127, 57, 251, 0.3);
    border: 1px solid rgba(127, 57, 251, 0.5);
    color: var(--haunt-text);
}

.keyword-chip button {
    color: var(--haunt-orange);
}

.keyword-chip button:hover {
    color: var(--haunt-green);
}

.keyword-empty-state {
    color: var(--haunt-muted);
}

#timer,
#timeInArticle,
.time-in-article {
    color: var(--haunt-text) !important;
    text-shadow: 0 0 8px rgba(127, 57, 251, 0.45);
}

#resetTimerBtn,
#clearAllBtn,
#pauseTimerBtn,
#resumeTimerBtn {
    background: rgba(18, 13, 31, 0.85) !important;
    color: var(--haunt-text) !important;
    border: 1px solid rgba(127, 57, 251, 0.5) !important;
    box-shadow: 0 0 14px rgba(127, 57, 251, 0.35);
    padding: 0.35rem 0.8rem !important;
    border-radius: 0.4rem !important;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

#resetTimerBtn:hover,
#clearAllBtn:hover,
#pauseTimerBtn:hover,
#resumeTimerBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(127, 57, 251, 0.45);
}

#submitBtn,
#refreshArticleBtn,
#keywordBtn,
#infoBtn,
#rsvpBtn,
.rsvp-controls button,
#keywordForm button,
#clearKeywordsBtn,
.sidebar button,
button {
    font-family: "Roboto", sans-serif;
    background: linear-gradient(
        135deg,
        rgba(255, 117, 24, 0.95),
        rgba(127, 57, 251, 0.85)
    );
    color: #ffffff;
    border: 1px solid rgba(255, 117, 24, 0.6);
    box-shadow: 0 0 18px rgba(127, 57, 251, 0.45);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

#submitBtn:hover,
#refreshArticleBtn:hover,
#keywordBtn:hover,
#infoBtn:hover,
#rsvpBtn:hover,
.rsvp-controls button:hover,
#keywordForm button:hover,
#clearKeywordsBtn:hover,
.sidebar button:hover,
button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 0 25px rgba(255, 117, 24, 0.75);
}

#submitBtn .fill {
    background: rgba(18, 13, 31, 0.4);
}

#submitBtn span {
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

#submitBtn.rumbling {
    animation: haunt-rumble 0.6s ease-in-out infinite;
}

.modal {
    background: rgba(8, 6, 14, 0.8);
}

.modal-content,
.rsvp-modal-content {
    background: rgba(18, 13, 31, 0.95);
    border: 1px solid rgba(127, 57, 251, 0.5);
    box-shadow: 0 0 35px rgba(127, 57, 251, 0.4);
    color: var(--haunt-text);
}

.close-btn {
    color: var(--haunt-orange);
}

.close-btn:hover,
.close-btn:focus {
    color: var(--haunt-green);
    text-shadow: 0 0 12px rgba(139, 233, 139, 0.8);
}

.rsvp-word-display {
    background: rgba(8, 6, 14, 0.85);
    border: 1px solid rgba(255, 117, 24, 0.4);
}

.rsvp-word-display.highlighted {
    color: var(--haunt-orange);
}

.rsvp-progress {
    background: rgba(255, 255, 255, 0.12);
}

.rsvp-progress-fill {
    background: linear-gradient(
        90deg,
        var(--haunt-orange),
        var(--haunt-purple)
    );
    box-shadow: 0 0 14px rgba(255, 117, 24, 0.65);
}

.sidebar-content-scrollable::-webkit-scrollbar,
.container::-webkit-scrollbar {
    width: 0.6rem;
}

.sidebar-content-scrollable::-webkit-scrollbar-thumb,
.container::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(127, 57, 251, 0.55),
        rgba(255, 117, 24, 0.65)
    );
    border-radius: 1rem;
}

.sidebar-content-scrollable::-webkit-scrollbar-track,
.container::-webkit-scrollbar-track {
    background: rgba(12, 9, 18, 0.65);
}

#submitTooltip {
    background: rgba(18, 13, 31, 0.95);
    border: 1px solid rgba(127, 57, 251, 0.45);
    color: var(--haunt-text);
    box-shadow: 0 0 18px rgba(127, 57, 251, 0.35);
}

@keyframes haunt-rumble {
    0% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(-2px, 1px);
    }
    50% {
        transform: translate(2px, -1px);
    }
    75% {
        transform: translate(-1px, -2px);
    }
    100% {
        transform: translate(0, 0);
    }
}
