:root {
    --bg: #0b1220;
    --bg-raised: #111c30;
    --bg-card: #14213a;
    --line: #223252;
    --ink: #eef3fb;
    --ink-soft: #9fb0cc;
    --ink-muted: #66788f;
    --accent: #ff9e3d;
    --accent-deep: #d0770f;
    --teal: #2f9d8b;
    --danger: #d8575f;
    --danger-bright: #e5636a;
    --radius: 14px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
}
img { max-width: 100%; height: auto; }

/* ---------- nav ---------- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background: rgba(11, 18, 32, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--ink);
}
.brand-mark { width: 34px; height: 34px; }
.brand-name {
    font-weight: 800;
    letter-spacing: 0.06em;
    font-size: 15px;
    white-space: nowrap;
}
.brand-9000 { color: var(--accent); }
.nav-links {
    display: flex;
    gap: 18px;
    margin-left: auto;
}
.nav-links a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.nav-links a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-danger {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 18px rgba(216, 87, 95, 0.35);
}
.btn-danger:hover { background: var(--danger-bright); }
.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border-color: var(--line);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-muted); }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn-report { white-space: nowrap; }

/* ---------- hero ---------- */
.hero {
    position: relative;
    background:
        radial-gradient(1000px 500px at 75% -10%, rgba(47, 157, 139, 0.16), transparent 60%),
        radial-gradient(800px 420px at 15% 110%, rgba(255, 158, 61, 0.10), transparent 60%),
        var(--bg);
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}
.hero-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 56px 20px 40px;
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 30px;
    align-items: center;
}
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255, 158, 61, 0.12);
    border: 1px solid rgba(255, 158, 61, 0.4);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
}
.hero h1 {
    margin: 18px 0 10px;
    font-size: clamp(34px, 5.4vw, 58px);
    line-height: 1.04;
    letter-spacing: -0.02em;
    font-weight: 900;
}
.timer {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin: 22px 0 6px;
}
.timer-cell { display: flex; flex-direction: column; align-items: center; min-width: 74px; }
.timer-num {
    font-size: clamp(40px, 6.5vw, 68px);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    text-shadow: 0 0 34px rgba(255, 158, 61, 0.35);
    line-height: 1;
}
.timer-label {
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-top: 6px;
}
.timer-sep {
    font-size: clamp(30px, 5vw, 50px);
    font-weight: 300;
    color: var(--ink-muted);
    transform: translateY(-6px);
}
.status-line { color: var(--ink-soft); margin: 10px 0 4px; }
.status-line strong { color: var(--teal); letter-spacing: 0.05em; }
.status-line strong.status-bad { color: var(--danger-bright); }
.record-chip { color: var(--ink-muted); font-size: 14px; margin: 0 0 22px; }
.record-chip strong { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-art { position: relative; text-align: center; }
.hero-art img {
    position: relative;
    z-index: 1;
    max-height: 460px;
    width: auto;
    filter: drop-shadow(0 18px 40px rgba(0, 0, 0, 0.45));
}
.hero-art-glow {
    position: absolute;
    inset: 12% 8%;
    background: radial-gradient(closest-side, rgba(255, 158, 61, 0.22), transparent 70%);
    border-radius: 50%;
}

/* ---------- ticker ---------- */
.ticker {
    border-top: 1px solid var(--line);
    background: rgba(17, 28, 48, 0.7);
    overflow: hidden;
    padding: 8px 0;
}
.ticker-track {
    display: inline-block;
    white-space: nowrap;
    animation: ticker 40s linear infinite;
    color: var(--ink-muted);
    font-size: 13px;
    letter-spacing: 0.05em;
}
.ticker-track span { margin: 0 26px; }
@keyframes ticker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .ticker-track { animation: none; }
}

/* ---------- sections ---------- */
.section {
    max-width: 1100px;
    margin: 0 auto;
    padding: 64px 20px 20px;
}
.section-title {
    font-size: clamp(26px, 3.6vw, 38px);
    font-weight: 900;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
}
.section-sub { color: var(--ink-soft); margin: 0 0 28px; }

