:root { color-scheme: light; --ink: #302747; --muted: #655b74; --paper: #fff8e8; --card: #fffefa; --yellow: #ffcf53; --mint: #c6edbb; --peach: #ffd2b9; --blue: #c5e1ff; --violet: #dfd0f6; --red: #a52c35; --line: #e0d7e7; }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); background-image: radial-gradient(#ddd2b8 1px, transparent 1px); background-size: 22px 22px; font-family: "Trebuchet MS", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.6; }
button, input, select { font: inherit; }
button, input, select { -webkit-tap-highlight-color: transparent; }
.site-header { max-width: 1280px; padding: 25px 34px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 31px; line-height: 1; font-weight: 900; letter-spacing: -1.5px; transform: rotate(-2deg); }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border: 3px solid var(--ink); border-radius: 12px; background: var(--yellow); box-shadow: 3px 3px 0 var(--ink); font-size: 31px; font-weight: 900; letter-spacing: 0; }
#identity { max-width: 220px; padding: 6px 15px; border: 2px solid var(--ink); border-radius: 12px; background: var(--violet); box-shadow: 3px 3px 0 var(--ink); overflow-wrap: anywhere; font-size: 13px; font-weight: 800; }
#identity:empty { display: none; }
main { max-width: 1220px; padding: 0 28px 48px; margin: auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; align-items: center; gap: 26px; padding: 24px 0 35px; }
.hero-copy { min-width: 0; }
.hero-castle { display: block; width: 150px; height: 145px; transform: rotate(3deg); }
.eyebrow { display: inline-block; padding: 3px 9px; margin-bottom: 10px; border: 2px solid var(--ink); border-radius: 7px; background: var(--yellow); color: var(--ink); font-size: 10px; font-weight: 900; letter-spacing: .8px; line-height: 1.5; }
h1, h2 { margin: 0; font-weight: 900; line-height: 1.12; letter-spacing: -1.1px; }
h1 { font-size: clamp(36px, 4.2vw, 55px); letter-spacing: -2px; text-shadow: 3px 3px 0 #ffe7a3; }
h2 { font-size: 28px; }
p { color: var(--muted); margin: 14px 0 20px; }
.hero p { margin-bottom: 0; max-width: 530px; font-size: 15px; }
.room-stats { display: flex; gap: 12px; text-align: center; }
.room-stats > div { min-width: 77px; padding: 13px 12px 10px; border: 3px solid var(--ink); border-radius: 16px; background: var(--blue); box-shadow: 4px 4px 0 var(--ink); transform: rotate(-3deg); }
.room-stats > div + div { background: var(--peach); transform: rotate(3deg); }
.room-stats strong { display: block; font-size: 31px; font-weight: 900; line-height: 1.1; }
.room-stats span { display: block; margin-top: 7px; font-size: 9px; font-weight: 800; letter-spacing: .6px; }
#stage { display: grid; gap: 25px; }
.card { min-width: 0; padding: 27px; border: 3px solid var(--ink); border-radius: 19px; background: var(--card); box-shadow: 6px 6px 0 var(--ink); }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 21px; }
.card-heading > div:first-child { min-width: 0; }
.card-heading .eyebrow { margin-bottom: 9px; }
.entry-card { max-width: 610px; padding: 32px; }
.entry-card form { max-width: 420px; }
.entry-card .button { margin-top: 23px; width: 100%; }
.entry-card .eyebrow { background: var(--mint); }
label { display: block; font-size: 12px; font-weight: 800; margin-bottom: 7px; }
input, select { width: 100%; min-width: 0; padding: 11px 12px; border: 2px solid var(--ink); border-radius: 10px; background: white; color: var(--ink); }
select {
  appearance: none;
  padding-right: 42px;
  background-image: linear-gradient(45deg, transparent calc(50% - 1px), var(--ink) calc(50% - 1px), var(--ink) calc(50% + 1px), transparent calc(50% + 1px)), linear-gradient(135deg, transparent calc(50% - 1px), var(--ink) calc(50% - 1px), var(--ink) calc(50% + 1px), transparent calc(50% + 1px));
  background-position: right 20px center, right 14px center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
input:focus, select:focus { outline: 3px solid #7954bc; outline-offset: 3px; }
input[readonly] { background: #f0ecf6; }
.entry-card input + label { margin-top: 17px; }
.button { padding: 12px 22px; border: 3px solid var(--ink); border-radius: 12px; background: var(--yellow); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); font-size: 14px; font-weight: 900; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; }
.button:hover:not(:disabled) { background: #ffdc7c; transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.button.secondary { background: var(--violet); }
.button.secondary:hover:not(:disabled) { background: #e9ddfb; }
.button:disabled { background: #e8e4ea; color: #746b80; box-shadow: 2px 2px 0 #746b80; border-color: #746b80; cursor: not-allowed; }
.button:focus-visible { outline: 3px solid #7954bc; outline-offset: 4px; }
.rules-card { background: #fffdf4; }
.rule-description { max-width: 850px; font-size: 16px; color: var(--ink); }
.rule-notes { display: flex; flex-wrap: wrap; gap: 10px 22px; padding-top: 17px; border-top: 2px dashed #c6bad4; color: var(--muted); font-size: 12px; }
.rule-notes span::before { content: "•"; color: var(--ink); font-weight: 900; margin-right: 6px; }
.timer-box { flex-shrink: 0; min-width: 143px; padding: 12px 15px 9px; border: 3px solid var(--ink); border-radius: 15px; background: var(--mint); box-shadow: 3px 3px 0 var(--ink); text-align: center; transform: rotate(2deg); }
.timer-box span { display: block; font-size: 9px; font-weight: 800; letter-spacing: .5px; }
.timer-box strong { display: block; font-size: 37px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -1px; line-height: 1.3; }
.timer-box.urgent { background: #ffb5a7; }
.pill { max-width: 100%; padding: 6px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--paper); font-size: 11px; font-weight: 800; }
.pill.submitted { background: var(--mint); }
.castles { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 10px; margin: 27px 0; }
.castle { --tile: var(--mint); padding: 23px 7px 10px; border: 2px solid var(--ink); border-radius: 13px; background: var(--tile); box-shadow: 3px 3px 0 var(--ink); text-align: center; transition: transform .12s; }
.castle:nth-child(5n+2) { --tile: var(--peach); }
.castle:nth-child(5n+3) { --tile: var(--violet); }
.castle:nth-child(5n+4) { --tile: var(--blue); }
.castle:nth-child(5n+5) { --tile: #ffe498; }
.castle:focus-within { transform: translateY(-4px); }
.castle label { font-size: 9px; letter-spacing: .3px; }
.castle-icon { position: relative; display: block; width: 37px; height: 34px; margin: 0 auto 13px; border: 3px solid var(--ink); border-top: 0; border-radius: 0 0 4px 4px; background: var(--card); }
.castle-icon::before { content: ""; position: absolute; top: -9px; left: -3px; width: calc(100% + 6px); height: 13px; background: var(--ink); clip-path: polygon(0 0, 21% 0, 21% 42%, 39% 42%, 39% 0, 61% 0, 61% 42%, 79% 42%, 79% 0, 100% 0, 100% 100%, 0 100%); }
.castle-icon::after { content: ""; position: absolute; bottom: 0; left: calc(50% - 5px); width: 10px; height: 14px; border-radius: 6px 6px 0 0; background: var(--ink); box-shadow: -11px -13px 0 -3px var(--ink), 11px -13px 0 -3px var(--ink); }
.castle.has-troops .castle-icon { background: var(--yellow); }
.castle input { padding: 7px 1px; border: 2px solid var(--ink); border-radius: 8px; text-align: center; font-size: 24px; font-variant-numeric: tabular-nums; font-weight: 900; appearance: textfield; -moz-appearance: textfield; }
.castle input::-webkit-inner-spin-button, .castle input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.allocation-actions { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 20px; border-top: 2px dashed #c6bad4; }
.army-budget { width: 360px; max-width: 100%; }
.budget { margin: 0 0 9px; font-size: 13px; font-weight: 800; color: var(--ink); }
.budget.over-budget { color: var(--red); }
#army-meter { display: block; width: 100%; height: 18px; overflow: hidden; border: 2px solid var(--ink); border-radius: 7px; background: #efeaf5; accent-color: #91c886; }
#army-meter::-webkit-progress-bar { background: #efeaf5; }
#army-meter::-webkit-progress-value { background: #91c886; }
#army-meter::-moz-progress-bar { background: #91c886; }
#army-meter.over-budget::-webkit-progress-value { background: #ff9a7e; }
#army-meter.over-budget::-moz-progress-bar { background: #ff9a7e; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.card > p:last-child { margin-bottom: 0; }
.notice { margin-top: 18px; padding: 13px 17px; border: 2px solid var(--ink); border-radius: 11px; background: #fff0b9; box-shadow: 3px 3px 0 var(--ink); font-size: 13px; font-weight: 600; }
#feedback { margin-top: 0; margin-bottom: 22px; }
.notice.error { background: #ffe0d9; color: #80242c; }
.notice.success { background: var(--mint); }
.round-count-input { width: 155px; flex-shrink: 0; }
.ruleset-guide { padding: 0; overflow: hidden; }
.ruleset-guide summary { padding: 16px 22px; background: var(--violet); cursor: pointer; list-style: none; }
.ruleset-guide summary::-webkit-details-marker { display: none; }
.ruleset-guide summary:hover { background: #e9ddfb; }
.ruleset-guide summary:focus-visible { outline: 3px solid #7954bc; outline-offset: -6px; }
.ruleset-guide summary h2 { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 16px; letter-spacing: 0; }
.ruleset-guide-title { display: flex; align-items: center; gap: 10px; }
.ruleset-guide-mark { display: grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: 8px; background: var(--yellow); font-size: 16px; }
.ruleset-guide-toggle::before { content: "+"; font-size: 24px; line-height: 1; }
.ruleset-guide[open] summary { border-bottom: 2px solid var(--ink); }
.ruleset-guide[open] .ruleset-guide-toggle::before { content: "−"; }
.ruleset-guide-content { padding: 0 22px 18px; }
.ruleset-guide-content > p { margin: 16px 0; }
.ruleset-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ruleset-guide-item { padding: 17px; border: 2px solid var(--ink); border-radius: 12px; background: #eff8e9; }
.ruleset-guide-item:nth-child(2) { background: #fff0e6; }
.ruleset-guide-item:nth-child(3) { background: #f0e9fc; }
.ruleset-guide-item:nth-child(4) { background: #eaf4ff; }
.ruleset-guide-item:last-child { grid-column: 1 / -1; background: #fff4ce; }
.ruleset-guide-item h3 { margin: 0 0 9px; font-size: 16px; line-height: 1.3; }
.ruleset-guide-item p { margin: 0 0 12px; color: var(--ink); font-size: 13px; }
.ruleset-guide-maximum { font-size: 11px; font-weight: 800; }
.schedule-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 160px; align-items: end; gap: 20px; padding: 15px 0; border-top: 2px dashed var(--line); }
.round-label { align-self: center; padding: 5px 9px; border: 2px solid var(--ink); border-radius: 9px; background: var(--blue); text-align: center; font-size: 12px; font-weight: 800; }
.schedule-row:nth-child(even) .round-label { background: var(--peach); }
.form-actions { margin-top: 23px; }
.export-controls { margin-top: 24px; padding-top: 20px; border-top: 2px dashed var(--line); }
.export-options { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 15px; }
.export-round-choice { flex: 1; min-width: 200px; }
.roster { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.logout { text-align: right; }
.logout .button { font-size: 11px; padding: 7px 12px; }
.waiting-card { padding: 35px; background: #eff8e9; }
.waiting-card h2 { margin-top: 22px; }
#leaderboards { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-top: 27px; }
#leaderboards[hidden], [hidden] { display: none; }
#leaderboards > .card:first-child .eyebrow { background: var(--blue); }
#leaderboards > .card:last-child .eyebrow { background: var(--yellow); }
#leaderboards select { margin-top: 21px; font-size: 12px; }
.table-scroll { overflow-x: auto; border: 2px solid var(--ink); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; background: white; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
th { padding: 12px 10px; border-bottom: 2px solid var(--ink); background: var(--violet); text-align: left; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .3px; }
td { padding: 13px 10px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th:nth-child(n+3), td:nth-child(n+3) { text-align: right; }
td:nth-child(2), td:last-child { font-weight: 800; }
.your-row { background: #e3f6da; }
@media (max-width: 1050px) { .castles { grid-template-columns: repeat(5, minmax(0, 1fr)); } #leaderboards { grid-template-columns: 1fr; } .hero { grid-template-columns: minmax(0, 1fr) 120px auto; gap: 18px; } .hero-castle { width: 120px; height: 130px; } .room-stats { gap: 10px; } .room-stats > div { min-width: 65px; padding: 12px 9px; } }
@media (max-width: 700px) {
  .site-header { padding: 22px 22px 13px; } main { padding: 0 19px 32px; } .brand { font-size: 25px; } .brand-mark { width: 36px; height: 36px; font-size: 27px; }
  #identity { max-width: 135px; font-size: 11px; padding: 4px 9px; } .hero { padding: 22px 0 28px; grid-template-columns: minmax(0, 1fr) 86px; gap: 18px 10px; }
  .hero p { font-size: 13px; } .hero-castle { width: 86px; height: 105px; } h1 { font-size: 36px; letter-spacing: -1.5px; } .room-stats { grid-column: 1 / -1; gap: 13px; }
  .room-stats > div { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 11px; border-width: 2px; border-radius: 10px; box-shadow: 3px 3px 0 var(--ink); transform: none; }
  .room-stats > div + div { transform: none; } .room-stats strong { font-size: 22px; } .room-stats span { margin: 0; font-size: 9px; }
  .card, .entry-card, .waiting-card { padding: 20px; border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); } h2 { font-size: 25px; } .card-heading { gap: 14px; }
  .timer-box { min-width: 113px; padding: 9px 10px 6px; border-width: 2px; } .timer-box span { font-size: 8px; } .timer-box strong { font-size: 29px; }
  .allocation-actions { align-items: stretch; flex-direction: column; gap: 18px; } .army-budget { width: 100%; } .castles { gap: 9px 7px; } .castle { padding: 20px 4px 7px; border-radius: 9px; box-shadow: 2px 2px 0 var(--ink); }
  .export-options { align-items: stretch; flex-direction: column; } .export-round-choice { min-width: 0; }
  .castle input { font-size: 21px; } .castle label { font-size: 8px; letter-spacing: 0; } .castle-icon { width: 30px; height: 31px; margin-bottom: 11px; }
  .schedule-row { grid-template-columns: minmax(0, 1fr) 107px; gap: 12px; } .round-label { grid-column: 1 / -1; justify-self: start; } .round-count-input { width: 118px; }
  .ruleset-guide { padding: 0; } .ruleset-guide summary { padding: 14px 17px; } .ruleset-guide-content { padding: 0 17px 14px; } .ruleset-guide-grid { grid-template-columns: 1fr; }
  .pill { padding: 5px 8px; font-size: 10px; } .rule-description { font-size: 14px; } .rule-notes { font-size: 11px; }
}
@media (max-width: 420px) {
  .castles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .castle { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; gap: 6px; padding: 17px 7px 8px; }
  .castle label { margin: 0; } .castle-icon { width: 27px; height: 25px; margin-bottom: 7px; }
  .castle input { padding: 10px 0; font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { .button, .castle { transition: none; } }
@media (forced-colors: active) { select { appearance: auto; background-image: none; padding-right: 12px; } }
