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

:root {
  --bg: #eef7fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --panel-soft: #f3fbff;
  --text: #0f2130;
  --muted: #536779;
  --border: rgba(15, 33, 48, 0.12);
  --accent: #018faf;
  --accent-2: #97c93c;
  --accent-3: #ec3c43;
  --gold: #d99d12;
  --silver: #8e99a7;
  --bronze: #a96938;
  --shadow: 0 18px 48px rgba(14, 30, 41, 0.12);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Sora", "Barlow", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(circle at 12% 16%, rgba(1, 143, 175, 0.18), transparent 26%),
    radial-gradient(circle at 90% 10%, rgba(151, 201, 60, 0.2), transparent 26%),
    radial-gradient(circle at 8% 82%, rgba(236, 60, 67, 0.16), transparent 22%),
    linear-gradient(180deg, #f3fbfe 0%, #eff8fa 100%);
  padding: 0 1.15rem 3rem;
}

body[data-embed="true"] {
  padding: 0;
  background: transparent;
}

body[data-theme="dark"] {
  --bg: #07131b;
  --panel: rgba(9, 27, 38, 0.94);
  --panel-strong: #0d2431;
  --panel-soft: #0d2431;
  --text: #f2f8fb;
  --muted: #b6c6d2;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 0.94rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  padding: 0.35rem 0.78rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  padding: 0.82rem 1.15rem;
  font: inherit;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #048cab 0%, #0f9dc1 100%);
  box-shadow: 0 12px 24px rgba(1, 143, 175, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 28px rgba(1, 143, 175, 0.26);
}

.btn.secondary {
  color: var(--text);
  background: rgba(15, 33, 48, 0.05);
  box-shadow: none;
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  box-shadow: none;
}

.hero {
  position: relative;
  max-width: 1320px;
  margin: 1rem auto 0;
  padding: 2rem 1.4rem;
  border-radius: 30px;
  color: #ffffff;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 84%, rgba(236, 60, 67, 0.95), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(174, 213, 68, 0.92), transparent 28%),
    radial-gradient(circle at 62% 72%, rgba(1, 143, 175, 0.52), transparent 26%),
    linear-gradient(135deg, #0a99b6 0%, #0791ae 38%, #8abf43 100%);
  box-shadow: 0 28px 60px rgba(2, 66, 86, 0.2);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.07), transparent 46%),
    linear-gradient(290deg, rgba(0, 0, 0, 0.08), transparent 42%);
  pointer-events: none;
}

.hero--internal {
  margin-bottom: 0.4rem;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 1.35rem;
}

.hero__copy {
  display: grid;
  gap: 0.8rem;
  max-width: 760px;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero p:not(.pill) {
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  line-height: 1.6;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.stat-card {
  padding: 1rem 1rem 1.15rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
}

.stat-card--gold {
  box-shadow: inset 0 0 0 1px rgba(217, 157, 18, 0.26);
}

.stat-card--silver {
  box-shadow: inset 0 0 0 1px rgba(142, 153, 167, 0.28);
}

.stat-card--bronze {
  box-shadow: inset 0 0 0 1px rgba(169, 105, 56, 0.3);
}

.stat-label {
  display: block;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  display: block;
  margin-top: 0.55rem;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
}

.page-shell {
  max-width: 1320px;
  margin: 1rem auto 0;
  display: grid;
  gap: 1rem;
}

.dashboard-grid,
.admin-layout {
  display: grid;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel--accent {
  background:
    linear-gradient(180deg, rgba(1, 143, 175, 0.05), transparent 58%),
    var(--panel);
}

.panel--inset {
  background: var(--panel-soft);
  box-shadow: none;
}

.panel--narrow {
  max-width: 540px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2,
.section-head h3,
.embed-card h1 {
  letter-spacing: -0.03em;
}

.podium-grid {
  display: grid;
  gap: 0.9rem;
}

.podium-card {
  position: relative;
  overflow: hidden;
  padding: 1rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.64));
  display: grid;
  gap: 0.7rem;
}

.podium-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -36% auto;
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(1, 143, 175, 0.16), transparent 70%);
}

.podium-card--1 {
  background:
    linear-gradient(180deg, rgba(217, 157, 18, 0.14), rgba(255, 255, 255, 0.85)),
    #ffffff;
}

.podium-card--2 {
  background:
    linear-gradient(180deg, rgba(142, 153, 167, 0.14), rgba(255, 255, 255, 0.85)),
    #ffffff;
}

.podium-card--3 {
  background:
    linear-gradient(180deg, rgba(169, 105, 56, 0.16), rgba(255, 255, 255, 0.86)),
    #ffffff;
}

.podium-rank,
.position-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 0.8rem;
  border-radius: 999px;
  background: rgba(15, 33, 48, 0.08);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
}

.position-badge {
  min-width: 34px;
  height: 34px;
  font-size: 0.88rem;
}

