:root {
    --bg: #000000;
    --bg-soft: #060606;
    --gold: #EAB308;
    --gold-soft: #f5c842;
    --gold-hover: #ca9a06;
    --gold-glow: rgba(234, 179, 8, 0.18);
    --card: #0d0d0d;
    --card-2: #111111;
    --card-border: #1f1f1f;
    --card-border-strong: #2a2a2a;
    --input-bg: #141414;
    --input-bg-focus: #1a1a1a;
    --text: #ffffff;
    --text-muted: #9a9a9a;
    --text-faint: #6a6a6a;
    --danger: #ff6b6b;
    --success: #6bd99a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    background:
        radial-gradient(1200px 600px at 50% -200px, rgba(234, 179, 8, 0.08), transparent 60%),
        var(--bg);
    min-height: 100vh;
}

.hero {
    text-align: center;
    padding: 80px 20px 40px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 5rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    color: var(--gold);
    line-height: 1.05;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1em;
}

.hero-title .hero-title-white {
    color: #ffffff !important;
    font-weight: 900 !important;
    font-size: 1.8em;
    letter-spacing: -0.01em;
    line-height: 1;
}

.hero-title-rest {
    color: var(--gold);
}

.hero-subtitle {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.stats {
    max-width: 1100px;
    margin: 30px auto 60px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    flex: 1 1 280px;
    max-width: 420px;
}

.stat-number {
    font-size: clamp(3.5rem, 8vw, 6rem);
    font-weight: 900;
    color: var(--gold);
    letter-spacing: 0.02em;
    line-height: 1;
    text-shadow: 0 0 40px var(--gold-glow);
}

.stat-label {
    margin-top: 8px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--text);
}

.stat-divider {
    width: 1px;
    align-self: stretch;
    background: var(--card-border);
    min-height: 80px;
}

.stats-breakdown-grid {
    max-width: 1100px;
    margin: -30px auto 50px;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 18px;
    align-items: stretch;
}

@media (max-width: 760px) {
    .stats-breakdown-grid {
        grid-template-columns: 1fr;
    }
}

.stats-breakdown {
    padding: 22px 24px;
    background: linear-gradient(180deg, var(--card-2), var(--card));
    border: 1px solid var(--card-border);
    border-radius: 14px;
    text-align: center;
    box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-breakdown-title {
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.age-breakdown {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    max-width: 720px;
}


.age-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    transition: opacity 0.15s, border-color 0.15s, background 0.15s;
}

.age-chip .age-count {
    color: var(--gold);
    font-weight: 800;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.age-chip .age-label {
    color: var(--text-muted);
    font-weight: 600;
}

.age-chip.is-empty {
    opacity: 0.45;
}

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    align-items: stretch;
}

.map-card,
.form-card {
    background: linear-gradient(180deg, var(--card-2), var(--card));
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}

.form-card {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
}

.card-title {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin-bottom: 20px;
}

.form-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: -10px;
    margin-bottom: 22px;
}

.map-layout {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 32px;
    flex-wrap: nowrap;
}

.map-image-wrap {
    background: #050505;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 65%;
    max-width: 1000px;
    min-width: 0;
}

