:root {
  --paper: #f3e7cc; --paper2: #ead9b4; --ink: #2a2118; --grass: #2f6b3a; --grass2: #3f8a4b; --gold: #e0a21a;
  --red: #b8392b; --kit: #2f6b3a; --muted: #7a6a52;
  --display: 'Alfa Slab One', Georgia, serif, 'Noto Color Emoji';
  --body: Archivo, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif, 'Noto Color Emoji';
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: var(--body); }
body { background: radial-gradient(120% 80% at 50% 0%, #f8eed8 0%, var(--paper) 55%, var(--paper2) 100%); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .25;
  background-image: repeating-linear-gradient(90deg, rgba(47,107,58,.05) 0 60px, transparent 60px 120px); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; min-height: 44px; }
a { color: var(--grass); }
#app { position: relative; height: 100%; display: flex; flex-direction: column; max-width: 980px; margin: 0 auto; }
#top { display: flex; align-items: center; justify-content: space-between; padding: max(6px, env(safe-area-inset-top)) 10px 4px; }
#top .tools { display: flex; gap: 4px; }
#home { font-family: var(--display); font-size: 18px; letter-spacing: .3px; padding: 0 6px; }
#home b { font-weight: 400; }
#dayname { color: var(--muted); font-size: 15px; }
.ghost { border-radius: 12px; padding: 0 12px; }
.ghost:hover { background: rgba(0,0,0,.06); }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 10px max(10px, env(safe-area-inset-bottom)); position: relative; }
[hidden] { display: none !important; }

/* body.touch / body.mouse / body.pad pick which hints show */
.t-touch, .t-mouse, .t-pad { display: none; }
body.touch .t-touch, body.mouse .t-mouse, body.pad .t-pad { display: inline; }

/* title */
#title { justify-content: center; align-items: center; text-align: center; }
.hero { max-width: 420px; }
#mark { display: block; min-height: 20px; margin-bottom: 6px; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(54px, 15vw, 88px); line-height: .92; margin: 0 0 10px; color: var(--grass);
  text-shadow: 3px 3px 0 #fff, 6px 6px 0 rgba(42,33,24,.18); }
