/* ===== World Cup 2026 inspired palette ===== */
:root {
  --wc-purple: #7B00E5;
  --wc-purple-deep: #5400A8;
  --wc-purple-light: #9A33F0;
  --wc-red: #E61E2B;
  --wc-red-deep: #B30E1C;
  --wc-lime: #C8E91E;
  --wc-lime-bright: #DCF534;
  --wc-gold: #E5B53D;
  --wc-gold-bright: #F4C947;
  --wc-trophy-green: #003D2C;
  --wc-white: #FFFFFF;
  --wc-black: #0A0A0A;

  --bg: #F5F3EE;
  --surface: #FFFFFF;
  --surface-muted: #F3F0E8;
  --text: #14101C;
  --text-muted: #5C5868;
  --border: #E6E2D8;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 28, 0.05), 0 1px 3px rgba(20, 16, 28, 0.06);
  --shadow-md: 0 10px 28px rgba(123, 0, 229, 0.10), 0 2px 6px rgba(20, 16, 28, 0.05);
  --shadow-lg: 0 24px 60px rgba(84, 0, 168, 0.22);
}

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

body {
  font-family: 'Inter', 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== Banner — WC26-style color block composition ===== */
.banner {
  position: relative;
  background: var(--wc-purple);
  color: var(--wc-white);
  padding: 56px 24px 96px;
  overflow: hidden;
  isolation: isolate;
}

/* Decorative geometric color blocks */
.banner__shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.banner__shape {
  position: absolute;
  display: block;
  border-radius: 50%;
}
/* Big red curved blob — right side */
.banner__shape--red {
  width: 900px;
  height: 900px;
  right: -260px;
  top: -180px;
  background: var(--wc-red);
}
/* Smaller deep-red accent overlapping the red */
.banner__shape--red-deep {
  width: 320px;
  height: 320px;
  right: 18%;
  top: -120px;
  background: var(--wc-red-deep);
  opacity: 0.85;
}
/* Lime green corner wedge — bottom-right */
.banner__shape--lime {
  width: 520px;
  height: 520px;
  right: -180px;
  bottom: -260px;
  background: var(--wc-lime);
}
/* Small floating dot — purple accent on lime */
.banner__shape--dot {
  width: 90px;
  height: 90px;
  right: 8%;
  bottom: 6%;
  background: var(--wc-purple-deep);
  opacity: 0.6;
}

.banner__inner {
  position: relative;
  z-index: 2;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: center;
  justify-content: space-between;
}

.banner__brand { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }

.banner__badge {
  display: inline-flex;
  width: max-content;
  padding: 6px 14px;
  background: var(--wc-white);
  color: var(--wc-black);
  font-weight: 800;
  letter-spacing: 2px;
  font-size: 11px;
  border-radius: 999px;
  text-transform: uppercase;
}

.banner__title {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: clamp(44px, 8vw, 96px);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 0.92;
  color: var(--wc-white);
}
.banner__title-line {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.18);
}
.banner__title-line--accent { color: var(--wc-lime-bright); }
.banner__title-cup {
  display: inline-block;
  font-size: 0.78em;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
  transform: translateY(-0.05em);
}

.banner__subtitle {
  margin: 8px 0 0;
  color: rgba(255,255,255,0.86);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.4px;
}

/* Banner meta column (period + countdown) */
.banner__meta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  min-width: 280px;
}
.banner__period {
  display: flex; flex-direction: column;
  padding: 12px 16px;
  background: rgba(0,0,0,0.22);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
}
.banner__period-label {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--wc-lime-bright);
  font-weight: 700;
}
.banner__period-value {
  margin-top: 4px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--wc-white);
}

.countdown {
  background: var(--wc-white);
  color: var(--wc-black);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.countdown__label {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--wc-purple);
  margin-bottom: 10px;
  text-align: center;
  font-weight: 800;
}
.countdown__digits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  text-align: center;
}
.countdown__digits > div {
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 4px;
  border: 1px solid var(--border);
}
.countdown__digits span {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1;
  color: var(--wc-purple-deep);
  letter-spacing: -0.02em;
}
.countdown__digits em {
  font-style: normal;
  display: block;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 600;
}
.countdown.is-ended .countdown__digits { opacity: 0.4; }