/* ---------- stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}
.stat-tile {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    font-weight: 700;
}
.stat-value {
    font-size: 34px;
    font-weight: 900;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}
.stat-value-sm { font-size: 24px; overflow-wrap: anywhere; }
.stat-foot { font-size: 12.5px; color: var(--ink-muted); }

/* ---------- visitor bar ---------- */
.visitor-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 20px;
    margin-bottom: 18px;
    color: var(--ink-soft);
    font-size: 14px;
}
.visitor-icon { font-size: 16px; }
.visitor-count {
    font-weight: 900;
    font-size: 18px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

/* ---------- chart ---------- */
.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
}
.chart-title { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-note { color: var(--ink-muted); font-size: 12px; margin: 10px 0 0; }
.chart-tip {
    position: absolute;
    pointer-events: none;
    background: #0b1220;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
    color: var(--ink);
    transform: translate(-50%, -110%);
    white-space: nowrap;
    display: none;
    z-index: 5;
}

/* ---------- wall of shame ---------- */
.shame-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
    margin-bottom: 34px;
}
.shame-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.shame-rank {
    font-size: 26px;
    font-weight: 900;
    color: var(--accent);
    min-width: 40px;
    text-align: center;
}
.shame-card.rank-1 { border-color: rgba(255, 158, 61, 0.55); box-shadow: 0 0 24px rgba(255, 158, 61, 0.12); }
.shame-who { display: flex; flex-direction: column; min-width: 0; }
.shame-name { font-weight: 800; overflow-wrap: anywhere; }
.shame-count { color: var(--ink-soft); font-size: 13px; }
.shame-empty { color: var(--ink-muted); font-style: italic; }

.log-title { font-size: 20px; font-weight: 800; margin: 0 0 14px; }
.incident-log {
    list-style: none;
    margin: 0;
    padding: 0;
    border-left: 2px solid var(--line);
}
.incident-log li {
    position: relative;
    padding: 0 0 22px 24px;
}
.incident-log li::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--bg);
}
.log-date { font-size: 12.5px; color: var(--ink-muted); letter-spacing: 0.04em; }
.log-head { font-weight: 800; margin: 2px 0; }
.log-head .log-name { color: var(--danger-bright); }
.log-remark { color: var(--ink-soft); font-size: 14.5px; margin: 0; font-style: italic; }
.log-streak {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--teal);
    background: rgba(47, 157, 139, 0.12);
    border: 1px solid rgba(47, 157, 139, 0.35);
    padding: 2px 10px;
    border-radius: 999px;
}

/* ---------- game ---------- */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}
#game-canvas {
    display: block;
    width: 100%;
    height: 420px;
    border-radius: 10px;
    background: linear-gradient(#0e2a44, #123a5c 70%, #0d4a6e);
    touch-action: manipulation;
    cursor: pointer;
}
.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 6px 2px;
    color: var(--ink-soft);
    font-size: 14px;
}
.game-meta strong { color: var(--accent); }
.game-hint { color: var(--ink-muted); font-size: 12.5px; text-align: right; }

/* ---------- footer ---------- */
.footer {
    margin-top: 70px;
    border-top: 1px solid var(--line);
    padding: 34px 20px 44px;
    text-align: center;
    color: var(--ink-soft);
}
.footer-mark { width: 44px; }
.fine-print { color: var(--ink-muted); font-size: 12.5px; max-width: 560px; margin: 8px auto 0; }

/* ---------- modal ---------- */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(4, 8, 16, 0.72);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.modal {
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    max-height: 92vh;
    overflow-y: auto;
}
.modal-art { max-height: 150px; width: auto; }
.modal h2 { margin: 10px 0 4px; font-size: 24px; font-weight: 900; }
.modal-sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
.modal form { text-align: left; }
.modal label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 14px 0 6px;
}
.modal input, .modal textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    font: inherit;
    padding: 11px 13px;
}
.modal input:focus, .modal textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* tears animation on incident */
.tear {
    position: fixed;
    top: -30px;
    z-index: 200;
    font-size: 26px;
    animation: tearfall 2.6s ease-in forwards;
    pointer-events: none;
}
@keyframes tearfall {
    to { transform: translateY(110vh) rotate(20deg); opacity: 0.7; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .nav-links { display: none; }
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
        padding-top: 36px;
    }
    .timer { justify-content: center; }
    .timer-cell { min-width: 58px; }
    .hero-actions { justify-content: center; }
    .hero-art img { max-height: 300px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    #game-canvas { height: 340px; }
}
@media (max-width: 420px) {
    .brand-name { font-size: 13px; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 27px; }
}
