:root {
  color-scheme: dark;
  font-family: Geist, Inter, system-ui, sans-serif;
  --bg: #151416;
  --panel: #201d20;
  --field: #181619;
  --line: #3e363b;
  --text: #f8eee8;
  --muted: #c5b5b1;
  --accent: #f3a276;
  --accent-strong: #ffc19d;
  --alert: #ffd098;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body { margin: 0; min-width: 300px; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.shell { max-width: 1232px; margin-inline: auto; width: calc(100% - 64px); }
.top { border-bottom: 1px solid #322a30; background: #191619; }
.top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: .92rem; font-weight: 670; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 20px; height: 20px; position: relative; display: inline-block; border-radius: 50%; background: radial-gradient(circle at 31% 27%, #ffbd92, #de704e 61%, #893c32); box-shadow: 0 0 13px #d86b4d45; flex: none; }
.brand-mark::after { position: absolute; content: ""; inset: 6px -5px; border: 1px solid #ffc09bba; transform: rotate(-33deg); border-radius: 50%; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.button, .quiet-button { min-height: 40px; border-radius: 8px; padding: 8px 13px; display: inline-flex; align-items: center; gap: 5px; justify-content: center; font-weight: 650; font-size: .83rem; text-decoration: none; white-space: nowrap; }
.button { border: 1px solid #5e453e; color: var(--accent-strong); background: #332622; }
.button:hover:not(:disabled) { background: #47312a; }
.button.ghost { border-color: var(--line); background: transparent; color: var(--text); }
.button.ghost:hover { background: #332b30; }
.quiet-button { border: 1px solid transparent; background: transparent; color: var(--muted); }
.quiet-button:hover { color: var(--text); background: #30282d; }
.mobile-summary { display: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #241713; }
.button.primary:hover:not(:disabled) { background: var(--accent-strong); }
.button:disabled { opacity: .45; }

.hero {
  min-height: 226px; position: relative; isolation: isolate; overflow: hidden; border: 1px solid #503432;
  margin: 28px 0 24px; border-radius: 15px; display: flex; align-items: center;
  background: radial-gradient(ellipse at 74% 70%, #4a2829, transparent 56%), linear-gradient(103deg, #211a1e 9%, #291c21 57%, #291923);
}
.hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, #211a1e 0%, #211a1e38 55%, transparent 83%); }
.hero-content { max-width: 720px; padding: 31px 35px 32px; }
.hero-kicker { margin: 0 0 13px; color: #ffc2a0; font-size: .8rem; font-weight: 650; }
.hero-kicker span { margin-inline: 5px; opacity: .7; }
h1 { font-size: clamp(2.25rem, 5.2vw, 4.4rem); line-height: 1.02; letter-spacing: -.056em; margin: 0; font-weight: 760; }
.hero-copy { color: #e3cbc2; max-width: 430px; font-size: .98rem; line-height: 1.54; margin: 17px 0 0; }
.hero-art { z-index: -2; position: absolute; overflow: hidden; inset: 0 0 0 37%; }
.planet {
  width: min(610px, 73vw); aspect-ratio: 1; position: absolute; top: -123%; right: -1%;
  border-radius: 50%; opacity: .94;
  background: radial-gradient(ellipse at 52% 73%, transparent 27%, #48251a65 58%, #1c1418f2 91%),
    radial-gradient(ellipse at 43% 60%, #c57854, #9b523b 23%, #4e2931 63%, #211a1e 83%);
  box-shadow: inset 0 -1px 20px #ffad7c88, 0 30px 85px #d0754e35;
}
.with-photo .planet {
  top: -113%; right: -1%; background: url("mars.webp") center / cover no-repeat;
  filter: saturate(.82) contrast(1.03);
  box-shadow: inset 0 0 85px 14px #1a1216a0, 0 20px 95px #c7634b38;
}

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(292px, 326px); align-items: start; gap: 20px; }
.entry { display: grid; min-width: 0; gap: 16px; }
.panel { border-radius: 13px; border: 1px solid var(--line); background: var(--panel); padding: 21px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 17px; }
h2 { font-size: 1.13rem; line-height: 1.25; letter-spacing: -.025em; margin: 0; font-weight: 725; }
.section-head p { color: var(--muted); font-size: .83rem; line-height: 1.5; margin: 5px 0 0; }
.section-head .button { min-height: 36px; }
.player-rows { display: grid; gap: 11px; }
.player {
  margin: 0; min-inline-size: 0; border: 1px solid var(--line); border-radius: 9px; padding: 12px;
  background: #252124;
}
.player-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.player-marker { width: 10px; height: 10px; border-radius: 50%; background: var(--player-color); flex: none; }
.player-name { flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; padding: 5px 7px; color: var(--text); font-weight: 670; border-radius: 6px; }
.player-name:hover, .player-name:focus { border-color: var(--line); }
.player-name::placeholder { opacity: 1; color: var(--text); }
.player-subtotal { color: var(--muted); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.icon-button { width: 32px; height: 34px; display: inline-grid; place-items: center; flex: none; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 1.17rem; line-height: 1; }
.icon-button:hover { color: var(--text); background: #453338; }
.score-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.field { min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: .74rem; line-height: 1.26; color: var(--muted); }
.field-hint { color: var(--muted); font-weight: 400; }
.field label { cursor: text; }
.number {
  width: 100%; min-width: 0; height: 37px; padding: 5px 7px; border: 1px solid #4a3d43;
  background: var(--field); border-radius: 6px; color: var(--text); font-variant-numeric: tabular-nums;
  font-weight: 620; font-size: .96rem; appearance: textfield;
}
.number::-webkit-inner-spin-button, .number::-webkit-outer-spin-button { appearance: none; margin: 0; }
.number::placeholder { color: #a49394; opacity: 1; }
.number:focus, .player-name:focus { outline: 1px solid var(--accent); outline-offset: 1px; }
.number:invalid:not(:focus) { border-color: #ffb27e; }
.field-abbrev { text-decoration: none; }
.input-caption { margin: 12px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.48; }

.count, .point-unit { background: #352924; color: #ffc4a3; border: 1px solid #604438; font-size: .76rem; font-weight: 670; border-radius: 6px; padding: 5px 8px; white-space: nowrap; }
.award-rows { display: grid; gap: 7px; }
.award { border: 1px solid var(--line); border-radius: 8px; background: #242023; }
.award.active { border-color: #815c49; }
.award-toggle {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 11px; padding: 8px 10px;
  text-align: left; border: 0; border-radius: 8px; color: var(--text); background: transparent; line-height: 1.35;
}
.award-toggle:hover:not(:disabled) { background: #33292d; }
.award-toggle:disabled { opacity: .57; }
.check { display: grid; flex: none; width: 19px; height: 19px; place-items: center; border-radius: 4px; border: 1px solid #826b6f; color: #281913; background: #1b171a; }
.award.active .check { border-color: var(--accent); background: var(--accent); }
.award.active .check::after { content: ""; width: 8px; height: 5px; border-left: 2px solid; border-bottom: 2px solid; transform: rotate(-45deg) translate(0, -1px); }
.award-title { font-weight: 670; font-size: .88rem; }
.award-description { display: block; margin-top: 2px; color: var(--muted); font-size: .77rem; }
.award-fields { padding: 8px 10px 10px; border-top: 1px solid #4c3a3b; display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.award-field label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.award-points { min-height: 1em; color: var(--accent-strong); font-weight: 650; }
.rules { padding-block: 14px; }
.rules summary { cursor: pointer; font-weight: 650; font-size: .86rem; }
.rule-body { color: var(--muted); font-size: .85rem; line-height: 1.6; }
.rule-body a { color: var(--accent-strong); text-underline-offset: 3px; }
.rule-body p:last-child { margin-bottom: 1px; }

.results { position: sticky; top: 16px; background: linear-gradient(159deg, #261f23, #201c20 72%); }
.result-head { margin-bottom: 15px; }
.result-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.result-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) min-content; align-items: center; gap: 8px;
  min-height: 53px; padding: 7px 9px; border-radius: 8px; background: #2a242a; border: 1px solid #43373e;
}
.result-row.leader { background: #3a2927; border-color: #7d5546; }
.place { display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 680; background: #382e36; border-radius: 5px; }
.leader .place { color: #34211a; background: var(--accent); }
.result-name { overflow-wrap: anywhere; font-size: .88rem; font-weight: 630; }
.total { font-weight: 740; font-size: 1.15rem; font-variant-numeric: tabular-nums; min-width: 20px; text-align: right; }
.result-detail { display: block; color: var(--muted); font-size: .7rem; margin-top: 2px; line-height: 1.4; }
.empty-results { padding: 10px 11px; border: 1px dashed #605056; border-radius: 8px; color: var(--muted); font-size: .83rem; line-height: 1.5; margin: 0; }
.validation, .notice { background: #3b2a22; border: 1px solid #715140; color: var(--alert); border-radius: 7px; padding: 8px 10px; margin: 11px 0 0; font-size: .77rem; line-height: 1.5; }
.result-actions { display: grid; gap: 5px; margin-top: 15px; }
.result-actions .quiet-button { min-height: 33px; }
.feedback { color: var(--accent-strong); font-size: .8rem; margin: 6px 0 0; text-align: center; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 16px 1px 25px; color: var(--muted); font-size: .75rem; }

dialog { width: min(calc(100% - 30px), 420px); border: 1px solid #765245; border-radius: 13px; background: var(--panel); color: var(--text); padding: 21px; }
dialog::backdrop { background: #100c12be; }
dialog p { color: var(--muted); line-height: 1.5; font-size: .9rem; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 16px; }

@media (max-width: 1050px) {
  .shell { width: calc(100% - 42px); }
  .workspace { gap: 14px; grid-template-columns: minmax(0, 1fr) minmax(245px, 285px); }
  .panel { padding: 16px; }
  .score-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; }
}
@media (max-width: 730px) {
  .shell { width: calc(100% - 28px); }
  .top-inner { min-height: 56px; }
  .top-actions { gap: 3px; }
  .rules-link { display: none; }
  .mobile-summary { display: inline-flex; }
  .hero { margin: 15px 0; min-height: 173px; border-radius: 11px; }
  .hero-content { padding: 23px 17px; }
  .hero-kicker { margin-bottom: 9px; }
  .hero-copy { font-size: .88rem; margin-top: 10px; max-width: 330px; }
  .hero-art { left: 31%; }
  .planet, .with-photo .planet { top: -56%; right: -18%; width: max(290px, 65vw); opacity: .62; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .results { position: static; }
  .entry { gap: 13px; }
  .score-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .number { height: 42px; font-size: 1rem; }
}
@media (max-width: 380px) {
  .shell { width: calc(100% - 22px); }
  .top-inner { gap: 5px; }
  .brand { gap: 8px; font-size: .81rem; }
  .top-actions .button, .top-actions .quiet-button { padding-inline: 7px; font-size: .77rem; }
  .panel { padding: 13px; }
  .hero-content { padding-inline: 13px; }
  h1 { font-size: 2.05rem; }
}