/* ===== Layout ===== */
.container {
  max-width: 1180px;
  margin: -56px auto 40px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  position: relative;
  z-index: 3;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
/* Top color stripe per card */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--wc-purple) 0%, var(--wc-red) 50%, var(--wc-lime) 100%);
}

.card__header { margin-bottom: 18px; }
.card__header--row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}
.card__title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--wc-purple-deep);
  letter-spacing: -0.02em;
}
.card__hint { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.card__footer { margin-top: 18px; }
.note { margin: 0; color: var(--text-muted); font-size: 13px; }

/* ===== Lookup ===== */
.lookup__form { margin-top: 4px; }
.lookup__field { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup__field input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 13px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.lookup__field input:focus {
  outline: none;
  border-color: var(--wc-purple);
  background: var(--wc-white);
  box-shadow: 0 0 0 4px rgba(123, 0, 229, 0.14);
}
.lookup__field button {
  padding: 13px 28px;
  background: var(--wc-black);
  color: var(--wc-white);
  font-weight: 800;
  letter-spacing: 1.5px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  position: relative;
  overflow: hidden;
}
.lookup__field button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--wc-purple) 0%, var(--wc-red) 100%);
  opacity: 0;
  transition: opacity 0.2s;
}
.lookup__field button span,
.lookup__field button { position: relative; }
.lookup__field button:hover:not(:disabled)::before { opacity: 1; }
.lookup__field button:hover:not(:disabled) { box-shadow: 0 8px 20px rgba(123, 0, 229, 0.3); }
.lookup__field button:active:not(:disabled) { transform: translateY(1px); }
.lookup__field button:disabled { opacity: 0.45; cursor: not-allowed; }
.lookup__validation {
  margin: 8px 0 0;
  color: var(--wc-red-deep);
  font-size: 13px;
  font-weight: 600;
}

.lookup__result {
  margin-top: 18px;
  border-radius: 14px;
  padding: 20px;
  background: var(--surface-muted);
  border: 2px dashed var(--border);
}
.lookup__result.is-success {
  background: linear-gradient(135deg, rgba(200, 233, 30, 0.18), rgba(255,255,255,0.5));
  border-style: solid;
  border-color: var(--wc-lime);
}
.lookup__result.is-unranked {
  background: linear-gradient(135deg, rgba(229, 181, 61, 0.14), rgba(255,255,255,0.5));
  border-style: solid;
  border-color: var(--wc-gold);
}
.lookup__result.is-error {
  background: linear-gradient(135deg, rgba(230, 30, 43, 0.10), rgba(255,255,255,0.5));
  border-style: solid;
  border-color: var(--wc-red);
}

.result__row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 16px;
  align-items: center;
}
.result__row + .result__row { margin-top: 10px; }
.result__label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 700;
}
.result__value {
  font-size: 19px;
  font-weight: 800;
  color: var(--wc-purple-deep);
  letter-spacing: -0.01em;
}
.result__value--rank {
  font-size: 32px;
  color: var(--wc-red);
  font-weight: 900;
}
.result__msg { margin: 0; color: var(--text); }

