:root {
  --bg: #f6faf9;
  --surface: #fff;
  --text: #19322e;
  --muted: #62766f;
  --border: #dcebe7;
  --primary: #23816b;
  --soft: #e5f6f1;
  --wall: #d7d2b8;
  --danger: #ab3547;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    "PingFang SC",
    "Microsoft YaHei",
    sans-serif;
  line-height: 1.6;
}
button,
input {
  font: inherit;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button {
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: var(--soft);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #3aa68a;
  outline-offset: 3px;
}
.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.primary:hover {
  background: #1c6a57;
}
.text-button {
  border-color: transparent;
  background: transparent;
  padding: 7px 9px;
  color: var(--muted);
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25;
  letter-spacing: -1px;
}
h2 {
  font-size: 23px;
  line-height: 1.4;
}
h3 {
  font-size: 15px;
  margin-bottom: 12px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
input {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #bed8d0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}
form label + label,
#register-fields label {
  margin-top: 15px;
}
.topbar {
  max-width: 1160px;
  margin: auto;
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 750;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--soft);
  width: 32px;
  height: 32px;
  border-radius: 7px;
  font-size: 25px;
}
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  min-width: 0;
}
.platform-nav {
  display: flex;
  gap: 24px;
  margin-left: auto;
  font-size: 14px;
}
.platform-nav a {
  padding: 10px 0;
  color: var(--muted);
}
.platform-nav a[aria-current="page"] {
  color: var(--primary);
  box-shadow: inset 0 -2px var(--primary);
}
.platform-hero {
  padding: 24px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}
