:root {
    --bg: #0f1115;
    --panel: #1a1d24;
    --panel-border: #2a2e38;
    --text: #e8e8ec;
    --text-muted: #9a9fac;
    --accent: #d4af37;
    --accent-dim: #8a6f1e;
    --success: #4caf6d;
    --fail: #d05c5c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    line-height: 1.4;
}

.topnav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
}

.brand {
    color: var(--accent);
    font-weight: bold;
    text-decoration: none;
    font-size: 1rem;
}

.admin-btn {
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--panel-border);
    padding: 0.4rem 0.9rem;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.admin-btn:hover { border-color: var(--accent); }

.topnav-left { justify-self: start; min-width: 0; }
.topnav-center { justify-self: center; }
.topnav-right { justify-self: end; display: flex; align-items: center; gap: 0.5rem; }

.nav-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
}

@media (max-width: 650px) {
    .topnav {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
    }
    .nav-hamburger { display: block; }
    .topnav-center,
    .topnav-right {
        display: none;
        width: 100%;
        justify-content: flex-start;
        padding-top: 0.6rem;
    }
    .topnav.menu-open .topnav-center,
    .topnav.menu-open .topnav-right {
        display: flex;
    }
}

.raid-event-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 700;
    background: linear-gradient(90deg, #ffd700, #ffed4e, #ffd700);
    background-size: 200% 100%;
    padding: 0.5rem 1.2rem;
    border-radius: 20px;
    animation: money-banner-shine 2.5s linear infinite;
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.55);
}

.raid-event-btn:hover { box-shadow: 0 0 20px rgba(212, 175, 55, 0.85); }

.raid-event-btn-inactive {
    color: #b8bec8;
    background: #30343b;
    animation: none;
    box-shadow: inset 0 0 0 1px #484e58;
}

.raid-event-btn-inactive:hover {
    color: #e1e4e9;
    background: #3b414a;
    box-shadow: inset 0 0 0 1px #616a77;
}

.raid-event-btn-inactive svg { flex-shrink: 0; }

@media (max-width: 480px) {
    .raid-event-btn { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.container.container-wide {
    max-width: 1800px;
}

@media (max-width: 480px) {
    .container { padding: 0.75rem; }
    .panel { padding: 0.9rem; }
    .topnav { padding: 0.6rem 0.75rem; }
    .brand { font-size: 0.85rem; }
    .admin-btn { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
    h1.page-title { font-size: 1.25rem; }
    .filter-buttons button { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
    table { font-size: 0.78rem; }
    th, td { padding: 0.4rem 0.35rem; }
}

h1.page-title {
    text-align: center;
    color: var(--accent);
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.panel h2:first-child {
    margin-top: 0;
}

.raid-logs-heading { margin: 0 0 1.6rem; }
.raid-logs-eyebrow {
    margin: 0 0 0.3rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.raid-logs-heading h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.4rem); }
.raid-logs-heading > p:last-child { margin: 0.35rem 0 0; color: var(--text-muted); }
.raid-logs-empty { color: var(--text-muted); }
.raid-log-list { display: grid; gap: 1rem; }
.raid-log-card {
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--panel-border);
    border-left: 4px solid var(--success);
    border-radius: 10px;
    background: radial-gradient(circle at top right, rgba(76, 175, 109, 0.07), transparent 36%), var(--panel);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}
.raid-log-card-fail {
    border-left-color: var(--fail);
    background: radial-gradient(circle at top right, rgba(208, 92, 92, 0.07), transparent 36%), var(--panel);
}
.raid-log-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.raid-log-date { margin: 0 0 0.15rem; color: var(--text-muted); font-size: 0.82rem; }
.raid-log-topline h2 { margin: 0; font-size: 1.35rem; }
.raid-log-status {
    flex: none;
    padding: 0.3rem 0.7rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 700;
}
.raid-log-card-fail .raid-log-status { color: var(--fail); }
.raid-log-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}
.raid-log-stats > div {
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.12);
}
.raid-log-stats span, .raid-log-stats strong { display: block; }
.raid-log-stats span { margin-bottom: 0.2rem; color: var(--text-muted); font-size: 0.76rem; }
.raid-log-stats strong { font-size: 0.98rem; font-weight: 650; }
.raid-log-pace {
    --pace-color: var(--accent);
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.14);
    box-shadow: inset 3px 0 var(--pace-color);
}
.raid-log-pace-faster { --pace-color: var(--success); }
.raid-log-pace-slower { --pace-color: var(--fail); }
.raid-log-pace-main { display: grid; grid-template-columns: 2.35rem minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; }
.raid-log-pace-symbol {
    display: grid;
    place-items: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid var(--pace-color);
    border-radius: 8px;
    color: var(--pace-color);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
}
.raid-log-pace-label, .raid-log-pace-copy strong, .raid-log-pace-average span, .raid-log-pace-average strong { display: block; }
.raid-log-pace-label { color: var(--text-muted); font-size: 0.74rem; }
.raid-log-pace-copy strong { margin-top: 0.1rem; font-size: 0.97rem; font-weight: 600; }
.raid-log-pace-delta { color: var(--pace-color); font-size: 1.12rem; font-weight: 800; }
.raid-log-pace-average { padding-left: 1rem; border-left: 1px solid var(--panel-border); text-align: right; }
.raid-log-pace-average span { color: var(--text-muted); font-size: 0.74rem; }
.raid-log-pace-average strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.raid-log-pace p { margin: 0.65rem 0 0 3.15rem; color: var(--text-muted); font-size: 0.75rem; }
.raid-log-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.raid-log-detail h3, .raid-log-drops h3 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.raid-log-detail p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }
.raid-log-people { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.raid-log-person {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.82rem;
    text-decoration: none;
}
a.raid-log-person:hover { border-color: var(--accent); color: var(--accent); }
.raid-log-person-death { border-color: var(--fail); color: var(--fail); }
.raid-log-drops { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--panel-border); }
.raid-log-drop-list { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.raid-log-drop {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 13rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--accent-dim);
    border-radius: 7px;
    background: rgba(212, 175, 55, 0.08);
}
.raid-log-drop img { width: 32px; height: 32px; object-fit: contain; }
.raid-log-drop strong, .raid-log-drop span { display: block; }
.raid-log-drop strong { color: var(--accent); font-size: 0.86rem; }
.raid-log-drop span { color: var(--text-muted); font-size: 0.78rem; }

