/* Survivor Pool — night jungle / tribal council */
:root {
  --bg: #0b0906;
  --jungle: #0c1a16;
  --water: #0e3d38;
  --teal: #1a5c54;
  --panel: #1a140e;
  --panel-2: #241c14;
  --wood: #3a2a18;
  --wood-edge: #5a4030;
  --line: #4a3524;
  --line-strong: #6e5034;
  --flame: #e8892a;
  --flame-2: #f4b24a;
  --ember: #ff6b1a;
  --parchment: #efe4c4;
  --sand: #d8c49a;
  --ink: #f4ead4;
  --muted: #b8a888;
  --faint: #7a6c58;
  --win: #4cbe7a;
  --loss: #d04a3a;
  --tie: #c9a24a;
  --live: #ff6b3d;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --tap: 48px;
  --font: "Source Sans 3", system-ui, sans-serif;
  --display: "Anton", Impact, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}
a { color: var(--flame-2); text-decoration: none; }
button, input, select { font: inherit; }
img { max-width: 100%; }

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

.jungle-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(900px 420px at 82% 118%, rgba(232,137,42,0.20), transparent 52%),
    radial-gradient(720px 460px at 8% -8%, rgba(14,61,56,0.55), transparent 55%),
    radial-gradient(500px 280px at 50% 0%, rgba(232,137,42,0.07), transparent 60%),
    linear-gradient(180deg, #0d1a16 0%, #0b0906 48%, #1a0c06 100%);
}
.jungle-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.045'/%3E%3C/svg%3E");
  opacity: 0.7;
}
.palm {
  position: absolute; height: min(78vh, 620px); width: auto; opacity: 0.42;
  filter: blur(0.2px);
}
.palm-left { left: -36px; bottom: -40px; }
.palm-right { right: -40px; bottom: -50px; }
.fire-glow {
  position: absolute; left: 50%; bottom: -80px; transform: translateX(-50%);
  width: 70vw; height: 280px;
  background: radial-gradient(ellipse at center, rgba(232,137,42,0.18), transparent 70%);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px;
  background: rgba(11, 9, 6, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(232,137,42,0.18);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(244,178,74,0.35), transparent 55%),
    linear-gradient(165deg, #3a2a18, #1a120c);
  border: 1px solid #6e5034;
  box-shadow: inset 0 1px 0 rgba(244,210,122,0.25), 0 0 16px rgba(232,137,42,0.18);
}
.brand-text { display: flex; flex-direction: column; line-height: 0.86; }
.brand-name {
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.22em;
  line-height: 1;
  color: var(--parchment);
}
.brand-sub {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.42em;
  color: var(--flame);
  padding-left: 1px;
}
.who { color: var(--muted); font-size: 13px; text-align: right; }
.who strong { color: var(--ink); font-weight: 700; }
.who-name {
  display: inline; margin: 0; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; cursor: pointer; text-align: inherit;
}
.who-name:hover strong { text-decoration: underline; text-underline-offset: 3px; }

.app { width: min(1120px, calc(100% - 28px)); margin: 22px auto 80px; }
.boot, .empty {
  padding: 36px 20px; text-align: center; color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--serif);
}

.hero {
  padding: 28px 8px 10px;
  text-align: center;
}
.kicker {
  color: var(--flame-2);
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
}
.wordmark {
  margin: 10px 0 4px;
}
.wordmark .wm-survivor {
  display: block;
  font-family: var(--display);
  font-size: clamp(56px, 13vw, 112px);
  letter-spacing: 0.16em;
  line-height: 0.86;
  color: var(--parchment);
  text-shadow: 0 2px 0 #3a2410, 0 10px 28px rgba(0,0,0,0.45);
}
.wordmark .wm-pool {
  display: block;
  margin-top: 4px;
  font-family: var(--display);
  font-size: clamp(18px, 3.4vw, 28px);
  letter-spacing: 0.62em;
  color: var(--flame);
}
.tagline {
  margin: 8px 0 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  color: var(--sand);
}
.lede {
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 22px;
  font-size: 17px;
  font-family: var(--serif);
}
.lede strong { color: var(--parchment); font-weight: 700; }

