:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #242925;
  background: #f2f1e9;
  font-synthesis: none;
  --lime: #b8f36b;
  --ink: #242925;
  --muted: #858980;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
input,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  transition:
    background 0.18s,
    transform 0.18s,
    opacity 0.18s;
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  cursor: default;
  opacity: 0.42;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #769d45;
  outline-offset: 4px;
}
input:focus {
  outline: 2px solid #86b54b;
  outline-offset: 2px;
}
select:focus-visible {
  outline: 2px solid #86b54b;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 27px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d9dcd0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -1px;
}
.brand-icon {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 2px;
  transform: rotate(-35deg);
  margin-right: 5px;
}
.brand-icon i {
  width: 9px;
  height: 9px;
  background: var(--ink);
  border-radius: 50%;
}
.brand-dot {
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
}
.connection {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #6f766b;
}
.connection i,
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a0a398;
  display: inline-block;
}
.connection.online i {
  background: #6b9741;
}
.icon-button {
  position: relative;
  border: 1px solid #d9dcd0;
  background: transparent;
  border-radius: 50%;
  width: 33px;
  height: 33px;
  font-size: 20px;
}
.sound-slash {
  position: absolute;
  font-size: 22px;
  left: 15px;
  top: 2px;
}
.help-button {
  border: 0;
  background: none;
  font-size: 12px;
}
.help-button span {
  margin-left: 14px;
  font-size: 17px;
}
main {
  max-width: 1160px;
  padding: 0 26px;
  margin: auto;
}
.intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 36px 0 29px;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.8px;
  font-weight: 700;
}
.tiny-star {
  margin-right: 7px;
  font-size: 17px;
  vertical-align: middle;
}
h1 {
  font-size: clamp(38px, 4.7vw, 59px);
  line-height: 1.01;
  letter-spacing: -3.2px;
  margin: 16px 0 0;
  font-weight: 800;
}
h1 span {
  position: relative;
  z-index: 0;
}
h1 span:after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 0;
  right: -5px;
  height: 11px;
  background: var(--lime);
  bottom: 4px;
  transform: rotate(-2deg);
}
.intro > p {
  font-size: 13px;
  line-height: 1.7;
  color: #74796e;
  margin: 0 22px 4px 20px;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 338px;
  gap: 25px;
  align-items: start;
}
.arena {
  scroll-margin-top: 16px;
  background: #252b27;
  border-radius: 21px;
  padding: 25px 30px 22px;
  box-shadow: 0 7px 0 #dfe0d5;
  color: #e8ede4;
  overflow: hidden;
}
.arena-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: #7f8d80;
}
.arena-label {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #dce3d5;
  font-size: 9px;
  font-weight: bold;
}
.arena-size {
  font-size: 9px;
  background: #343b34;
  border: 1px solid #424b40;
  border-radius: 4px;
  padding: 4px 6px;
  color: #9aaa92;
  letter-spacing: 0;
  white-space: nowrap;
}
.scoreboard {
  display: flex;
  gap: 10px;
  margin: 20px 0 20px;
}
.score {
  flex: 1;
  min-width: 0;
  background: #2d342e;
  border: 1px solid #414a3f;
  border-radius: 10px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  opacity: 0.65;
}
.score.active {
  border-color: var(--player);
  opacity: 1;
}
.score-dot {
  background: var(--player);
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 0 15px color-mix(in srgb, var(--player) 15%, transparent);
}
.score-name {
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.score small {
  font-weight: 400;
  font-size: 9px;
  color: #9daa97;
  display: block;
  margin-top: 4px;
}
.score-value {
  margin-left: auto;
  font-size: 22px;
  font-weight: 700;
  color: var(--player);
  letter-spacing: -1px;
}
.board-wrap {
  position: relative;
}
.board {
  display: grid;
  grid-template-columns: repeat(var(--size, 6), 1fr);
  gap: 8px;
  background: #202520;
  border: 1px solid #424a3e;
  padding: 13px;
  border-radius: 14px;
  aspect-ratio: 1;
}
.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1px solid #3c4438;
  background: #30372f;
  border-radius: 10px;
  min-width: 0;
  padding: 0;
  box-shadow: inset 0 1px 0 #ffffff04;
  opacity: 1 !important;
}
.cell:after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  background: #57604e;
  border-radius: 50%;
}
.cell.occupied:after {
  display: none;
}
.cell.playable:hover {
  background: #48543d;
  border-color: #84976b;
}
.cell:disabled {
  cursor: default;
}
.last-move-marker {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #bcc1b6;
  box-shadow: 0 0 0 1px #242925;
  z-index: 3;
  pointer-events: none;
}
.orb {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--player);
  box-shadow:
    inset 0 -4px 0 #00000014,
    0 3px 9px #00000020;
  z-index: 1;
}
.orb.critical {
  box-shadow:
    inset 0 -4px 0 #00000014,
    0 0 0 4px color-mix(in srgb, var(--player) 10%, transparent),
    0 0 20px color-mix(in srgb, var(--player) 13%, transparent);
}
.pips {
  position: relative;
  width: 50%;
  height: 50%;
}
.pip {
  position: absolute;
  width: 25%;
  height: 25%;
  background: #253027;
  border-radius: 50%;
  left: 37.5%;
  top: 37.5%;
}
.pips[data-count="2"] .pip:nth-child(1) {
  left: 10%;
}
.pips[data-count="2"] .pip:nth-child(2) {
  left: 65%;
}
.pips[data-count="3"] .pip:nth-child(1) {
  top: 4%;
}
.pips[data-count="3"] .pip:nth-child(2) {
  left: 5%;
  top: 62%;
}
.pips[data-count="3"] .pip:nth-child(3) {
  left: 70%;
  top: 62%;
}
.cell.pop .orb {
  animation: pop 0.24s ease-out;
}
.cell.burst:before {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid var(--player, var(--lime));
  border-radius: 50%;
  z-index: 2;
  animation: burst 0.35s ease-out forwards;
  pointer-events: none;
}
.arena-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 0 0;
  min-height: 66px;
}
.turn-dot {
  width: 7px;
  height: 7px;
  background: var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 0 4px #b8f36b10;
  flex: none;
}
.arena-bottom strong {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}
.arena-bottom span#turn-detail {
  display: block;
  color: #899682;
  font-size: 10px;
  margin-top: 3px;
  line-height: 1.4;
}
.preview-mark {
  margin-left: auto;
  color: var(--lime);
  font-size: 32px;
}
.timer {
  margin-left: auto;
  font-size: 27px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timer span {
  color: #8b9886;
  font-size: 10px;
  margin-left: 4px;
}
.timer.urgent {
  color: #ff9478;
}
.side {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.setup-panel,
.room-panel {
  background: #fafaf6;
  border: 1px solid #dce0d2;
  border-radius: 17px;
  padding: 25px;
}
.panel-tag {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.live-dot {
  background: #81a959;
}
.side h2 {
  font-size: 29px;
  letter-spacing: -1.1px;
  line-height: 1.06;
  margin: 19px 0 12px;
}
.lime-period {
  color: #7da547;
}
.muted {
  font-size: 11px;
  color: #858b7e;
  line-height: 1.6;
  margin: 0 0 22px;
}
.side label, .side .group-label {
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 1.2px;
  display: block;
  margin-bottom: 8px;
}
input {
  width: 100%;
  border: 1px solid #dce0d4;
  background: #f2f3eb;
  border-radius: 8px;
  padding: 13px;
  font-size: 12px;
  color: var(--ink);
}
input::placeholder {
  color: #9b9f93;
}
.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 0;
  font-size: 10px;
  color: #777e70;
}
.size-picker {
  display: flex;
  gap: 5px;
}
.size-picker button {
  border: 1px solid #dfe2d8;
  border-radius: 5px;
  font-size: 9px;
  background: transparent;
  padding: 7px 9px;
  color: #848c79;
}
.size-picker button.selected {
  background: #e5ebda;
  border-color: #b7c89f;
  color: #38452e;
}
.primary {
  width: 100%;
  border: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px;
  border-radius: 8px;
  background: var(--lime);
  color: #293320;
  font-size: 12px;
  font-weight: 700;
}
.primary:hover:not(:disabled) {
  background: #c9ff87;
}
.primary span {
  font-size: 20px;
  line-height: 14px;
}
.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #979d8f;
  font-size: 9px;
  margin: 19px 0;
}
.divider:before,
.divider:after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e4e6dc;
}
.join-form {
  display: flex;
  gap: 8px;
}
.join-form input {
  letter-spacing: 2.5px;
  font-size: 10px;
  flex: 1;
  min-width: 0;
  text-transform: uppercase;
}
.join-form button {
  border: 1px solid #d5dccb;
  border-radius: 7px;
  background: #e9eddf;
  width: 44px;
  flex: none;
  font-size: 20px;
}
.setup-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 17px;
  font-size: 8px;
  color: #969d8e;
}
.practice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 18px 21px;
  border: 1px solid #d4dac6;
  background: #e7ecdb;
  border-radius: 12px;
  color: var(--ink);
  width: 100%;
}
.practice-card:hover {
  background: #dde7cb;
}
.practice-symbol {
  font-size: 35px;
  line-height: 1;
  color: #677c50;
}
.practice-card strong {
  display: block;
  font-size: 12px;
}
.practice-card small {
  display: block;
  font-size: 9px;
  margin-top: 5px;
  color: #838d75;
}
.practice-arrow {
  margin-left: auto;
  font-size: 20px;
}
.how-card {
  padding: 16px 14px 0;
}
.how-title {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 1px;
  border-bottom: 1px solid #d9dfcd;
  padding-bottom: 13px;
}
.how-title span {
  color: #99a28d;
  font-weight: normal;
  letter-spacing: 0;
}
.mini-rule {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 16px;
}
.mini-rule p {
  margin: 0;
  font-size: 10px;
  line-height: 1.65;
  color: #909784;
}
.mini-rule strong {
  color: #525e49;
  font-size: 11px;
  font-weight: 500;
}
.mini-orb {
  border-radius: 50%;
  height: 25px;
  width: 25px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d2e4b7;
  color: #708653;
  font-size: 28px;
}
.mini-orb.critical {
  background: #e1daf3;
  color: #9584bf;
  font-size: 13px;
  letter-spacing: -1px;
}
.mini-rule-star {
  font-size: 28px;
  width: 25px;
  color: #86996c;
}
footer {
  margin: 35px 0 0;
  padding: 21px 0 27px;
  border-top: 1px solid #d9ddcf;
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.6px;
}
.footer-light {
  font-weight: 400;
  color: #929a85;
  letter-spacing: 0;
  margin-left: 7px;
}
footer > span:last-child {
  color: #8c9680;
  font-size: 7px;
  display: flex;
  align-items: center;
  gap: 19px;
}
.footer-star {
  font-size: 19px;
  color: #71895a;
}
.room-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
}
.room-heading h2 {
  font-size: 34px;
  letter-spacing: 3px;
  margin: 5px 0 13px;
}
.copy-button {
  border: 1px solid #d5dccb;
  border-radius: 8px;
  background: #e9eddf;
  width: 39px;
  height: 39px;
  font-size: 23px;
}
.players {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0;
}
.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #e2e5d9;
  background: #f2f4eb;
  padding: 13px;
  border-radius: 9px;
  font-size: 12px;
}
.player-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--player);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
}
.player-row small {
  font-size: 8px;
  color: #919988;
  margin-left: auto;
}
.player-row.empty {
  border-style: dashed;
  background: none;
  color: #a6ad9c;
  font-size: 10px;
}
.room-note {
  font-size: 10px;
  color: #8d9780;
  line-height: 1.7;
}
.text-button {
  display: block;
  margin: 20px auto 0;
  border: 0;
  background: none;
  font-size: 10px;
  color: #818b75;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.result {
  position: static;
  background: #f2f3ea;
  color: var(--ink);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  text-align: center;
}
.result-star {
  font-size: 32px;
  color: #749449;
  margin-bottom: 7px;
}
.result h2 {
  font-size: 31px;
  letter-spacing: -1px;
  margin: 12px 0;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.result p {
  font-size: 12px;
  line-height: 1.6;
  color: #7e8b71;
}
.result button {
  margin-top: 15px;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #252b27;
  color: #e9efdf;
  font-size: 12px;
  padding: 15px 24px;
  border: 1px solid #637452;
  border-radius: 11px;
  box-shadow: 0 8px 30px #0003;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
dialog {
  max-width: 480px;
  width: calc(100% - 32px);
  border: 1px solid #d3dcc6;
  border-radius: 20px;
  padding: 34px;
  background: #f4f5ed;
  color: var(--ink);
}
dialog::backdrop {
  background: #162014aa;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 28px;
  letter-spacing: -1px;
}
dialog ol {
  padding-left: 18px;
  color: #6b7860;
  font-size: 13px;
  line-height: 1.7;
}
dialog li {
  padding-left: 5px;
  margin: 14px 0;
}
dialog strong {
  color: #3d4e32;
}
.dialog-close {
  position: absolute;
  right: 15px;
  top: 10px;
  background: none;
  border: 0;
  font-size: 27px;
  color: #6f7e62;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes pop {
  0% {
    transform: scale(0.65);
  }
  65% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes burst {
  from {
    transform: scale(0.45);
    opacity: 1;
  }
  to {
    transform: scale(1.7);
    opacity: 0;
  }
}
@media (min-width: 1300px) {
  main {
    max-width: 1100px;
  }
  .intro {
    padding-top: 40px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 326px;
    gap: 26px;
  }
  .arena {
    padding: 24px 30px;
  }
  .board {
    max-width: 536px;
    margin: auto;
  }
  .side {
    gap: 13px;
  }
}
@media (max-width: 850px) {
  .header {
    padding: 22px 24px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
  }
  .arena {
    padding: 20px 18px;
  }
  .board {
    gap: 5px;
    padding: 9px;
  }
  .cell {
    border-radius: 7px;
  }
  .setup-panel,
  .room-panel {
    padding: 20px;
  }
  .arena-top {
    font-size: 7px;
  }
  .arena-label {
    gap: 7px;
    font-size: 8px;
  }
  .score {
    padding: 10px 8px;
    gap: 6px;
  }
  .score-value {
    font-size: 18px;
  }
  .scoreboard {
    gap: 7px;
  }
  .intro > p {
    font-size: 11px;
    margin-right: 0;
  }
  .how-card {
    padding: 13px 9px;
  }
}
@media (max-width: 670px) {
  .header {
    padding: 19px 20px;
  }
  .header-right {
    gap: 16px;
  }
  .brand {
    font-size: 22px;
  }
  .connection {
    font-size: 0;
    gap: 0;
  }
  .help-button {
    font-size: 10px;
  }
  .help-button span {
    margin-left: 4px;
  }
  main {
    padding: 0 18px;
  }
  .intro {
    padding: 25px 0;
  }
  .intro > p {
    display: none;
  }
  h1 {
    font-size: 44px;
    letter-spacing: -2.3px;
  }
  .eyebrow {
    font-size: 8px;
  }
  .game-layout {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .arena {
    width: 100%;
    padding: 21px 20px;
  }
  .side {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .board {
    gap: 7px;
    padding: 11px;
  }
  .arena-top {
    font-size: 8px;
  }
  .scoreboard {
    margin: 17px 0;
  }
  .arena-bottom {
    padding-top: 20px;
  }
  .setup-panel,
  .room-panel {
    padding: 24px;
  }
  .side h2 br {
    display: none;
  }
  .side h2 {
    font-size: 28px;
  }
  .setup-panel .muted {
    font-size: 12px;
  }
  .primary {
    padding: 16px 18px;
  }
  .how-card {
    padding: 12px 8px;
  }
  .mini-rule {
    margin-top: 15px;
  }
  .mini-rule p {
    font-size: 11px;
  }
  .how-title {
    font-size: 9px;
  }
  footer > span:last-child {
    font-size: 0;
    gap: 0;
  }
  .footer-light {
    font-size: 7px;
  }
  .scoreboard:has(.score:nth-child(3)) {
    flex-wrap: wrap;
  }
  .scoreboard:has(.score:nth-child(3)) .score {
    flex-basis: 40%;
  }
  .result {
    padding: 20px;
  }
  .result h2 {
    font-size: 27px;
  }
  .result-star {
    font-size: 28px;
  }
  .arena.in-game {
    scroll-margin-top: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

/* Keep the board in reach on laptop screens and during a match. */
.setting-line {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
.size-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.size-picker button {
  padding: 9px 3px;
}
.scoreboard:has(.score:nth-child(3)) {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.board.placing .cell.playable {
  border-color: #7a945c;
}
.board.placing .cell.playable:hover:after {
  width: 30%;
  height: 30%;
  background: var(--lime);
  opacity: 0.6;
}
.board.large-board {
  gap: 5px;
  padding: 9px;
}
@media (max-width: 670px) {
  .scoreboard:has(.score:nth-child(3)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .board.large-board {
    gap: 3px;
    padding: 6px;
  }
  .board.large-board .cell {
    border-radius: 5px;
  }
  .board.large-board .orb.critical {
    box-shadow:
      inset 0 -2px 0 #00000014,
      0 0 0 2px color-mix(in srgb, var(--player) 10%, transparent);
  }
}
.board {
  width: 100%;
  max-width: 536px;
  margin-inline: auto;
}
.quick-start {
  margin-left: auto;
  flex: none;
  border: 1px solid #799b56;
  border-radius: 7px;
  background: #b8f36b;
  color: #293320;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
}
/* Separate entry, menu, room and profile screens share the original palette. */
.navigation {
  display: flex;
  gap: 6px;
  align-items: center;
}
.navigation button,
.entry-tabs button {
  border: 0;
  background: transparent;
  color: #6d7865;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.navigation button.selected,
.entry-tabs button.selected {
  background: #e3e9d8;
  color: #33432b;
}
.navigation button:hover,
.entry-tabs button:hover {
  background: #e8eddf;
}
.navigation span {
  margin-right: 4px;
}
.header-right {
  gap: 18px;
}
.surface {
  background: #fafaf6;
  border: 1px solid #dce0d2;
  border-radius: 18px;
  padding: 30px;
}
.surface h2 {
  font-size: 27px;
  letter-spacing: -1px;
  line-height: 1.1;
  margin: 17px 0 14px;
}
.surface label,
.room-panel label, .surface .group-label, .room-panel .group-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
  margin: 18px 0 9px;
  color: #58644e;
}
.surface .muted,
.room-panel .muted {
  font-size: 12px;
  color: #727c66;
}
.surface input {
  font-size: 14px;
}
.form-note {
  font-size: 11px;
  line-height: 1.65;
  color: #7b866f;
  margin: 13px 0 0;
}
.inline-error {
  font-size: 12px;
  line-height: 1.5;
  color: #9d392c;
  background: #faece4;
  padding: 12px;
  border-radius: 8px;
}
.secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border: 1px solid #cfd9c3;
  border-radius: 8px;
  background: #eaf0e0;
  color: #445638;
  padding: 11px 13px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.secondary:hover {
  background: #dce8cb;
}
.loading-view {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7c8e69;
  font-size: 13px;
}
.loading-star {
  font-size: 60px;
}
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  align-items: center;
  gap: 70px;
  padding: 65px 20px 40px;
  min-height: 70vh;
}
.login-intro h1 {
  font-size: clamp(44px, 5vw, 66px);
}
.login-intro > p {
  color: #737d68;
  font-size: 14px;
  line-height: 1.7;
  margin: 23px 0;
}
.entry-card {
  box-shadow: 0 8px 0 #e4e6da;
}
.entry-card h2 {
  margin-bottom: 22px;
}
.entry-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  border: 1px solid #e0e5d6;
  padding: 4px;
  border-radius: 10px;
  margin: 20px 0;
}
.entry-tabs button {
  padding: 11px 5px;
  font-size: 11px;
}
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 8px 0 22px;
}
.avatar-picker button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e0e6d6;
  background: #f1f4e9;
  color: #597c39;
  border-radius: 11px;
  min-height: 47px;
  font-size: 25px;
}
.avatar-picker button.selected {
  border-color: #83a950;
  background: #e2f4cb;
  box-shadow: inset 0 0 0 1px #83a950;
}
.login-art {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 118px;
  padding-bottom: 10px;
  margin: 25px 0 15px;
}
.login-art span {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lime);
  color: #2d3826;
  width: 92px;
  height: 92px;
  border-radius: 30px;
  font-size: 35px;
  letter-spacing: -5px;
  border-bottom: 5px solid #a2d45e;
  transform: rotate(-10deg);
}
.login-art span:nth-child(2) {
  width: 69px;
  height: 69px;
  background: #b6a8ff;
  border-color: #9b8adf;
  transform: rotate(12deg);
}
.login-art span:nth-child(3) {
  width: 53px;
  height: 53px;
  background: #ffad94;
  border-color: #dd927b;
  transform: rotate(-5deg);
}
.login-art i {
  position: absolute;
  top: 0;
  left: 230px;
  font-size: 54px;
  font-style: normal;
  font-weight: 300;
  color: #819871;
}
.intro-meta {
  display: flex;
  gap: 21px;
  color: #939d88;
  font-size: 8px;
  letter-spacing: 1px;
}
.home-intro {
  padding: 39px 0 32px;
  align-items: center;
  gap: 20px;
}
.home-intro h1 {
  font-size: clamp(32px, 4vw, 46px);
  letter-spacing: -2px;
  max-width: 750px;
  overflow-wrap: anywhere;
}
.welcome-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.large-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: #e6efda;
  color: #628244;
  font-size: 35px;
  flex: none;
}
.welcome-profile strong {
  display: block;
  font-size: 12px;
  color: #59664d;
}
.welcome-profile small {
  display: block;
  margin-top: 7px;
  font-size: 10px;
  color: #929c86;
}
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.home-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.home-layout .setup-panel {
  padding: 30px;
}
.clock-settings {
  margin: 25px 0 22px;
  padding-top: 4px;
  border-top: 1px solid #e4e7dc;
}
.clock-settings label, .clock-settings .group-label {
  margin-top: 16px;
}
.tempo-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tempo-picker button {
  border: 1px solid #dfe5d5;
  background: #f3f5ec;
  border-radius: 9px;
  padding: 12px 6px;
  color: #738364;
}
.tempo-picker strong {
  display: block;
  font-size: 11px;
  font-weight: 600;
}
.tempo-picker span {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  color: #929e86;
}
.tempo-picker button.selected {
  border-color: #91af6b;
  background: #e8f3da;
  color: #3c5429;
}
.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 10px;
}
.time-inputs label, .time-inputs .group-label {
  min-height: 15px;
  font-size: 10px;
}
.unit-input {
  display: flex;
  align-items: center;
  background: #f2f3eb;
  border: 1px solid #dce0d4;
  border-radius: 8px;
  padding-right: 12px;
}
.unit-input input {
  border: 0;
  background: transparent;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  padding: 12px;
}
/* Legal pages (privacy / terms), generated from legal/*.md */
.legal{max-width:52rem;line-height:1.55}
.legal table{border-collapse:collapse;width:100%;margin:.75rem 0;display:block;overflow-x:auto}
.legal th,.legal td{border:1px solid rgba(127,127,127,.35);padding:.35rem .5rem;text-align:left;vertical-align:top}
.legal blockquote{margin:.75rem 0;padding:.5rem .9rem;border-left:4px solid currentColor;opacity:.85}
.legal-nav{font-size:.9rem}
.unit-input span {
  font-size: 10px;
  color: #909c83;
}
.increment-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: center;
  gap: 15px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #dce0d4;
  border-radius: 9px;
  background: #f8f9f3;
}
.clock-settings .increment-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  margin: 0;
  font-size: 12px;
  cursor: pointer;
}
.increment-toggle input {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  flex: none;
  accent-color: #719548;
}
.increment-toggle small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: #738364;
}
.increment-settings > div > label, .increment-settings > div > .group-label {
  margin-top: 0;
  font-size: 10px;
}
.increment-settings input:disabled {
  opacity: 0.5;
}
.secondary.leave-room {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 13px 18px;
  border-color: #d5aaa0;
  background: #fbefea;
  color: #864c3e;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.secondary.leave-room:hover:not(:disabled) {
  border-color: #b9877c;
  background: #f7e2da;
}
@media (max-width: 520px) {
  .increment-settings {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
}
.home-layout .size-picker button {
  font-size: 11px;
  padding: 12px 3px;
}
.join-panel .join-form button {
  width: auto;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
}
.join-panel .join-form input {
  font-size: 13px;
}
.notice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 18px;
  border: 1px solid #cfdfb9;
  background: #e8f0dc;
  border-radius: 11px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #50693e;
}
.match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 0 20px;
  gap: 15px;
}
.match-motto {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0;
  padding: 13px 8px;
  border-bottom: 1px solid #dce0d2;
  background: #f2f1e9;
  color: #425637;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.master-card {
  min-width: 0;
  margin-bottom: 24px;
  padding: 23px;
  border: 1px solid #d9dfcc;
  border-radius: 14px;
  background: #f2f3ea;
  color: var(--ink);
  text-align: center;
  scroll-margin-top: 60px;
}
.master-card .eyebrow {
  color: #738260;
  font-size: 8px;
  line-height: 1.5;
}
.master-card h2 {
  margin: 10px 0 18px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.8px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.master-portrait {
  display: block;
  width: min(100%, 180px);
  height: 216px;
  aspect-ratio: 5 / 6;
  margin: 0 auto;
  border-radius: 9px;
  object-fit: cover;
  object-position: center;
  background: #d8dccb;
}
.master-card blockquote {
  margin: 20px 0 10px;
  color: #38472e;
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.master-card cite {
  display: block;
  color: #748165;
  font-size: 10px;
  font-style: normal;
  line-height: 1.6;
}
.master-card .primary {
  width: 100%;
  max-width: 315px;
  margin: 21px auto 0;
  min-height: 46px;
}
.master-card.result > p {
  margin: 0 0 18px;
}
dialog.master-popup {
  width: calc(100% - 32px);
  max-width: 430px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.master-popup:not([open]) {
  display: none;
}
.pause-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #dce2d1;
  border-radius: 9px;
  background: #f4f5ef;
}
.pause-controls.is-paused {
  border-color: #b5c598;
  background: #eaf0de;
}
.pause-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.pause-copy strong {
  color: #435536;
  font-size: 12px;
}
.pause-copy span {
  color: #758267;
  font-size: 10px;
  line-height: 1.5;
}
.pause-controls .secondary {
  flex-shrink: 0;
  min-height: 42px;
  padding: 10px 14px;
  font-size: 12px;
}
.timer.paused {
  color: #64794c;
}
@media (max-width: 420px) {
  dialog.master-popup {
    padding: 20px 16px;
  }
  .pause-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }
  .pause-controls .secondary {
    width: 100%;
  }
}
.arena.in-game {
  scroll-margin-top: 60px;
}
@media (max-width: 670px) {
  .match-motto {
    padding: 12px 2px;
    font-size: 14px;
  }
  .master-card {
    padding: 18px 15px;
    margin-bottom: 21px;
  }
  .master-card h2 {
    font-size: 23px;
  }
}
.match-header > span {
  font-size: 9px;
  letter-spacing: 1px;
  color: #8c9780;
}
.back-button {
  border: 0;
  background: none;
  padding: 6px 0;
  color: #69775b;
  font-size: 12px;
}
.game-layout.lobby {
  display: block;
  max-width: 780px;
  margin: 0 auto;
}
.lobby .players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.lobby .side {
  display: block;
}
.lobby .room-panel {
  padding: 30px;
}
.lobby .room-panel > .primary {
  max-width: 310px;
  margin: 0 auto;
}
.lobby .room-note {
  text-align: center;
}
.room-heading {
  gap: 10px;
  margin-top: 12px;
}
.room-heading label, .room-heading .group-label {
  margin: 10px 0 0;
}
.room-heading h2 {
  margin-bottom: 14px;
}
.invite-tools {
  padding: 14px;
  border: 1px solid #dce4ce;
  background: #f1f5e8;
  border-radius: 10px;
}
.invite-tools summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #506742;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
.invite-tools summary::-webkit-details-marker {
  display: none;
}
.invite-tools input {
  font-size: 10px;
}
.invite-tools label, .invite-tools .group-label {
  font-size: 9px;
}
.invite-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.invite-actions .secondary {
  flex: 1;
  white-space: normal;
  line-height: 1.4;
  padding: 10px 6px;
  font-size: 10px;
}
.room-settings-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 20px;
  padding: 13px 9px;
  border-block: 1px solid #e0e5d7;
  text-align: center;
}
.room-settings-summary strong {
  display: block;
  font-size: 13px;
  color: #556c43;
}
.room-settings-summary small {
  display: block;
  margin-top: 5px;
  font-size: 8px;
  color: #939d85;
}
.player-row > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-avatar {
  flex: none;
  font-size: 16px;
}
.player-row small {
  flex: none;
}
.board-legend {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 8px;
  color: #7d8e73;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #3d4937;
  line-height: 1.5;
}
.score {
  flex-wrap: wrap;
  position: relative;
}
.score-name {
  flex: 1;
}
.score-clock {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.2px;
  color: #c1cdba;
  flex-basis: 100%;
  padding-left: 20px;
  white-space: nowrap;
}
.score-clock.urgent {
  color: #ff9478;
}
.score-clock small {
  display: inline;
  margin-left: 5px;
  font-size: 8px;
}
.score-value {
  font-size: 17px;
}
.timer {
  min-width: 67px;
  text-align: right;
}
.timer strong {
  display: block;
  font-size: 27px;
  font-weight: 500;
}
.timer span {
  display: block;
  margin-left: 0;
  font-size: 8px;
}
.turn-copy {
  min-width: 0;
}
.page-view {
  padding-top: 34px;
}
.page-title {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
}
.page-title h1 {
  font-size: 42px;
  letter-spacing: -2px;
  margin-top: 16px;
}
.page-description {
  font-size: 13px;
  color: #7c886e;
  line-height: 1.7;
  margin: 21px 0;
}
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-top: 28px;
}
.profile-layout h2 {
  margin-top: 0;
  font-size: 24px;
}
.profile-layout .transfer-card h2 {
  margin-top: 20px;
}
.profile-layout .avatar-picker {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
/* Wrapper only exists so the password-type field sits in a form (#15); no layout of its own. */
.profile-code-form { display: contents; }
.transfer-card input {
  font-size: 12px;
  font-family: monospace;
}
.record-strip {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 0;
  color: #7a886b;
  font-size: 11px;
}
.record-strip strong {
  color: #4f6a39;
  font-size: 22px;
  margin-right: 5px;
  font-variant-numeric: tabular-nums;
}
.display-controls {
  border-top: 1px solid #dce0d2;
  padding-top: 22px;
}
.display-controls h2 {
  margin: 0 0 15px;
  font-size: 20px;
}
.texture-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.texture-picker button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 74px;
  padding: 10px;
  border: 1px solid #d1d9c6;
  border-radius: 10px;
  background: #f2f5eb;
  color: #435639;
  text-align: left;
}
.texture-picker button[aria-pressed="true"] {
  border-color: #7d9d58;
  background: #e8f0dc;
}
.texture-picker button:hover {
  background: #e8eddf;
}
.texture-picker strong {
  display: block;
  font-size: 12px;
}
.texture-picker small {
  display: block;
  margin-top: 5px;
  color: #77836b;
  font-size: 10px;
  line-height: 1.4;
}
.display-preview {
  --player: #b9fa64;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #30372f;
}
.surface .display-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 19px 0 0;
  font-size: 12px;
  cursor: pointer;
}
.display-toggle input {
  flex: none;
  width: 17px;
  height: 17px;
  padding: 0;
  margin: 0;
  accent-color: #6a8848;
}
@media (max-width: 670px) {
  .texture-picker {
    gap: 8px;
  }
  .texture-picker button {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
  }
  .board.large-board .last-move-marker {
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
  }
}
.leaderboard-surface {
  padding: 8px 22px;
  overflow-x: auto;
}
.leaderboard-surface .muted {
  margin: 23px 4px;
}
.leaderboard-surface table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.leaderboard-surface th {
  font-size: 10px;
  font-weight: 600;
  color: #8f9b80;
  text-align: left;
  padding: 18px 8px;
  border-bottom: 1px solid #dfe5d5;
}
.leaderboard-surface td {
  padding: 17px 8px;
  border-bottom: 1px solid #e8ecdf;
}
.leaderboard-surface tr:last-child td {
  border-bottom: 0;
}
.leaderboard-surface td:nth-child(n + 3),
.leaderboard-surface th:nth-child(n + 3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.leaderboard-surface .me td {
  background: #edf5e2;
}
.leader-player {
  display: flex;
  align-items: center;
  gap: 12px;
}
.leader-player .large-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 21px;
}
.leader-player > span:last-child {
  overflow-wrap: anywhere;
}
.leader-player small {
  font-size: 9px;
  color: #8b9d79;
  margin-left: 5px;
}
@media (max-width: 900px) {
  .login-layout {
    gap: 35px;
    padding: 45px 0 30px;
    grid-template-columns: 1fr 1fr;
  }
  .login-intro h1 {
    font-size: 48px;
    letter-spacing: -2.5px;
  }
  .header {
    padding-inline: 24px;
  }
  .header-right {
    gap: 12px;
  }
  .navigation button {
    padding: 10px;
    font-size: 11px;
  }
  .welcome-profile small {
    display: none;
  }
  .welcome-profile .large-avatar {
    width: 46px;
    height: 46px;
    font-size: 29px;
  }
}
@media (max-width: 670px) {
  .header {
    flex-wrap: wrap;
    gap: 16px;
    padding: 17px 18px 14px;
  }
  .navigation {
    width: 100%;
    order: 3;
    justify-content: stretch;
    border-top: 1px solid #e0e4d6;
    padding-top: 10px;
  }
  .navigation button {
    flex: 1;
    font-size: 12px;
    padding: 10px 9px;
  }
  .header-right {
    gap: 13px;
  }
  .login-layout {
    display: block;
    padding: 27px 0 20px;
    min-height: auto;
  }
  .login-intro h1 {
    font-size: 42px;
    letter-spacing: -2.3px;
  }
  .login-intro > p {
    font-size: 12px;
    margin: 16px 0 23px;
  }
  .login-art,
  .intro-meta {
    display: none;
  }
  .login-intro {
    padding: 0 5px;
  }
  .entry-card {
    margin-top: 23px;
  }
  .surface,
  .home-layout .setup-panel {
    padding: 23px;
  }
  .surface h2 {
    font-size: 25px;
  }
  .home-intro {
    padding: 26px 0;
    gap: 13px;
  }
  .home-intro h1 {
    font-size: 30px;
    letter-spacing: -1.3px;
  }
  .welcome-profile > div {
    display: none;
  }
  .welcome-profile .large-avatar {
    width: 41px;
    height: 41px;
    border-radius: 12px;
    font-size: 25px;
  }
  .home-layout,
  .profile-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .time-inputs {
    gap: 10px;
  }
  .time-inputs label, .time-inputs .group-label {
    min-height: 28px;
    line-height: 1.4;
  }
  .unit-input {
    padding-right: 8px;
  }
  .unit-input input {
    padding: 12px 10px;
  }
  .notice-bar {
    flex-wrap: wrap;
  }
  .match-header {
    padding-top: 19px;
  }
  .match-header > span {
    font-size: 7px;
    letter-spacing: 0.4px;
    text-align: right;
  }
  .lobby .players {
    display: flex;
  }
  .lobby .room-panel {
    padding: 24px;
  }
  .score-clock {
    font-size: 14px;
    padding-left: 17px;
  }
  .score-name {
    font-size: 10px;
  }
  .score small {
    font-size: 8px;
  }
  .score-value {
    font-size: 16px;
  }
  .board-legend {
    font-size: 7px;
  }
  .board-legend > span {
    flex: 1;
  }
  .page-view {
    padding-top: 27px;
  }
  .page-title h1 {
    font-size: 34px;
    letter-spacing: -1.5px;
  }
  .page-title .secondary {
    padding: 10px 12px;
  }
  .leaderboard-surface {
    padding: 4px 10px;
  }
  .leaderboard-surface td {
    padding: 13px 5px;
    font-size: 11px;
  }
  .leaderboard-surface th {
    padding-inline: 5px;
    font-size: 9px;
  }
  .leader-player {
    gap: 7px;
  }
  .leader-player .large-avatar {
    width: 27px;
    height: 27px;
    font-size: 18px;
    border-radius: 8px;
  }
  .record-strip {
    gap: 17px;
    font-size: 10px;
  }
}
body[data-mode="online"] .intro,
body[data-mode="practice"] .intro {
  padding: 23px 0;
}
body[data-mode="online"] .intro .eyebrow,
body[data-mode="practice"] .intro .eyebrow {
  display: none;
}
body[data-mode="online"] h1,
body[data-mode="practice"] h1 {
  font-size: 34px;
  letter-spacing: -1.5px;
  margin: 0;
}
body[data-mode="online"] h1 br,
body[data-mode="practice"] h1 br {
  display: none;
}
body[data-mode="online"] h1 br:after,
body[data-mode="practice"] h1 br:after {
  content: " ";
}
@media (max-width: 670px) {
  body[data-mode="online"] h1,
  body[data-mode="practice"] h1 {
    font-size: 25px;
    letter-spacing: -1px;
  }
  body[data-mode="online"] .intro,
  body[data-mode="practice"] .intro {
    padding: 20px 0;
  }
  .quick-start {
    padding: 10px 9px;
    font-size: 9px;
  }
}

