:root {
    --bg: #eef3ef;
    --ink: #0d1a14;
    --muted: #5a6b61;
    --line: #cfdcd3;
    --accent: #118a4e;
    --accent-dark: #0b6a3b;
    --gold: #b8891d;
    --danger: #b42318;
    --panel: rgba(255, 255, 255, 0.88);
    --shadow: 0 22px 60px rgba(13, 26, 20, 0.08);
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font-body);
    color: var(--ink);
    background:
        radial-gradient(1000px 480px at 8% -8%, rgba(17, 138, 78, 0.16), transparent 55%),
        radial-gradient(820px 420px at 92% 4%, rgba(184, 137, 29, 0.14), transparent 50%),
        linear-gradient(180deg, #f4faf5 0%, var(--bg) 40%, #e8efe9 100%);
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header, .site-footer, .site-main {
    width: min(920px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.35rem 0 0.75rem;
}

.brand {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
}
.brand span { color: var(--accent); }

.site-header nav a {
    margin-left: 1rem;
    color: var(--muted);
    font-weight: 600;
}

.site-main { padding-bottom: 3.5rem; }
.site-footer {
    padding: 1.5rem 0 2.5rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.panel, .board-panel, .hero-stage {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    box-shadow: var(--shadow);
    padding: 1.35rem;
    margin-bottom: 1.15rem;
    backdrop-filter: blur(10px);
}
.panel.narrow { width: min(560px, 100%); margin-inline: auto; }

.hero-stage {
    position: relative;
    overflow: hidden;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(200px, 0.8fr);
    gap: 1rem 1.25rem;
    align-items: center;
    padding: 1.35rem 1.35rem 1.2rem;
}
.hero-glow {
    position: absolute;
    inset: -20% auto auto -10%;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(17, 138, 78, 0.22), transparent 70%);
    pointer-events: none;
    animation: drift 10s ease-in-out infinite alternate;
}
.hero-copy { position: relative; z-index: 1; min-width: 0; }
.hero-visual {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    background: transparent !important;
    box-shadow: none;
    border: 0;
    animation: floaty 5.5s ease-in-out infinite alternate;
}
.hero-visual img {
    display: block;
    width: min(100%, 300px);
    max-height: 280px;
    height: auto;
    object-fit: contain;
    object-position: center bottom;
    background: transparent !important;
    filter: drop-shadow(0 14px 28px rgba(17, 138, 78, 0.18));
    user-select: none;
    pointer-events: none;
}
.brand-mark {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 6vw, 3.4rem);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1;
}
.brand-mark span { color: var(--accent); }
.hero-copy h1 {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 3vw, 1.85rem);
    font-weight: 600;
    margin: 0.55rem 0 0.45rem;
    color: var(--ink);
}
.lead { color: var(--muted); line-height: 1.55; max-width: 54ch; margin: 0 0 0.85rem; }
.stats-pill {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(17, 138, 78, 0.12);
    color: var(--accent-dark);
    font-size: 0.82rem;
    font-weight: 600;
}
.presence-wrap {
    width: min(920px, calc(100% - 2rem));
    margin: 0 auto 0.35rem;
}
.presence-bar {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.55rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(207, 220, 211, 0.95);
    box-shadow: 0 8px 22px rgba(13, 26, 20, 0.05);
    color: #4b5563;
    font-size: 0.9rem;
    font-weight: 500;
}
.presence-online {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #16a34a;
    font-weight: 700;
}
.presence-online .live-online-count {
    font-weight: 800;
}
.presence-sep {
    color: #9ca3af;
}
.presence-total {
    color: #4b5563;
}
.presence-stats {
    color: #4b5563;
    font-weight: 600;
    text-decoration: none;
}
.presence-stats:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}
.live-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
    animation: livePulse 1.6s ease-out infinite;
    flex-shrink: 0;
}
.live-visitors.is-tick .live-online-count,
.live-visitors.is-tick .live-total-count {
    animation: liveTick 0.45s ease;
}
@keyframes livePulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    70% { box-shadow: 0 0 0 0.45rem rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@keyframes liveTick {
    0% { transform: scale(1); }
    40% { transform: scale(1.06); }
    100% { transform: scale(1); }
}
.muted { color: var(--muted); }
.success { color: var(--accent-dark); }
.error { color: var(--danger); font-weight: 600; }

.hero-form {
    display: grid;
    gap: 0.85rem;
    max-width: 100%;
    padding: 1rem;
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(207, 220, 211, 0.9);
}
.bid-form label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.92rem; }
.bid-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.85rem;
    padding: 0.8rem 0.95rem;
    font: inherit;
    background: #fff;
}
.bid-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.6rem;
    align-items: end;
}
.stepper {
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 0.85rem;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0.9rem;
    padding: 0.85rem 1.15rem;
    font-weight: 700;
    cursor: pointer;
    background: #e8efe9;
    color: var(--ink);
}
.btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 14px 30px rgba(17, 138, 78, 0.28);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1rem;
}
.section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.35rem;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rank-row {
    display: grid;
    grid-template-columns: 3.4rem 4.2rem 1fr auto;
    gap: 0.85rem;
    align-items: center;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 1.05rem;
    background: #fff;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    animation: rise 0.55s ease both;
    animation-delay: calc(min(var(--i), 20) * 18ms);
}
.rank-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(13, 26, 20, 0.08);
    border-color: rgba(17, 138, 78, 0.35);
}
.rank-row.featured {
    padding: 1rem 1.05rem;
    background: linear-gradient(120deg, #fffef8, #ffffff 45%);
}
.rank-row.tier-10 { border-color: rgba(184, 137, 29, 0.35); }
.rank-row.tier-20 { background: #f7fcf9; }
.rank-row.open { opacity: 0.92; }

.rank-badge {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--muted);
    text-align: center;
}
.rank-row.featured .rank-badge { color: var(--gold); font-size: 1.2rem; }

.rank-media {
    width: 4.2rem;
    height: 4.2rem;
    border-radius: 0.9rem;
    overflow: hidden;
    background: #eef5f0;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.rank-og {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rank-favicon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
}
.rank-placeholder {
    color: var(--muted);
    font-size: 1.2rem;
}

.rank-body { min-width: 0; }
.rank-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
    word-break: break-word;
    text-decoration: none;
}
.rank-domain:hover { color: var(--accent-dark); text-decoration: underline; }
.rank-domain.open-label { color: var(--muted); }
.rank-title {
    margin-top: 0.15rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--ink);
    line-height: 1.3;
}
.rank-desc {
    margin: 0.25rem 0 0;
    font-size: 0.86rem;
    line-height: 1.4;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.rank-meta {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

.rank-side {
    display: grid;
    gap: 0.45rem;
    justify-items: end;
    min-width: 5.5rem;
}
.rank-bid {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-dark);
}
.rank-claim {
    border: 1px solid var(--line);
    background: #f4faf6;
    border-radius: 0.75rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    color: var(--ink);
}
.rank-claim:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.1rem;
}
.rank-paid-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.submit-panel h1 {
    font-family: var(--font-display);
    margin: 0 0 0.5rem;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}