.tag { font-size: 17px; line-height: 1.35; margin: 0 0 18px; }
.cta { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.big { background: var(--grass); color: #fff; font-family: var(--display); font-size: 22px; border-radius: 14px; padding: 10px 22px; min-height: 56px;
  box-shadow: 0 4px 0 #1d4425; transition: transform .08s; }
.big:hover { background: var(--grass2); }
.big:active { transform: translateY(2px); box-shadow: 0 2px 0 #1d4425; }
.wide { width: 100%; }
.how { color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 18px; }
.note { color: var(--muted); font-size: 14px; text-align: center; }

/* the team strip */
.team { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; padding: 4px 0 6px; }
.slot { position: relative; aspect-ratio: 3 / 4; border-radius: 8px; border: 2px dashed rgba(42,33,24,.25); display: flex; align-items: flex-end; justify-content: center;
  font-size: 10px; font-weight: 800; color: var(--muted); padding-bottom: 3px; background: rgba(255,255,255,.35); overflow: hidden; }
.slot.cur { border-color: var(--gold); border-style: solid; box-shadow: 0 0 0 2px rgba(224,162,26,.3); }
.slot.full { border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); background: #fff; padding: 0; }
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .pos { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(42,33,24,.75); color: #fff; text-align: center; font-size: 10px; padding: 1px 0; }
.slot .chem { position: absolute; top: 2px; right: 2px; font-size: 10px; font-weight: 800; border-radius: 6px; padding: 0 3px; background: var(--grass); color: #fff; }
.slot .chem.bad { background: var(--red); }
.slot.slap { animation: slap .38s cubic-bezier(.2,1.6,.4,1); }
@keyframes slap { 0% { transform: scale(1.8) rotate(-8deg); opacity: 0; } 60% { transform: scale(.94) rotate(1deg); opacity: 1; } 100% { transform: none; } }

.prompt { text-align: center; font-family: var(--display); font-size: 20px; margin: 2px 0 8px; }
.prompt small { display: block; font-family: var(--body); font-size: 13px; color: var(--muted); font-weight: 500; }

/* cards */
.cards { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; align-content: start; }
.card { position: relative; background: #fff; border-radius: 12px; padding: 5px; box-shadow: 0 2px 0 rgba(42,33,24,.18), 0 6px 14px rgba(42,33,24,.12);
  display: flex; flex-direction: column; text-align: left; transition: transform .12s, box-shadow .12s; min-width: 0; }
.card:hover, .card.focus { transform: translateY(-3px) rotate(-.6deg); box-shadow: 0 0 0 3px var(--gold), 0 10px 18px rgba(42,33,24,.2); }
.card.rare { background: linear-gradient(135deg, #fff6d6, #fff 40%, #fff3c4); }
.card .pic { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 3 / 4; background: var(--paper); }
.card .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .num { position: absolute; left: 4px; top: 4px; background: var(--kit); color: #fff; font-family: var(--display); font-size: 20px; line-height: 1; padding: 4px 6px; border-radius: 7px; }
.card .key { position: absolute; right: 4px; top: 4px; background: rgba(255,255,255,.85); font-weight: 800; font-size: 12px; border-radius: 6px; padding: 2px 6px; }
.card .rarebadge { position: absolute; left: 4px; bottom: 4px; background: var(--gold); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 5px; border-radius: 5px; }
.card .info { position: absolute; right: 2px; bottom: 2px; width: 36px; height: 36px; min-height: 0; border-radius: 50%; background: rgba(255,255,255,.9); font-size: 18px; font-weight: 800; color: var(--grass); }
.card h3 { margin: 5px 1px 2px; font-size: 13px; line-height: 1.15; min-height: 2.3em; }
.bars { display: grid; gap: 2px; font-size: 10px; }
.bar { display: grid; grid-template-columns: 26px 1fr 20px; align-items: center; gap: 3px; color: var(--muted); font-weight: 700; }
.bar i { display: block; height: 6px; border-radius: 3px; background: rgba(42,33,24,.12); overflow: hidden; }
.bar i b { display: block; height: 100%; background: var(--grass2); }
.bar.hl i b { background: var(--gold); }
.bar.hl { color: var(--ink); }
.bar span { text-align: right; color: var(--ink); }
.card .q { font-size: 11px; line-height: 1.25; margin-top: 4px; font-style: italic; color: #4c3f2e; }
.card .flags { font-size: 10px; font-weight: 800; margin-top: 3px; color: var(--grass); }
.card .flags .bad { color: var(--red); }
.card.picked { animation: pick .4s ease-in forwards; }
@keyframes pick { to { transform: translateY(-60vh) scale(.3) rotate(-10deg); opacity: 0; } }
.card.gone { animation: gone .3s ease-in forwards; }
@keyframes gone { to { transform: translateY(20px); opacity: 0; } }

.quip { min-height: 44px; text-align: center; font-size: 15px; font-style: italic; padding: 8px 6px 0; }
.quip b { font-style: normal; font-family: var(--display); font-weight: 400; color: var(--grass); }
.flash { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); font-family: var(--display); font-size: 40px; color: var(--grass); pointer-events: none;
  text-shadow: 2px 2px 0 #fff; animation: flash .9s ease-out forwards; z-index: 5; white-space: nowrap; }
@keyframes flash { 0% { transform: translate(-50%, -50%) scale(.5); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1); opacity: 0; } }

/* season */
.board { background: var(--ink); color: #f6e7b0; border-radius: 12px; text-align: center; padding: 8px; font-family: var(--display); box-shadow: inset 0 0 0 3px #4a3a28; }
#record { font-size: 46px; letter-spacing: 2px; line-height: 1.05; }
#boardsub { font-family: var(--body); font-size: 13px; color: #cdbb8a; font-weight: 700; }
#matches { flex: 1; min-height: 0; overflow-y: auto; list-style: none; padding: 6px 0; margin: 0; }
#matches li { display: grid; grid-template-columns: 30px 1fr auto; gap: 6px; align-items: center; background: rgba(255,255,255,.6); border-radius: 9px; padding: 6px 8px; margin-bottom: 5px;
  animation: drop .25s ease-out; font-size: 13px; }
@keyframes drop { from { transform: translateY(-6px); opacity: 0; } }
#matches .wl { font-family: var(--display); font-size: 18px; text-align: center; border-radius: 6px; color: #fff; background: var(--grass); }
#matches .L .wl { background: var(--red); }
#matches .opp { font-weight: 800; }
#matches .line { color: var(--muted); font-size: 12px; }
#matches .sc { font-family: var(--display); font-size: 18px; }
#matches .sc small { font-family: var(--body); font-size: 11px; color: var(--muted); display: block; text-align: right; }
.tension { text-align: center; font-family: var(--display); font-size: 22px; color: var(--grass); padding: 6px; animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }

/* result */
#result { overflow-y: auto; }
.paper { background: #fbf6ea; border-radius: 4px; padding: 10px 12px; box-shadow: 0 2px 8px rgba(42,33,24,.2); margin-top: 4px; }
.masthead { font-family: var(--display); font-size: 12px; letter-spacing: 1px; border-bottom: 3px double var(--ink); padding-bottom: 4px; text-align: center; }
#headline { font-family: var(--display); font-weight: 400; font-size: clamp(24px, 7vw, 40px); line-height: 1; margin: 8px 0 4px; text-align: center; text-transform: uppercase; }
.resrecord { text-align: center; font-weight: 800; font-size: 15px; }
.resrecord b { font-family: var(--display); font-weight: 400; font-size: 30px; color: var(--grass); }
.badge { text-align: center; margin: 4px auto; background: var(--gold); color: #fff; font-family: var(--display); padding: 4px 10px; border-radius: 8px; width: max-content; }
.roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.rp { display: grid; grid-template-columns: 40px 1fr; gap: 5px; align-items: center; font-size: 11px; line-height: 1.2; }
.rp img { width: 40px; height: 53px; object-fit: cover; border-radius: 5px; border: 2px solid #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.rp b { display: block; font-size: 12px; }
.rp span { color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 6px; margin: 10px 0 6px; }
.row2 .big { font-size: 18px; padding: 6px; }
.row2 .ghost { background: rgba(255,255,255,.6); }
.vote { text-align: center; }
.vote p { margin: 6px 0 4px; font-weight: 800; font-size: 14px; }
.vote .opts { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.vote .opts button { flex: none; background: #fff; border-radius: 20px; padding: 0 12px; font-size: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.door { display: block; width: 100%; background: rgba(42,33,24,.07); border-radius: 12px; font-size: 13px; margin: 6px 0; padding: 0 10px; }
.credit { font-size: 11px; color: var(--muted); text-align: center; }

/* album */
.albumhead { display: flex; align-items: center; gap: 10px; }
.albumhead h2 { font-family: var(--display); font-weight: 400; margin: 4px 0; font-size: 24px; }
.albumhead span { color: var(--muted); font-weight: 700; flex: 1; }
.albumgrid { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, 84px); grid-auto-rows: 112px; justify-content: center; gap: 8px; align-content: start; padding: 6px 2px 20px;
  background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(42,33,24,.04) 22px 23px); }
.st { position: relative; width: 84px; height: 112px; border-radius: 8px; border: 2px dashed rgba(42,33,24,.22); display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11px; color: var(--muted); padding: 4px; min-height: 0; }
.st.got { border: 3px solid #fff; padding: 0; box-shadow: 0 2px 4px rgba(0,0,0,.25); transform: rotate(var(--r, 0deg)); }
.st.got img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.st.rare { border-color: var(--gold); }
.st .nm { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(42,33,24,.72); color: #fff; font-size: 10px; padding: 2px; border-radius: 0 0 5px 5px; }

/* card back */
.overlay { position: fixed; inset: 0; background: rgba(42,33,24,.55); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 14px; }
.backcard { position: relative; background: #fbf6ea; border-radius: 14px; max-width: 420px; width: 100%; max-height: 100%; overflow-y: auto; padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
  background-image: repeating-linear-gradient(0deg, transparent 0 24px, rgba(47,107,58,.08) 24px 25px); }
.close { position: absolute; right: 6px; top: 6px; font-size: 18px; }
.backcard h2 { font-family: var(--display); font-weight: 400; margin: 0 40px 2px 0; font-size: 24px; line-height: 1.1; }
.backcard .sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.backcard .top { display: grid; grid-template-columns: 96px 1fr; gap: 10px; }
.backcard .top img { width: 96px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.backcard table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.backcard td { padding: 4px 2px; border-bottom: 1px solid rgba(42,33,24,.12); vertical-align: top; }
.backcard td:first-child { font-weight: 800; width: 70px; }
.backcard td.v { font-family: var(--display); font-size: 16px; text-align: right; width: 40px; }
.backcard .from { color: var(--muted); font-size: 12px; }
.backcard .fact { font-size: 14px; line-height: 1.35; }
.backcard .src { font-size: 12px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 20; font-size: 14px; max-width: 90vw; text-align: center; }

/* bigger screens: more room for the cards */
@media (min-width: 700px) {
  .team { max-width: 520px; margin: 0 auto; width: 100%; }
  .cards { max-width: 760px; margin: 0 auto; width: 100%; gap: 14px; }
  .card { padding: 8px; }
  .card h3 { font-size: 16px; }
  .bars { font-size: 12px; gap: 3px; }
  .bar { grid-template-columns: 40px 1fr 26px; }
  .bar i { height: 8px; }
  .card .q { font-size: 13px; }
  .card .flags { font-size: 12px; }
  #result, #season, #album { max-width: 640px; margin: 0 auto; width: 100%; }
  .roster { grid-template-columns: repeat(6, 1fr); }
  .rp { grid-template-columns: 1fr; text-align: center; }
  .rp img { width: 100%; height: auto; aspect-ratio: 3 / 4; }
}
@media (min-width: 700px) and (max-height: 860px) {
  .cards { max-width: 600px; }
}

/* round 2: the header never wraps, the season's weather while drafting, the back page and the day's table */
#home { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#top { gap: 4px; }
#top .tools { flex: none; }
@media (max-width: 420px) { #home { font-size: 16px; } #dayname { font-size: 13px; } }
.switch { background: rgba(255,255,255,.55); font-size: 15px; }
.switch b { color: var(--grass); }
.switch[aria-pressed="false"] b { color: var(--muted); }
.weather { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--muted); margin: -2px 0 4px; flex-wrap: wrap; }
.weather b { color: var(--ink); font-weight: 800; }
.weather .fx { display: flex; gap: 2px; }
.weather .fx i { width: 15px; height: 18px; border-radius: 3px; background: rgba(47,107,58,.18); font-style: normal; font-size: 11px; line-height: 18px; text-align: center; }
.weather .fx i.n { background: #3a3f5c; }
.weather .fx i.r { background: #9fb7c9; }
.paper { padding: 12px 12px 8px; background-image: repeating-linear-gradient(0deg, transparent 0 26px, rgba(42,33,24,.035) 26px 27px); }
#headline { font-size: clamp(26px, 8vw, 44px); line-height: .98; }
.resrecord { display: flex; flex-direction: column; align-items: center; }
.resrecord b { font-size: 54px; line-height: 1; }
.resrecord span { color: var(--muted); font-size: 13px; }
.roster { grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
.rp { display: flex; flex-direction: column; align-items: center; text-align: center; grid-template-columns: none; font-size: 11px; }
.rp img { width: 100%; height: auto; aspect-ratio: 3 / 4; border: 4px solid #fff; border-radius: 4px; transform: rotate(var(--r, 0deg)); margin-bottom: 4px; }
.rp b { font-family: var(--display); font-weight: 400; font-size: 14px; }
.paperfoot { display: flex; justify-content: space-between; gap: 8px; border-top: 3px double var(--ink); margin-top: 10px; padding-top: 5px; font-size: 12px; font-weight: 800; color: var(--muted); }
#paperrank { color: var(--grass); }
.rank { background: var(--ink); color: #f6e7b0; border-radius: 12px; padding: 10px 12px; margin-top: 10px; text-align: center; font-size: 14px; line-height: 1.35; }
.rank p { margin: 6px 0 0; }
.rank b { color: #fff; }
.rk-big { font-family: var(--display); font-size: 26px; color: #fff; }
.rk-big span { font-family: var(--body); font-size: 14px; color: #cdbb8a; font-weight: 700; }
.rk-wait { color: #cdbb8a; }
.rank .mini { display: inline-flex; gap: 2px; vertical-align: middle; }
.rank .mini img { width: 24px; height: 32px; object-fit: cover; border-radius: 3px; border: 1px solid #fff; }
@media (min-width: 700px) {
  .roster { grid-template-columns: repeat(6, 1fr); }
  .weather { font-size: 13px; }
}
