:root {
  color-scheme: light;
  --paper: #edf1ef;
  --ink: #171b1a;
  --muted: #77817d;
  --line: #cbd2cf;
  --acid: #d1f35a;
  --coral: #fa6d51;
  --court: #171b1a;
  --mono: "DM Mono", "Courier New", monospace;
  --display: "Space Grotesk", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(rgba(23, 27, 26, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 27, 26, .035) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: var(--display);
}
button, input { font: inherit; }
button { color: inherit; }
.topbar { height: 70px; padding: 0 clamp(18px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(237, 241, 239, .94); }
.wordmark { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 700; }
.wordmark-light { margin-left: 5px; color: #737e79; font-weight: 500; }
.mark { position: relative; display: flex; gap: 3px; align-items: center; width: 22px; height: 22px; }
.mark i { display: block; width: 4px; height: 13px; border-radius: 1px; background: var(--ink); }
.mark i:first-child { height: 9px; background: var(--coral); }
.mark b { position: absolute; left: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.topbar-right { display: flex; align-items: center; gap: 18px; color: #53605b; font: 10px var(--mono); letter-spacing: .04em; }
.connection { display: flex; align-items: center; gap: 8px; }
.connection-dot, .live-pulse { width: 7px; height: 7px; border-radius: 50%; background: #b3bcb8; }
.connection-dot.online { background: #53a96f; box-shadow: 0 0 0 3px rgba(83, 169, 111, .14); }
.top-divider { width: 1px; height: 17px; background: var(--line); }
.season-label b { color: var(--coral); }
.account-button { padding: 8px 10px; border: 1px solid #aeb9b4; background: transparent; color: var(--ink); cursor: pointer; font: 9px var(--mono); white-space: nowrap; }
.account-button:hover { border-color: var(--ink); background: rgba(255, 255, 255, .48); }
.account-name strong { overflow: hidden; max-width: 142px; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-dialog { width: min(420px, calc(100% - 28px)); max-width: none; padding: 0; border: 1px solid #8f9a95; background: var(--paper); color: var(--ink); box-shadow: 10px 10px 0 rgba(23, 27, 26, .2); }
.account-dialog::backdrop { background: rgba(18, 23, 21, .64); }
.account-dialog-content { position: relative; padding: 30px; }
.dialog-close { position: absolute; top: 17px; right: 17px; width: 30px; height: 30px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 21px; line-height: 1; }
.account-dialog h2 { margin: 12px 0 24px; font-size: 27px; line-height: 1.1; }
.auth-modes { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.auth-mode { padding: 10px 5px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #707b76; cursor: pointer; font-size: 12px; }
.auth-mode.selected { border-bottom-color: var(--coral); color: var(--ink); font-weight: 700; }
.auth-field { display: grid; gap: 8px; margin: 15px 0; color: #727d78; font: 9px var(--mono); letter-spacing: .06em; }
.auth-field input { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #b8c1bd; border-radius: 0; background: rgba(255, 255, 255, .54); color: var(--ink); font: 14px var(--display); letter-spacing: 0; }
.auth-hint, .auth-notice { min-height: 16px; margin: 10px 0; color: #727d78; font: 10px var(--mono); }
.auth-notice { color: #a53c2e; }
.auth-submit { width: 100%; height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; border: 0; background: var(--acid); cursor: pointer; font-size: 13px; font-weight: 700; }
.auth-submit:hover { background: #defa7d; }
.account-status { display: grid; gap: 10px; padding: 12px 0 4px; }
.account-status strong { font-size: 20px; }
.signout-button { margin-top: 9px; background: #dfe5e2; }
.signout-button:hover { background: #d2dad6; }
.account-status[hidden], #auth-fields[hidden] { display: none; }
.layout { width: min(1320px, calc(100% - 2 * clamp(18px, 5vw, 76px))); margin: 0 auto; padding: 43px 0 50px; display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: clamp(28px, 4vw, 58px); }
.play-column { min-width: 0; animation: rise-in .55s ease-out both; }
.right-column { padding-top: 8px; animation: rise-in .55s .12s ease-out both; }
.page-heading { min-height: 105px; display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow, .field-label { display: flex; align-items: center; gap: 8px; margin: 0; color: #727d78; font: 10px var(--mono); letter-spacing: .08em; }
.eyebrow-line { display: inline-block; width: 16px; height: 1px; background: var(--coral); }
h1 { margin: 9px 0 0; font-size: clamp(34px, 4vw, 50px); line-height: 1; letter-spacing: -.035em; font-weight: 600; }
h1 span { color: var(--coral); }
.live-count { display: flex; align-items: center; gap: 7px; padding-top: 26px; color: #737d79; font: 10px var(--mono); }
.live-pulse { width: 6px; height: 6px; background: var(--coral); animation: pulse 1.7s infinite; }
.court-shell { padding: 0 23px 13px; background: var(--court); color: #edf1ef; box-shadow: 7px 7px 0 rgba(23, 27, 26, .09); }
.court-topline { height: 39px; display: flex; align-items: center; justify-content: space-between; color: #a3afaa; font: 9px var(--mono); letter-spacing: .08em; }
.court-tag { display: flex; gap: 7px; align-items: center; color: #c4ccc8; }
.court-tag-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--acid); }
.scoreline { min-height: 72px; display: grid; grid-template-columns: 1fr 48px 1fr; align-items: center; padding: 2px 1px 10px; }
.score-player { display: flex; align-items: center; gap: 9px; min-width: 0; font: 10px var(--mono); color: #b5bfbb; }
.score-player strong { margin-left: auto; color: #f0f3f1; font: 600 28px var(--display); line-height: 1; }
.score-player-right { justify-content: flex-end; }
.score-player-right strong { margin: 0 auto 0 0; }
.side-indicator { width: 7px; height: 7px; background: var(--acid); }
.rival-indicator { background: var(--coral); }
.score-center { text-align: center; color: #6f7a75; font: 9px var(--mono); }
.canvas-wrap { position: relative; overflow: hidden; border: 1px solid #39413d; background: #202623; }
#court { display: block; width: 100%; height: auto; aspect-ratio: 5 / 3; touch-action: none; outline: none; }
.canvas-corner { position: absolute; width: 10px; height: 10px; border-color: var(--acid); border-style: solid; pointer-events: none; }
.corner-tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.corner-tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.corner-br { right: -1px; bottom: -1px; border-width: 0 1px 1px 0; }
.court-footer { min-height: 42px; display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; }
.court-message { color: #c2cbc7; font-size: 12px; }
.controls-hint { display: flex; align-items: center; gap: 5px; color: #8a9691; font: 8px var(--mono); white-space: nowrap; }
kbd { min-width: 17px; height: 18px; padding: 2px 4px; border: 1px solid #46504b; color: #c5ceca; text-align: center; font: 9px var(--mono); }
.hint-divider { width: 1px; height: 12px; margin: 0 4px; background: #46504b; }
.action-row { min-height: 79px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); }
.queue-button { flex: 1; min-width: 190px; height: 49px; padding: 0 15px; display: flex; align-items: center; gap: 11px; border: 0; background: var(--acid); cursor: pointer; text-align: left; font-size: 14px; font-weight: 700; transition: background .15s, transform .15s; }
.queue-button:hover:not(:disabled) { background: #defa7d; transform: translateY(-2px); }
.queue-button:focus-visible, input:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.queue-button:disabled { cursor: wait; opacity: .72; }
.queue-button.searching { background: #e1e7e3; }
.button-symbol { display: grid; width: 23px; height: 23px; place-items: center; border: 1px solid rgba(23, 27, 26, .32); border-radius: 50%; font: 19px var(--display); }
.button-arrow { margin-left: auto; font-size: 17px; }
.name-field { width: 142px; flex: 0 0 142px; display: grid; gap: 7px; }
.field-label { font-size: 9px; }
.name-field input { width: 100%; padding: 0 0 3px; border: 0; border-bottom: 1px solid #9ca7a2; border-radius: 0; background: transparent; color: var(--ink); outline: none; font-size: 14px; }
.rating-block { min-width: 63px; display: grid; gap: 5px; }
.rating-block strong { font: 600 19px var(--display); }
.notice { min-height: 20px; margin: 10px 0 0; color: #7b8581; font: 10px var(--mono); }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 2px 0 17px; border-bottom: 1px solid var(--ink); }
.panel-heading h2 { margin: 8px 0 0; font-size: 22px; letter-spacing: -.025em; font-weight: 600; }
.ladder-icon { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid var(--line); font-size: 15px; }
.ladder-columns, .ladder-row { display: grid; grid-template-columns: minmax(0, 1fr) 42px 54px; align-items: center; gap: 5px; }
.ladder-columns { height: 37px; color: #87918d; font: 8px var(--mono); }
.ladder-columns span:last-child { text-align: right; }
.leaderboard { min-height: 250px; margin: 0; padding: 0; list-style: none; }
.ladder-row { min-height: 44px; border-top: 1px solid #d9dfdc; font-size: 11px; animation: row-in .3s ease-out both; }
.ladder-player { display: flex; min-width: 0; align-items: center; gap: 8px; }
.ladder-rank { width: 17px; color: #8a9490; font: 9px var(--mono); }
.ladder-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ladder-record { color: #717b77; font: 9px var(--mono); }
.ladder-rating { text-align: right; font: 10px var(--mono); }
.ladder-row:first-child .ladder-rank { color: #bd4f38; }
.empty-ladder { min-height: 250px; display: grid; place-content: center; gap: 8px; border-top: 1px solid #d9dfdc; text-align: center; }
.empty-ladder strong { font-size: 12px; font-weight: 600; }
.empty-ladder span { color: #7c8782; font: 9px var(--mono); }
.ladder-footer { display: flex; align-items: center; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); color: #75807b; font: 8px var(--mono); letter-spacing: .05em; }
.rank-marker { width: 6px; height: 6px; background: var(--coral); }
.ladder-footer-rule { flex: 1; height: 1px; margin-left: 4px; background: var(--line); }
.record-panel { margin-top: 40px; padding: 16px 16px 14px; border: 1px solid #c4cdca; background: rgba(255, 255, 255, .34); }
.record-top { display: flex; justify-content: space-between; align-items: center; }
.record-number { color: var(--coral); font: 500 11px var(--mono); }
.record-stats { display: flex; align-items: flex-end; gap: 12px; padding: 15px 0 12px; }
.record-stats div { display: grid; gap: 3px; }
.record-stats strong { font: 600 26px var(--display); line-height: 1; }
.record-stats div span { color: #7b8581; font: 8px var(--mono); }
.record-slash { padding-bottom: 2px; color: #a0aaa5; font: 18px var(--display); }
.record-streak { margin: 0 1px 1px auto; color: #67a477; font-size: 19px; }
.record-track { height: 3px; background: #d2d9d6; }
.record-track span { display: block; width: 0; height: 100%; background: var(--coral); transition: width .4s ease; }
.aside-note { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; }
.note-index { padding-top: 2px; color: var(--coral); font: 9px var(--mono); }
.aside-note p { margin: 0; color: #707b76; font-size: 11px; line-height: 1.65; }
.page-footer { min-height: 48px; padding: 0 clamp(18px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: #7b8581; font: 8px var(--mono); letter-spacing: .06em; }
.footer-dot { padding: 0 5px; color: var(--coral); }
@keyframes rise-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes row-in { from { opacity: 0; transform: translateX(5px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(250, 109, 81, .12); } }

@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr) 240px; gap: 26px; }
  .court-shell { padding-right: 16px; padding-left: 16px; }
  .controls-hint { font-size: 7px; }
  .action-row { gap: 16px; }
  .name-field { width: 118px; flex-basis: 118px; }
}
@media (max-width: 700px) {
  .topbar { height: 58px; }
  .topbar-right { gap: 10px; font-size: 8px; }
  .season-label { display: none; }
  .layout { width: calc(100% - 32px); padding-top: 29px; grid-template-columns: 1fr; gap: 25px; }
  .page-heading { min-height: 90px; }
  .right-column { padding-top: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(135px, .72fr); gap: 18px; }
  .ladder-panel { grid-row: span 2; }
  .record-panel { margin-top: 0; align-self: start; padding: 13px; }
  .aside-note { margin: 0; align-self: start; }
  .leaderboard, .empty-ladder { min-height: 190px; }
  .ladder-row { min-height: 38px; }
  .page-footer { padding: 0 16px; font-size: 7px; }
}
@media (max-width: 460px) {
  .topbar { padding: 0 12px; }
  .topbar-right { gap: 7px; }
  .topbar-right .connection { gap: 5px; font-size: 7px; }
  .account-button { padding: 7px 6px; font-size: 8px; }
  .topbar-right .top-divider { display: none; }
  .account-dialog-content { padding: 25px 21px; }
  .layout { width: calc(100% - 24px); padding-top: 24px; }
  .page-heading { min-height: 82px; }
  h1 { font-size: 35px; }
  .live-count { padding-top: 18px; font-size: 8px; }
  .court-shell { padding: 0 11px 11px; }
  .court-topline { height: 34px; font-size: 8px; }
  .scoreline { min-height: 60px; }
  .score-player { gap: 6px; font-size: 8px; }
  .score-player strong { font-size: 25px; }
  .court-footer { min-height: 38px; align-items: center; }
  .court-message { font-size: 10px; }
  .controls-hint { gap: 3px; font-size: 6px; }
  kbd { min-width: 15px; height: 16px; padding: 1px 3px; font-size: 8px; }
  .action-row { flex-wrap: wrap; gap: 12px 14px; padding: 12px 0; }
  .queue-button { flex-basis: 100%; height: 45px; }
  .name-field { flex: 1; width: auto; }
  .rating-block { margin-left: auto; }
  .right-column { grid-template-columns: 1fr; gap: 15px; }
  .ladder-panel { grid-row: auto; }
  .record-panel { display: none; }
  .aside-note { padding: 2px 0 7px; }
  .leaderboard, .empty-ladder { min-height: 172px; }
  .page-footer { min-height: 43px; gap: 8px; }
  .page-footer span:last-child { text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