@media (max-width: 700px) {
    .raid-log-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
    .raid-log-card { padding: 1rem; }
    .raid-log-pace-main { grid-template-columns: 2.35rem minmax(0, 1fr); }
    .raid-log-pace-average { grid-column: 2; padding: 0; border: 0; text-align: left; }
    .raid-log-pace p { margin-left: 3.15rem; }
    .raid-log-details { grid-template-columns: minmax(0, 1fr); }
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.filter-buttons button {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--panel-border);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
}

.filter-buttons button.active {
    background: var(--accent-dim);
    color: var(--text);
    border-color: var(--accent);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    padding: 0.5rem 0.6rem;
    text-align: right;
    border-bottom: 1px solid var(--panel-border);
}

th:first-child, td:first-child { text-align: left; }

th {
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th.sorted::after { content: ' \25BC'; font-size: 0.7em; }

tbody tr:hover { background: rgba(255,255,255,0.03); }

.tables-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
}

@media (max-width: 800px) {
    .tables-grid { grid-template-columns: minmax(0, 1fr); }
}

.event-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.tables-grid-single { grid-template-columns: minmax(0, 1fr); }

.event-summary-grid > .panel {
    min-width: 0;
    margin-bottom: 0;
}

.event-summary-grid:has(#eventSelfPurples[hidden]) {
    grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 800px) {
    .event-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.dashboard-left {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* Panels inside the dashboard grid rely purely on grid/flex gap for spacing,
   so the vertical gaps match the horizontal column gap exactly. */
.dashboard-grid .panel {
    margin-bottom: 0;
}

.filter-panel-compact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-row-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

#teamSizeSlider {
    width: 160px;
}

.filter-buttons-compact {
    margin-bottom: 0;
    gap: 0.3rem;
}

.filter-buttons-compact button {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

@media (max-width: 480px) {
    .filter-panel-compact { gap: 0.75rem; }
}

.dashboard-left .tables-grid {
    flex: 1;
}

.chart-panel {
    display: flex;
    flex-direction: column;
}

.chart-panel .chart-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
}

.chart-panel canvas { max-height: 100%; }

.chart-3d-legend {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(26, 29, 36, 0.8);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    pointer-events: none;
    max-width: calc(100% - 1rem);
}

.chart-3d-legend-caption {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-bottom: 0.4rem;
}

.chart-3d-legend-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chart-3d-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text);
    font-size: 0.78rem;
    pointer-events: auto;
    cursor: help;
}

.chart-3d-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dashboard-grid table { font-size: 0.82rem; }
.dashboard-grid th, .dashboard-grid td { padding: 0.35rem 0.4rem; }

@media (max-width: 1000px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-left .tables-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 650px) {
    .dashboard-left .tables-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1000px) {
    .chart-panel .chart-wrap { flex: none; height: 320px; }
}

@media (max-width: 480px) {
    .chart-panel .chart-wrap { height: 260px; }
    .dashboard-grid, .dashboard-left, .tables-grid { gap: 0.9rem; }
}

.accordion summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.accordion summary::-webkit-details-marker { display: none; }

.accordion summary::before {
    content: '\25B8';
    color: var(--accent);
    transition: transform 0.15s ease;
    font-size: 0.9rem;
}

.accordion[open] summary::before {
    transform: rotate(90deg);
}

.mobile-table { display: none; }

@media (max-width: 650px) {
    .desktop-table { display: none; }
    .mobile-table { display: table; }
}

form.stacked label {
    display: block;
    margin-bottom: 0.9rem;
}

/* A plain wrapper div is used instead of <label> for fields where the label
   must NOT enclose the interactive content (e.g. the team tag-input) - native
   <label> click-forwarding targets the first labelable descendant, which
   shifts as chips are added/removed and re-triggers unrelated controls. */
form.stacked > div {
    margin-bottom: 0.9rem;
}

form.stacked > div > label {
    margin-bottom: 0.3rem;
}