.level-select {
  min-width: 0;
  min-height: 44px;
  border: 1px solid #ccd7be;
  border-radius: 8px;
  background: #fafbf6;
  color: #34472a;
  padding: 9px 30px 9px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.level-select:disabled {
  opacity: 0.5;
  cursor: default;
}
.practice-setup {
  overflow: hidden;
  border: 1px solid #d4dac6;
  background: #e7ecdb;
  border-radius: 12px;
}
.practice-level-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
}
.practice-level-setting label, .practice-level-setting .group-label {
  margin: 0;
  font-size: 10px;
  line-height: 1.5;
  color: #677c50;
}
.practice-setup .practice-card {
  border: 0;
  border-top: 1px solid #d4dac6;
  border-radius: 0;
}
.practice-panel > .level-select {
  width: 100%;
}
.bot-management {
  border: 1px dashed #bbcba6;
  border-radius: 10px;
  padding: 14px;
  margin: 0 0 18px;
  background: #eff5e5;
}
.bot-add-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.bot-add-row > div {
  flex: 1;
  min-width: 0;
}
.bot-add-row label, .bot-add-row .group-label {
  margin: 0 0 7px;
}
.bot-add-row .level-select {
  width: 100%;
}
.bot-add-row .secondary {
  min-height: 44px;
  flex: none;
  padding: 11px 13px;
}
.bot-management .form-note {
  margin-bottom: 0;
}
.local-management h3 { margin: 0 0 7px; font-size: 16px; }
.local-add-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(110px, 1fr) auto; align-items: end; gap: 9px; margin-top: 12px; }
.local-add-row label, .local-add-row .group-label { min-width: 0; margin: 0; }
.local-add-row input, .local-add-row select, .local-player-controls input, .local-player-controls select { width: 100%; min-height: 44px; border: 1px solid #d8dccf; border-radius: 8px; padding: 9px; background: #fff; color: #303b2c; }
.local-add-row button { min-height: 44px; }
.player-row.local-player { flex-wrap: wrap; }
.local-player-controls { display: grid; grid-template-columns: minmax(0, 2fr) minmax(105px, 1fr) auto auto; flex-basis: 100%; gap: 8px; padding-left: 35px; }
.local-player-controls button { min-height: 44px; }
.player-row.bot-player {
  flex-wrap: wrap;
}
.player-row > .player-name {
  flex: 1;
}
.bot-player .player-badge {
  color: #627b4f;
  font-size: 9px;
}
.bot-player-controls {
  display: flex;
  flex-basis: 100%;
  gap: 8px;
  padding-left: 35px;
  margin-top: 2px;
}
.bot-player-controls .level-select {
  flex: 1;
  width: 0;
}
.bot-remove {
  flex: none;
  min-height: 44px;
  border: 1px solid #d8dccf;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  background: #fafbf6;
  color: #747c68;
}
.bot-remove:hover {
  background: #f1e5dc;
  border-color: #d8bfae;
  color: #865d43;
}
.ranking-note {
  color: #647750;
  font-size: 10px;
  line-height: 1.6;
  padding: 10px 12px;
  margin: 0 0 18px;
  background: #edf1e4;
  border-radius: 8px;
}
.score .score-bot-label {
  color: #b4cba4;
  font-size: 8px;
}
@media (max-width: 670px) {
  .practice-level-setting {
    padding: 12px 16px;
  }
  .bot-add-row {
    gap: 9px;
  }
  .bot-player-controls {
    padding-left: 0;
  }
  .local-add-row, .local-player-controls { grid-template-columns: minmax(0, 1fr) minmax(105px, 1fr); padding-left: 0; }
  .local-add-row button { grid-column: 1 / -1; }
  .score .score-bot-label {
    font-size: 7px;
  }
}

/* Mobile comfort without changing the existing board or visual identity. */
.offline-entry { margin-top: 20px; padding-top: 16px; border-top: 1px solid #d3dcc6; }
.offline-entry button, .practice-resume { min-height: 44px; }
.practice-resume { margin: 0 0 16px; }
.board-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; font-size: 14px; }
.board-tools button { min-height: 44px; }
.board-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; }
.board-wrap.enlarged .board { width: max(100%, calc(var(--size) * 52px + 24px)); max-width: none; }
.board-wrap.enlarged .cell { min-width: 44px; min-height: 44px; }
body { padding-bottom: env(safe-area-inset-bottom, 0px); }