.pager-btn, .pager-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.4rem;
    height: 2.4rem;
    padding: 0 0.75rem;
    border-radius: 0.7rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
}
.pager-btn:hover, .pager-num:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
    text-decoration: none;
}
.pager-num.current {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-color: transparent;
    color: #fff;
}
.pager-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}
.pager-ellipsis {
    color: var(--muted);
    padding: 0 0.2rem;
    font-weight: 700;
}

.number-one-title {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    margin: 0;
    letter-spacing: -0.02em;
}
.crown-list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}
.crown-row {
    display: grid;
    grid-template-columns: 3.2rem 3.6rem 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 1.05rem;
    background: #fff;
}
.crown-row.is-current {
    border-color: rgba(184, 137, 29, 0.45);
    background: linear-gradient(120deg, #fffef8, #ffffff 50%);
}
.crown-ordinal {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--muted);
    text-align: center;
}
.crown-row.is-current .crown-ordinal { color: var(--gold); }
.crown-media {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.85rem;
    overflow: hidden;
    background: #eef5f0;
    display: grid;
    place-items: center;
}
.crown-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.crown-body { min-width: 0; }
.crown-meta {
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.88rem;
}
.crown-when {
    text-align: right;
    display: grid;
    gap: 0.25rem;
    justify-items: end;
}
.crown-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(184, 137, 29, 0.14);
    color: #8a6814;
    font-size: 0.78rem;
    font-weight: 700;
}
.crown-dates {
    font-size: 0.82rem;
    color: var(--ink);
}

