/* ===== Halo Finland visual system + Aim Trainer components ===== */
:root {
  --bg: #000000;
  --fg: #e6f0ff;
  --muted: #a5b4c3;
  --accent: #7cc4ff;
  --accent-strong: #41a3ff;
  --card: rgba(0, 0, 0, 0.68);
  --border: rgba(255,255,255,0.08);
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  --header-height: 80px;
  --success: #71d89b;
  --danger: #ff8b98;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--fg);
  background:
    radial-gradient(circle at 50% -15%, rgba(65,163,255,0.14), transparent 34rem),
    #000;
  overflow-x: hidden;
}

a { color: var(--accent); }
a:hover { color: #b2dcff; }

/* Halo Finland header */
header {
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 10;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background: linear-gradient(to bottom, rgba(0,0,0,0.82), rgba(0,0,0,0.44));
  border-bottom: 1px solid var(--border);
}

.container {
  width: min(1100px, 92vw);
  height: 100%;
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  text-decoration: none;
}

.brand-logo {
  width: auto;
  height: 42px;
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 12px rgba(65,163,255,0.25));
}

.brand .title {
  display: block;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--fg);
}

.brand .subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  color: var(--fg);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  transition: transform .05s ease, background .2s ease, border-color .2s ease;
}
.header-link:hover {
  transform: translateY(-1px);
  background: rgba(124,196,255,0.12);
  border-color: rgba(124,196,255,0.35);
  color: var(--fg);
}

main {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 40px 0 12px;
}

.hero {
  margin: 0 0 24px;
  display: grid;
  gap: 10px;
}
.hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.hero .tagline {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(14px, 2.2vw, 18px);
  line-height: 1.6;
}

.card {
  width: 100%;
  margin: 18px auto;
  padding: clamp(18px, 2.8vw, 28px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.card h2 {
  margin: 0 0 10px;
  font-size: clamp(22px, 3vw, 28px);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}
.card p {
  color: #d6e5ff;
  line-height: 1.6;
}

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

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 8px 20px rgba(65,163,255,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
  color: #06111d;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover,
button.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  color: #06111d;
}
.btn:focus-visible,
button.btn:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Search / text input */
.input-wrap {
  position: relative;
  margin: 20px 0 18px;
}
.input-wrap .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
input[type="text"] {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.input-wrap input[type="text"] { padding-left: 44px; }
input[type="text"]::placeholder { color: #74869a; }
input[type="text"]:hover { background: rgba(255,255,255,0.05); }
input[type="text"]:focus {
  border-color: rgba(124,196,255,0.5);
  background: rgba(65,163,255,0.06);
  box-shadow: 0 0 0 4px rgba(65,163,255,0.09);
  outline: none;
}

/* Leaderboard */
.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.card-heading-copy { min-width: 0; }
.card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
  scrollbar-width: thin;
  scrollbar-color: rgba(124,196,255,.35) transparent;
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
th {
  background: rgba(255,255,255,0.035);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(124,196,255,0.055); }
tbody tr:last-child td { border-bottom: 0; }
th:nth-child(1) { width: 12%; }
th:nth-child(2) { width: 38%; }
th:nth-child(3) { width: 20%; }
th:nth-child(4) { width: 30%; }
td:nth-child(2) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
  color: var(--fg);
  font-weight: 800;
}
.rank-1 { color: #ffd75e; border-color: rgba(255,215,94,.34); background: rgba(255,215,94,.07); }
.rank-2 { color: #dbe7f3; border-color: rgba(219,231,243,.26); background: rgba(219,231,243,.055); }
.rank-3 { color: #e2a36f; border-color: rgba(226,163,111,.32); background: rgba(226,163,111,.065); }

.leaderboard-footer {
  width: 100%;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}
.leaderboard-footer p { margin: 0; color: inherit; }

/* Messages */
.flash,
#status {
  display: none;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  line-height: 1.45;
}
.flash:not(:empty),
#status:not(:empty) { display: block; }
.flash.success,
#status.success {
  border-color: rgba(113,216,155,.35);
  background: rgba(113,216,155,.08);
  color: #bcf4d1;
}
.flash.error,
#status.error {
  border-color: rgba(255,139,152,.35);
  background: rgba(255,139,152,.08);
  color: #ffd0d5;
}

/* Participation instructions */
.instructions {
  border-left: 3px solid var(--accent-strong);
  padding-left: clamp(16px, 2vw, 24px);
}
.instructions h2 { margin-bottom: 16px; }
.instructions ol {
  margin: 0;
  padding-left: 22px;
  color: #d6e5ff;
  line-height: 1.72;
}
.instructions li + li { margin-top: 6px; }
.instructions a { text-underline-offset: 3px; }

.note {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  color: #d6e5ff;
  line-height: 1.55;
}
.note strong { color: var(--fg); }
.note.auto {
  border-color: rgba(113,216,155,.22);
  background: rgba(113,216,155,.055);
}
.note.warning {
  border-color: rgba(255,215,94,.22);
  background: rgba(255,215,94,.055);
}

/* Manual add-player page */
.centered-main {
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100svh - var(--header-height));
  display: grid;
  place-items: center;
  padding: 40px 0;
}
.add-player-card { max-width: 560px; }
.add-player-card h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 6vw, 42px);
  letter-spacing: -.025em;
}
.add-player-card .intro {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.6;
}
.add-player-form {
  display: grid;
  gap: 12px;
}
.add-player-form .btn { width: 100%; }

/* Footer */
.site-footer {
  width: min(1100px, 92vw);
  margin: 10px auto 0;
  padding: 22px 0 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 14px 20px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.footer-links a:hover { color: var(--fg); }

@media (max-width: 700px) {
  :root { --header-height: 72px; }
  .container { width: min(1100px, 94vw); }
  main,
  .site-footer { width: min(1100px, 94vw); }
  main { padding-top: 26px; }
  .brand-logo { height: 36px; }
  .brand .subtitle { display: none; }
  .header-link { padding: 7px 10px; font-size: 13px; }
  .hero { margin-bottom: 14px; }
  .card { margin: 14px auto; padding: 18px; border-radius: 16px; }
  .card-heading { align-items: stretch; }
  .card-heading .btn { width: 100%; }
  th, td { padding: 12px 12px; }
}

@media (max-width: 430px) {
  .brand .title { font-size: 14px; }
  .header-link { font-size: 12px; }
  .hero h1 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}
