/* DECTRIS 20-years party app — house style
   Navy #00244D · Blue #004899 · Gray-blue #566473 · Light #F5F8FB */

@font-face {
  font-family: 'Open Sans';
  src: url('/fonts/OpenSans-var.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Roboto Mono';
  src: url('/fonts/RobotoMono-var.woff2') format('woff2');
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --navy: #00244D;
  --blue: #004899;
  --blue-bright: #0A6ED1;
  --gray: #566473;
  --bg: #F5F8FB;
  --card: #FFFFFF;
  --line: #DDE5EE;
  --green: #0FA36B;
  --red: #C0392B;
  --amber: #E8890C;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Open Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--navy);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mono { font-family: 'Roboto Mono', ui-monospace, monospace; }

h1 { font-size: 1.5rem; font-weight: 700; line-height: 1.25; margin: 0.3em 0 0.5em; }
h2 { font-size: 1.15rem; font-weight: 700; margin: 1em 0 0.5em; }

a { color: var(--blue); }
.muted { color: var(--gray); font-size: 0.9rem; }

/* --- Layout ------------------------------------------------------------- */

/* Party accents pulled from the colorful "20 years" logo */
:root {
  --party-orange: #F5A623;
  --party-pink: #E84393;
  --party-teal: #14B8A6;
}
.party-stripe {
  height: 4px;
  background: linear-gradient(90deg,
    var(--party-orange), var(--party-pink), #7C3AED, var(--blue), var(--party-teal));
}

.topbar {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  gap: 1rem;
}
.topbar-logo { height: 38px; display: block; }
.topbar-nav { display: flex; gap: 1rem; min-width: 0; }
.topbar-nav a { color: var(--navy); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.topbar-teamname {
  max-width: 45vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-teamname::before { content: '👥 '; }
.topbar-nav a:active { opacity: 0.7; }

.container {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.footer {
  text-align: center;
  padding: 1rem;
  color: var(--gray);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  background: #fff;
}

/* --- Hero ----------------------------------------------------------------- */

.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero h1 { font-size: 1.6rem; }
.hero-sub { color: var(--gray); }
.hero-badge {
  width: 92px; height: 92px;
  margin: 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--party-orange) 0%, var(--party-pink) 50%, var(--party-teal) 100%);
  color: #fff;
  font-family: 'Roboto Mono', monospace;
  font-size: 2.4rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 36, 77, 0.25);
}
.hero-badge-sub { font-size: 0.75rem; font-weight: 400; letter-spacing: 0.2em; text-transform: uppercase; }

/* --- Cards & forms ------------------------------------------------------------ */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0, 36, 77, 0.06);
}
.card.center { text-align: center; }
.card-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .card-grid { grid-template-columns: 1fr 1fr; } }
.card-grid .card { border-top: 5px solid var(--party-orange); }
.card-grid .card:nth-child(2) { border-top-color: var(--party-teal); }
.station-card { border-top: 5px solid var(--chip, var(--blue)); }

label { display: block; font-weight: 600; font-size: 0.9rem; margin: 0.9rem 0 0.3rem; }

input[type='text'], input[type='password'], input[type='number'], textarea, select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  color: var(--navy);
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 72, 153, 0.15);
}
.input-code { text-transform: uppercase; letter-spacing: 0.25em; font-family: 'Roboto Mono', monospace; }