.platform-hero h1 {
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.15;
}
.platform-hero .lede {
  max-width: 520px;
}
.profile-link,
.back-link {
  display: inline-block;
  color: var(--primary);
  font-weight: 650;
  font-size: 14px;
  padding: 8px 0;
}
.back-link {
  margin-bottom: 24px;
}
.game-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 340px));
  gap: 24px;
}
.game-catalog .wall-poster {
  height: 215px;
}
.game-details h3 {
  font-size: 24px;
  margin-bottom: 0;
}
.game-entry {
  color: var(--primary);
  font-weight: 700;
}
.game-card > a {
  display: block;
  height: 100%;
}
.game-card:has(> a:hover) {
  border-color: var(--primary);
}
.catalog-game-name {
  padding: 60px 20px;
  background: var(--soft);
  font-size: 28px;
  font-weight: 700;
}
.catalog-note {
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
}
.game-intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 42px;
  align-items: center;
}
.game-cover {
  height: 300px;
}
.game-cover .poster-hole {
  top: 65px;
}
.game-intro-copy > .small {
  margin-top: 12px;
}
.game-rules {
  margin-top: 40px;
  padding: 24px 0;
  border-block: 1px solid var(--border);
}
.game-rules h2 {
  font-size: 20px;
}
.game-rules ol {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  padding-left: 20px;
  margin-bottom: 0;
}
.game-rules li {
  padding-left: 4px;
}
.game-rules strong,
.game-rules span {
  display: block;
}
.game-rules span {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}
#profile .records {
  max-width: 740px;
}
.game-stat {
  margin-top: 24px;
}
#username {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
main {
  max-width: 1160px;
  margin: auto;
  padding: 40px 28px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 9px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 12px;
}
.lede {
  margin: 22px 0;
  color: var(--muted);
  max-width: 420px;
  font-size: 16px;
}
.auth-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: center;
  min-height: 70vh;
}
.intro h1 {
  font-size: clamp(36px, 4.5vw, 56px);
}
.auth-panel {
  background: var(--surface);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.auth-panel > .small {
  margin-top: 20px;
}
.tabs {
  display: flex;
  gap: 6px;
  margin: 20px 0;
}
.tabs button {
  flex: 1;
  background: transparent;
  border-color: transparent;
}
.tabs button[aria-pressed="true"] {
  background: var(--soft);
  color: var(--primary);
  border-color: #bed8d0;
}
.full {
  width: 100%;
}
.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 28px;
  margin-top: 12px;
}
.wall-poster {
  height: 240px;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background-color: var(--wall);
  background-image:
    linear-gradient(0deg, transparent 95%, #b7b29a 95%),
    linear-gradient(90deg, transparent 97%, #b7b29a 97%);
  background-size: 90px 48px;
  box-shadow: inset 0 0 0 1px #b7b29a;
}
.poster-hole {
  position: absolute;
  width: 145px;
  height: 145px;
  border-radius: 48% 55% 43% 50%;
  background: #273f37;
  left: calc(50% - 72px);
  top: 36px;
  transform: rotate(-14deg);
  box-shadow: 0 0 0 8px #c2bca3;
}
.poster-hole:before {
  content: "";
  position: absolute;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  top: 30px;
  left: 58px;
  background: #edc68d;
}
.poster-hole:after {
  content: "";
  position: absolute;
  border-radius: 24px 24px 0 0;
  width: 66px;
  height: 70px;
  top: 82px;
  left: 47px;
  background: #66b49b;
}
.poster-label {
  position: absolute;
  bottom: 13px;
  left: 18px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 2px;
  color: #394339;
}
.rules-line {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 15px;
  flex-wrap: wrap;
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.tag {
  font-size: 12px;
  background: var(--soft);
  padding: 6px 12px;
  border-radius: 5px;
}
.lobby-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
}
.game-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}
.game-card .wall-poster {
  border-radius: 0;
  height: 260px;
}
.game-details {
  padding: 25px;
}
.game-details p:not(.eyebrow) {
  color: var(--muted);
  margin: 8px 0 22px;
}
.records {
  padding-top: 12px;
}
.records h3 {
  margin-top: 30px;
}
.stats-row {
  display: flex;
  gap: 35px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.stats-row strong {
  display: block;
  font-size: 32px;
  line-height: 1.2;
}
.stats-row span {
  font-size: 12px;
  color: var(--muted);
}
.history-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.history-row small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.empty {
  color: var(--muted);
  font-size: 14px;
  padding: 18px 0;
}
.join-form {
  max-width: 550px;
  margin-top: 35px;
}
.join-form > div {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.join-form input {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.join-form button {
  flex-shrink: 0;
  white-space: nowrap;
}
.room-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
}
.room-heading h1 {
  font-size: 26px;
  letter-spacing: 0;
}
.room-links {
  display: flex;
  gap: 6px;
}
.room-links button {
  font-size: 13px;
}
.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 32px;
}
.arena {
  min-width: 0;
}
.scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 8px 8px 0 0;
}
.scoreboard > div {
  flex: 1;
  min-width: 0;
}
.scoreboard > div:last-child {
  text-align: right;
}
.scoreboard span {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.scoreboard strong {
  font-size: 34px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.score-middle {
  text-align: center !important;
  color: var(--muted);
}
.score-middle b {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.stage-header {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
}
#arena {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3/2;
  background: #d7d2b8;
  touch-action: none;
  border-radius: 0 0 8px 8px;
}
.action-hint {
  text-align: center;
  min-height: 34px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}
.movement {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 12px;
  margin-top: 5px;
  touch-action: none;
  user-select: none;
}
.movement button {
  height: 66px;
  background: white;
  font-size: 22px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.movement span {
  display: block;
  font-size: 11px;
  font-weight: 400;
}
.movement #crouch {
  font-size: 16px;
}
.movement button.held,
.movement button[aria-pressed="true"] {
  background: var(--soft);
  border-color: var(--primary);
}
.room-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 10px 0;
}
.room-actions .primary {
  min-width: 180px;
}
.preview-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.preview-row canvas {
  width: 144px;
  height: 96px;
  border-radius: 6px;
}
.preview-row p:first-child {
  font-size: 13px;
  margin-bottom: 5px;
}
.room-sidebar section {
  padding: 0 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.room-sidebar h2 {
  font-size: 18px;
}
.member-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.member-row > div {
  min-width: 0;
}
.member-row strong {
  display: block;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.member-row small {
  font-size: 11px;
  color: var(--muted);
}
.member-row button {
  font-size: 12px;
  padding: 6px 10px;
  flex-shrink: 0;
}
.request {
  padding: 12px 0;
  font-size: 13px;
}
.request button {
  font-size: 12px;
  margin: 8px 6px 0 0;
}
.result {
  background: var(--soft);
  border-radius: 8px;
  padding: 20px !important;
}
.result h2 {
  font-size: 23px;
}
.result p {
  font-size: 13px;
  margin-top: 8px;
}
.connection {
  padding: 10px;
  background: #fff2cf;
  font-size: 13px;
  border-radius: 6px;
  margin-bottom: 12px;
}
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 22px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  font-size: 14px;
  z-index: 20;
  box-shadow: 0 4px 20px #19322e25;
  pointer-events: none;
}
dialog {
  width: min(400px, calc(100% - 32px));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  color: var(--text);
}
dialog::backdrop {
  background: #19322e70;
}
dialog p {
  margin: 15px 0;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  padding: 30px 20px calc(24px + env(safe-area-inset-bottom));
}
footer span {
  margin: 0 10px;
}
@media (prefers-reduced-motion: no-preference) {
  #auth,
  #lobby {
    animation: arrive 0.35s ease-out;
  }
  .result {
    animation: arrive 0.25s ease-out;
  }
  @keyframes arrive {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
  }
  .platform-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 24px;
  }
  .account,
  #login-link {
    margin-left: auto;
  }
  #login-link {
    font-size: 13px;
  }
  .platform-hero {
    padding: 8px 0 28px;
    margin-bottom: 24px;
  }
  .platform-hero .lede {
    font-size: 14px;
    margin: 18px 0 12px;
  }
  .game-catalog {
    grid-template-columns: 1fr;
  }
  .game-intro-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .game-cover {
    height: 210px;
  }
  .game-cover .poster-hole {
    top: 25px;
  }
  .game-intro-copy .primary {
    width: 100%;
  }
  .game-intro-copy .lede {
    margin: 15px 0 20px;
  }
  .game-rules ol {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  #profile h1 {
    font-size: 27px;
  }
  .topbar {
    padding: 15px 18px;
  }
  main {
    padding: 24px 16px;
  }
  .auth-layout {
    grid-template-columns: 1fr;
    gap: 26px;
    min-height: 0;
  }
  .intro h1 {
    font-size: 34px;
  }
  .intro .wall-poster,
  .intro .rules-line {
    display: none;
  }
  .lede {
    margin: 13px 0 0;
    font-size: 14px;
  }
  .auth-panel {
    padding: 22px;
  }
  .auth-panel .eyebrow {
    display: none;
  }
  .lobby-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .game-card .wall-poster {
    height: 200px;
  }
  .section-heading {
    margin-bottom: 22px;
  }
  .section-heading h1 {
    font-size: 28px;
  }
  .game-details {
    padding: 20px;
  }
  .game-details .primary {
    width: 100%;
  }
  .room-grid {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .room-heading {
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 8px;
  }
  .room-heading h1 {
    font-size: 21px;
  }
  .room-heading .eyebrow {
    font-size: 10px;
  }
  .room-links {
    gap: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 170px;
  }
  .room-links button {
    padding: 5px 8px;
    min-height: 36px;
    font-size: 12px;
  }
  .scoreboard {
    padding: 10px 16px;
  }
  .scoreboard strong {
    font-size: 30px;
  }
  .scoreboard span {
    font-size: 12px;
  }
  .room-sidebar section {
    margin-bottom: 18px;
    padding-bottom: 18px;
  }
  .room-sidebar h2 {
    font-size: 17px;
  }
  .preview-row {
    margin-top: 6px;
    padding-top: 12px;
  }
  .preview-row canvas {
    width: 120px;
    height: 80px;
  }
  .movement button {
    height: 60px;
  }
  .account {
    gap: 3px;
  }
  .brand {
    font-size: 15px;
  }
  .brand-mark {
    width: 28px;
    height: 28px;
  }
  #username {
    max-width: 90px;
  }
  .tag {
    display: none;
  }
  footer {
    padding-top: 12px;
  }
}
