/* Perfect 82 – score card, header additions, arcade overlay */
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("./press-start-2p-latin.woff2") format("woff2"); }
:root {
  --p82-bg: #131a15; --p82-panel: #1b2719; --p82-raise: #202b1e; --p82-line: #42543a; --p82-line-2: #33412e;
  --p82-lime: #d5fb77; --p82-lime-2: #c4e895; --p82-ink: #22300f; --p82-text: #e4f5c8; --p82-muted: #aacb89; --p82-dim: #8fae74;
  --p82-loss: #ff8a7a;
}
.p82-arcade-font { font-family: "Press Start 2P", ui-monospace, Menlo, Consolas, monospace; font-weight: 400; letter-spacing: 0; }

/* ---- header ---- */
.ad-free.p82-chip { background: var(--p82-lime); color: var(--p82-ink); border-radius: 5px; padding: 3px 7px; letter-spacing: 1px; }
.icon-button.p82-trophy { position: relative; }
.icon-button.p82-trophy.dot::after { content: ""; position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--p82-lime); box-shadow: 0 0 0 2px #171f17; }
@media (max-width: 400px) { .ad-free:not(.p82-chip) { display: none; } .ad-free.p82-chip { display: inline-block; margin-right: 0; padding: 3px 5px; font-size: 11px; } .header-actions { gap: 4px; } }