.room-colors { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.room-color { min-width: 48px; min-height: 48px; border: 2px solid transparent; border-radius: 12px; background: var(--choice-color); color: #202820; font-weight: 700; font-size: 14px; }
.room-color[aria-pressed="true"] { border-color: #243322; outline: 2px solid #fff; outline-offset: -5px; }
.room-color:disabled:not([aria-pressed="true"]) { opacity: .5; cursor: not-allowed; }
.turn-order-panel { margin: 18px 0; padding: 15px; border: 1px solid #dce2d1; border-radius: 10px; background: #f8faf5; }
.turn-order-panel h3 { margin: 0 0 5px; }
.order-methods { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.order-methods button, #roll-order { min-height: 44px; }
.order-methods [aria-pressed="true"] { outline: 2px solid #66864a; }
.turn-order-list { margin: 0 0 8px; padding-left: 30px; }
.order-row { padding: 5px 0; min-height: 44px; }
.order-name { display: inline-flex; align-items: center; gap: 8px; min-width: 130px; max-width: calc(100% - 100px); overflow-wrap: anywhere; }
.order-name::before { content: ""; width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--player); border: 2px solid #293225; }
.order-shift { min-width: 44px; min-height: 44px; margin-left: 4px; padding: 6px; }
.roll-history p { margin: 4px 0; font-size: 12px; }

/* Lobby preview: a compact room ledger. All visual changes stay in the lobby. */
.game-layout:not(.lobby) .lobby-players-heading { display: none; }
.lobby .room-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  column-gap: 24px;
  row-gap: 0;
  padding: 30px 34px;
  border-color: #d7ddcf;
  border-radius: 14px;
}
.lobby .room-panel > * { min-width: 0; grid-column: 1 / -1; }
.lobby .panel-tag { color: #586d48; font-size: 10px; letter-spacing: 1.15px; }
.lobby .room-heading { margin: 10px 0 0; align-items: end; }
.lobby .room-heading label, .lobby .room-heading .group-label { margin: 0 0 4px; font-size: 10px; }
.lobby .room-heading h2 { margin: 0; font-size: 32px; letter-spacing: 2.5px; line-height: 1.1; }
.lobby #copy-code { min-height: 44px; }
.lobby #room-hint { margin: 8px 0 17px; font-size: 12px; line-height: 1.45; }
.lobby .lobby-players-heading {
  margin: 0;
  padding: 18px 0 7px;
  border-top: 1px solid #d9dfd2;
  font-size: 17px;
  letter-spacing: -.2px;
}
.lobby .players {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 0 0 8px;
}
.lobby .player-row {
  min-height: 59px;
  padding: 9px 3px;
  gap: 10px;
  border: 0;
  border-bottom: 1px solid #e1e5da;
  border-radius: 0;
  background: transparent;
}
.lobby .player-avatar { width: 29px; height: 29px; font-size: 16px; }
.lobby .player-row .player-name {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}
.lobby .player-row .player-badge {
  max-width: 92px;
  margin-left: auto;
  color: #5b6658;
  font-size: 10px;
  line-height: 1.25;
  text-align: right;
  overflow-wrap: anywhere;
}
.lobby .player-row.empty {
  border: 1px dashed #cdd7c4;
  border-radius: 8px;
  min-height: 49px;
  margin: 5px 0;
  padding: 10px;
  font-size: 11px;
  color: #677364;
}
.lobby .bot-player-controls { margin-top: 3px; padding-left: 39px; }
.lobby .bot-player-controls .level-select,
.lobby .bot-player-controls .bot-remove { min-height: 44px; }
.lobby #color-selection { padding: 8px 0 14px; }
.lobby #color-selection h3 { margin: 0 0 5px; font-size: 16px; }
.lobby #color-selection .form-note { margin: 0; font-size: 11px; line-height: 1.45; }
.lobby .room-colors { margin: 10px 0 0; }
.lobby .room-color { border-radius: 8px; font-size: 12px; }
.lobby .room-color[data-taken] { opacity: .88; font-size: 0; }
.lobby .room-color[data-taken]::after {
  content: "DOLU";
  font-size: 9px;
  letter-spacing: .35px;
  font-weight: 800;
}
.lobby .bot-management {
  padding: 12px 14px;
  margin: 0 0 17px;
  border-style: solid;
  border-color: #d8e2ce;
  background: #f5f8ef;
}
.lobby .invite-tools {
  grid-column: 1;
  margin: 0 0 19px;
  padding: 15px;
  background: #f5f7ef;
  border-color: #dce3d4;
  border-radius: 9px;
}
.lobby .invite-tools summary { font-size: 13px; color: #354a32; }
.lobby .invite-tools label, .lobby .invite-tools .group-label { margin: 12px 0 6px; font-size: 10px; }
.lobby .invite-tools input { font-size: 11px; min-height: 40px; }
.lobby .invite-actions .secondary { min-height: 44px; font-size: 11px; }
.lobby .invite-tools .form-note { margin: 10px 0 0; font-size: 10px; line-height: 1.45; }
.lobby .room-settings-summary {
  grid-column: 2;
  align-self: stretch;
  margin: 0 0 19px;
  padding: 10px 13px;
  gap: 0;
  border: 1px solid #dce3d4;
  border-radius: 9px;
  background: #f9faf6;
  text-align: left;
}
.lobby .room-settings-summary > div { padding: 9px 6px; }
.lobby .room-settings-summary > div:nth-child(-n + 2) { border-bottom: 1px solid #e1e7d9; }
.lobby .room-settings-summary strong { font-size: 16px; color: #2f4430; }
.lobby .room-settings-summary small { margin-top: 4px; font-size: 10px; color: #667465; letter-spacing: .35px; }
.lobby .turn-order-panel {
  margin: 0 0 16px;
  padding: 17px 0 12px;
  border: 0;
  border-top: 1px solid #d9dfd2;
  border-radius: 0;
  background: transparent;
}
.lobby .turn-order-panel h3 { font-size: 17px; letter-spacing: -.2px; }
.lobby .turn-order-panel .form-note { font-size: 11px; line-height: 1.45; }
.lobby .order-row { padding: 3px 0; }
.lobby .order-name { font-size: 13px; line-height: 1.35; max-width: calc(100% - 108px); }
.lobby .order-methods { margin: 10px 0; }
.lobby .order-methods button { border-radius: 8px; }
.lobby .ranking-note { margin: 0 0 14px; font-size: 11px; }
.lobby .room-panel > .primary {
  width: 100%;
  max-width: none;
  min-height: 52px;
  margin: 0;
  border-radius: 9px;
  font-size: 14px;
}
.lobby .room-note { margin: 9px 0 13px; font-size: 11px; line-height: 1.45; }
.lobby .leave-room {
  justify-self: center;
  width: auto;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid #cdbab1;
  border-radius: 8px;
  background: transparent;
  color: #795447;
  font-size: 12px;
}
.lobby .leave-room:hover { background: #f7ebe6; }
@media (max-width: 670px) {
  .lobby .room-panel { display: block; padding: 20px; }
  .lobby .room-heading h2 { font-size: 28px; }
  .lobby .players { grid-template-columns: minmax(0, 1fr); }
  .lobby .invite-tools, .lobby .room-settings-summary { margin-bottom: 15px; }
  .lobby .room-settings-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lobby .bot-player-controls { padding-left: 39px; }
  .lobby .order-name { min-width: 0; max-width: calc(100% - 108px); }
}

/* Approved paper-ledger direction for screens outside a match. */
:is(#login-view, #home-view, #profile-view) {
  --ui-paper: #fbfbf7;
  --ui-line: #dbe2d3;
  --ui-soft: #f1f5e9;
  --ui-ink: #2d4130;
}
:is(#login-view, #home-view, #profile-view) .surface {
  background: var(--ui-paper);
  border-color: var(--ui-line);
  border-radius: 16px;
}
:is(#login-view, #home-view, #profile-view) button:disabled {
  opacity: .57;
}
:is(#login-view, #home-view, #profile-view) input:focus-visible,
:is(#login-view, #home-view, #profile-view) select:focus-visible {
  outline: 3px solid #769d45;
  outline-offset: 2px;
}
#loading-view { color: #456440; }
#loading-view p { margin-top: 11px; font-size: 13px; font-weight: 600; }

/* Player entry */
#login-view { gap: 52px; }
#login-view .login-intro { min-width: 0; }
#login-view .login-intro h1 { color: #263629; }
#login-view .login-intro > p { max-width: 43ch; color: #596b56; }
#login-view .intro-meta { flex-wrap: wrap; line-height: 1.6; color: #62775b; }
#login-view .entry-card {
  width: 100%;
  box-shadow: none;
  padding: 30px;
}
#login-view .entry-card h2 {
  margin: 14px 0 18px;
  font-size: 29px;
  color: var(--ui-ink);
}
#login-view .entry-tabs {
  margin: 17px 0 21px;
  border-color: var(--ui-line);
  background: #edf2e5;
}
#login-view .entry-tabs button { min-height: 44px; font-size: 12px; font-weight: 700; }
#login-view .entry-tabs button[aria-pressed="true"] {
  background: var(--ui-paper);
  color: var(--ui-ink);
  box-shadow: 0 1px 3px #27372218;
}
#login-view .entry-card label, #login-view .entry-card .group-label { margin: 16px 0 8px; color: #425d3f; font-size: 12px; }
#login-view .entry-card input:not([type="checkbox"]) {
  min-height: 48px;
  background: #f6f8f1;
  font-size: 14px;
}
#login-view .avatar-picker button { min-height: 52px; }
#login-view .entry-card .primary { min-height: 52px; font-size: 14px; }
#login-view .offline-entry {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--ui-line);
}
#login-view .offline-entry button { min-height: 44px; }
#login-view .offline-entry button + button { margin-top: 8px; }
#login-view .inline-error { border: 1px solid #e0b9aa; }

.local-setup {
  margin: 24px 0;
  scroll-margin-top: 20px;
  border-color: #cdddbb;
  background: #f7faef;
}
.offline-shortcut { width: 100%; min-height: 44px; margin-top: 10px; }
.local-setup h2 { margin-bottom: 8px; }
.local-setup .muted { max-width: 620px; }
.local-settings { display: flex; flex-wrap: wrap; gap: 14px; }
.local-settings label, .local-settings .group-label { flex: 1 1 170px; }
.local-settings select, .local-names input, .local-names select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  padding: 9px 12px;
  border: 1px solid #cad7bf;
  border-radius: 8px;
  background: #fff;
  color: #293320;
}
.local-names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.local-player-setup { min-width: 0; }
.local-names label, .local-names .group-label { display: block; min-width: 0; }
.local-names label + select, .local-names label + input, .local-names .group-label + select, .local-names .group-label + input { margin-bottom: 10px; }
.local-color { display: inline-block; width: 14px; height: 14px; margin-right: 8px; border: 1px solid #718268; border-radius: 50%; vertical-align: -2px; }
.local-setup .primary { margin-top: 17px; min-height: 48px; }
.local-setup #local-resume { margin-top: 12px; min-height: 44px; }
#local-panel #local-restart { min-height: 44px; }
@media (max-width: 520px) {
  .local-names { grid-template-columns: 1fr; }
}

/* Home and room setup */
#home-view .home-intro {
  min-width: 0;
  margin-bottom: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--ui-line);
}
#home-view .home-intro h1 { color: #263629; }
#home-view .welcome-profile {
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--ui-line);
  border-radius: 13px;
  background: var(--ui-soft);
}
#home-view .welcome-profile > div { min-width: 0; }
#home-view .welcome-profile strong { overflow-wrap: anywhere; }
#home-view .setup-panel { padding: 30px; }
#home-view .setup-panel h2 { margin: 14px 0 9px; font-size: 30px; color: var(--ui-ink); }
#home-view .setup-panel > .muted { max-width: 58ch; margin-bottom: 21px; line-height: 1.55; }
#home-view #create-room-form > label,
#home-view .clock-settings > label, #home-view #create-room-form > .group-label, #home-view .clock-settings > .group-label { color: #425d3f; font-size: 12px; }
#home-view .size-picker { gap: 7px; }
#home-view .size-picker button {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding: 8px 3px;
  border-color: #cfdcc4;
  border-radius: 9px;
  background: #f6f8f2;
  color: #3d513b;
  font-size: 13px;
  font-weight: 700;
}
#home-view .size-picker button.selected,
#home-view .tempo-picker button.selected {
  border-color: #718f54;
  background: #e5f2d3;
  color: #2e4a29;
  box-shadow: inset 0 0 0 1px #718f54;
}
#home-view .clock-settings {
  margin: 22px 0 18px;
  padding: 2px 18px 18px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: #f6f8f1;
}
#home-view .tempo-picker button {
  min-height: 63px;
  background: #fbfcf8;
  color: #455a40;
}
#home-view .tempo-picker strong { font-size: 12px; }
#home-view .tempo-picker span { font-size: 11px; color: #5f7457; }
#home-view .time-inputs label,
#home-view .increment-settings label, #home-view .time-inputs .group-label, #home-view .increment-settings .group-label { color: #52664d; font-size: 11px; line-height: 1.4; }
#home-view .unit-input { background: #fff; }
#home-view .unit-input input { min-height: 44px; }
#home-view .increment-settings { background: #fff; }
#home-view #create { min-height: 52px; font-size: 14px; }
#home-view .setup-foot { color: #63765a; }
#home-view .join-panel h2 { margin: 15px 0 9px; color: var(--ui-ink); }
#home-view .join-panel .muted { margin-bottom: 16px; }
#home-view .join-form input { min-height: 48px; background: #f6f8f1; font-size: 14px; }
#home-view .join-form button {
  min-height: 48px;
  border-color: #a9cf7c;
  background: #dff3c6;
  color: #2f4a2a;
  font-size: 13px;
}
#home-view .practice-setup { border-radius: 14px; background: #edf3e4; }
#home-view .practice-level-setting label, #home-view .practice-level-setting .group-label { color: #415b3e; font-size: 11px; }
#home-view .notice-bar { color: #395535; font-size: 12px; line-height: 1.5; }
#home-view .notice-bar button { min-height: 44px; }
#home-view #recovering-banner { border-color: #d8c79d; background: #f8f2df; color: #655438; }