form.stacked input[type="text"],
form.stacked input[type="number"],
form.stacked input[type="password"],
form.stacked input[type="date"],
form.stacked select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.3rem;
    background: var(--bg);
    border: 1px solid var(--panel-border);
    color: var(--text);
    border-radius: 6px;
    color-scheme: dark;
}

form.stacked input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    border-radius: 4px;
}

form.stacked input[type="date"]::-webkit-calendar-picker-indicator:hover {
    background: var(--panel-border);
}

form.stacked .checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

form.stacked .checkbox-row input { width: auto; margin-top: 0; }

form.stacked .switch-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
    cursor: pointer;
}

.switch-row input[type="checkbox"] {
    flex-shrink: 0;
}

.switch-row .switch-text {
    display: inline-flex;
    align-items: center;
    height: 24px;
}

.switch-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    min-width: 44px;
    background: var(--panel-border);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    margin: 0;
    transition: background 0.15s ease;
}

.switch-row input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.switch-row input[type="checkbox"]:checked {
    background: var(--accent);
}

.switch-row input[type="checkbox"]:checked::before {
    transform: translateX(20px);
    background: #1a1a1a;
}

.switch-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.team-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
}

.team-heading button { white-space: nowrap; }

.form-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.form-action-button[hidden] { display: none; }
.form-action-button:hover { border-color: var(--accent); background: rgba(212, 175, 55, 0.08); }
.form-action-button:focus-visible, .drop-item-choices button:focus-visible, .drop-entry-remove:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.form-action-button-danger:hover { border-color: var(--fail); color: var(--fail); background: rgba(208, 92, 92, 0.08); }
.form-action-button-accent { margin-top: 0.65rem; border-color: var(--accent); color: var(--accent); }

.drop-entries { display: flex; flex-direction: column; gap: 0.5rem; }
.drop-empty { margin: 0; color: var(--text-muted); font-size: 0.85rem; }
.drop-entry {
    display: grid;
    grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1.5fr) auto;
    align-items: end;
    gap: 0.5rem;
    padding: 0.65rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
}
form.stacked .drop-entry-field { margin: 0; min-width: 0; color: var(--text-muted); font-size: 0.8rem; }
form.stacked .drop-entry-field select { margin-top: 0.2rem; font-size: 0.9rem; }
.drop-entry-remove {
    width: 2.3rem;
    height: 2.3rem;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}
.drop-entry-remove:hover { border-color: var(--fail); color: var(--fail); }
.drop-composer {
    margin-top: 0.65rem;
    padding: 0.9rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
}
.drop-composer[hidden] { display: none; }
form.stacked .drop-composer label { margin-bottom: 0.25rem; }
form.stacked .drop-composer select { max-width: 18rem; margin-top: 0; }
.drop-composer p { margin: 0.85rem 0 0.45rem; color: var(--text-muted); font-size: 0.85rem; }
.drop-item-choices { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.drop-item-choices button {
    padding: 0.5rem 0.7rem;
    border: 1px solid var(--panel-border);
    border-radius: 7px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}
.drop-item-choices button:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 520px) {
    .drop-entry { grid-template-columns: minmax(0, 1fr) auto; }
    .drop-entry-field:nth-child(2) { grid-column: 1; }
    .drop-entry-remove { grid-column: 2; grid-row: 1 / 3; align-self: center; }
}

.event-visibility-dialog {
    box-sizing: border-box;
    width: min(460px, calc(100vw - 2rem));
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.event-visibility-dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.event-visibility-dialog h2 { margin-top: 0; }
.event-visibility-dialog p { color: var(--text-muted); font-size: 0.9rem; }
.event-visibility-person {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--panel-border);
}
.event-visibility-person-name { flex: 1; overflow-wrap: anywhere; }
.event-visibility-person-state { min-width: 2rem; font-size: 0.85rem; color: var(--text-muted); }
.event-visibility-actions { display: flex; justify-content: flex-end; gap: 1rem; align-items: center; margin-top: 1.25rem; }
.event-visibility-actions .btn { min-width: 8.5rem; }
.event-visibility-cancel { background: transparent; border-color: var(--panel-border); }

.tag-input {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    padding: 0.4rem;
    background: var(--bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
}

.tag-input:focus-within {
    border-color: var(--accent);
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--accent-dim);
    color: var(--text);
    border-radius: 20px;
    padding: 0.25rem 0.4rem 0.25rem 0.7rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.tag-chip button {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.2rem;
}

#teamTextInput {
    flex: 1;
    min-width: 140px;
    border: none !important;
    background: transparent !important;
    padding: 0.25rem !important;
    margin-top: 0 !important;
    width: auto !important;
}

#teamTextInput:focus {
    outline: none;
}

.tag-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.3rem;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    z-index: 10;
    max-height: 220px;
    overflow-y: auto;
}

.tag-suggestions.open {
    display: block;
}