/* ---- results score card ---- */
.p82-card { flex-shrink: 0; background: var(--p82-panel); border: 1px solid var(--p82-line); border-radius: 12px; padding: 12px 14px 10px; }
.p82-card.perfect { border-color: var(--p82-lime); box-shadow: 0 0 0 1px #d5fb7733 inset; }
.p82-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.p82-card-head span { font: 600 12px monospace; letter-spacing: 1.5px; color: #c6e69b; }
.p82-card-head strong { font: 900 30px/1 Arial, sans-serif; color: var(--p82-lime); font-variant-numeric: tabular-nums; }
.p82-card-lines { margin-top: 8px; display: grid; gap: 4px; }
.p82-card-lines div { display: grid; grid-template-columns: 1fr auto 56px; gap: 10px; align-items: baseline; font-size: 13px; color: #b7cda0; }
.p82-card-lines small { font: 500 11px monospace; color: var(--p82-dim); }
.p82-card-lines b { text-align: right; color: var(--p82-text); font-variant-numeric: tabular-nums; }
.p82-card-foot { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--p82-line-2); font: 500 11px monospace; color: var(--p82-muted); letter-spacing: .3px; }
.p82-card-foot b { color: var(--p82-lime); font-weight: 700; }

/* ---- overlay shell ---- */
html.p82-open, html.p82-open body { overflow: hidden; }
#p82ui { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; }
#p82ui[hidden] { display: none; }
.p82-backdrop { position: absolute; inset: 0; background: rgba(6, 10, 7, .74); backdrop-filter: blur(3px); animation: p82-fade .18s ease-out; }
.p82-panel { position: relative; width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--p82-panel); border: 1px solid #53683f; border-radius: 16px; padding: 18px 18px 16px; color: var(--p82-text);
  font-family: Arial, Helvetica, sans-serif; box-shadow: 0 26px 90px #000a; animation: p82-rise .2s ease-out; outline: none; }
.p82-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.p82-top h2 { margin: 0; font-size: 15px; line-height: 1.3; color: var(--p82-lime); text-shadow: 0 0 12px #d5fb7755; }
.p82-x { width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; border: 1px solid var(--p82-line); background: var(--p82-raise); color: var(--p82-muted); font-size: 15px; cursor: pointer; }
.p82-x:hover { color: var(--p82-text); border-color: #6b8452; }
.p82-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 11px 16px; margin-top: 10px;
  border: 1px solid var(--p82-lime); border-radius: 10px; background: var(--p82-lime); color: var(--p82-ink); font: 800 16px Arial, sans-serif;
  box-shadow: 0 3px #6e8d37; cursor: pointer; }
.p82-btn:active { transform: translateY(2px); box-shadow: 0 1px #6e8d37; }
.p82-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.p82-link { background: none; border: 0; color: #c0d8a4; font: 600 13px Arial, sans-serif; text-decoration: underline; text-underline-offset: 3px; padding: 8px 4px; cursor: pointer; }
.p82-link:hover { color: var(--p82-lime); }
.p82-panel button:focus-visible { outline: 2px solid var(--p82-lime); outline-offset: 2px; }

/* ---- daily card ---- */
.p82-daily { background: var(--p82-raise); border: 1px solid var(--p82-line); border-left: 3px solid var(--p82-lime); border-radius: 10px; padding: 12px 13px; }
.p82-daily.done { border-left-color: #7fa45a; }
.p82-daily-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 600 11px monospace; letter-spacing: 1.2px; color: #c6e69b; }
.p82-daily-head em { font-style: normal; color: var(--p82-dim); }
.p82-daily-main { margin: 7px 0 0; font-size: 14px; color: #d8ecbd; }
.p82-daily-main b { color: var(--p82-lime); }
.p82-daily-note { margin: 4px 0 0; font: 500 12px monospace; color: var(--p82-muted); }
.p82-daily .p82-link { padding-left: 0; }
.p82-flash { margin: 0 0 12px; padding: 10px; text-align: center; font-size: 11px; line-height: 1.5; color: var(--p82-ink); background: var(--p82-lime); border-radius: 8px; animation: p82-pop .35s ease-out; }

/* ---- tabs + table ---- */
.p82-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 16px 0 8px; padding: 4px; background: #111811; border: 1px solid var(--p82-line-2); border-radius: 10px; }
.p82-tabs button { min-height: 34px; border: 0; border-radius: 7px; background: none; color: var(--p82-muted); font: 700 12px monospace; letter-spacing: 1.2px; cursor: pointer; }
.p82-tabs button[aria-selected="true"] { background: #2b3a26; color: var(--p82-lime); }
.p82-table { min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.p82-row { display: grid; grid-template-columns: 52px 1fr 70px 70px; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 6px; font-size: 13px; color: #cfe3b4; font-variant-numeric: tabular-nums; }
.p82-row.all { grid-template-columns: 50px 1fr 44px 40px 66px; }
.p82-row > span:nth-child(n+3) { text-align: right; }
.p82-row:nth-child(odd):not(.p82-th) { background: #1f2b1d; }
.p82-th { font-size: 10px; letter-spacing: 1.2px; color: var(--p82-dim); padding-top: 2px; padding-bottom: 5px; }
.p82-th span { white-space: nowrap; }
.p82-row .p82-name { font-family: "Press Start 2P", ui-monospace, monospace; font-size: 11px; letter-spacing: .5px; color: var(--p82-text); white-space: nowrap; }
.p82-row.top > span:first-child { color: var(--p82-lime); font-weight: 700; }
.p82-row.perfect > span:nth-child(3) { color: var(--p82-lime); }
.p82-row.me { background: #34481f !important; box-shadow: inset 3px 0 var(--p82-lime); }
.p82-row.me .p82-name { color: var(--p82-lime); }
.p82-gap { text-align: center; color: var(--p82-dim); letter-spacing: 4px; padding: 2px 0; }
.p82-count { margin: 8px 0 0; text-align: right; font-size: 11px; color: var(--p82-dim); }
.p82-empty { margin: 0; padding: 26px 8px; text-align: center; font: 500 13px/1.6 Arial, sans-serif; color: var(--p82-muted); }
.p82-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--p82-line-2); font: 500 12px monospace; color: var(--p82-muted); }
.p82-foot b { color: var(--p82-lime); }
.p82-rules { margin: 8px 0 0; font-size: 11px; line-height: 1.5; color: var(--p82-dim); }

/* ---- arcade initials ---- */
.p82-arcade { text-align: center; }
.p82-arcade .p82-top { text-align: left; }
.p82-crt { position: relative; overflow: hidden; margin: 2px 0 16px; padding: 16px 10px 14px; border-radius: 12px; border: 1px solid #4b613b;
  background: radial-gradient(at 50% 110%, #364c22, #172014); }
.p82-crt::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px); }
.p82-crt span { display: block; font-size: 10px; color: #c6e69b; }
.p82-crt strong { display: block; margin: 12px 0 10px; font-size: clamp(30px, 11vw, 40px); line-height: 1; color: var(--p82-lime); text-shadow: 0 0 18px #d5fb7780; }
.p82-crt small { display: block; font: 500 12px monospace; color: #b7cda0; }
.p82-arcade h3 { margin: 4px 0 12px; font-size: 11px; line-height: 1.5; color: var(--p82-text); }
.p82-slots { display: grid; grid-template-columns: repeat(6, minmax(0, 54px)); justify-content: center; gap: 8px; }
.p82-slot { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
.p82-spin { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--p82-line); background: var(--p82-raise); color: var(--p82-muted); font-size: 14px; cursor: pointer; touch-action: manipulation; }
.p82-spin:active { background: #2b3a26; color: var(--p82-lime); }
.p82-letter { width: 100%; height: 62px; padding: 0; border-radius: 10px; border: 2px solid var(--p82-line); background: #101610; color: var(--p82-text); font-size: 24px; line-height: 1; cursor: pointer; position: relative; }
.p82-slot.blank .p82-letter::before { content: ""; position: absolute; left: 12px; right: 12px; bottom: 11px; height: 3px; background: #3a4a33; }
.p82-slot.on.blank .p82-letter::before { display: none; }
.p82-slot.on .p82-letter { border-color: var(--p82-lime); color: var(--p82-lime); text-shadow: 0 0 10px #d5fb7780; }
.p82-slot.on .p82-letter::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 8px; height: 3px; background: var(--p82-lime); animation: p82-blink 1s steps(1) infinite; }
.p82-type { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; left: 50%; top: 50%; }
.p82-go { margin-top: 18px; font-size: 13px; }
.p82-err { min-height: 18px; margin: 8px 0 0; font-size: 13px; color: var(--p82-loss); }
.p82-err.soft { color: var(--p82-dim); }
.p82-hint { margin: 2px 0 0; font-size: 11px; color: var(--p82-dim); }
.p82-blink { animation: p82-blink 1.1s steps(1) infinite; }
.p82-blink-slow { animation: p82-blink 1.6s steps(1) infinite; }

@keyframes p82-blink { 50% { opacity: 0; } }
@keyframes p82-fade { from { opacity: 0; } }
@keyframes p82-rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes p82-pop { from { transform: scale(.94); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .p82-blink, .p82-blink-slow, .p82-slot.on .p82-letter::after, .p82-panel, .p82-backdrop, .p82-flash { animation: none !important; }
}
@media (max-width: 380px) {
  .p82-panel { padding: 16px 14px 14px; }
  .p82-row { grid-template-columns: 44px 1fr 60px 58px; gap: 4px; font-size: 12px; padding: 7px 6px; }
  .p82-row.all { grid-template-columns: 44px 1fr 38px 34px 58px; }
  .p82-row .p82-name { font-size: 10px; letter-spacing: 0; }
  .p82-th { letter-spacing: .3px; }
  .p82-slots { grid-template-columns: repeat(6, minmax(0, 44px)); gap: 6px; }
  .p82-letter { height: 54px; font-size: 20px; }
  .p82-spin { height: 32px; font-size: 12px; }
}

/* ---- pick screen: rerolls, open spots, one scrolling list ---- */
.p82-pool { flex-shrink: 0; border: 1px solid #42543a; border-left: 3px solid var(--team-color); background: #202b1e; border-radius: 9px; overflow: hidden; }
.p82-pool .pool-banner { border: 0; border-radius: 0; background: none; }
.p82-pool.spinning .pool-banner > div, .p82-pool.spinning .pool-banner > strong { animation: p82-blur .12s linear infinite; }
@keyframes p82-blur { 50% { opacity: .55; transform: translateY(-2px); } }
.p82-rolls { display: grid; grid-template-columns: 1fr 1fr 1fr; border-top: 1px solid #34452d; }
.p82-roll { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; font-size: 14px; color: #c8dda9; background: none; border: 0; cursor: pointer; }
.p82-roll + .p82-roll { border-left: 1px solid #34452d; }
.p82-roll b { font: 800 15px monospace; color: #d5fb77; }
.p82-roll:hover:not(:disabled) { background: #26331f; }
.p82-roll:disabled { opacity: .35; cursor: not-allowed; }
.p82-need { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; flex-shrink: 0; }
.p82-need > span { font: 700 11px monospace; letter-spacing: 1.2px; color: #8fa37e; margin-right: 3px; }
.p82-need button { font: 700 12px monospace; color: #c8dda9; padding: 4px 9px; border-radius: 6px; background: #172015; border: 1px solid #34452d; cursor: pointer; }
.p82-need button[aria-pressed="true"] { color: #22300f; background: #d5fb77; border-color: #d5fb77; }
.screen-players .candidate-list { flex: none; transition: opacity .15s; }
.candidate-list.p82-rolling { opacity: .15; filter: blur(3px); pointer-events: none; }
.candidate.p82-off { opacity: .55; }
.p82-stick { position: sticky; bottom: -8px; margin: auto 0 -8px; padding: 12px 0 8px; background: linear-gradient(to bottom, transparent, #131a15 12px); flex-shrink: 0; z-index: 2; }
.p82-home { display: grid; place-items: center; width: 32px; height: 32px; margin-left: -8px; border-radius: 8px; color: #c8dda9; }
.p82-home:hover { background: #26331f; }
