/* Badminton court: green court, white lines, yellow shuttle accents. */
:root {
  --court: #1d7a4c;
  --court-dark: #14613d;
  --court-deep: #0e4a2e;
  --line: #f7f9f4;
  --shuttle: #ffd23f;
  --ink: #10251a;
  --danger: #c8412f;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  color: var(--line);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { background: var(--court-dark); }
body {
  margin: 0 auto; max-width: 560px; min-height: 100vh;
  padding: 0 12px calc(16px + env(safe-area-inset-bottom));
  /* faint court lines running down the page */
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(255,255,255,.08) calc(50% - 1px), rgba(255,255,255,.08) calc(50% + 1px), transparent calc(50% + 1px)),
    var(--court-dark);
}

.top {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 4px 14px;
  border-bottom: 3px solid var(--line); margin-bottom: 16px;
}
.logo { width: 52px; height: 52px; flex: none; transform: rotate(-30deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.top h1 { margin: 0; font-size: 1.5rem; letter-spacing: .02em; text-transform: uppercase; }
.sub { margin: 2px 0 0; font-size: .85rem; opacity: .8; }

.loading { text-align: center; padding: 2rem 1rem; opacity: .85; }

/* Each panel is a court: white outer line plus the inner doubles line. */
.court {
  background: var(--court); border: 3px solid var(--line); border-radius: 4px;
  box-shadow: inset 0 0 0 6px var(--court), inset 0 0 0 8px rgba(247,249,244,.35);
  padding: 18px 16px; margin: 0 0 16px;
}
.court h2 { margin: 0 0 6px; font-size: 1.3rem; }
.court h3 { margin: 16px 0 8px; font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; opacity: .85; }
.hint { margin: 0 0 14px; font-size: .92rem; opacity: .85; }
.hello { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.banner { background: var(--shuttle); color: var(--ink); font-weight: 600; border-radius: 6px; padding: 10px 12px; margin: 8px 0; }

/* name picker */
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name {
  min-height: 56px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--court-deep); color: var(--line); font: inherit; font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 10px;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.name:active:not(:disabled) { background: var(--shuttle); color: var(--ink); border-color: var(--shuttle); }
.name.done, .name:disabled { opacity: .45; cursor: default; }
.name small { font-weight: 400; font-size: .75rem; }

/* vote form */
.card {
  border: 2px dashed rgba(247,249,244,.55); border-radius: 6px; margin: 0 0 14px; padding: 12px 12px 14px;
}
.card legend { font-weight: 700; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.num {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--shuttle); color: var(--ink); font-size: .9rem;
}
label { display: block; font-size: .9rem; margin: 8px 0 4px; opacity: .9; }
select, textarea, input {
  width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: #fff;
  border: 2px solid transparent; border-radius: 8px; padding: 10px 12px; min-height: 48px;
}
select:focus, textarea:focus, input:focus { outline: none; border-color: var(--shuttle); }
textarea { resize: vertical; }

.btn {
  display: block; width: 100%; min-height: 52px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; cursor: pointer; padding: 10px 18px;
}
.btn.primary { background: var(--shuttle); color: var(--ink); box-shadow: 0 3px 0 #c9a21f; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #c9a21f; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { width: auto; min-height: 44px; font-size: .85rem; padding: 6px 14px; flex: none; }
.btn:disabled { opacity: .6; }
.link {
  background: none; border: 0; color: var(--shuttle); font: inherit; font-size: .9rem;
  text-decoration: underline; padding: 10px 0; min-height: 44px; cursor: pointer;
}
.error { background: #fff; color: var(--danger); font-weight: 600; border-radius: 6px; padding: 8px 12px; margin: 0 0 12px; }

/* thank you: a shuttle flies over the net */
.thanks { text-align: center; }
.rally { position: relative; height: 120px; margin: 0 0 10px; overflow: hidden; }
.net {
  position: absolute; left: 50%; bottom: 0; width: 6px; height: 64px; transform: translateX(-50%);
  background: repeating-linear-gradient(0deg, var(--line) 0 2px, transparent 2px 8px);
  border-top: 4px solid var(--line);
}
.flying { position: absolute; width: 44px; height: 44px; left: 0; bottom: 0; animation: rally 2.4s ease-in-out infinite alternate; }
@keyframes rally {
  0%   { transform: translate(0, -8px) rotate(60deg); }
  50%  { transform: translate(calc(min(560px, 100vw) / 2 - 70px), -70px) rotate(90deg); }
  100% { transform: translate(calc(min(560px, 100vw) - 130px), -8px) rotate(120deg); }
}
@media (prefers-reduced-motion: reduce) { .flying { animation: none; left: calc(50% - 22px); bottom: 70px; } }

/* who has voted */
.bar { height: 12px; background: var(--court-deep); border-radius: 999px; overflow: hidden; border: 2px solid var(--line); }
.bar span { display: block; height: 100%; background: var(--shuttle); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border-radius: 999px; padding: 6px 12px; font-size: .9rem; font-weight: 600; }
.chip.waiting { border: 2px solid var(--shuttle); color: var(--shuttle); }
.chip.voted { background: rgba(247,249,244,.15); }

/* manager scoreboard */
.pin input { text-align: center; letter-spacing: .4em; font-size: 1.4rem; margin-bottom: 12px; }
.row { border-top: 2px solid rgba(247,249,244,.35); }
.row:last-child { border-bottom: 2px solid rgba(247,249,244,.35); }
.row summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 56px; padding: 6px 2px; cursor: pointer;
}
.row summary::-webkit-details-marker { display: none; }
.row summary::after { content: "▸"; opacity: .6; order: -1; transition: transform .15s; }
.row[open] summary::after { transform: rotate(90deg); }
.who { flex: 1; font-weight: 600; }
.score {
  min-width: 52px; text-align: center; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums;
  background: #0b1f15; color: var(--shuttle); border-radius: 6px; padding: 4px 8px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.row.leader summary { color: var(--shuttle); }
.row.leader .score { background: var(--shuttle); color: var(--ink); }
.reasons { list-style: none; margin: 0 0 12px; padding: 0 0 0 20px; }
.reasons li { background: rgba(0,0,0,.18); border-radius: 6px; padding: 8px 10px; margin: 0 0 8px; }
.reasons p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ballots { list-style: none; margin: 0; padding: 0; }
.ballot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid rgba(247,249,244,.3);
}
.ballot div { font-size: .95rem; }

.foot { text-align: center; padding: 8px 0 4px; }
.foot a { color: var(--line); opacity: .75; font-size: .9rem; display: inline-block; padding: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #0b1f15; color: #fff; padding: 12px 18px; border-radius: 999px; font-size: .95rem;
  box-shadow: 0 4px 12px rgba(0,0,0,.35); max-width: calc(100vw - 32px); z-index: 10;
}