/* Profile and display settings */
#profile-view .page-title {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ui-line);
}
#profile-view .page-title h1 { color: #263629; }
#profile-view .profile-layout { align-items: start; }
#profile-view .profile-layout > .surface { min-width: 0; padding: 30px; }
#profile-view .profile-layout h2 { color: var(--ui-ink); }
#profile-view .profile-layout label, #profile-view .profile-layout .group-label { color: #425d3f; font-size: 12px; }
#profile-view #profile-name { min-height: 48px; background: #f6f8f1; }
#profile-view .avatar-picker button { min-height: 52px; }
#profile-view #save-profile { min-height: 52px; font-size: 14px; }
#profile-view .leaderboard-choice { display: inline-flex; align-items: center; gap: 9px; margin-top: 18px; font-size: 14px !important; cursor: pointer; }
#profile-view .leaderboard-choice input { width: 19px; height: 19px; accent-color: #648d45; }
#profile-view .leaderboard-choice + .form-note { margin: 7px 0 0; line-height: 1.5; }
#profile-view .record-strip {
  margin-top: 21px;
  padding: 19px 0;
  border-top: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  flex-wrap: wrap;
}
#profile-view .display-controls {
  margin-top: 20px;
  padding: 19px;
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  background: #f5f8ef;
}
#profile-view .display-controls h2 { margin-bottom: 14px; font-size: 19px; }
#profile-view .texture-picker button { min-height: 78px; background: #fff; }
#profile-view .texture-picker button[aria-pressed="true"] {
  border-color: #729452;
  box-shadow: inset 0 0 0 1px #729452;
}
#profile-view .transfer-card .muted { line-height: 1.6; }
#profile-view #profile-code { min-height: 48px; background: #f6f8f1; }
#profile-view .transfer-card .invite-actions button { min-height: 44px; }
#profile-view .account-removal {
  margin-top: 23px;
  padding: 18px;
  border: 1px solid #e3c9bf;
  border-radius: 11px;
  background: #fbf3ef;
}
#profile-view .account-removal h3 { margin: 0 0 7px; color: #7b4739; }
#profile-view .account-removal .form-note { margin: 0 0 13px; color: #76594f; }
#profile-view #delete-profile { min-height: 44px; border-color: #d6aa9b; background: #fff8f4; color: #874d3c; }
#profile-view #logout { min-height: 44px; margin-top: 15px; }

