:root { color-scheme: light; --paper: #f5f4ee; --ink: #26372c; --muted: #687167; --line: #d8ddd1; --green: #356744; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.65 system-ui, sans-serif; }
a { color: inherit; text-underline-offset: 5px; }
button, input { font: inherit; }
button, .button { min-height: 44px; border: 1px solid #acb8a9; border-radius: 5px; background: transparent; padding: 10px 18px; color: var(--ink); cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
button:hover:enabled { background: #e9ede3; border-color: var(--green); }
button:active:enabled { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #67956a; outline-offset: 4px; }
.primary { color: #fff; background: var(--green); border-color: var(--green); font-weight: 600; }
.primary:hover:enabled { color: #fff; background: #254f31; }
.text-button { min-height: 36px; border: 0; border-radius: 0; padding: 0 3px; color: var(--green); text-decoration: underline; text-underline-offset: 4px; }
input { width: 100%; min-width: 0; min-height: 46px; border: 1px solid #b9c3b3; border-radius: 4px; background: #fffefa; padding: 10px 12px; color: var(--ink); }
input::placeholder { color: #81897e; font-size: 13px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 23px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.site-header { max-width: 1160px; margin: 0 auto; min-height: 92px; padding: 0 28px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; font-size: 23px; font-weight: 750; letter-spacing: -.7px; white-space: nowrap; }
.brand img { object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: 28px; font-size: 14px; }
.site-nav a { text-decoration: none; padding: 10px 0; color: var(--muted); }
.site-nav [aria-current=page] { color: var(--green); box-shadow: 0 2px var(--green); font-weight: 650; }
.portal-main { max-width: 1104px; margin: 0 auto; padding: 42px 28px 28px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 650; letter-spacing: .13em; margin-bottom: 8px; }
.page-title { font-size: clamp(30px, 4vw, 42px); font-weight: 650; line-height: 1.25; letter-spacing: -.03em; margin-bottom: 12px; }
.muted { color: var(--muted); }
.lobby-layout { display: grid; grid-template-columns: minmax(290px, .85fr) minmax(0, 1.2fr); align-items: center; gap: 60px; margin-top: 32px; }
.lobby-workspace { min-width: 0; padding: 4px 0; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-heading .muted { font-size: 12px; }
#auth-form { display: flex; flex-direction: column; }
#auth-form label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
#auth-form label[for=password] { margin-top: 17px; }
#auth-submit { width: 100%; margin-top: 22px; }
.field-help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.switch-auth { display: flex; justify-content: center; align-items: center; gap: 8px; font-size: 13px; margin-top: 10px; }
.profile-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profile-line h2 { overflow-wrap: anywhere; }
.personal-best { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; color: var(--muted); border-bottom: 1px solid var(--line); padding: 16px 0 22px; margin-bottom: 24px; }
.personal-best strong { font-size: 22px; font-variant-numeric: tabular-nums; color: var(--green); }
.room-actions { display: grid; gap: 10px; }
#create-room { display: flex; justify-content: space-between; align-items: center; }
.join-section { margin-top: 30px; }
#join-form { display: flex; gap: 8px; margin-top: 10px; }
#join-room { flex-shrink: 0; }
.invitation { border-left: 3px solid #769757; padding: 7px 12px; background: #eaf0df; margin-top: 18px; font-size: 13px; }
#resume-legacy { margin-top: 16px; width: 100%; }
.status-message { margin-top: 16px; color: var(--muted); }
.error-message { color: #9c3d29; }
.preview-stage { position: relative; overflow: hidden; background: #77c500; aspect-ratio: 4/3; border: 1px solid #6d823e; }
.board-preview { display: block; width: 100%; height: auto; }
.preview-piece { position: absolute; width: 7.4%; height: auto; top: .3%; left: 42%; }
.preview-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 12px; }
.preview-caption a { color: var(--green); }
.lobby-footer { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 18px; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.ranking-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 28px 0 18px; }
.personal-score { padding: 18px 0; border-block: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; margin-top: 28px; }
#personal-label { flex: 1; min-width: 150px; overflow-wrap: anywhere; }
#personal-best { white-space: nowrap; }
#personal-note { flex-basis: 100%; font-size: 13px; }
.score-value { color: var(--green); font-size: 25px; font-weight: 650; font-variant-numeric: tabular-nums; }
.ranking-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ranking-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 12px 16px; border-bottom: 1px solid #aebda7; }
.ranking-table td { padding: 17px 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.ranking-table th:first-child, .ranking-table td:first-child { width: 80px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking-table th:last-child, .ranking-table td:last-child { text-align: right; width: 190px; font-variant-numeric: tabular-nums; }
.ranking-table tr.is-self { background: #eaf0e2; }
.ranking-table td:last-child { color: var(--green); font-size: 21px; font-weight: 600; }
.empty-state { padding: 64px 18px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); }
.empty-state h2 { color: var(--ink); font-size: 21px; margin-bottom: 8px; }
.empty-state a { display: inline-block; margin-top: 18px; color: var(--green); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { .page-heading, .lobby-layout { animation: arrive .25s ease-out; } @keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } } }
@media (max-width: 850px) { .lobby-layout { gap: 30px; grid-template-columns: minmax(280px,1fr) minmax(0,1fr); } .site-nav { gap: 20px; } }
@media (max-width: 660px) {
  .site-header { min-height: 76px; padding: 0 20px; gap: 12px; }
  .brand { font-size: 19px; gap: 7px; } .brand img { width: 26px; height: 26px; }
  .site-nav { gap: 16px; font-size: 13px; }
  .portal-main { padding: 28px 20px 24px; }
  .lobby-layout { display: flex; flex-direction: column; align-items: stretch; gap: 34px; margin-top: 26px; }
  .game-preview { max-width: 520px; width: 100%; margin: 0 auto; }
  .lobby-footer { display: block; margin-top: 28px; } .lobby-footer p + p { margin-top: 6px; }
  .ranking-table th, .ranking-table td { padding-inline: 8px; }
  .ranking-table th:first-child, .ranking-table td:first-child { width: 48px; }
  .ranking-table th:last-child, .ranking-table td:last-child { width: 124px; }
  .ranking-toolbar { gap: 12px; align-items: flex-start; }
}