.tag-suggestion {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.tag-suggestion:hover {
    background: rgba(255,255,255,0.05);
}

.tag-suggestion-new {
    color: var(--accent);
}

.btn {
    background: var(--accent-dim);
    color: var(--text);
    border: 1px solid var(--accent);
    padding: 0.55rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
}

.btn:hover { background: var(--accent); color: #1a1a1a; }

.btn-link {
    color: var(--accent);
    text-decoration: none;
}

.pill-success { color: var(--success); }
.pill-fail { color: var(--fail); }

.low-data-flag {
    color: var(--fail);
    font-weight: 800;
    cursor: help;
}

.grid-table input[type="number"] {
    width: 100px;
    padding: 0.3rem;
    background: var(--bg);
    border: 1px solid var(--panel-border);
    color: var(--text);
    border-radius: 4px;
}

.multi-select {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.multi-select label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg);
    border: 1px solid var(--panel-border);
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
}

.error { color: var(--fail); margin-bottom: 1rem; }
.notice { color: var(--success); margin-bottom: 1rem; }

.recommendation {
    text-align: center;
    padding: 1.5rem;
}

.recommendation .level {
    font-size: 2.5rem;
    color: var(--accent);
    font-weight: bold;
}

.clog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}

.clog-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1rem 0.5rem;
    position: relative;
}

.clog-item img {
    max-width: 72px;
    max-height: 72px;
    image-rendering: pixelated;
    margin-bottom: 0.5rem;
}

.clog-count {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
}

.clog-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.3;
    min-height: 2.1em;
    display: flex;
    align-items: center;
}

.clog-dates {
    display: flex;
    flex-direction: column;
    margin-top: 0.3rem;
}

.clog-date {
    font-size: 0.7rem;
    color: var(--accent);
    line-height: 1.5;
    white-space: nowrap;
}

.clog-grid-compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
}

.clog-grid-compact .clog-item {
    padding: 0.6rem 0.3rem;
}

.clog-grid-compact .clog-item img {
    max-width: 44px;
    max-height: 44px;
    margin-bottom: 0.3rem;
}

.clog-grid-compact .clog-name {
    font-size: 0.72rem;
    min-height: 1.9em;
}

.clog-grid-compact .clog-date {
    font-size: 0.62rem;
    white-space: normal;
}

