@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #F5F5F7;
    --surface: #FFFFFF;
    --text: #1D1D1F;
    --text-secondary: #6E6E73;
    --accent: #000000;
    --danger: #FF3B30;
    --success: #34C759;
    --border: #D2D2D7;
}

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

/* Splash screen */

body.no-scroll { overflow: hidden; }

.splash {
    display: none;
}

.splash.splash-visible {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: #000000;
    align-items: center;
    justify-content: center;
    animation: splash-in 0.6s ease;
}

.splash.splash-exit {
    animation: splash-out 0.4s ease forwards;
}

.splash-content {
    text-align: center;
    padding: 32px;
    max-width: 400px;
}

.splash-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 32px;
}

.splash-img {
    width: 180px;
    height: auto;
    border-radius: 16px;
    margin-bottom: 48px;
    opacity: 0.95;
}

.splash-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--surface);
    line-height: 1.2;
    margin-bottom: 40px;
}

.splash-enter {
    display: inline-block;
    padding: 0 36px;
    height: 52px;
    line-height: 52px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.03em;
    color: #000000;
    background: #FFFFFF;
    border: none;
    border-radius: 980px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.splash-enter:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(1.03);
}

.splash-enter:active {
    transform: scale(0.98);
}

@keyframes splash-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes splash-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.15s;
}

a:hover { color: var(--text); }

/* Ticker */

.ticker {
    background: var(--text);
    overflow: hidden;
    white-space: nowrap;
    height: 36px;
    display: flex;
    align-items: center;
}

.ticker-track {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.01em;
    animation: ticker-scroll 200s linear infinite;
    will-change: transform;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Header */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
}

header nav {
    width: 100%;
    max-width: 680px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header .site-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

/* Hamburger button */

.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}

.menu-toggle:hover {
    background: var(--bg);
}

.menu-toggle svg {
    display: block;
}

/* Slide-out menu */

.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.25s;
}

.menu-overlay.open {
    display: block;
    opacity: 1;
}

.menu-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 901;
    width: 280px;
    max-width: 80vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.menu-drawer.open {
    transform: translateX(0);
}

.menu-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.menu-drawer-header span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.menu-close:hover {
    background: var(--bg);
}

.menu-nav {
    list-style: none;
    padding: 8px 0;
    flex: 1;
}

.menu-nav li a {
    display: block;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.15s;
}

.menu-nav li a:hover {
    background: var(--bg);
}

.menu-nav li.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 24px;
}

/* Hero image */

.hero-img {
    text-align: center;
    margin-top: 32px;
}

.hero-img img {
    width: 200px;
    height: auto;
    border-radius: 16px;
}

/* Container */

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 48px 24px;
}

/* Page title */

.page-title {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text);
    text-align: center;
}

.page-title-left {
    text-align: left;
}

.page-caption {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
    margin-top: 12px;
}

.page-caption-left {
    text-align: left;
}

/* Flash messages */

.flashes {
    list-style: none;
    margin-bottom: 32px;
}