/* ===== Leaderboard ===== */
.leaderboard__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.meta__chip {
  background: var(--wc-purple);
  color: var(--wc-white);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.meta__chip--muted {
  background: var(--surface-muted);
  color: var(--text-muted);
  font-weight: 600;
}

.leaderboard__body { min-height: 60px; }
.state {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.state--error { color: var(--wc-red-deep); font-weight: 600; }

.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th, .lb-table td {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.lb-table th {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--wc-white);
  background: var(--wc-purple-deep);
  font-weight: 800;
  border-bottom: none;
}
.lb-table th:first-child { border-top-left-radius: 10px; }
.lb-table th:last-child { border-top-right-radius: 10px; }
.lb-table th:first-child, .lb-table td.rank { width: 80px; text-align: center; }
.lb-table td.fp {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--wc-purple-deep);
  font-size: 15px;
}
.lb-table tbody tr { transition: background 0.12s; }
.lb-table tbody tr:hover { background: rgba(200, 233, 30, 0.14); }

/* Highlight the top-3 rows */
.lb-table tbody tr:nth-child(1) { background: linear-gradient(90deg, rgba(229, 181, 61, 0.10), transparent 60%); }
.lb-table tbody tr:nth-child(1):hover { background: rgba(229, 181, 61, 0.18); }

.rank-pill {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  font-weight: 900;
  background: var(--surface-muted);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  font-size: 15px;
}
.rank-pill.is-1 {
  background: linear-gradient(135deg, var(--wc-gold), var(--wc-gold-bright));
  color: #4a3200;
  box-shadow: 0 6px 14px rgba(229, 181, 61, 0.42);
}
.rank-pill.is-2 {
  background: linear-gradient(135deg, #c4cad0, #f0f3f5);
  color: #2a323a;
  box-shadow: 0 4px 10px rgba(120, 130, 140, 0.3);
}
.rank-pill.is-3 {
  background: linear-gradient(135deg, #cd7f32, #e8a667);
  color: #3a1f00;
  box-shadow: 0 4px 10px rgba(205, 127, 50, 0.35);
}

.lb-table tr.is-tied td.rank::after {
  content: 'TIED';
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  background: var(--wc-lime);
  color: var(--wc-black);
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: 1px;
  vertical-align: middle;
  font-weight: 700;
}

.nickname { font-weight: 700; color: var(--text); }
.user-id {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 6px;
  font-family: 'SFMono-Regular', Consolas, monospace;
}

/* ===== Rules ===== */
.rules__list { margin: 0; padding: 0; list-style: none; }
.rules__list li {
  padding: 12px 0 12px 32px;
  border-bottom: 1px solid var(--border);
  position: relative;
  color: var(--text);
  font-size: 14px;
}
.rules__list li:last-child { border-bottom: 0; }
.rules__list li::before {
  content: '';
  position: absolute;
  left: 6px; top: 18px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--wc-purple);
  box-shadow: 0 0 0 3px rgba(123, 0, 229, 0.18);
}
.rules__list li:nth-child(3n+2)::before { background: var(--wc-red); box-shadow: 0 0 0 3px rgba(230, 30, 43, 0.18); }
.rules__list li:nth-child(3n+3)::before { background: var(--wc-lime); box-shadow: 0 0 0 3px rgba(200, 233, 30, 0.32); }

.rules__sublist {
  margin: 8px 0 0;
  padding: 0 0 0 18px;
  list-style: none;
  color: var(--text-muted);
  font-size: 13px;
}
.rules__sublist li {
  padding: 4px 0 4px 14px;
  border: none;
  position: relative;
}
.rules__sublist li::before {
  content: '›';
  position: absolute;
  left: 0; top: 3px;
  width: auto; height: auto;
  background: none;
  box-shadow: none;
  color: var(--wc-purple);
  font-weight: 800;
  font-size: 14px;
  border-radius: 0;
}

code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: var(--wc-black);
  color: var(--wc-lime-bright);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.88em;
  font-weight: 600;
}

.site-footer {
  text-align: center;
  padding: 28px;
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: 0.3px;
}

/* ===== Responsive tweaks ===== */
@media (max-width: 880px) {
  .banner__shape--red { width: 600px; height: 600px; right: -200px; top: -160px; }
  .banner__shape--red-deep { width: 220px; height: 220px; right: 10%; top: -80px; }
  .banner__shape--lime { width: 360px; height: 360px; right: -160px; bottom: -200px; }
  .banner__shape--dot { width: 60px; height: 60px; }
}

@media (max-width: 640px) {
  .banner { padding: 32px 18px 72px; }
  .banner__inner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .banner__meta { width: 100%; }
  .container { padding: 0 16px; margin-top: -44px; }
  .card { padding: 20px; }
  .result__row { grid-template-columns: 88px 1fr; }
  .lb-table th:nth-child(4), .lb-table td:nth-child(4) { display: none; }
  .banner__title { font-size: clamp(40px, 14vw, 64px); }
}