.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.7rem 1.3rem;
  font: inherit;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: filter 0.15s;
}
.btn:active { filter: brightness(1.15); }
.btn-primary { background: linear-gradient(135deg, var(--blue-bright), var(--blue)); color: #fff; width: 100%; box-shadow: 0 3px 10px rgba(0, 72, 153, 0.3); }
.btn-secondary { background: #E8F0F9; color: var(--blue); width: 100%; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: none; color: var(--gray); border: 1.5px solid var(--line); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; margin-top: 0; width: auto; }
.btn-link { background: none; border: none; color: var(--blue); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
@media (min-width: 640px) { .btn-primary, .btn-secondary { width: auto; } }

.alert { border-radius: 8px; padding: 0.75rem 1rem; margin: 1rem 0; font-size: 0.95rem; }
.alert-error { background: #FBEAE8; color: var(--red); border: 1px solid #F0C4BE; }
.alert-success { background: #E7F6EF; color: #0B6E49; border: 1px solid #BEE3D2; }
.alert-info { background: #E8F0F9; color: var(--blue); border: 1px solid #C6DBF1; }

.how-it-works ol { padding-left: 1.2rem; }
.how-it-works li { margin: 0.4rem 0; }

/* --- Team banner & progress ---------------------------------------------------- */

.team-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(120deg, var(--navy) 0%, var(--blue) 85%, var(--party-teal) 180%);
  color: #fff;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 6px 18px rgba(0, 36, 77, 0.25);
}
.team-banner-name { font-size: 1.2rem; font-weight: 700; }
.team-banner-code { font-size: 0.85rem; opacity: 0.85; }
.team-banner-code .mono { font-size: 1rem; letter-spacing: 0.15em; color: #9FD1FF; }

.progress-ring {
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--navy) 74%, transparent 75% 100%),
    var(--ring, conic-gradient(rgba(255,255,255,0.15) 0 100%));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
}

/* --- Station list ------------------------------------------------------------- */

.category-block { margin: 1.25rem 0; }
.category-title { margin-bottom: 0.5rem; }
.chip {
  display: inline-block;
  background: var(--chip, var(--blue));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.station-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.station-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 5px solid var(--chip, var(--blue));
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  color: var(--navy);
}
.station-item.is-done { background: #F2FAF6; border-color: #BEE3D2; border-left-color: var(--green); text-decoration: none; }
a.station-item .station-meta { color: var(--green); font-weight: 600; }

.team-settings {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 1rem 0;
}
.team-settings summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.8rem 1rem;
  color: var(--blue);
}
.team-settings-body { padding: 0 1rem 1rem; border-top: 1px solid var(--line); }
.team-settings-body > p { font-size: 0.95rem; }

.qr-hint {
  text-align: center;
  font-weight: 600;
  background: #FDF6EC;
  border: 1px dashed var(--party-orange);
  border-radius: 10px;
  padding: 0.7rem 1rem;
}
.station-num {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--chip, var(--blue));
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.station-num.lg { width: 46px; height: 46px; font-size: 1.2rem; }
.station-info { flex: 1; min-width: 0; }
.station-name { display: block; font-weight: 600; }
.station-meta { display: block; color: var(--gray); font-size: 0.8rem; }
.station-status { font-size: 1.1rem; color: var(--gray); }
.is-done .station-status { color: var(--green); font-weight: 700; }

/* --- Station detail -------------------------------------------------------------- */

.backlink { display: inline-block; margin: 0.25rem 0; text-decoration: none; font-weight: 600; }
.station-head { display: flex; gap: 1rem; align-items: flex-start; }
.station-head h1 { margin: 0.2em 0 0.1em; }
.station-desc { border-left: 3px solid var(--line); padding-left: 0.9rem; color: #22354a; }

.choices { border: none; margin: 0; padding: 0; }
.choices legend { font-weight: 600; font-size: 0.9rem; padding: 0; margin-bottom: 0.4rem; }
.choice {
  display: flex; align-items: center; gap: 0.7rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.4rem 0;
  font-weight: 400;
  cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--blue); background: #E8F0F9; }
.choice input { accent-color: var(--blue); width: 1.1rem; height: 1.1rem; }

.answer-locked { background: #F2FAF6; border: 1px solid #BEE3D2; border-radius: 10px; padding: 1rem; }
.answer-parts { list-style: none; margin: 0.5rem 0; padding: 0; }
.answer-parts li { padding: 0.25rem 0; font-size: 0.95rem; }
.answer-quote { font-style: italic; background: #EDF2F8; border-radius: 6px; padding: 0.1rem 0.4rem; }
.answer-photo { max-width: 100%; border-radius: 10px; border: 1px solid var(--line); margin: 0.6rem 0; }
.one-shot-note { margin-top: 0.6rem; }
.part-audio { display: block; width: 100%; margin: 0.3rem 0 0.5rem; }

.visually-hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.photo-label { cursor: pointer; }
.photo-btn { display: block; }
.photo-filename:empty { display: none; }

.join-code-box { background: var(--bg); border-radius: 10px; padding: 1rem; margin: 1rem 0; }
.join-code {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  color: var(--blue);
  padding: 0.5rem;
  user-select: all;
}

.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list li {
  display: flex; gap: 0.7rem; align-items: baseline;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.progress-list li a { flex: 1; text-decoration: none; color: var(--navy); }
.progress-list .station-status { font-size: 0.85rem; }
.progress-list li.is-done .station-status { color: var(--green); }

/* --- Admin -------------------------------------------------------------------- */

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 1rem; align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 1rem;
  margin: 0.5rem 0 1rem;
}
.admin-nav a { text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.inline-form { display: inline; }
.admin-login { max-width: 420px; margin: 2rem auto; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--blue); }
.stat-label { color: var(--gray); font-size: 0.85rem; }
.stat-attention { border-color: var(--amber); background: #FDF6EC; }
.stat-attention .stat-value { color: var(--amber); }

.danger-zone {
  margin-top: 2.5rem;
  border: 1px solid #F0C4BE;
  border-radius: 10px;
  background: #fff;
}
.danger-zone summary { cursor: pointer; font-weight: 700; color: var(--red); padding: 0.8rem 1rem; }
.danger-zone-body { padding: 0 1rem 1rem; border-top: 1px solid #F0C4BE; }
.danger-zone-body input { max-width: 200px; }

.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.filter-bar select { width: auto; flex: 1; min-width: 140px; }
.filter-bar .btn { margin-top: 0; width: auto; }

.inbox-card { padding: 1rem; }
.inbox-head { display: flex; gap: 0.8rem; align-items: center; }
.inbox-head > div { flex: 1; }
.inbox-answer { margin: 0.7rem 0; display: inline-block; }
.grade-badge { background: #E7F6EF; color: #0B6E49; border-radius: 6px; padding: 0.25rem 0.6rem; font-size: 0.85rem; white-space: nowrap; }
.pending-badge { background: #FDF6EC; color: var(--amber); border-radius: 6px; padding: 0.25rem 0.6rem; font-size: 0.85rem; white-space: nowrap; }
.card-missing { opacity: 0.55; }
.team-link { text-decoration: none; }
.team-link:hover { text-decoration: underline; }
.team-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.team-detail-head .stat-card { min-width: 130px; }
.grade-form { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 0.8rem; padding-top: 0.2rem; }
.grade-form label { flex: 0 1 130px; }
.grade-form .btn { margin-top: 0.9rem; width: auto; }
.points-input { font-size: 1.1rem; }
.inbox-card .answer-photo { max-height: 320px; }
.btn-delete-sub { color: var(--red); font-size: 0.8rem; margin-top: 0.5rem; }
.jury-hint { background: #FDF6EC; border: 1px dashed var(--amber); border-radius: 8px; padding: 0.5rem 0.8rem; margin: 0.7rem 0; font-size: 0.85rem; color: #6b4e10; }
.jury-hint div { padding: 0.1rem 0; }

.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: var(--bg); color: var(--gray); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.table tr:last-child td { border-bottom: none; }
.top-three td { background: #FDF9EC; }
.rename-form { display: flex; gap: 0.5rem; align-items: center; }
.rename-form input { width: auto; min-width: 160px; padding: 0.35rem 0.5rem; }

/* --- QR sheet ---------------------------------------------------------------- */

.qr-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 1.5rem 0; }
.qr-card {
  background: #fff;
  border: 2px solid var(--chip, var(--blue));
  border-radius: 14px;
  padding: 1.25rem;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}
.qr-card-head { display: flex; gap: 0.8rem; align-items: center; text-align: left; margin-bottom: 0.8rem; }
.qr-card-head .station-num { background: var(--chip, var(--blue)); }
.qr-card-title { font-weight: 700; }
.qr-card-cat { color: var(--gray); font-size: 0.85rem; }
.qr-svg svg { width: 100%; max-width: 240px; height: auto; }
.qr-url { font-size: 0.72rem; color: var(--gray); word-break: break-all; margin-top: 0.5rem; }

@media print {
  .no-print, .topbar, .footer { display: none !important; }
  body, .container { background: #fff; max-width: none; padding: 0; }
  .qr-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

/* --- Confetti ------------------------------------------------------------------ */

.confetti-piece {
  position: fixed;
  top: -12px;
  width: 9px; height: 14px;
  z-index: 999;
  pointer-events: none;
  animation: confetti-fall 2.6s ease-in forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.3; }
}
