:root {
    --bg: #0d0d0d;
    --bg-soft: #161616;
    --panel: rgba(17, 17, 17, 0.72);
    --panel-solid: #121212;
    --text: #f5f5f5;
    --muted: #a5a5a5;
    --line: rgba(255, 255, 255, 0.06);
    --primary: #ff2a2a;
    --primary-soft: rgba(255, 42, 42, 0.12);
    --success: #58d68d;
    --danger: #ff7373;
    --shadow: 0 14px 46px rgba(0, 0, 0, 0.36);
    --overlay-text: #dc6b96;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top, rgba(255, 42, 42, 0.18), transparent 28%),
        linear-gradient(135deg, #040404, #0d0d0d 45%, #120707 100%);
    color: var(--text);
    font-family: "Montserrat", sans-serif;
    font-size: 15px;
}

body {
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

.site-shell {
    width: min(1080px, calc(100% - 36px));
    margin: 0 auto;
    padding: 18px 0 26px;
}

.topbar,
.footer,
.panel,
.hero-card,
.status-panel,
.logo-frame {
    border: 1px solid var(--line);
    background: var(--panel);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.topbar,
.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 16px;
}

.topbar {
    margin-bottom: 18px;
}

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

.brand img {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.brand div {
    display: grid;
    gap: 2px;
}

.brand strong {
    font-size: 0.95rem;
    font-weight: 600;
}

.brand span {
    font-size: 0.82rem;
}

.brand span,
.footer span,
.eyebrow,
.inline-note p,
.empty-state p,
.panel p,
.hero-card p {
    color: var(--muted);
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
}

.topbar-nav a:not(.button) {
    opacity: 0.86;
}

.flash,
.error-box {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
}

.flash-success {
    background: rgba(88, 214, 141, 0.12);
    color: #d9ffe9;
}

.error-box {
    background: rgba(255, 90, 90, 0.12);
    color: #ffd8d8;
}

.hero-layout,
.dashboard-layout {
    display: grid;
    gap: 18px;
}

.hero-layout {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: stretch;
    min-height: calc(100vh - 160px);
}

.hero-card,
.status-panel,
.logo-frame,
.panel {
    border-radius: 20px;
    padding: 20px;
}

.hero-card {
    display: grid;
    align-content: center;
    gap: 14px;
}

.hero-card h1,
.form-panel h1,
.panel h1,
.panel h2 {
    margin: 0;
    line-height: 1;
}

.hero-card h1 {
    font-size: clamp(2rem, 4.2vw, 3.4rem);
    max-width: 12ch;
    line-height: 0.98;
    letter-spacing: -0.04em;
    font-weight: 700;
}

.hero-card p {
    max-width: 46ch;
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
}

.hero-visual {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 18px;
}

.logo-frame {
    display: grid;
    place-items: center;
    overflow: hidden;
    min-height: 320px;
    background:
        radial-gradient(circle at center, rgba(255, 42, 42, 0.26), transparent 42%),
        rgba(13, 13, 13, 0.82);
}

.logo-frame img {
    width: min(250px, 74%);
    filter: drop-shadow(0 12px 26px rgba(255, 42, 42, 0.28));
}

.status-panel {
    display: grid;
    gap: 8px;
}

.status-panel span {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.status-panel strong {
    font-size: 1.15rem;
    font-weight: 600;
}

.status-panel p {
    margin: 0;
    line-height: 1.55;
}

.hero-actions,
.panel-heading,
.grid-panels {
    display: flex;
    gap: 10px;
}

.grid-panels {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 600;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, #ff4747, #ff2a2a 60%, #b30000);
    box-shadow: 0 8px 22px rgba(255, 42, 42, 0.24);
}

.button.ghost {
    background: rgba(255, 255, 255, 0.02);
    border-color: var(--line);
}

.button.small {
    min-height: 36px;
    padding: 0 14px;
}

.feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.feature-list li,
.event-pill {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    border: 1px solid rgba(255, 42, 42, 0.2);
    font-size: 0.88rem;
}

.pill-success {
    background: rgba(88, 214, 141, 0.14);
    border-color: rgba(88, 214, 141, 0.24);
}

.pill-error {
    background: rgba(255, 115, 115, 0.14);
    border-color: rgba(255, 115, 115, 0.24);
}

.status-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-layout {
    min-height: calc(100vh - 160px);
    display: grid;
    place-items: center;
}

.form-panel {
    width: min(620px, 100%);
}

.form-panel.narrow {
    width: min(460px, 100%);
}

.form-grid {
    display: grid;
    gap: 14px;
}

.form-grid.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label,
.inline-note {
    display: grid;
    gap: 6px;
}

.form-actions {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    grid-column: 1 / -1;
}

.form-actions .button {
    width: auto;
    min-width: 0;
}

.form-grid span {
    font-size: 0.88rem;
}

input,
select,
textarea,
code {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(255, 42, 42, 0.55);
    box-shadow: 0 0 0 4px rgba(255, 42, 42, 0.12);
}

textarea {
    resize: vertical;
}

code {
    padding: 9px 11px;
    overflow-wrap: anywhere;
    font-size: 0.88rem;
}

.dashboard-layout {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
}

.admin-layout {
    grid-template-columns: 1fr;
}

.stack-gap {
    display: grid;
    gap: 18px;
}

.panel-heading {
    justify-content: space-between;
    align-items: center;
}

.panel-heading h2 {
    font-size: 1.28rem;
}

.event-preview {
    display: grid;
    gap: 10px;
    border-radius: 18px;
    padding: 18px;
    background:
        radial-gradient(circle at top right, rgba(255, 42, 42, 0.16), transparent 35%),
        var(--panel-solid);
    border: 1px solid var(--line);
}

.event-preview h3 {
    margin: 0;
    font-size: 1.5rem;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.data-table small {
    color: var(--muted);
}

.data-table .button {
    white-space: nowrap;
}

.empty-state {
    border-radius: 18px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--line);
}

.log-list {
    display: grid;
    gap: 10px;
}

.log-entry {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.footer {
    margin-top: 18px;
    font-size: 0.84rem;
}

.overlay-page {
    overflow: hidden;
    min-height: 100vh;
    background: transparent;
}

.overlay-page::before {
    display: none;
}

#overlay-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

.overlay-card {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 3vh;
    transform: translateX(-50%) translateY(30px);
    width: min(420px, calc(100vw - 32px));
    aspect-ratio: 810 / 1418;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    transition: opacity 220ms ease, transform 220ms ease;
}

.overlay-poster {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.overlay-avatar-frame {
    position: absolute;
    left: 21.6%;
    top: 28.1%;
    width: 57%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 8px;
    background: #000;
}

.overlay-avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
}

.overlay-avatar-frame img.is-empty {
    opacity: 0;
}

.overlay-card.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-card.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.overlay-copy {
    display: grid;
    align-content: center;
    gap: 6px;
}

.overlay-copy-poster {
    position: absolute;
    inset: 0;
    display: block;
    pointer-events: none;
}

.overlay-copy span,
.overlay-copy small {
    color: var(--overlay-text);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
}

#overlay-type {
    display: none;
}

#overlay-sender {
    position: absolute;
    top: 62.5%;
    left: 12%;
    right: 12%;
    margin: 0;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    line-height: 1.05;
    text-align: center;
    color: var(--overlay-text);
    text-wrap: balance;
}

.overlay-copy h1 {
    text-shadow: 0 2px 0 rgba(255, 255, 255, 0.22);
}

#overlay-phrase {
    position: absolute;
    top: 69.4%;
    left: 11%;
    right: 11%;
    margin: 0;
    font-size: clamp(0.98rem, 1.7vw, 1.12rem);
    line-height: 1.45;
    text-align: center;
    color: var(--overlay-text);
}

#overlay-meta {
    position: absolute;
    top: 79.9%;
    left: 12%;
    right: 12%;
    margin: 0;
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    font-weight: 700;
    text-align: center;
    color: var(--overlay-text);
}

@media (max-width: 960px) {
    .hero-layout,
    .dashboard-layout,
    .grid-panels,
    .form-grid.two-columns {
        grid-template-columns: 1fr;
    }

    .site-shell {
        width: min(100% - 18px, 1080px);
    }

    .topbar,
    .footer,
    .panel-heading,
    .topbar-nav,
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-layout {
        min-height: auto;
    }

    .logo-frame {
        min-height: 240px;
    }

    .overlay-card {
        bottom: 4vh;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(30px);
        width: min(360px, calc(100vw - 22px));
    }

    .overlay-card.visible {
        transform: translateX(-50%) translateY(0);
    }
}