.admin-panel h3 {
    margin: 0.5rem 0 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
}
.admin-form label {
    display: grid;
    gap: 0.35rem;
    font-weight: 600;
    font-size: 0.92rem;
}
.admin-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    padding: 0.75rem 0.9rem;
    font: inherit;
}
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.admin-hint {
    border: 1px dashed var(--line);
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    background: #f8fbf9;
    margin-bottom: 0.5rem;
}
.admin-code {
    display: block;
    word-break: break-all;
    font-size: 0.88rem;
    padding: 0.45rem 0;
}

.admin-dashboard { width: 100%; }
.admin-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.5rem 0 1.1rem;
}
.admin-tabs a {
    padding: 0.45rem 0.85rem;
    border-radius: 0.7rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}
.admin-tabs a.active,
.admin-tabs a:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    text-decoration: none;
}
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.admin-stat {
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    background: #fff;
    display: grid;
    gap: 0.25rem;
}
.admin-stat span { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.admin-stat strong { font-family: var(--font-display); font-size: 1.35rem; }
.admin-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.admin-search input {
    flex: 1;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    font: inherit;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.65rem 0.55rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.admin-table th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tr.is-hidden { opacity: 0.55; background: #f7f7f7; }
.inline-form { display: inline; margin: 0; }

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes drift {
    from { transform: translate(0, 0); }
    to { transform: translate(40px, 28px); }
}
@keyframes floaty {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}
@keyframes errorBadgePulse {
    0%, 100% { transform: scale(1) rotate(-6deg); box-shadow: 0 18px 40px rgba(17, 138, 78, 0.22); }
    50% { transform: scale(1.04) rotate(-3deg); box-shadow: 0 22px 48px rgba(184, 137, 29, 0.28); }
}
@keyframes errorDigitSway {
    from { transform: translateY(0) rotate(-2deg); }
    to { transform: translateY(-8px) rotate(2deg); }
}

.error-404 {
    position: relative;
    overflow: hidden;
    text-align: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 1.4rem;
    box-shadow: var(--shadow);
    padding: clamp(2rem, 6vw, 3.25rem) 1.35rem 2.25rem;
    margin-bottom: 1.15rem;
    backdrop-filter: blur(10px);
    animation: rise 0.55s ease-out both;
}
.error-404-glow {
    position: absolute;
    inset: -18% auto auto 12%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(17, 138, 78, 0.22), transparent 70%);
    pointer-events: none;
    animation: drift 11s ease-in-out infinite alternate;
}
.error-404-glow-gold {
    inset: auto 8% -20% auto;
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(184, 137, 29, 0.18), transparent 70%);
    animation-duration: 13s;
    animation-direction: alternate-reverse;
}
.error-404-brand {
    position: relative;
    z-index: 1;
    margin: 0 0 0.35rem;
}
.error-404-figure {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.35rem, 2vw, 0.85rem);
    margin: 0.5rem 0 1rem;
    font-family: var(--font-display);
    line-height: 1;
    user-select: none;
}
.error-404-digit {
    font-size: clamp(4.5rem, 16vw, 7.5rem);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.06em;
    animation: errorDigitSway 4.5s ease-in-out infinite alternate;
}
.error-404-digit:last-child {
    animation-delay: 0.35s;
    animation-direction: alternate-reverse;
}
.error-404-badge {
    display: grid;
    place-items: center;
    width: clamp(4.2rem, 14vw, 6.2rem);
    height: clamp(4.2rem, 14vw, 6.2rem);
    border-radius: 1.25rem;
    background: linear-gradient(145deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 18px 40px rgba(17, 138, 78, 0.22);
    animation: errorBadgePulse 3.2s ease-in-out infinite, floaty 5.5s ease-in-out infinite alternate;
}
.error-404-badge-hash {
    font-size: clamp(0.85rem, 2.8vw, 1.1rem);
    font-weight: 600;
    opacity: 0.85;
    margin-bottom: -0.35rem;
}
.error-404-badge-q {
    font-size: clamp(2rem, 7vw, 2.85rem);
    font-weight: 700;
    margin-top: -0.15rem;
}
.error-404 h1 {
    position: relative;
    z-index: 1;
    margin: 0 0 0.55rem;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 4.5vw, 2.15rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.error-404-lead {
    position: relative;
    z-index: 1;
    max-width: 28rem;
    margin: 0 auto 1.35rem;
    color: var(--muted);
    font-size: 1.05rem;
}
.error-404-path {
    display: block;
    margin-top: 0.65rem;
    font-size: 0.92rem;
}
.error-404-path code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 0.2rem 0.55rem;
    border-radius: 0.5rem;
    background: rgba(13, 26, 20, 0.06);
    border: 1px solid var(--line);
    color: var(--ink);
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.86em;
}
.error-404-actions {
    position: relative;
    z-index: 1;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 720px) {
    .error-404 {
        padding: 1.6rem 1.05rem 1.75rem;
    }
    .error-404-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .error-404-actions .btn { width: 100%; }
}

@media (max-width: 720px) {
    .hero-stage {
        grid-template-columns: minmax(0, 1fr) 104px;
        gap: 0.75rem;
        align-items: center;
        padding: 1.05rem;
    }
    .brand-mark {
        font-size: clamp(1.65rem, 7vw, 2.1rem);
    }
    .hero-copy h1 {
        font-size: 1.12rem;
        margin: 0.35rem 0 0.4rem;
    }
    .hero-copy .lead {
        font-size: 0.92rem;
        margin-bottom: 0.55rem;
    }
    .hero-visual {
        animation: none;
        align-self: start;
        margin-top: 0.15rem;
    }
    .hero-visual img {
        width: 100px;
        max-height: 120px;
        filter: drop-shadow(0 8px 14px rgba(17, 138, 78, 0.14));
    }
    .hero-actions {
        margin-top: 0.55rem;
    }
    .rank-row {
        grid-template-columns: 2.6rem 3.4rem 1fr;
        grid-template-areas:
            "badge media side"
            "body body body";
    }
    .rank-badge { grid-area: badge; }
    .rank-media { grid-area: media; width: 3.4rem; height: 3.4rem; }
    .rank-body { grid-area: body; }
    .rank-side {
        grid-area: side;
        justify-items: end;
        align-content: start;
    }
    .section-head { flex-direction: column; align-items: start; }
    .admin-grid { grid-template-columns: 1fr; }
    .crown-row {
        grid-template-columns: 2.6rem 3rem 1fr;
        grid-template-areas:
            "ord media body"
            "when when when";
    }
    .crown-ordinal { grid-area: ord; }
    .crown-media { grid-area: media; width: 3rem; height: 3rem; }
    .crown-body { grid-area: body; }
    .crown-when {
        grid-area: when;
        justify-items: start;
        text-align: left;
        padding-top: 0.15rem;
    }
}

@media (max-width: 420px) {
    .hero-stage {
        grid-template-columns: minmax(0, 1fr) 84px;
    }
    .hero-visual img {
        width: 80px;
        max-height: 96px;
    }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .hero-actions .btn { width: 100%; }
}
