/* Presentation is independent of game and protocol code. */
:root {
  font: 16px/1.5 system-ui, sans-serif;
  color-scheme: dark;
  color: #f1f3ef;
  background: #101c25;
  --muted: #abbcc7;
  --line: #405463;
  --panel: #1c303e;
  --accent: #a4d3e7;
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 50rem; margin: 0 auto; padding: clamp(1.5rem, 6vw, 4.5rem) 1.5rem 3rem; }
header { margin-bottom: 3.25rem; }
.arcade-link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; margin-bottom: .25rem; color: var(--muted); font-size: .875rem; text-decoration: none; }
.arcade-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: .2em; }
h1 { margin: .25rem 0 0; font-size: clamp(2rem, 5vw, 3rem); font-weight: 650; line-height: 1.2; letter-spacing: -.035em; }
main:has(#match:not([hidden])) h1 { font-size: 1.5rem; }
p { margin: 0; }
button, input, .button { font: inherit; }
button, .button {
  min-height: 44px; padding: .65rem 1rem; border: 1px solid var(--line);
  border-radius: .25rem; background: var(--panel); color: inherit;
  cursor: pointer; touch-action: manipulation; font-size: .9rem; font-weight: 500;
}
button:hover:not(:disabled), .button:hover { background: #2b4658; }
button:disabled { cursor: default; opacity: .36; }
.primary { background: var(--accent); color: #101c25; border-color: var(--accent); font-weight: 600; }
.primary:hover:not(:disabled), .button.primary:hover { background: #c1e4f2; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); padding-inline: .5rem; }
.quiet:hover:not(:disabled) { background: var(--panel); color: #f1f3ef; }
:focus-visible { outline: 3px solid #d6bc7d; outline-offset: 4px; }
input { min-width: 0; border: 1px solid var(--line); border-radius: .25rem; background: #0c1720; color: inherit; min-height: 46px; }
[hidden] { display: none !important; }
#lobby { display: flex; align-items: flex-end; gap: 2.5rem; padding-bottom: 2.5rem; }
#join-form label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.join-entry { display: flex; gap: .5rem; }
#join-code { width: 9rem; text-align: center; font: 1.15rem ui-monospace, monospace; letter-spacing: .13em; }
#join-code::placeholder { color: #8499a8; }
.match-status { display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; margin-bottom: 1.75rem; }
#status { font-size: 1.25rem; font-weight: 500; line-height: 1.4; }
#result h2 { font-size: 2rem; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
#match:has(#stay-open:not([hidden])) .match-status { margin-bottom: .875rem; }
#status:empty { display: none; }
#time, #invite-time { font-size: .85rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#role { color: var(--muted); margin-bottom: 1rem; }
#invitation { padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.75rem; }
.invitation-status { color: var(--muted); margin-bottom: 1rem; }
.invitation-entry { display: flex; align-items: center; gap: 1.25rem; }
.invitation-details { min-width: 0; }
.invitation-code { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem 1rem; }
#copy-code { flex-shrink: 0; }
.small-label { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
#code { font: 600 clamp(1.65rem, 5vw, 2rem)/1.2 ui-monospace, monospace; letter-spacing: .15em; user-select: all; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
#reserve { padding-bottom: .75rem; border-bottom: 1px solid var(--line); }
#total { font-variant-numeric: tabular-nums; white-space: nowrap; }
#reserve.invalid #total { color: #f3aaa0; }
.pips { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 4px; }
.pips button { min-width: 0; min-height: 44px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.pips button::before { content: ""; display: block; height: 16px; border: 1px solid var(--line); border-radius: 1px; }
.pips .filled::before { background: var(--accent); border-color: var(--accent); }
.pips button:hover:not(:disabled) { background: transparent; }
.pips button:hover:not(:disabled)::before { border-color: #f1f3ef; }
.lane { display: grid; grid-template-columns: 5rem minmax(0, 1fr) auto 5rem; align-items: center; gap: 1rem; padding: 1.2rem 0; border-bottom: 1px solid var(--line); }
.lane label { color: var(--muted); font-size: .9rem; }
.stepper { display: flex; align-items: center; }
.stepper button { width: 44px; padding: 0; font-size: 1.5rem; font-weight: 400; }
.stepper input { width: 3.25rem; padding: 0; border: 0; background: transparent; text-align: center; font: 600 1.25rem ui-monospace, monospace; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.fill { padding-inline: .5rem; background: transparent; color: var(--accent); }
.submit-row { display: flex; justify-content: flex-end; padding: 1.5rem 0; }
#locked { max-width: 32rem; margin: 2.625rem 0 0; }
#locked .small-label { margin: 0; font-size: .875rem; }
#locked-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; margin: 1.125rem 0 0; }
#locked-values div { border-top: 1px solid var(--line); padding-top: .875rem; }
#locked-values dt { color: var(--muted); font-size: .8125rem; }
#locked-values dd { margin: .375rem 0 0; font: 500 2.75rem/1.3 ui-monospace, Menlo, monospace; letter-spacing: -.04em; }
#move-receipt { margin-top: 1rem; }
.hint { color: var(--muted); font-size: .9375rem; }
#result { padding: .25rem 0 .5rem; }
#result h2 { margin: 0 0 .875rem; }
#result-score { color: var(--muted); }
.match-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: 2.375rem; }
#match:has(#locked:not([hidden])) .match-actions { max-width: 32rem; }
#cancel { margin-left: auto; font-weight: 400; }
#copy-status { min-height: 1.5rem; margin-top: .4rem; }
#copy-status:empty { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#copy-fallback { width: 100%; padding: .5rem; }
#error { margin-bottom: 1.25rem; padding: .8rem 1rem; color: #ffd1c9; background: #341e1d; border-left: 3px solid #e5a196; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  main { padding-inline: 1rem; }
  header { margin-bottom: 2.5rem; }
  #lobby { flex-direction: column; align-items: stretch; gap: 1.5rem; }
  #start { align-self: flex-start; }
  .lane { grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1rem; }
  .lane label { grid-column: 1; grid-row: 1; }
  .stepper { grid-column: 2; grid-row: 1; }
  .lane-pips { grid-column: 1; grid-row: 2; gap: 3px; }
  .fill { grid-column: 2; grid-row: 2; justify-self: end; min-width: 5rem; }
  .match-status { flex-direction: column; gap: .35rem; }
  .invitation-entry { gap: 1rem; }
  #copy-code { padding-inline: .75rem; }
  #locked-values { gap: 1rem; }
}