@media (max-width: 670px) {
  #login-view .entry-card, #home-view .setup-panel, #profile-view .profile-layout > .surface { padding: 20px; }
  #login-view .entry-card h2, #home-view .setup-panel h2 { font-size: 27px; }
  #home-view .home-intro { align-items: flex-start; margin-bottom: 18px; }
  #home-view .welcome-profile { padding: 4px; }
  #home-view .clock-settings { padding: 2px 12px 14px; }
  #home-view .size-picker { flex-wrap: wrap; }
  #home-view .size-picker button { flex: 1 1 calc(33.333% - 7px); }
  #home-view .time-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #home-view .notice-bar { align-items: stretch; }
  #home-view .notice-bar button { flex: 1; }
  #profile-view .profile-layout { margin-top: 20px; }
  #profile-view .display-controls { padding: 15px; }
  #profile-view .transfer-card .invite-actions { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  #home-view .time-inputs { grid-template-columns: minmax(0, 1fr); }
  #home-view .join-form { flex-wrap: wrap; }
  #home-view .join-form button { width: 100%; }
}

/* Match-local display choice and ephemeral replay viewer. */
#room-view #display-controls {
  margin-bottom: 16px;
  padding: 19px;
  border: 1px solid #dbe2d3;
  border-radius: 14px;
  background: #fbfbf7;
}
#room-view #display-controls h2 { margin: 0 0 12px; color: #2d4130; font-size: 19px; }
#room-view .texture-picker button { min-height: 66px; background: #f5f8ef; }
#room-view .texture-picker button[aria-pressed="true"] { background: #e5f2d3; }
#room-view .display-toggle { display: flex; align-items: center; gap: 9px; margin: 17px 0 0; font-size: 12px; }
#room-view .display-toggle input { flex: none; }
#room-view #display-controls .form-note { margin: 9px 0 0; }
#result .replay-open { width: 100%; max-width: 315px; min-height: 48px; margin: 0 0 5px; border-color: #7e9b62; font-weight: 700; }
#result .replay-open:disabled { opacity: .55; }
#result .replay-availability { margin: 0 0 18px; color: #60735b; font-size: 12px; line-height: 1.5; }
dialog.match-replay {
  width: min(760px, calc(100% - 24px));
  max-width: 760px;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 24px;
  overflow-y: auto;
  border: 1px solid #cbd9be;
  border-radius: 18px;
  background: #fbfbf7;
  color: #2d4130;
}
dialog.match-replay:not([open]) { display: none; }
.replay-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.replay-header h2 { margin: 7px 0 0; font-size: 29px; }
.replay-header button { flex: none; min-height: 44px; }
.replay-note { margin: 12px 0 16px; color: #5e7158; font-size: 13px; line-height: 1.55; }
.replay-players { display: flex; flex-wrap: wrap; gap: 7px 16px; margin: 0 0 12px; font-size: 12px; }
.replay-players span { display: inline-flex; align-items: center; gap: 7px; }
.replay-players i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #53624c; }
.replay-board-wrap { display: flex; justify-content: center; overflow-x: auto; }
.replay-board { width: min(100%, 510px); }
.replay-board [role="row"] { display: contents; }
.replay-board .cell { cursor: default; }
.replay-board .cell:focus-visible { outline: 3px solid #192c58; outline-offset: -4px; z-index: 1; }
.replay-progress { margin: 14px 0; text-align: center; font-size: 13px; font-weight: 700; }
.replay-seek-label { display: block; margin: 0 0 5px; color: #425d3f; font-size: 12px; font-weight: 700; }
.replay-seek { display: block; width: 100%; min-height: 34px; margin: 0 0 12px; accent-color: #729d42; }
.replay-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center; gap: 8px; }
.replay-controls button, .replay-controls select { min-height: 44px; }
.replay-controls button { width: 100%; margin: 0; padding: 9px 12px; }
.replay-controls label, .replay-controls .group-label { grid-column: 1 / -1; display: inline-flex; justify-self: center; align-items: center; gap: 7px; color: #425d3f; font-size: 12px; }
.replay-controls select { border: 1px solid #cbd9be; border-radius: 8px; background: #fff; color: #2d4130; padding: 0 8px; }
.match-replay :is(button, select):focus-visible, #room-view .texture-picker button:focus-visible {
  outline: 3px solid #769d45;
  outline-offset: 2px;
}
@media (max-width: 670px) {
  #room-view #display-controls { padding: 15px; }
  dialog.match-replay { padding: 15px; }
  .replay-header h2 { font-size: 25px; }
  .replay-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #replay-last { grid-column: 1 / -1; }
}

.player-report{margin-left:auto;padding:.2rem .55rem;font-size:.75rem;min-height:0;opacity:.75}
.player-report:hover,.player-report:focus-visible{opacity:1}

/* Match-start portrait: scrolls on short screens, owns every tap, and has an explicit close. */
.master-tip {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 80;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 24px 28px;
  background: #f4f4ec;
  color: var(--ink);
  border: 1px solid #e2e5d8;
  border-radius: 18px;
  box-shadow: 0 14px 44px rgb(0 0 0 / .16), 0 0 0 100vmax rgb(20 27 22 / .36);
  text-align: center;
  pointer-events: auto;
}
.master-tip[hidden] { display: none; }
.master-tip > * { flex-shrink: 0; }
.master-tip strong { margin: 8px 0 22px; font-size: 22px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
.master-tip .master-portrait { width: 60%; max-width: 230px; height: auto; aspect-ratio: 5 / 6; margin: 0 auto; border-radius: 12px; object-fit: cover; }
.master-tip blockquote { margin: 24px 0 10px; color: #38472e; font-size: 18px; font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; quotes: "“" "”"; }
.master-tip blockquote::before { content: open-quote; }
.master-tip blockquote::after { content: close-quote; }
.master-tip cite { font-size: 13px; font-style: normal; line-height: 1.5; color: #5b6057; }
.master-tip-close { align-self: flex-end; min-width: 78px; min-height: 44px; margin: -8px -14px 0 0; padding: 8px 10px; border: 1px solid #d3d9c7; background: #f4f4ec; font-size: 13px; color: #435536; border-radius: 10px; }
.master-tip-close span { margin-left: 6px; font-size: 19px; }
.master-tip-close:focus-visible { outline: 3px solid #435536; outline-offset: 3px; }
.hide-portraits .master-portrait { display: none; }

/* Phones: keep the whole board on screen for 2-6 players (issue #29). The pause card,
   player cards and the zoom button get compact; fitBoard() in app.js caps the board size to
   the height that is left. */
@media (max-width: 670px) {
  #arena:not([hidden]) { padding: 14px 12px; scroll-margin-top: 52px; }
  #arena .scoreboard { margin: 10px 0 8px; gap: 6px; }
  #arena .scoreboard:has(.score:nth-child(5)) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #arena .score { padding: 6px 8px; gap: 6px; }
  #arena .score small { margin-top: 2px; }
  #arena .score-value { font-size: 15px; }
  #arena .score-clock { font-size: 12px; padding-left: 17px; }
  #arena .pause-controls { flex-direction: row; align-items: center; gap: 10px; margin: 8px 0 0; padding: 6px 10px; }
  #arena .pause-controls .secondary { width: auto; min-height: 36px; padding: 6px 10px; font-size: 11px; }
  #arena .pause-controls:not(.is-paused) #pause-description { display: none; }
  #arena .board-tools { margin: 0 0 8px; }
  #arena .board-tools button { min-height: 36px; padding: 6px 12px; font-size: 12px; }
  #arena .board-wrap:not(.enlarged) .board { max-width: min(536px, var(--board-fit, 536px)); }
  #arena .arena-bottom { margin-top: 10px; }
}

/* Issue #31: in the lobby the room (code + invite) comes before the display settings. */
.lobby .side { display: flex; flex-direction: column; }
.lobby .side > #display-controls { order: 1; }

/* Issue #32: guest play first on the entry card; practice card above the room form. */
.offline-entry.guest-first { margin: 4px 0 22px; padding: 0 0 18px; border-top: 0; border-bottom: 1px solid #d3dcc6; display: grid; gap: 10px; }
.offline-entry.guest-first > strong { font-size: 14px; color: #2f4a2c; }
.offline-entry.guest-first .form-note { margin: 0; }
.home-layout > .practice-first { grid-column: 1 / -1; margin: 0; }

/* Issue #35: the toast never blocks input and stays clear of the main buttons. */
.toast { pointer-events: none; padding: 10px 16px; max-width: min(360px, calc(100vw - 32px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); line-height: 1.4; }

/* Issue #34: WCAG AA (4.5:1) for small text. Grey-on-cream text, the rules card, lobby
   badges, inactive player cards and the board legend were 2.3–4.4:1. Ratios are checked by
   test/ui/contrast.test.mjs; the colours stay in the existing green-grey palette. */
.form-note, .muted, p.muted, .room-note, #room-note, .ranking-note, #room-ranking-note,
.footer-light, footer > span, #match-heading, .how-title span, .mini-rule p,
.player-badge, .room-settings-summary small, .unit-input span, .clock-settings small,
.connection, .back-button, .entry-tabs button:not(.selected), #connection {
  color: var(--ink-2, #566149) !important;
}
.practice-card small, .display-controls small, .practice-setup small,
.time-presets span, .time-presets button span {
  color: var(--ink-2, #4f5a45) !important;
}
.player-report { opacity: 1; }
/* Dark arena: inactive cards keep full opacity (dimming is shown by the border and dot). */
.score { opacity: 1; }
.score:not(.active) { border-color: #3a423a; }
.score:not(.active) .score-dot { box-shadow: none; }
.score small, .score-clock small, .score-bot-label { color: #aab6a4 !important; }
.score-clock { color: #c1cdba; }
#round-label, #last-move-label, #clock-label, .board-legend, .board-legend span, .arena-top { color: #9aa898 !important; }
.navigation button:not(.selected) { color: #566149; }
[data-turn] span, [data-total] span, [data-increment] span { color: #4f5a45 !important; }

/* First-game tutorial (issue #33): pinned to the top so the board stays tappable. */
.tutorial-card {
  position: fixed; top: max(10px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  z-index: 16; width: min(440px, calc(100vw - 24px)); padding: 12px 14px;
  background: #252b27; color: #eef3e8; border: 1px solid #b8f36b; border-radius: 12px; box-shadow: 0 8px 26px #0004;
}
.tutorial-card[hidden] { display: none; }
.tutorial-card strong { display: block; font-size: 13px; color: #b8f36b; }
.tutorial-card p { margin: 4px 0 10px; font-size: 13px; line-height: 1.4; }
.tutorial-actions { display: flex; gap: 8px; justify-content: flex-end; }
.tutorial-actions button { min-height: 40px; padding: 8px 14px; font-size: 12px; width: auto; }
.tutorial-card .secondary { background: transparent; color: #dfe7d8; border-color: #6c7d62; }

/* Issue #38: flat SVG player icons. */
.avatar-icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }
#entry-avatars button .avatar-icon, #profile-avatars button .avatar-icon { width: 24px; height: 24px; color: #3d5a34; }
#entry-avatars button.selected .avatar-icon, #profile-avatars button.selected .avatar-icon { color: #2a4a1f; }
.player-avatar .avatar-icon { color: #1f2a1d; width: 0.95em; height: 0.95em; }

/* Profile creation: required terms-of-use checkbox (Play UGC policy). */
#login-view .entry-card .terms-accept, .terms-accept { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin: 14px 0 16px; font-size: 14px; line-height: 1.4; font-weight: 400; text-transform: none; letter-spacing: 0; color: #2c3a2a; }
.terms-accept input { width: 22px; flex: none; height: 22px; min-height: 0; margin: 0; accent-color: #435536; }
.terms-accept a { color: inherit; text-decoration: underline; }

/* Report button in leaderboard rows (Play UGC policy). */
.leader-player .leader-report { margin-left: auto; min-height: 32px; min-width: 44px; padding: 4px 8px; font-size: 12px; }