.map-image {
    display: block;
    width: 100%;
    max-width: 1000px;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    filter: url(#gold-map);
}

.map-filter-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.leaderboard {
    flex: 0 1 35%;
    min-width: 240px;
    max-width: 360px;
    background: linear-gradient(180deg, #0c0c0c 0%, #060606 100%);
    border: 1px solid rgba(234, 179, 8, 0.35);
    border-radius: 14px;
    padding: 22px 20px;
    box-shadow:
        0 0 0 1px rgba(234, 179, 8, 0.05) inset,
        0 24px 60px -30px rgba(234, 179, 8, 0.25),
        0 30px 60px -30px rgba(0, 0, 0, 0.8);
    align-self: stretch;
    display: flex;
    flex-direction: column;
}

.leaderboard-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid rgba(234, 179, 8, 0.2);
}

.leaderboard-title {
    color: var(--gold);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.leaderboard-sub {
    color: var(--text-faint);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 600;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    counter-reset: rank;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 6px;
    border-radius: 8px;
    transition: background 0.15s;
}

.leaderboard-item:hover {
    background: rgba(234, 179, 8, 0.06);
}

.leaderboard-item + .leaderboard-item {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #1a1a1a;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.rank-1 {
    background: linear-gradient(180deg, #f5d264, #c9941b);
    color: #000;
    box-shadow: 0 4px 14px -4px rgba(234, 179, 8, 0.7);
}

.rank-2 {
    background: linear-gradient(180deg, #d8d8d8, #8a8a8a);
    color: #000;
}

.rank-3 {
    background: linear-gradient(180deg, #c98a4d, #7a4a1f);
    color: #000;
}

.city-name {
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.city-count {
    color: var(--gold);
    font-size: 0.95rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.leaderboard-empty {
    color: var(--text-faint);
    font-size: 0.9rem;
    text-align: center;
    padding: 18px 6px;
}

@media (max-width: 820px) {
    .map-layout {
        flex-direction: column;
        align-items: stretch;
    }
    .map-image-wrap,
    .leaderboard {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.field-label em {
    color: var(--gold);
    font-style: normal;
    margin-left: 2px;
}

.field-label .optional {
    color: var(--text-faint);
    margin-left: 4px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: none;
}

.form input[type="text"],
.form input[type="number"],
.form select {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text);
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    width: 100%;
}

.form input::placeholder {
    color: #555;
}

.form input:focus,
.form select:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 4px var(--gold-glow);
}

.field.is-disabled .field-label {
    opacity: 0.4;
}

.field.is-disabled input {
    opacity: 0.5;
    cursor: not-allowed;
}

.select-wrap {
    position: relative;
}

.select-wrap::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--gold);
    border-bottom: 2px solid var(--gold);
    transform: translateY(-75%) rotate(45deg);
    pointer-events: none;
}

.form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.checkbox-row input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid var(--card-border-strong);
    background: var(--input-bg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.checkbox-row input[type="checkbox"]:checked + .checkbox-mark {
    border-color: var(--gold);
    background: var(--gold);
}

.checkbox-row input[type="checkbox"]:checked + .checkbox-mark::after {
    content: "";
    width: 6px;
    height: 11px;
    border-right: 2px solid #000;
    border-bottom: 2px solid #000;
    transform: rotate(45deg) translate(-1px, -1px);
}

.checkbox-row input[type="checkbox"]:focus-visible + .checkbox-mark {
    box-shadow: 0 0 0 4px var(--gold-glow);
}

.checkbox-text {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 500;
}

.file-field .file-drop {
    position: relative;
    border: 1.5px dashed var(--card-border-strong);
    background: var(--input-bg);
    border-radius: 12px;
    padding: 22px 18px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    color: var(--text-muted);
}

.file-field .file-drop:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--input-bg-focus);
}

.file-field input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-drop-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    pointer-events: none;
}

.primary-btn {
    margin-top: 8px;
    background: linear-gradient(180deg, var(--gold-soft), var(--gold));
    color: #000;
    border: none;
    padding: 16px 22px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    border-radius: 10px;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
    box-shadow: 0 10px 30px -10px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.primary-btn:hover {
    filter: brightness(1.05);
    box-shadow: 0 14px 36px -10px var(--gold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.primary-btn:active {
    transform: scale(0.99);
}

.primary-btn:disabled,
.primary-btn.is-loading {
    opacity: 0.7;
    cursor: not-allowed;
    filter: none;
}

.form-message {
    min-height: 1.2em;
    font-size: 0.9rem;
    text-align: center;
    color: var(--text-muted);
}

.form-message[data-type="error"] {
    color: var(--danger);
}

.form-message[data-type="success"] {
    color: var(--success);
}

.footer {
    border-top: 1px solid var(--card-border);
    padding: 30px 20px;
    text-align: center;
}

.copyright {
    color: var(--text-muted);
    font-size: 0.85rem;
}