.rules {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin: 22px 0 28px;
}
.rule {
  background:
    linear-gradient(180deg, #f3e7c8 0%, #e4d2a4 100%);
  color: #2a1c10;
  border: 1px solid #c4a66a;
  border-radius: 10px;
  padding: 14px 14px 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 10px 22px rgba(0,0,0,0.28);
}
.rule b {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.08em;
  color: #8a3e10;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 400;
}
.rule span { color: #4a3824; font-size: 14px; font-family: var(--serif); }

.split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

.card {
  background:
    repeating-linear-gradient(90deg, rgba(90,64,48,0.08) 0 2px, transparent 2px 11px),
    linear-gradient(180deg, #241c14, #1a140e);
  border: 1px solid var(--wood-edge);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(232,184,74,0.08);
}
.card h2 {
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 32px;
  margin: 0 0 4px;
  color: var(--parchment);
}
.card p.hint { color: var(--muted); margin: 0 0 16px; font-size: 14px; font-family: var(--serif); }

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
input, select {
  width: 100%; min-height: var(--tap);
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #100c08;
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--flame); outline-offset: 2px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  min-height: var(--tap);
  border: 0; border-radius: 12px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: 0.02em;
}
.btn-block { width: 100%; margin-top: 16px; }
.btn-gold, .btn-flame {
  background: linear-gradient(180deg, #f4c25a, #e8892a 58%, #c46a12);
  color: #1a1006;
  box-shadow: 0 0 0 1px rgba(244,178,74,0.25), 0 0 18px rgba(232,137,42,0.28);
  animation: flame-glow 2.6s ease-in-out infinite;
}
@keyframes flame-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(244,178,74,0.22), 0 0 14px rgba(232,137,42,0.28); }
  50% { box-shadow: 0 0 0 1px rgba(244,210,122,0.4), 0 0 26px rgba(255,140,40,0.5); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-gold, .btn-flame { animation: none; }
}
.btn-ghost, .btn-wood {
  background: linear-gradient(180deg, #3a2a18, #24180f);
  color: var(--parchment);
  border: 1px solid var(--wood-edge);
}
.btn-danger { background: #4a1d16; color: #ffd0c4; border: 1px solid #7a3030; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; animation: none; }
.btn-sm { min-height: 40px; padding: 0 12px; font-size: 14px; }

.pool-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.pool-head h1 {
  font-family: var(--display); font-size: clamp(36px, 7vw, 60px);
  margin: 0; letter-spacing: 0.06em; line-height: 0.92;
  color: var(--parchment);
}
.code-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: #24180f; border: 1px solid var(--wood-edge);
  border-radius: 999px; padding: 8px 12px; font-size: 14px;
}
.code-pill a { color: inherit; text-decoration: none; }
.code-pill kbd {
  font: 700 15px var(--font); letter-spacing: 0.16em; color: var(--flame);
}
.week-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 16px;
}
.week-bar select { width: auto; min-width: 160px; }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 14px;
  scrollbar-width: thin;
}
.tab {
  min-height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] {
  background: linear-gradient(180deg, #f4c25a, #e8892a);
  color: #1a1006; border-color: var(--flame);
}

.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 12px 12px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  background: #140e0a;
}
tr:last-child td { border-bottom: 0; }
tr.you td { background: rgba(232,137,42,0.10); }
.rank { font-family: var(--display); font-size: 26px; letter-spacing: 0.04em; color: var(--flame); }
.pts { font-weight: 700; font-size: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid rgba(255,255,255,0.12);
  font-weight: 700; letter-spacing: 0.04em;
}
.chip img { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.hint { color: var(--muted); font-family: var(--serif); }

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.team-btn {
  min-height: 72px;
  border-radius: 14px;
  border: 2px solid transparent;
  padding: 10px 10px 8px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
}
.team-btn .abbr { font-family: var(--display); font-size: 28px; letter-spacing: 0.06em; line-height: 1; }
.team-btn .vs { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; opacity: 0.9; margin-top: 2px; }
.team-btn .p4-badge {
  position: absolute;
  top: 5px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 5px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  background: #0b0906;
  color: #efe4c4;
  border: 1px solid var(--wood-edge);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.team-btn .p4-badge .p4-mark { color: #efe4c4; }
.team-btn .p4-badge .t25-mark,
.team-btn .p4-badge.top25 .t25-mark {
  color: var(--flame-2);
}
.team-btn .p4-badge.top25 {
  border-color: var(--flame-2);
}
.ap-num { font-family: var(--display); font-weight: 700; letter-spacing: 0.02em; opacity: 0.92; }
.team-btn .ap-num { font-size: 15px; margin-right: 2px; }
.chip .ap-num { font-size: 13px; margin-right: 4px; }
.side .ap-num { font-size: 14px; margin-right: 2px; }
.team-btn .meta { font-size: 12px; opacity: 0.86; }
.team-btn.selected { box-shadow: 0 0 0 2px #fff3c4, 0 0 0 5px var(--flame); }
.team-btn.used, .team-btn.bye, .team-btn.locked {
  opacity: 0.38; cursor: not-allowed; filter: grayscale(0.4);
}
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
.leg-av { background: var(--flame); }
.leg-used { background: #6d5a48; }
.leg-bye { background: #3d4d48; }
.leg-lock { background: var(--loss); }

.games { display: flex; flex-direction: column; gap: 10px; }
.game {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.side { display: flex; align-items: center; gap: 8px; }
.side.home { justify-content: flex-end; text-align: right; }
.side img { width: 28px; height: 28px; }
.side .score { font-family: var(--display); font-size: 30px; min-width: 28px; }
.game-mid { text-align: center; color: var(--muted); font-size: 12px; }
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
}
.badge-live { background: var(--live); color: #1a0b06; }
.badge-final { background: #1d3a2b; color: #8ee0b0; }
.badge-pre { background: #2a2014; color: var(--flame-2); }
.winner .abbr, .winner .score { color: var(--win); }

.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 70vh; }
.matrix { border-collapse: separate; border-spacing: 0; min-width: max-content; }
.matrix th, .matrix td {
  min-width: 36px; height: 36px; padding: 0; text-align: center;
  border-right: 1px solid #2a2014; border-bottom: 1px solid #2a2014;
  font-size: 11px; font-weight: 700;
}
.matrix th.corner, .matrix td.name {
  position: sticky; left: 0; z-index: 2; background: #1a140e;
  min-width: 120px; text-align: left; padding: 0 10px;
}
.matrix thead th { position: sticky; top: 0; z-index: 3; background: #140e0a; }
.matrix thead th.corner { z-index: 4; }
.matrix .burn { background: var(--flame); color: #1a1006; }
.matrix .open { color: #4a3524; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: #24180f; border: 1px solid var(--flame);
  color: var(--ink); padding: 12px 16px; border-radius: 12px;
  opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 50;
  max-width: min(92vw, 420px);
  box-shadow: 0 0 22px rgba(232,137,42,0.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.admin-game { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.err { color: #ffb4b4; font-size: 14px; margin-top: 8px; min-height: 1.2em; }

@media (max-width: 560px) {
  .app { width: min(100% - 18px, 1120px); }
  .game { grid-template-columns: 1fr; }
  .side.home { justify-content: flex-start; text-align: left; }
  .chip { min-height: 44px; }
  .palm-left, .palm-right { opacity: 0.28; }
  .brand-name { letter-spacing: 0.16em; font-size: 22px; }
}

.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.mode-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: linear-gradient(180deg, #f4c25a, #e8892a); color: #1a1006; }
.mode-badge.dim { background: #24180f; color: var(--parchment); border: 1px solid var(--wood-edge); }
.line-chip { display: inline-flex; align-items: center; margin-top: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; background: #efe4c4; color: #5a3a10; border: 1px solid #c4a66a; }
.switch-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 6px; color: var(--parchment); font-weight: 700; }
.switch-row input { width: 20px; min-height: 20px; accent-color: #e8892a; }
.disclose { margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: #140e0a; }
.disclose summary { cursor: pointer; font-weight: 700; color: var(--flame-2); }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-top: 10px; }
.wp-cell { margin: 0; font-size: 11px; text-align: center; }
.wp-cell input { min-height: 40px; padding: 0 6px; text-align: center; }
.filter { width: 100%; min-height: 44px; margin: 0 0 12px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: #100c08; color: var(--ink); }
tr.elim td { opacity: 0.72; }
.snuff { display: inline-block; margin-left: 6px; color: #e8892a; font-size: 12px; font-weight: 700; }
.game-mid .line-chip { margin: 6px 0 2px; }

.back-tribe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 0 0 16px;
  padding: 10px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f4b24a, #e8892a);
  color: #1a1008;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 22px rgba(232,137,42,0.35);
}
.back-tribe:hover { filter: brightness(1.06); }
.who .btn-gold { margin-right: 8px; }

.tribe-list {
  margin: 0 auto 22px;
  max-width: 360px;
  text-align: center;
}
.tribe-list-kicker {
  display: block;
  margin: 0 0 10px;
  color: var(--flame-2);
  font-size: 12px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
}
.tribe-list select {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #f4b24a, #e8892a);
  color: #1a1008;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 22px rgba(232,137,42,0.35);
  cursor: pointer;
}
.tribe-list select:hover { filter: brightness(1.06); }
.tribe-list option { color: #1a1008; background: #efe4c4; }
.tribe-list-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.back-tribe .tribe-code {
  margin-left: 8px;
  opacity: 0.7;
  letter-spacing: 0.16em;
  font-size: 12px;
}

.roster-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.btn-danger { color: #1a1008; background: #d04a3a; border: 0; }
.btn-danger:hover { filter: brightness(1.06); }

.tribe-list .btn { margin-top: 12px; }
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
  background: rgba(8, 6, 4, 0.72);
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(100%, 420px);
  padding: 22px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 8px; }

.handle-marks { margin-left: 4px; }
.handle-mark {
  display: inline-block;
  margin-left: 4px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.you-box { margin: 0 0 16px; }
.you-box .btn-block { margin-top: 12px; }
.code-pill { flex-wrap: wrap; }
.who .faint { display: inline-block; margin-left: 4px; }
@media (max-width: 560px) {
  .who { font-size: 12px; }
  .who .btn { margin-top: 6px; }
}
