:root {
  --bg: #f7f3ec;
  --bg-accent: #efe6d8;
  --card: #ffffff;
  --ink: #1d2327;
  --muted: #66707a;
  --line: #e4ddd2;
  --red: #b3261e;
  --red-ink: #ffffff;
  --red-soft: #fbe9e7;
  --green: #1f6f4a;
  --green-soft: #e3f2ea;
  --gold: #a87b12;
  --gold-soft: #fbf1d9;
  --focus: #2563eb;
  --shadow: 0 1px 2px rgba(29, 35, 39, .06), 0 4px 16px rgba(29, 35, 39, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121618;
    --bg-accent: #192024;
    --card: #1b2226;
    --ink: #e8ecee;
    --muted: #98a3ab;
    --line: #2c363c;
    --red: #e0574d;
    --red-ink: #1b0d0b;
    --red-soft: #3a1d1b;
    --green: #5cc493;
    --green-soft: #173327;
    --gold: #e0b44a;
    --gold-soft: #33290f;
    --focus: #7aa7ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -10%, var(--bg-accent) 0, transparent 40%),
    radial-gradient(circle at 110% 10%, var(--bg-accent) 0, transparent 35%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--red); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
p { margin: 0 0 .8rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
code { background: var(--bg-accent); padding: .1em .4em; border-radius: 6px; }
address { font-style: normal; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ok { color: var(--green); font-weight: 600; }
.warn { color: var(--gold); font-weight: 600; }

/* Layout */
.topbar {
  background: var(--red);
  color: var(--red-ink);
  border-bottom: 4px solid var(--green);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: .7rem 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .4rem; }
.nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nav a, .nav .linkish { color: inherit; opacity: .92; font-size: .95rem; }
.container { max-width: 980px; width: 100%; margin: 0 auto; padding: 1.5rem 16px 3rem; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1.5rem 16px 2rem; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.4rem;
  margin-bottom: 1.25rem;
}
.card.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.card.target { border-top: 6px solid var(--green); }
.card.waiting { border-top: 6px solid var(--gold); }
.card.danger-zone { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--muted); margin: 0; }
.target-name { font-size: 2.2rem; font-weight: 800; margin: .1rem 0 1rem; color: var(--green); overflow-wrap: anywhere; }
.hero { text-align: center; padding: 3rem 0 1.5rem; }
.hero-icon { font-size: 3.5rem; }
.lead { font-size: 1.15rem; max-width: 34rem; margin: 0 auto 1rem; }
.page-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.info .facts { display: flex; gap: 2rem; flex-wrap: wrap; }
.fact { display: flex; flex-direction: column; }
.label { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: block; }
.info .message { margin: 1rem 0 0; }
.callout { background: var(--gold-soft); border-radius: 10px; padding: .7rem .9rem; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 680px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  h1 { font-size: 1.55rem; }
  .target-name { font-size: 1.8rem; }
  .card { padding: 1.1rem; }
}

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin-bottom: 1.25rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); }
.stat .num { font-size: 1.7rem; font-weight: 800; display: block; font-variant-numeric: tabular-nums; }
.stat .num small { font-size: .95rem; color: var(--muted); font-weight: 600; }

/* Forms */
form.inline { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: .9rem; }
.stack h3 { margin-bottom: 0; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.wrap > select { flex: 1 1 160px; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .93rem; }
label .muted { font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; width: 100%;
  min-width: 0;
}
input[type=checkbox] { width: 1.1rem; height: 1.1rem; accent-color: var(--green); }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px;
}

/* Buttons */
.btn, button {
  font: inherit; font-weight: 650; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--green); color: #fff; text-decoration: none; line-height: 1.2;
}
.btn:hover, button:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg-accent); filter: none; }
.btn.danger { background: transparent; color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.btn.danger:hover { background: var(--red-soft); filter: none; }
.btn.big { font-size: 1.1rem; padding: .85rem 1.5rem; }
.btn.tiny { font-size: .82rem; padding: .3rem .7rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
.linkish { background: none; border: 0; padding: 0; font-weight: 500; text-decoration: underline; color: inherit; }
@media (prefers-color-scheme: dark) { .btn:not(.secondary):not(.danger), button:not(.linkish):not(.secondary):not(.danger):not(.pill-x) { color: #0d1a14; } }

/* Badges / flash */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge-pending { background: var(--gold-soft); color: var(--gold); }
.badge-sent { background: var(--green-soft); color: var(--green); }
.badge-received { background: var(--green); color: var(--card); }
.flash { border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1.25rem; font-weight: 600; }
.flash-ok { background: var(--green-soft); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 30%, transparent); }
.flash-err { background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent); }
blockquote.thanks { margin: 0 0 1rem; padding: .8rem 1rem; background: var(--bg-accent); border-left: 4px solid var(--gold); border-radius: 8px; }
blockquote .label { margin-bottom: .25rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -.3rem 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
td.actions, th.actions { text-align: right; white-space: nowrap; }
td.actions .btn, td.actions form { margin-left: .2rem; }
td a { text-decoration: none; color: var(--ink); }
td a:hover { text-decoration: underline; }

/* Exclusion pills */
.pill-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { display: inline-flex; align-items: center; gap: .4rem; background: var(--bg-accent); border-radius: 999px; padding: .25rem .4rem .25rem .8rem; font-size: .92rem; }
.pill-x { background: transparent; color: var(--muted); padding: 0 .45rem; font-size: 1.1rem; line-height: 1; border-radius: 999px; }
.pill-x:hover { background: var(--red-soft); color: var(--red); filter: none; }

details.add-player > summary { list-style: none; margin-top: .5rem; }
details.add-player > summary::-webkit-details-marker { display: none; }
details.add-player[open] > summary { margin-bottom: 1rem; }

.copy-row { display: flex; gap: .5rem; margin: 1rem 0; }
.copy-row input { flex: 1; }

/* Confirmation dialog */
.confirm-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem;
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  width: min(440px, calc(100vw - 32px));
}
.confirm-dialog::backdrop { background: rgba(10, 14, 16, .55); }
.confirm-msg { font-size: 1.05rem; margin-bottom: 1.2rem; }
.confirm-actions { justify-content: flex-end; }
.btn.danger-solid { background: var(--red); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.danger-solid { color: var(--red-ink); } }

/* Header banner */
.banner { margin: 0 0 1.25rem; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #0a0f24; }
.banner img { display: block; width: 100%; height: auto; max-height: 260px; object-fit: cover; }
@media (max-width: 680px) { .banner img { height: 130px; } .banner img.banner-default { object-position: 78% 50%; } }
.file-input { flex: 1 1 240px; padding: .45rem; }
.card form + form { margin-top: .8rem; }
