:root {
    color-scheme: dark;
    --bg: #090a0d;
    --panel: #15171d;
    --panel-2: #1d2028;
    --line: #313643;
    --text: #f5f7fb;
    --muted: #a8afbd;
    --accent: #34d399;
    --accent-2: #38bdf8;
    --danger: #fb7185;
    --gold: #fbbf24;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, rgba(52, 211, 153, 0.15), transparent 28rem), var(--bg);
    color: var(--text);
    font-family: Arial, "Malgun Gothic", sans-serif;
    line-height: 1.5;
}

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

input,
textarea,
button {
    font: inherit;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1117;
    color: var(--text);
    padding: 0.8rem 0.9rem;
}

textarea {
    resize: vertical;
}

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

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 700;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 64px;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 10, 13, 0.92);
    backdrop-filter: blur(12px);
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--accent);
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.nav a,
.link-button {
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    padding: 0.55rem 0.75rem;
    cursor: pointer;
}

.nav a:hover,
.link-button:hover {
    color: var(--text);
    background: var(--panel-2);
}

.nav-toggle {
    display: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    padding: 0.4rem 0.7rem;
}

.inline-form {
    display: inline;
}

.page {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 4rem;
}

.footer {
    border-top: 1px solid var(--line);
    color: var(--muted);
    padding: 1.2rem;
    text-align: center;
}

.flash-stack {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.flash {
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.1);
    padding: 0.8rem 1rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: 1.2rem;
    align-items: stretch;
    min-height: 520px;
}

.hero-copy,
.hero-panel,
.panel,
.auth-card,
.game-panel,
.result-panel,
.notice-panel,
.post-detail {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(21, 23, 29, 0.9);
}

.hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(2rem, 6vw, 5rem);
}

.hero h1,
.page-head h1,
.dashboard-head h1,
.game-panel h1,
.post-detail h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1.05;
}

.hero p {
    max-width: 620px;
    color: var(--muted);
}

.hero-panel,
.mini-stats {
    display: grid;
    gap: 0.9rem;
}

.hero-panel {
    align-content: center;
    padding: 1rem;
}

.stat {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1117;
    padding: 1rem;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
}

.stat strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.6rem;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.muted {
    color: var(--muted);
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--text);
    padding: 0.62rem 0.9rem;
    cursor: pointer;
    font-weight: 700;
}

.button.primary {
    border-color: rgba(52, 211, 153, 0.6);
    background: var(--accent);
    color: #07120e;
}

.button.danger {
    border-color: rgba(251, 113, 133, 0.6);
    background: rgba(251, 113, 133, 0.12);
    color: #fecdd3;
}

.button.small {
    min-height: 34px;
    padding: 0.35rem 0.55rem;
    font-size: 0.9rem;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.button-row,
.inline-controls,
.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.auth-card {
    width: min(440px, 100%);
    margin: 2rem auto;
    padding: 1.4rem;
}

.auth-card.wide {
    width: min(820px, 100%);
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.stack-form label {
    display: grid;
    gap: 0.45rem;
    color: var(--muted);
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.dashboard-head,
.page-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.3rem;
}

.with-action {
    align-items: center;
}

.mini-stats {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
}

.quick-grid,
.card-grid,
.admin-grid,
.two-column {
    display: grid;
    gap: 1rem;
}

.quick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 1rem 0;
}

.card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.action-card,
.game-card,
.shop-card,
.post-row,
.notice-panel,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.action-card,
.game-card,
.shop-card,
.notice-panel,
.panel {
    padding: 1rem;
}

.action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-card span,
.game-card p,
.shop-card p {
    color: var(--muted);
}

.action-card strong {
    color: var(--accent-2);
}

.game-card {
    min-height: 220px;
}

.game-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #0f1117;
    color: var(--accent);
    font-size: 1.6rem;
}

.shop-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    margin: 1rem 0;
    color: var(--accent-2);
    font-weight: 800;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.42fr) minmax(0, 0.58fr);
    gap: 1rem;
}

.game-panel,
.result-panel {
    padding: 1.2rem;
}

.result-panel {
    min-height: 360px;
    display: grid;
    align-content: center;
    justify-items: center;
    text-align: center;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.segmented input {
    position: absolute;
    opacity: 0;
}

.segmented span {
    display: grid;
    place-items: center;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1117;
    color: var(--text);
    cursor: pointer;
}

.segmented input:checked + span {
    border-color: var(--accent);
    background: rgba(52, 211, 153, 0.14);
}

.dice-face {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    border: 2px solid var(--accent);
    border-radius: 20px;
    font-size: 4rem;
    font-weight: 900;
}

.crash-meter {
    display: grid;
    place-items: center;
    width: min(100%, 360px);
    aspect-ratio: 1.6;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(135deg, #111318, #20232c);
    margin-bottom: 1rem;
}

.crash-meter span {
    color: var(--accent);
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
}

.crash-meter.meter-win {
    border-color: rgba(52, 211, 153, 0.8);
}

.crash-meter.meter-lose {
    border-color: rgba(251, 113, 133, 0.8);
}

.ladder-canvas {
    width: min(100%, 420px);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #0f1117;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.plus {
    color: var(--accent);
    font-weight: 800;
}

.minus {
    color: var(--danger);
    font-weight: 800;
}

.highlight-row {
    background: rgba(52, 211, 153, 0.09);
}

.nickname {
    font-weight: 800;
}

.name-gold {
    color: var(--gold);
}

.name-neon {
    color: #67e8f9;
    text-shadow: 0 0 12px rgba(103, 232, 249, 0.75);
}

.post-list {
    display: grid;
    gap: 0.75rem;
}

.post-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.post-row:hover {
    border-color: var(--accent);
}

.post-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.15);
    color: #bae6fd;
    padding: 0.2rem 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
}

.admin-badge {
    background: rgba(251, 191, 36, 0.16);
    color: #fde68a;
}

.claim-info {
    align-self: center;
    color: var(--accent);
    font-weight: 800;
    white-space: nowrap;
}

.empty {
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    padding: 2rem;
    text-align: center;
}

.post-detail {
    padding: 1.4rem;
}

.post-content {
    margin: 1.4rem 0;
    padding: 1rem;
    border-radius: 8px;
    background: #0f1117;
    white-space: normal;
}

.claim-box {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(56, 189, 248, 0.08);
    padding: 1rem;
    margin-bottom: 1rem;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-actions form {
    display: flex;
    gap: 0.35rem;
}

.admin-actions input {
    width: 90px;
    padding: 0.35rem 0.5rem;
}

@media (max-width: 900px) {
    .hero,
    .game-layout,
    .two-column,
    .admin-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .quick-grid,
    .mini-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .topbar {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 0.8rem 1rem;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .nav.is-open {
        display: flex;
    }

    .page {
        width: min(100% - 1rem, 1180px);
        padding-top: 1rem;
    }

    .dashboard-head,
    .page-head,
    .post-row {
        align-items: stretch;
        flex-direction: column;
    }

    .quick-grid,
    .mini-stats,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: auto;
    }

    .hero-copy {
        padding: 1.3rem;
    }
}