.flag-avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(238, 247, 251, 0.94));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: 0 12px 24px rgba(15, 33, 48, 0.1);
}

.flag-avatar--sm {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 1.25rem;
  box-shadow: none;
}

.flag-avatar--lg {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  font-size: 2.3rem;
}

.flag-avatar--xl {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  font-size: 2.15rem;
  box-shadow: 0 16px 30px rgba(15, 33, 48, 0.14);
}

.medal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.medal-strip--compact {
  gap: 0.42rem;
}

.medal-badge,
.total-chip,
.mini-medal {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.34rem 0.62rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.82rem;
  background: rgba(15, 33, 48, 0.04);
}

.medal-badge strong,
.total-chip strong,
.mini-medal {
  font-weight: 700;
}

.medal-badge::before,
.mini-medal::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.medal-badge--gold::before,
.mini-medal--gold::before {
  background: var(--gold);
}

.medal-badge--silver::before,
.mini-medal--silver::before {
  background: var(--silver);
}

.medal-badge--bronze::before,
.mini-medal--bronze::before {
  background: var(--bronze);
}

.total-chip {
  background: rgba(1, 143, 175, 0.08);
}

.total-chip--table {
  min-width: 56px;
  justify-content: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th,
td {
  padding: 0.9rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr {
  transition: background 0.18s ease;
}

tbody tr:hover {
  background: rgba(1, 143, 175, 0.04);
}

.country-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.country-copy {
  display: grid;
  gap: 0.12rem;
}

.country-name {
  font-weight: 600;
}

.country-code {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.medal-number {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.medal-number--gold {
  color: var(--gold);
}

.medal-number--silver {
  color: var(--silver);
}

.medal-number--bronze {
  color: var(--bronze);
}

.delegation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.9rem;
}

.delegation-card {
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(243, 251, 255, 0.88));
  padding: 1rem;
  display: grid;
  gap: 0.95rem;
}

.delegation-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.delegation-card__body {
  display: grid;
  gap: 0.45rem;
}

.embed-snippet {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px dashed var(--border);
  background: rgba(15, 33, 48, 0.03);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.form-grid {
  display: grid;
  gap: 0.95rem;
}

.medal-form-grid {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  font: inherit;
  padding: 0.9rem 1rem;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(1, 143, 175, 0.4);
  box-shadow: 0 0 0 4px rgba(1, 143, 175, 0.12);
}

.stepper {
  display: grid;
  gap: 0.55rem;
}

.stepper-actions {
  display: flex;
  gap: 0.5rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.admin-list {
  display: grid;
  gap: 0.65rem;
}

.admin-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.9rem 1rem;
  background: rgba(255, 255, 255, 0.86);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.admin-item:hover,
.admin-item.active {
  transform: translateY(-1px);
  border-color: rgba(1, 143, 175, 0.34);
  background: rgba(1, 143, 175, 0.08);
}

.admin-item__main,
.admin-item__meta,
.actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-item__meta {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-banner {
  min-height: 1.2rem;
}

.status-banner.error {
  color: #c23239;
}

.embed-shell {
  min-height: 100vh;
  display: grid;
  place-items: stretch;
}

.embed-shell--table-only {
  min-height: auto;
}

.embed-card {
  min-height: 100vh;
  padding: 1rem;
  background: var(--panel);
}

.embed-table-scene {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  padding: 1.15rem;
  background:
    radial-gradient(circle at 14% 84%, rgba(236, 60, 67, 0.88), transparent 23%),
    radial-gradient(circle at 86% 16%, rgba(174, 213, 68, 0.9), transparent 26%),
    radial-gradient(circle at 38% 52%, rgba(139, 164, 217, 0.42), transparent 20%),
    linear-gradient(135deg, #1096b2 0%, #0e93af 48%, #80bb45 100%);
}

.embed-table-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.08), transparent 42%),
    linear-gradient(290deg, rgba(0, 0, 0, 0.08), transparent 45%);
}

.table-wrap--scene {
  position: relative;
  z-index: 1;
}

.embed-table-scene__header {
  position: relative;
  z-index: 1;
  margin-bottom: 0.7rem;
}

.embed-table-title {
  color: #ffffff;
  font-size: clamp(1.5rem, 3vw, 2.05rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.medal-scene-table {
  width: 100%;
  min-width: 760px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 12px;
}

.scene-col--rank {
  width: 86px;
}

.scene-col--country {
  width: auto;
}

.scene-col--gold,
.scene-col--silver,
.scene-col--bronze,
.scene-col--total {
  width: 84px;
}

.medal-scene-table thead th {
  border-bottom: none;
  padding: 0 0.75rem 0.35rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-align: center;
}

.medal-scene-table thead th:nth-child(2) {
  text-align: left;
}

.table-head-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
}

.medal-scene-table tbody td {
  border-bottom: none;
  padding: 0.9rem 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  backdrop-filter: blur(14px);
}

.scene-cell {
  vertical-align: middle;
}

.medal-scene-table tbody td:first-child {
  border-radius: 22px 0 0 22px;
}

.medal-scene-table tbody td:last-child {
  border-radius: 0 22px 22px 0;
}

.scene-row--podium td {
  background: rgba(255, 255, 255, 0.18);
}

.scene-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.country-cell--featured {
  gap: 0.95rem;
}

.country-copy--featured {
  gap: 0.18rem;
  min-width: 0;
}

.country-name--featured {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-name--mobile {
  display: none;
}

.country-code--featured {
  color: rgba(255, 255, 255, 0.72);
}

.medal-number--scene {
  font-size: 1.18rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.12);
}

.scene-medal-label {
  display: none;
}

.total-chip--scene {
  min-width: 62px;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
}

.table-scene-empty {
  border-radius: 22px;
  text-align: center;
  color: rgba(255, 255, 255, 0.88);
}

.compact-table th,
.compact-table td {
  padding-block: 0.78rem;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(320px, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(15, 33, 48, 0.92);
  color: #ffffff;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  box-shadow: 0 18px 38px rgba(15, 33, 48, 0.22);
}

.toast.active {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 860px) {
  .hero {
    padding: 2.3rem 2rem;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.75fr);
  }

  .admin-layout {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.2fr);
  }

  .medal-form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .podium-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
  }

  .podium-card--1 {
    min-height: 320px;
  }

  .podium-card--2,
  .podium-card--3 {
    min-height: 280px;
  }
}

@media (max-width: 859px) {
  .section-head {
    flex-direction: column;
  }

  .actions,
  .admin-item {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    padding-inline: 0.8rem;
  }

  .hero {
    border-radius: 24px;
    padding: 1.45rem 1.1rem;
  }

  .panel,
  .embed-card {
    padding: 1rem;
    border-radius: 22px;
  }

  .embed-table-scene {
    padding: 0.9rem;
  }

  .admin-item {
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  .embed-table-scene {
    min-height: auto;
    padding: 0.9rem;
  }

  .embed-table-scene__header {
    margin-bottom: 0.55rem;
  }

  .embed-table-title {
    font-size: 1.32rem;
  }

  .table-wrap--scene {
    overflow: visible;
  }

  .medal-scene-table {
    min-width: 0;
    width: 100%;
    border-spacing: 0 8px;
  }

  .scene-col--rank {
    width: 48px;
  }

  .scene-col--gold,
  .scene-col--silver,
  .scene-col--bronze {
    width: 34px;
  }

  .scene-col--total {
    width: 40px;
  }

  .medal-scene-table thead th {
    padding: 0 0.15rem 0.28rem;
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-align: center;
    white-space: nowrap;
  }

  .medal-scene-table thead th:nth-child(2) {
    text-align: left;
    padding-left: 0.1rem;
  }

  .table-head-emoji {
    font-size: 0.92rem;
  }

  .medal-scene-table tbody tr {
    display: table-row;
  }

  .scene-row--podium {
    background: transparent !important;
  }

  .medal-scene-table tbody td {
    display: table-cell;
    padding: 0.6rem 0.2rem;
    min-width: 0;
    text-align: center;
    vertical-align: middle;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(14px);
  }

  .medal-scene-table tbody td:first-child,
  .medal-scene-table tbody td:last-child {
    border-radius: 0;
  }

  .medal-scene-table tbody td:first-child {
    border-radius: 18px 0 0 18px;
  }

  .medal-scene-table tbody td:last-child {
    border-radius: 0 18px 18px 0;
  }

  .scene-row--podium td {
    background: rgba(255, 255, 255, 0.18);
  }

  .scene-cell--rank,
  .scene-cell--gold,
  .scene-cell--silver,
  .scene-cell--bronze,
  .scene-cell--total {
    text-align: center;
  }

  .scene-cell--country {
    text-align: left;
  }

  .country-cell--featured {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
    align-items: center;
    gap: 0.4rem;
  }

  .country-copy--featured {
    min-width: 0;
  }

  .country-name--desktop {
    display: none;
  }

  .country-name--mobile {
    display: block;
  }

  .country-name--featured {
    font-size: 0.92rem;
    line-height: 1;
    letter-spacing: 0.04em;
  }

  .country-code--featured {
    display: none;
  }

  .flag-avatar--xl {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.28rem;
    box-shadow: 0 8px 16px rgba(15, 33, 48, 0.12);
  }

  .scene-rank {
    min-width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 0.8rem;
  }

  .scene-medal-label {
    display: none;
  }

  .medal-number--scene {
    display: table-cell;
    font-size: 0.98rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-shadow: none;
  }

  .total-chip--scene {
    display: inline-flex;
    width: auto;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    min-width: 0;
    font-size: 0.98rem;
    box-shadow: none;
  }

  .total-chip--scene::before {
    content: none;
  }

  .table-scene-empty {
    display: block;
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.16) !important;
  }
}