@media (max-width: 650px) {
    .clog-grid-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.hazard-sign {
    background: repeating-linear-gradient(45deg, #f2c40c, #f2c40c 20px, #1a1a1a 20px, #1a1a1a 40px);
    border: 4px solid #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.hazard-sign-days {
    background: #1a1a1a;
    color: #f2c40c;
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 800;
    padding: 0.3rem 1.5rem;
    border-radius: 6px;
    line-height: 1;
}

.hazard-sign-label {
    background: #1a1a1a;
    color: #f2c40c;
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0.3rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
}

.dry-streak-sign {
    background: repeating-linear-gradient(45deg, #9333ea, #9333ea 20px, #1a1a1a 20px, #1a1a1a 40px);
    border: 4px solid #1a1a1a;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.dry-streak-sign .hazard-sign-days,
.dry-streak-sign .hazard-sign-label {
    color: #d4a6f5;
}

#themeParticleCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

/* Seasonal theme accents - accent color, a subtle page background tint, and
   a themed top border on every panel so it reads as more than a color swap.
   Panels get a touch of transparency so the falling particles behind them
   remain visible through the panel body, not just in the gaps. */
body[class*="theme-"] .panel {
    background: rgba(26, 29, 36, 0.86);
    border-top: 4px solid var(--accent);
    transition: border-color 0.3s ease, background 0.3s ease;
}

body.theme-kerst { --accent: #e04848; --accent-dim: #7a2424; --bg: #0d1613; }
body.theme-nieuwjaar { --accent: #d4af37; --accent-dim: #8a6f1e; --bg: #14120a; }
body.theme-valentijn { --accent: #e0608f; --accent-dim: #8a3a58; --bg: #160d12; }
body.theme-pasen { --accent: #7fb069; --accent-dim: #4c6e3c; --bg: #10160d; }
body.theme-koningsdag { --accent: #ff8c1a; --accent-dim: #a35a10; --bg: #16110a; }
body.theme-halloween { --accent: #ff7518; --accent-dim: #7a3aa8; --bg: #140f1a; }
body.theme-sinterklaas { --accent: #e04848; --accent-dim: #7a2424; --bg: #16100d; }
body.theme-pride { --accent: #ff1493; --accent-dim: #a30d5e; --bg: #120c16; }

/* A few themes get an extra flourish beyond the plain accent-colored border. */
body.theme-kerst .panel {
    border-top: 10px solid transparent;
    border-image: repeating-linear-gradient(90deg, #ffffff 0 10px, #e04848 10px 20px, #2f8f4e 20px 30px) 10;
}

body.theme-sinterklaas .panel {
    border-top: 10px solid transparent;
    border-image: repeating-linear-gradient(90deg, #ffffff 0 10px, #e04848 10px 20px, #f2c40c 20px 30px) 10;
}

body.theme-nieuwjaar .panel {
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.3);
}

body.theme-halloween .panel {
    border-top: 6px solid transparent;
    border-image: linear-gradient(90deg, #ff7518, #7a3aa8) 1;
}

body.theme-valentijn .panel {
    box-shadow: 0 0 14px rgba(224, 96, 143, 0.25);
}

body.theme-pasen .panel {
    border-top: 6px solid transparent;
    border-image: repeating-linear-gradient(90deg, #f2e5b5 0 14px, #7fb069 14px 28px, #e0608f 28px 42px) 8;
}

body.theme-koningsdag .panel {
    box-shadow: 0 0 14px rgba(255, 140, 26, 0.3);
}

/* Pride: full rainbow, animated, extra fabulous. */
body.theme-pride .panel {
    position: relative;
    overflow: hidden;
    border-top: 4px solid transparent;
    box-shadow: 0 0 20px rgba(255, 20, 147, 0.3);
}

body.theme-pride .panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg,
        #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787,
        #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787);
    background-size: 200% 100%;
    animation: pride-shimmer 4s linear infinite;
}

body.theme-pride h1.page-title,
body.theme-pride .panel h2 {
    background: linear-gradient(90deg,
        #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787,
        #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: pride-shimmer 4s linear infinite;
}

@keyframes pride-shimmer {
    from { background-position: 0% 0; }
    to { background-position: -100% 0; }
}

/* ADHD modus - independent of the seasonal themes, just chaos. Kept mild
   enough to stay readable and avoid rapid strobing (no fast flashing). */
#adhdParticleCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

body.adhd-mode .panel {
    animation: adhd-wobble 0.5s ease-in-out infinite alternate;
}

@keyframes adhd-wobble {
    from { transform: rotate(-0.4deg) translateY(0); }
    to { transform: rotate(0.4deg) translateY(-2px); }
}

body.adhd-mode .btn {
    animation: adhd-pulse 0.8s ease-in-out infinite;
}

@keyframes adhd-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 rgba(212, 175, 55, 0); }
    50% { transform: scale(1.06); box-shadow: 0 0 12px var(--accent); }
}

.adhd-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent);
    border: 3px solid #ffffff;
    color: #1a1a1a;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.3;
    max-width: 300px;
    z-index: 2000;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px) scale(0.7);
    pointer-events: none;
}

.adhd-toast.show {
    animation: adhd-toast-pop 2.2s ease forwards;
}

@keyframes adhd-toast-pop {
    0% { opacity: 0; transform: translateY(20px) scale(0.7) rotate(-2deg); }
    15% { opacity: 1; transform: translateY(-8px) scale(1.1) rotate(2deg); }
    25% { transform: translateY(0) scale(1) rotate(0deg); }
    85% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
    100% { opacity: 0; transform: translateY(10px) scale(0.9) rotate(0deg); }
}

.clog-item-unobtained {
    opacity: 0.35;
}

.clog-item-unobtained img {
    filter: grayscale(100%);
}

.drop-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.drop-modal-overlay.open {
    display: flex;
}

#confettiCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1001;
}

.drop-modal {
    position: relative;
    z-index: 1002;
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 2.5rem 3.5rem;
    text-align: center;
    width: 640px;
    max-width: 92vw;
    box-shadow: 0 0 40px rgba(212, 175, 55, 0.35);
    animation: drop-modal-pop 0.35s ease;
}

@keyframes drop-modal-pop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.drop-modal-hard-close {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    z-index: 10;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.drop-modal-hard-close:hover {
    color: var(--accent);
}

.drop-modal-switch-animation {
    display: block;
    margin: 0.6rem auto 0;
    background: transparent;
    border: 1px solid var(--panel-border);
    color: var(--text-muted);
    border-radius: 20px;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.drop-modal-switch-animation:hover {
    border-color: var(--accent);
    color: var(--text);
}

.drop-modal-title {
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 3.25rem;
}

#dropModalOverlay .drop-modal {
    max-height: 92dvh;
    overflow-y: auto;
}

.purple-simulator-controls {
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
    text-align: left;
    font-size: 0.8rem;
}

.purple-simulator-controls strong {
    color: var(--accent);
}

.purple-simulator-controls input[type="range"] {
    display: block;
    width: 100%;
    margin: 0.5rem 0 0;
}

.simulator-level-ticks,
.simulator-purple-odds > div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.simulator-info-tooltip p,
.simulator-level-ticks {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 0.35rem 0;
}

.simulator-purple-odds {
    margin-top: 0.5rem;
}

.simulator-info {
    position: absolute;
    top: 1rem;
    right: 3.5rem;
    z-index: 11;
}

.simulator-info-button {
    display: grid;
    place-items: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    font: bold 0.85rem Georgia, serif;
    cursor: help;
}

.simulator-info-button:hover,
.simulator-info-button:focus-visible {
    color: var(--accent);
}

.simulator-info-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    width: min(310px, calc(92vw - 4.5rem));
    padding: 0.8rem;
    border: 1px solid var(--accent);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 8px 24px #0008;
    text-align: left;
    font-size: 0.75rem;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.simulator-info:hover .simulator-info-tooltip,
.simulator-info:focus-within .simulator-info-tooltip {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Share the available screen height between loot and the animation. */
#dropModalOverlay .drop-modal.simulator-mode {
    display: flex;
    flex-direction: column;
    height: min(720px, calc(100dvh - 24px));
    max-height: none;
    overflow: visible;
    padding: 2.75rem clamp(1rem, 4vw, 3.5rem) 1rem;
}

.drop-modal.simulator-mode .drop-modal-title {
    flex: 0 0 auto;
    margin: 0 0 0.75rem;
}

.drop-modal.simulator-mode .purple-simulator-controls {
    flex: 0 0 auto;
}

.drop-modal.simulator-mode .chest-big-items {
    flex: 1 1 0;
    min-height: 0;
    margin: 0.5rem 0;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.drop-modal.simulator-mode .chest-big-item {
    min-width: 0;
    max-width: 48%;
    gap: 0.25rem;
}

.drop-modal.simulator-mode .chest-big-item-img {
    width: auto;
    max-width: 100%;
    height: clamp(40px, 16dvh, 150px);
    object-fit: contain;
}

.drop-modal.simulator-mode .chest-stage,
.drop-modal.simulator-mode .chest-stage-3d {
    flex: 0 1 clamp(60px, 20dvh, 170px);
    min-height: 60px;
    margin-bottom: 0.75rem;
}

.drop-modal.simulator-mode .plinko-stage {
    --simulator-plinko-height: clamp(130px, 30dvh, 240px);
    flex: 0 0 var(--simulator-plinko-height);
    height: var(--simulator-plinko-height);
    margin-bottom: 0.5rem;
}

.drop-modal.simulator-mode .plinko-board {
    height: calc(var(--simulator-plinko-height) - 56px);
}

.drop-modal.simulator-mode > button {
    flex-shrink: 0;
    align-self: center;
}

.drop-modal.simulator-mode #rerollBtn {
    margin-top: 0.35rem;
}

@media (max-height: 560px) {
    #dropModalOverlay .drop-modal.simulator-mode {
        padding-top: 2rem;
        padding-bottom: 0.5rem;
    }
    .drop-modal.simulator-mode .drop-modal-title {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }
    .drop-modal.simulator-mode .chest-big-item-img {
        height: 40px;
    }
    .drop-modal.simulator-mode .chest-big-item-name {
        font-size: 0.8rem;
    }
    .drop-modal.simulator-mode .chest-stage,
    .drop-modal.simulator-mode .chest-stage-3d {
        flex-basis: 60px;
        margin-bottom: 0.3rem;
    }
    .drop-modal.simulator-mode > .btn {
        padding: 0.3rem 0.75rem;
    }
    .drop-modal.simulator-mode .plinko-stage {
        --simulator-plinko-height: 90px;
    }
    .drop-modal.simulator-mode .plinko-board {
        height: 54px;
    }
    .drop-modal.simulator-mode .plinko-slots {
        height: 36px;
    }
    .drop-modal.simulator-mode .plinko-slot {
        height: 32px;
        font-size: 0.5rem;
    }
}

.chest-stage {
    position: relative;
    height: 130px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 3rem;
}

.chest-big-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.25rem;
    margin-bottom: 2.25rem;
    /* Reserved even while empty (before the reveal), so injecting the image
       later doesn't resize/reflow the modal. */
    min-height: 280px;
}

.chest-big-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.chest-big-item-img {
    width: 240px;
    max-width: 49%;
    height: auto;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 24px rgba(212, 175, 55, 0.85));
    animation:
        chest-big-item-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both,
        chest-big-item-shake 2.2s ease-in-out infinite 0.5s;
}

@keyframes chest-big-item-shake {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-5deg); }
    40% { transform: rotate(4deg); }
    60% { transform: rotate(-3deg); }
    80% { transform: rotate(2deg); }
}

.chest-big-item-name {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.chest-big-item-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

@keyframes chest-big-item-pop {
    0% { opacity: 0; transform: scale(0.3) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.reveal-glow-flood {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    border-radius: 12px;
    opacity: 0;
    background: radial-gradient(circle at 50% 62%, rgba(255, 216, 130, 0.6), rgba(255, 190, 60, 0.28) 45%, transparent 72%);
    mix-blend-mode: screen;
}

.chest-purple-flash {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at 50% 50%, rgba(147, 51, 234, 0.65), transparent 70%);
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.chest-purple-flash.show {
    animation: chest-purple-pulse 2.4s ease-in-out infinite;
}

@keyframes chest-purple-pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.7; }
}

.reveal-suspense {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
    background: var(--panel);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 0 1.5rem;
}

.reveal-suspense.show {
    opacity: 1;
}

#suspenseText {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
    animation: suspense-pulse 1.2s ease-in-out infinite;
}

@keyframes suspense-pulse {
    0%, 100% { opacity: 0.65; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

.plinko-stage {
    position: relative;
    height: 280px;
    margin-bottom: 3rem;
}

/* Empty in-flow spacer only, reserves the same layout height chestStage/
   plinkoStage do - the actual WebGL canvas lives in .chest-stage-3d-bg. */
.chest-stage-3d {
    width: 100%;
    height: 260px;
    margin-bottom: 3rem;
}

/* Covers the whole popup, behind the title/text/buttons, so the beams can
   rise past the "obtained a new drop" title instead of being boxed into
   the small stage area. */
.chest-stage-3d-bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    border-radius: 12px;
    overflow: hidden;
}

.chest-stage-3d-bg canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.plinko-board {
    position: relative;
    width: 100%;
    height: 220px;
}

.plinko-peg {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-dim);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.plinko-peg-hit {
    animation: plinko-peg-flash 0.35s ease-out;
}

@keyframes plinko-peg-flash {
    0% { background: var(--accent); box-shadow: 0 0 10px rgba(212, 175, 55, 0.9); transform: translate(-50%, -50%) scale(1.6); }
    100% { background: var(--accent-dim); box-shadow: none; transform: translate(-50%, -50%) scale(1); }
}

.plinko-ball {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.85);
    transform: translate(-50%, -50%);
    transition: left 0.26s cubic-bezier(0.5, -0.3, 0.5, 1.3), top 0.26s ease-in;
}

.plinko-ball-anticipate {
    animation: plinko-ball-anticipate-pulse 0.35s ease-in-out infinite;
}

@keyframes plinko-ball-anticipate-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}

.plinko-ball-hop {
    animation: plinko-ball-hop-bounce 0.3s ease-out;
}

@keyframes plinko-ball-hop-bounce {
    0% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
    35% { transform: translate(-50%, -65%) scale(0.85, 1.2) rotate(25deg); }
    65% { transform: translate(-50%, -40%) scale(1.2, 0.8) rotate(-15deg); }
    100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.plinko-ball-landed {
    animation: plinko-ball-bounce 0.4s ease-out;
}

@keyframes plinko-ball-bounce {
    0% { transform: translate(-50%, -50%) scale(1); }
    40% { transform: translate(-50%, -50%) scale(1.35, 0.7); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.plinko-slots {
    position: relative;
    height: 56px;
}

.plinko-slot {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    width: calc(100% / 8);
    max-width: 68px;
    height: 52px;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.6rem;
    line-height: 1.1;
    color: var(--text-muted);
    padding: 2px;
    box-sizing: border-box;
}

.plinko-slot.active {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.6);
}

@media (max-width: 480px) {
    .plinko-stage {
        height: 240px;
    }
    .plinko-board {
        height: 180px;
    }
    .plinko-slot {
        height: 44px;
        font-size: 0.52rem;
    }
}

.chest-beams {
    position: absolute;
    bottom: 55px;
    left: 50%;
    width: 0;
    height: 0;
    z-index: 1;
}

.chest-beam-rotator {
    position: absolute;
    bottom: 0;
    left: 0;
    transform-origin: bottom center;
}

.chest-beam {
    width: 42px;
    height: 340px;
    background: linear-gradient(to top, #e40303, #ff8c00, #ffed00, #008026, #004dff, #750787, transparent);
    opacity: 0;
    transform: scaleY(0);
    transform-origin: bottom center;
    animation: chest-beam-rise 2.2s ease-out forwards;
    mix-blend-mode: screen;
}

@keyframes chest-beam-rise {
    0% { opacity: 0; transform: scaleY(0); }
    25% { opacity: 1; }
    80% { opacity: 0.8; }
    100% { opacity: 0; transform: scaleY(1); }
}

.chest-icon {
    position: relative;
    width: 110px;
    height: 88px;
    z-index: 2;
}

.chest-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 55px;
    background: linear-gradient(180deg, #8b5a2b, #6b4423);
    border: 3px solid #4a2f18;
    border-radius: 6px;
    box-shadow: inset 0 0 0 4px #d4af37;
}

.chest-lid-closed {
    position: absolute;
    top: 0;
    width: 100%;
    height: 32px;
    background: linear-gradient(180deg, #a9702f, #8b5a2b);
    border: 3px solid #4a2f18;
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 0 0 4px #d4af37;
}

.chest-lock {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: #d4af37;
    border-radius: 3px;
    border: 2px solid #4a2f18;
    z-index: 3;
}

.chest-shaking {
    animation: chest-shake 0.35s ease-in-out 2;
}

@keyframes chest-shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    20% { transform: translateX(-6px) rotate(-3deg); }
    40% { transform: translateX(5px) rotate(3deg); }
    60% { transform: translateX(-4px) rotate(-2deg); }
    80% { transform: translateX(3px) rotate(2deg); }
}

#chestOpen .chest-lid-open {
    position: absolute;
    top: -22px;
    width: 100%;
    height: 32px;
    background: linear-gradient(180deg, #a9702f, #8b5a2b);
    border: 3px solid #4a2f18;
    border-radius: 10px 10px 0 0;
    transform: perspective(80px) rotateX(55deg);
    transform-origin: bottom;
    box-shadow: inset 0 0 0 4px #d4af37;
}

#chestOpen .chest-glow {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 40px;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.95), transparent 70%);
    filter: blur(3px);
}

.money-banner {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1a1a1a;
    background: linear-gradient(90deg, #ffd700, #ffed4e, #ffd700);
    background-size: 200% 100%;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    animation: money-banner-shine 1.2s linear infinite, money-banner-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes money-banner-shine {
    from { background-position: 0% 0; }
    to { background-position: -200% 0; }
}

@keyframes money-banner-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.04); }
}

@media (max-width: 650px) {
    .drop-modal {
        padding: 1.25rem 1rem;
    }

    .drop-modal-title {
        font-size: 1.05rem;
        margin-bottom: 0.75rem;
    }

    .chest-stage {
        height: 90px;
        margin-bottom: 0.5rem;
    }

    .chest-big-items {
        gap: 0.5rem;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        min-height: 0;
    }

    .chest-big-item {
        gap: 0.15rem;
    }

    .chest-big-item-img {
        width: 130px;
    }

    .chest-big-item-name {
        font-size: 0.95rem;
    }

    .chest-big-item-date {
        font-size: 0.75rem;
    }

    .money-banner {
        margin-bottom: 0.5rem;
        padding: 0.4rem 0.75rem;
        font-size: 1.15rem;
    }
}

.drop-modal-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.drop-modal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.drop-modal-item img {
    max-width: 64px;
    max-height: 64px;
    image-rendering: pixelated;
}

.drop-modal-item span {
    color: var(--text);
    font-size: 0.9rem;
}

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.9rem;
}

.achievement-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 0.9rem 0.6rem;
}

.achievement-item-locked {
    border-color: var(--panel-border);
    opacity: 0.5;
}

.achievement-icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.achievement-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.achievement-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Spreadsheet modus - deliberately garish Excel pastiche. */
#spreadsheetBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #f3f3f3;
    border-bottom: 1px solid #b0b0b0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.75rem;
    font-family: Calibri, Arial, sans-serif;
    font-size: 0.8rem;
    color: #000;
    z-index: 3000;
}

.spreadsheet-cellref {
    background: #ffffff;
    border: 1px solid #b0b0b0;
    padding: 0.1rem 0.5rem;
    font-weight: 700;
}

.spreadsheet-fx {
    font-style: italic;
    color: #217346;
    font-weight: 700;
}

.spreadsheet-formula {
    font-family: 'Courier New', monospace;
}

body.spreadsheet-mode {
    background: #ffffff;
    color: #000000;
    font-family: Calibri, Arial, sans-serif;
    padding-top: 28px;
}

body.spreadsheet-mode .topnav {
    background: #217346;
    border-bottom: 1px solid #185c37;
}

body.spreadsheet-mode .brand,
body.spreadsheet-mode .admin-btn,
body.spreadsheet-mode .nav-hamburger {
    color: #ffffff;
}

body.spreadsheet-mode .panel {
    background: #ffffff;
    border: 1px solid #d0d7de;
    border-radius: 0;
    box-shadow: none;
}

body.spreadsheet-mode h1.page-title,
body.spreadsheet-mode .panel h2 {
    color: #217346;
    background: none;
    -webkit-background-clip: initial;
    background-clip: initial;
    animation: none;
}

body.spreadsheet-mode p,
body.spreadsheet-mode span,
body.spreadsheet-mode label,
body.spreadsheet-mode td,
body.spreadsheet-mode th {
    color: #000000;
}

body.spreadsheet-mode table {
    border-collapse: collapse;
}

body.spreadsheet-mode th,
body.spreadsheet-mode td {
    border: 1px solid #d0d7de;
}

body.spreadsheet-mode thead th {
    background: #217346;
    color: #ffffff;
}

body.spreadsheet-mode .btn {
    background: #217346;
    color: #ffffff;
    border: 1px solid #185c37;
    border-radius: 2px;
}

body.spreadsheet-mode input,
body.spreadsheet-mode select {
    background: #ffffff;
    color: #000000;
    border: 1px solid #b0b0b0;
}

body.spreadsheet-mode .filter-buttons button {
    background: #f3f3f3;
    color: #000000;
    border: 1px solid #b0b0b0;
}

body.spreadsheet-mode .filter-buttons button.active {
    background: #d0e7dc;
    border-color: #217346;
    color: #000000;
}

body.spreadsheet-mode .clog-item,
body.spreadsheet-mode .achievement-item,
body.spreadsheet-mode .hazard-sign-days,
body.spreadsheet-mode .hazard-sign-label {
    background: #ffffff;
    border: 1px solid #d0d7de;
    color: #000000;
}

.home-toolbar, .home-toolbar-actions, .home-player-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.home-toolbar { justify-content: space-between; margin-bottom: 1.25rem; }
.home-toolbar-actions { margin-left: auto; }
.home-player-search { flex-wrap: nowrap; min-width: 0; }
.home-player-input { position: relative; min-width: 0; }
.home-toolbar-button {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.45rem 1rem;
    min-height: 42px;
    border-radius: 24px;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}
.home-toolbar-button:hover { background: var(--panel); }
#homePlayerClear {
    position: absolute;
    right: 0.4rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: var(--panel);
    color: var(--text-muted);
    font-size: 1.4rem;
    padding: 0.15rem 0.45rem;
    cursor: pointer;
}

.home-player-search input {
    box-sizing: border-box;
    width: 280px;
    max-width: 100%;
    min-height: 42px;
    padding: 0.65rem 2.5rem 0.65rem 0.85rem;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font: inherit;
    color-scheme: dark;
}

.home-player-search input::placeholder {
    color: var(--text-muted);
}

.home-player-search input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body.spreadsheet-mode .clog-name,
body.spreadsheet-mode .achievement-name,
body.spreadsheet-mode .achievement-desc {
    color: #000000;
}