.flashes li {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.flashes li.success {
    background: #F0FFF4;
    color: var(--success);
    border: 1px solid var(--success);
}

.flashes li.error {
    background: #FFF5F5;
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    margin-bottom: 24px;
}

.card-heading {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.card-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Leaderboard */

.leaderboard {
    margin-top: 48px;
}

.lb-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.lb-row:last-child {
    border-bottom: none;
}

.lb-rank {
    font-size: 32px;
    font-weight: 700;
    color: var(--border);
    line-height: 1;
    min-width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.lb-first .lb-rank {
    color: var(--text);
}

.lb-middle {
    flex: 1;
    min-width: 0;
}

.lb-name {
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    display: block;
}

.lb-first .lb-name {
    font-weight: 700;
}

.lb-events {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.lb-ev {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.lb-ev strong {
    font-weight: 600;
    color: var(--text-secondary);
}

.lb-ev-filled strong {
    color: var(--text);
}

.lb-ev-dot {
    font-size: 13px;
    color: var(--border);
}

.lb-total {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    flex-shrink: 0;
    min-width: 48px;
    text-align: right;
    letter-spacing: -0.02em;
}

.lb-first .lb-total {
    color: var(--accent);
}

.lb-coopie {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center 38%;
    flex-shrink: 0;
    border: 2px solid var(--text);
}

/* Event status pills */

.event-status {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 48px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pill.complete {
    background: #F0FFF4;
    color: var(--success);
    border: 1px solid var(--success);
}

.pill.pending {
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* Winner banner */

.winner-banner {
    text-align: center;
    padding: 48px 32px;
    margin-bottom: 48px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.winner-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.winner-name {
    font-size: 48px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-top: 8px;
    line-height: 1.1;
}

/* Waiting state */

.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 15px;
}

/* Forms */

label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    margin-bottom: 16px;
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236E6E73' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

input::placeholder {
    color: var(--text-secondary);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
}

.field-group {
    margin-bottom: 0;
}

.player-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 28px;
    border: none;
    border-radius: 980px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: #333333;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #FFFFFF;
}

.btn-block {
    width: 100%;
}

/* Login page */

.login-wrap {
    max-width: 400px;
    margin: 0 auto;
    padding-top: 80px;
}

.login-icon {
    text-align: center;
    font-size: 40px;
    margin-bottom: 24px;
    line-height: 1;
}

.login-wrap .card-heading {
    text-align: center;
    margin-bottom: 24px;
}

.login-back {
    display: block;
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
}

/* Event card header */

.event-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.event-card-header .card-heading {
    margin-bottom: 0;
}

/* Sortable list */

.sortable-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sortable-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 6px;
    cursor: grab;
    user-select: none;
    transition: border-color 0.15s, opacity 0.15s;
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-item.dragging {
    opacity: 0.4;
}

.sort-handle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.5;
}

.sort-pos {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: 8px;
}

.sort-name {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

/* Locked (completed) results list */

.locked-list .locked-item {
    cursor: default;
    border-color: transparent;
    padding: 10px 16px;
    margin-bottom: 2px;
    background: transparent;
}

.locked-list .locked-item:nth-child(1) .sort-pos {
    background: var(--text);
    color: var(--surface);
}

.locked-list .locked-item:nth-child(1) .sort-name {
    font-weight: 700;
}

.sortable-placeholder {
    height: 54px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    margin-bottom: 6px;
}

.event-submit {
    margin-top: 24px;
}

/* Player management */

.player-list {
    margin-bottom: 20px;
}

.player-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.player-list-row:last-child {
    border-bottom: none;
}

.player-list-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.player-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-remove:hover {
    background: #FFF5F5;
    color: var(--danger);
}

.player-add-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.player-add-form input {
    flex: 1;
}

/* Badge (locked) */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 980px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-success {
    background: #F0FFF4;
    color: var(--success);
    border: 1px solid var(--success);
}

/* Tiebreaker */

.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.radio-option:last-of-type {
    border-bottom: none;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.radio-option span {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

/* Danger zone */

.danger-card {
    border-color: var(--danger);
}

.danger-card .card-heading {
    color: var(--danger);
}

/* Game rules page */

.back-link {
    font-size: 14px;
    color: var(--text-secondary);
}

.back-link:hover {
    color: var(--text);
}

.game-overview {
    font-size: 18px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: 20px;
}

.game-meta {
    display: flex;
    gap: 32px;
    margin-top: 32px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.game-meta-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.game-meta-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
}

.rules-section {
    margin-top: 40px;
}

.rules-heading {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.rules-list {
    padding-left: 20px;
}

.rules-list li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.rules-list li:last-child {
    border-bottom: none;
}

.points-table {
    width: 100%;
    max-width: 320px;
    border-collapse: collapse;
}

.points-table th,
.points-table td {
    text-align: left;
    padding: 10px 16px;
    font-size: 15px;
}

.points-table thead th {
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.points-table tbody td {
    border-bottom: 1px solid var(--border);
}

.points-table tbody tr:last-child td {
    border-bottom: none;
}

.points-table tbody td:last-child {
    font-weight: 600;
}

.game-nav {
    display: flex;
    gap: 12px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
}

/* Event pills as links */

a.pill {
    text-decoration: none;
    transition: border-color 0.15s;
}

a.pill:hover {
    border-color: var(--text);
    color: var(--text);
}

/* Profile card */

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.profile-photo-wide {
    width: 100%;
    height: 480px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.profile-photo-wide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 38%;
    display: block;
}

.profile-body {
    padding: 32px;
}

.profile-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.profile-name {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-top: 4px;
    line-height: 1.2;
}

.profile-bio {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 16px;
}

.profile-traits {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.profile-traits li {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg);
    padding: 6px 14px;
    border-radius: 980px;
    border: 1px solid var(--border);
}

/* Footer */

footer {
    text-align: center;
    padding: 48px 24px 32px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Responsive */

@media (max-width: 600px) {
    .page-title { font-size: 32px; }
    .winner-name { font-size: 32px; }
    .player-grid { grid-template-columns: 1fr; }
    .container { padding: 32px 16px; }
    .lb-rank { font-size: 24px; min-width: 32px; }
    .lb-name { font-size: 16px; }
    .lb-total { font-size: 22px; }
    .lb-ev { font-size: 12px; }
    .profile-photo-wide {
        max-height: 280px;
    }
    .profile-body {
        padding: 24px;
    }
    .profile-name { font-size: 24px; }
}
