

@font-face {
  font-family: "Sora";
  src: url("assets/fonts/Sora-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/Sora-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/Sora-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Sora";
  src: url("assets/fonts/Sora-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("assets/fonts/Fraunces_72pt-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}


:root {
  --bg: #f4f2ed;
  --bg-2: #fef6e7;
  --ink: #0f172a;
  --muted: #5b6472;
  --accent: #1ea672;
  --accent-dark: #127a53;
  --accent-soft: rgba(30, 166, 114, 0.12);
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Sora", "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #fff, var(--bg)) fixed;
  color: var(--ink);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 20px calc(60px + var(--safe-bottom));
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
}

.logo img {
  width: 100%;
  height: 100%;
  border-radius: 16px;
  display: block;
  object-fit: cover;
}

.brand h1 {
  margin: 0;
  font-family: "Fraunces", "Georgia", serif;
  font-size: 28px;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
}

.session {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-switch {
  display: inline-flex;
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.lang-switch button {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--accent);
  color: #fff;
}

.status {
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.notice {
  min-height: 0;
  margin-bottom: 8px;
  color: #b45309;
  font-size: 13px;
}

.panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.panel.login {
  background: linear-gradient(135deg, #fff, var(--bg-2));
}

.login-hero {
  width: 100%;
  height: 220px;
  border-radius: 16px;
  margin-bottom: 14px;
  background-image: linear-gradient(
      rgba(15, 23, 42, 0.25),
      rgba(15, 23, 42, 0.05)
    ),
    url("assets/login-hero.png");
  background-size: cover;
  background-position: 70% 30%;
}

.is-web .login-hero {
  height: 260px;
  background-position: 60% 35%;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.events-header {
  flex-direction: column;
  align-items: stretch;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.events-actions {
  justify-content: center;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.profile-box {
  display: grid;
  gap: 10px;
}

.leaderboard-summary {
  background: #f8fafc;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 12px;
  display: grid;
  gap: 6px;
}

.leaderboard-summary .summary-title {
  font-weight: 700;
}

.leaderboard-summary .summary-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
}

.profile-row span {
  color: var(--muted);
  font-size: 12px;
}

.small {
  font-size: 12px;
}

.id-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

label:not(.switch) {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

label.switch,
.switch {
  display: inline-flex !important;
  width: 46px !important;
  height: 26px !important;
  flex: 0 0 46px !important;
  align-items: center !important;
  justify-content: center !important;
}

label.switch .slider,
.switch .slider {
  width: 46px !important;
  height: 26px !important;
}

input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 14px;
  font-family: inherit;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--accent-dark);
}

button.danger {
  background: #dc2626;
}

button.danger:hover {
  background: #b91c1c;
}

button.danger:disabled {
  background: #fca5a5;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid rgba(30, 166, 114, 0.4);
}

button.small {
  padding: 6px 12px;
  font-size: 12px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.status-line {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

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

.cards li {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(30, 166, 114, 0.18);
  background: #fff;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cards li:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.cards li.selected {
  border-color: rgba(30, 166, 114, 0.7);
  box-shadow: 0 10px 22px rgba(30, 166, 114, 0.18);
}

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

.event-views {
  display: grid;
  gap: 12px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pagination span {
  font-size: 12px;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  flex-wrap: wrap;
  max-width: 100%;
}

.segmented button {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.tabs-center {
  display: flex;
  justify-content: center;
}

.auth-tabs {
  margin-bottom: 12px;
}

.account-tabs {
  margin: 6px 0 12px;
}

.account-pane {
  margin-top: 6px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.settings-row:last-of-type {
  border-bottom: none;
}

.settings-links {
  margin-top: 12px;
}

.settings-links a {
  color: var(--accent-dark);
  font-weight: 600;
}

.settings-danger {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(239, 68, 68, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.delete-confirm {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
  display: grid;
  gap: 10px;
}

.delete-success {
  margin: 12px 0 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(30, 166, 114, 0.2);
  background: rgba(30, 166, 114, 0.08);
  display: grid;
  gap: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.team-box {
  background: #f8fafc;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.team-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.team-control label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.team-inline {
  display: flex;
  gap: 10px;
  align-items: center;
}

.team-inline input {
  flex: 1;
}

.team-lists {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.team-list {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 12px;
}

.team-list h4 {
  margin-bottom: 8px;
}

.team-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.team-row + .team-row {
  margin-top: 6px;
}

.team-meta {
  color: #64748b;
  font-size: 0.9rem;
}

.team-status {
  font-size: 0.85rem;
  color: #64748b;
}

.team-actions-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.team-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.team-member:last-child {
  border-bottom: none;
}

.leaderboard-detail {
  margin-top: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 14px;
  padding: 12px;
}
}

.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  transition: 0.2s;
  border-radius: 999px;
}

.switch .slider::before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: white;
  transition: 0.2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.switch.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.event-card,
.race-card {
  display: grid;
  gap: 6px;
}

.event-meta,
.race-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.event-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.event-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.event-details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 10px;
}

.race-card {
  padding: 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.race-card.selected {
  border-color: rgba(30, 166, 114, 0.6);
  box-shadow: 0 10px 20px rgba(30, 166, 114, 0.2);
}

.race-result {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.result-section-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.race-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.race-form {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px dashed rgba(15, 23, 42, 0.12);
}

.race-form .form-title {
  font-weight: 600;
}

.race-form .form-meta {
  font-size: 12px;
  color: var(--muted);
}

.event-link {
  font-size: 12px;
}

a.event-link {
  text-decoration: none;
  border: 1px solid rgba(30, 166, 114, 0.4);
  color: var(--accent-dark);
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

a.event-link:hover {
  background: var(--accent);
  color: #fff;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.checkbox input {
  width: auto;
  margin: 0;
}

.mini-input {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 6px 10px;
}

.mini-input span {
  font-size: 12px;
  color: var(--muted);
}

.mini-input input {
  border: none;
  background: transparent;
  padding: 4px 0;
  width: 70px;
}

.time-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
}

.time-input input {
  width: 48px;
  border: none;
  background: transparent;
  padding: 4px 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.time-input input:focus {
  outline: none;
}

.time-sep {
  color: var(--muted);
  font-weight: 600;
}

.calendar-view {
  display: grid;
  gap: 10px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-label {
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekday {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.calendar-cell {
  min-height: 64px;
  padding: 8px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid transparent;
  cursor: pointer;
  display: grid;
  align-content: start;
  gap: 6px;
}

.calendar-cell.disabled {
  cursor: default;
  opacity: 0.4;
}

.calendar-cell.has-events {
  border-color: rgba(30, 166, 114, 0.35);
  background: rgba(30, 166, 114, 0.08);
}

.calendar-cell.selected {
  outline: 2px solid rgba(30, 166, 114, 0.8);
  background: rgba(30, 166, 114, 0.16);
}

.calendar-day {
  font-size: 12px;
  font-weight: 700;
}

.calendar-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.calendar-star {
  font-size: 12px;
  color: #f59e0b;
}

@media (min-width: 900px) {
  .is-web .login-hero {
    height: 312px;
    background-position: 60% 20%;
  }
}

.calendar-events {
  font-size: 13px;
  line-height: 1.5;
}

.calendar-event {
  display: block;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(30, 166, 114, 0.18);
  background: #fff;
  margin-bottom: 10px;
}

.calendar-event:last-child {
  border-bottom: none;
}

.map-view {
  position: relative;
  display: grid;
  gap: 12px;
}

.events-map {
  width: 100%;
  height: 280px;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  overflow: hidden;
  z-index: 1;
  overscroll-behavior: contain;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
}

.map-card {
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 5;
  pointer-events: auto;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.map-card strong {
  font-size: 14px;
}

.map-card .map-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #0ea5e9;
  border: 2px solid #fff;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.2);
}

.map-pin.saved {
  background: #f59e0b;
}

.saved-view .cards li {
  cursor: default;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  margin-bottom: 8px;
}

.leaderboard-list li.clickable {
  cursor: pointer;
}

.leaderboard-list .rank {
  font-weight: 700;
  color: var(--accent-dark);
}

.leaderboard-list .points {
  font-weight: 700;
  color: var(--ink);
}

.leaderboard-list li.me {
  background: rgba(30, 166, 114, 0.18);
  border: 1px solid rgba(30, 166, 114, 0.35);
}

.results-list {
  display: grid;
  gap: 10px;
}

.result-card {
  background: #f8fafc;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 6px;
}

.result-card .result-meta {
  font-size: 12px;
  color: var(--muted);
}

.results-total {
  position: sticky;
  bottom: 12px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
  margin-top: 12px;
  font-weight: 700;
}

.codebox {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px;
  border-radius: 12px;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .session {
    width: 100%;
    justify-content: space-between;
  }

  .login-hero {
    height: 220px;
    background-position: 70% 30%;
  }

  .is-web .login-hero {
    height: 220px;
    background-position: 60% 30%;
  }
}
.leaderboard-tabs {
  margin-top: 8px;
}

/* Hard override for toggle switch sizing/alignment */
.settings-row label.switch,
.settings-row .switch {
  position: relative !important;
  display: inline-flex !important;
  width: 46px !important;
  height: 26px !important;
  flex: 0 0 46px !important;
  align-items: center !important;
  justify-content: center !important;
}

.settings-row label.switch .slider,
.settings-row .switch .slider {
  position: absolute !important;
  inset: 0 !important;
  width: 46px !important;
  height: 26px !important;
}
