:root {
  font-family: ui-rounded, "Avenir Next", Avenir, system-ui, sans-serif;
  color: #172f2a;
  background: #f5f7f4;
  font-synthesis: none;
  --green: #174c3c;
  --muted: #5e7068;
  --line: #dce3dc;
  --yellow: #ffdf69;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: white;
  color: inherit;
  border-radius: 12px;
  padding: 12px 19px;
  font-weight: 700;
  min-height: 46px;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  background: #eef4ec;
  transform: translateY(-1px);
}
button:disabled {
  opacity: 0.48;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #eeae00;
  outline-offset: 3px;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover:not(:disabled) {
  background: #23624e;
}
.yellow {
  background: var(--yellow);
  border-color: #edcb52;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.small {
  font-size: 0.875rem;
  padding: 8px 12px;
  min-height: 38px;
}
a {
  color: var(--green);
}
.wrap {
  max-width: 1250px;
  margin: auto;
  padding: 0 32px;
}
header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.header {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -1px;
  text-decoration: none;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--yellow);
  height: 42px;
  width: 42px;
  border-radius: 12px;
  font-size: 2rem;
}
.header-note {
  font-size: 0.875rem;
  color: var(--muted);
}
.welcome {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 42px 0 26px;
  gap: 24px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-weight: 800;
  font-size: 0.75rem;
  color: var(--green);
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  line-height: 1.1;
  letter-spacing: -1.8px;
  margin: 0 0 14px;
}
p {
  line-height: 1.6;
  margin: 10px 0;
  color: var(--muted);
}
.welcome p {
  font-size: 1.05rem;
  margin-bottom: 0;
}
.join-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.join-inline input {
  width: 150px;
  text-transform: uppercase;
}
.shelf-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin: 4px 0 18px;
}
.shelf-head h2 {
  font-size: 1.1rem;
  margin: 0;
}
.subtle {
  font-size: 0.875rem;
  color: var(--muted);
}
.catalog {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.game-tile {
  text-align: left;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: white;
  box-shadow: 0 3px 0 #e7ece5;
  min-width: 0;
}
.game-tile:hover:not(:disabled) {
  transform: translateY(-4px);
  background: white;
  box-shadow: 0 7px 0 #e3e9df;
}
.tile-top {
  width: 100%;
  height: 118px;
  background: var(--tile);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
}
.tile-symbol {
  font-family: Georgia, serif;
  font-size: 3.25rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -2px;
}
.tile-num {
  font-size: 0.75rem;
  align-self: flex-start;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}
.tile-text {
  padding: 19px 19px 23px;
  display: block;
}
.tile-tag {
  font-size: 0.75rem;
  font-weight: 800;
  display: block;
  color: #587168;
  margin-bottom: 8px;
}
.tile-title {
  font-size: 1.08rem;
  display: block;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}
.tile-desc {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.55;
  display: block;
}
.footer {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 32px 0;
  line-height: 1.6;
}
.resume {
  background: #e1ede1;
  border: 1px solid #c8dec9;
  padding: 14px 18px;
  border-radius: 12px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.veil {
  position: fixed;
  inset: 0;
  background: #102b2580;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}
.modal {
  background: #fff;
  padding: 32px;
  border-radius: 24px;
  width: 100%;
  max-width: 570px;
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 80px #0a201f40;
}
.modal h2 {
  font-size: 1.8rem;
  letter-spacing: -0.7px;
  margin: 10px 0;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mode-list {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}
.mode-button {
  text-align: left;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mode-button span {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--muted);
}
.mode-button.active {
  border: 2px solid var(--green);
  background: #eef5eb;
  padding: 15px 17px;
}
.form-row {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  margin: 16px 0;
}
label {
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
input,
select {
  border: 1px solid #b9c8be;
  background: #fff;
  color: inherit;
  border-radius: 10px;
  padding: 11px 12px;
  min-height: 46px;
  min-width: 0;
}
input[type="number"] {
  width: 130px;
}
.wide {
  width: 100%;
  margin-top: 12px;
}
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0;
}
.scoreboard {
  display: flex;
  gap: 10px;
  align-items: center;
}
.score {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 0.875rem;
  background: white;
}
.score.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.score b {
  font-size: 1.2rem;
  margin-left: 12px;
}
.play-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 24px;
}
.play-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  min-width: 0;
}
.play-head {
  padding: 23px 28px;
  border-bottom: 1px solid var(--line);
  background: #fafcf8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.play-head h1 {
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  margin: 0 0 6px;
}
.turn {
  font-size: 0.875rem;
  color: var(--muted);
}
.play-body {
  padding: 28px;
  min-height: 380px;
}
.side-card {
  background: #edf2e9;
  padding: 23px;
  border-radius: 18px;
  margin-bottom: 18px;
}
.side-card h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}
.side-card p {
  font-size: 0.875rem;
  line-height: 1.7;
}
.hint-content {
  color: #214e3b;
  background: #fff7d2;
  padding: 13px;
  border-radius: 10px;
  margin-top: 12px;
  font-size: 0.875rem;
  line-height: 1.6;
}
.history {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
  padding-left: 20px;
}
.history li {
  margin: 8px 0;
}
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}
.center {
  text-align: center;
}
.big-number {
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -3px;
  line-height: 1.2;
  margin: 20px 0;
}
.math-line {
  font-family: Georgia, serif;
  font-size: 2rem;
  line-height: 1.5;
  margin: 22px 0;
  text-align: center;
}
.chip {
  display: inline-block;
  padding: 6px 11px;
  background: #edf2e9;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 700;
}
.stones {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 500px;
  margin: 25px auto;
}
.stone {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background: #29694f;
  box-shadow: inset -5px -5px 0 #174c3c;
  border: 2px solid #174c3c;
}
.stone:nth-child(3n) {
  background: #6aa181;
}
.game-grid {
  display: grid;
  gap: 6px;
  margin: auto;
}
.tic-grid {
  grid-template-columns: repeat(3, 1fr);
  max-width: 320px;
}
.tic-grid button {
  aspect-ratio: 1;
  font-size: 2.7rem;
  background: #f4f7f0;
  border: 1px solid #cddbd0;
}
.tic-grid .winning {
  background: var(--yellow);
}
.mark-choice button.active {
  background: var(--green);
  color: white;
}
.hundred-grid {
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
}
.square {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #f0f4ed;
  border-radius: 5px;
  font-size: 0.85rem;
}
.square.pos0 {
  background: #174c3c;
  color: white;
}
.square.pos1 {
  outline: 3px solid #da773d;
  outline-offset: -3px;
}
.square.pos1:not(.pos0) {
  background: #f9dfc9;
}
.square:last-child {
  font-weight: 900;
}
.square.reachable {
  box-shadow: inset 0 0 0 2px #94b692;
}
.dice {
  font-size: 2.3rem;
  background: #ffecad;
  display: inline-grid;
  place-items: center;
  height: 62px;
  width: 62px;
  border-radius: 14px;
  margin: 12px;
}
.move-buttons {
  gap: 6px;
}
.move-buttons button {
  min-width: 50px;
  padding: 9px;
}
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin: 20px 0;
}
.card {
  width: 65px;
  height: 88px;
  border: 1px solid #b9cabf;
  border-bottom: 4px solid #b9cabf;
  font-family: Georgia, serif;
  font-size: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: white;
  border-radius: 10px;
}
.card.negative {
  color: #ac353c;
}
.card.selected {
  background: #ffed9c;
  border-color: #9b7d16;
  transform: translateY(-6px);
}
.card.hidden {
  background: repeating-linear-gradient(
    45deg,
    #31614e,
    #31614e 5px,
    #42765e 5px,
    #42765e 10px
  );
  color: white;
  font-family: inherit;
}
.hand-title {
  font-size: 0.875rem;
  font-weight: 800;
  margin-top: 22px;
}
.stats-targets {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.stat-box {
  padding: 16px;
  background: #edf3e9;
  border-radius: 12px;
  text-align: center;
  min-width: 100px;
}
.stat-box strong {
  display: block;
  font-size: 2rem;
}
.stat-box span {
  font-size: 0.8rem;
}
.sequence {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
}
.sequence span {
  padding: 10px 13px;
  background: #edf3e9;
  border-radius: 8px;
  font-weight: 700;
}
.terms {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.term {
  display: flex;
  align-items: center;
  gap: 5px;
}
.term input {
  width: 72px;
}
.term input.exponent {
  width: 60px;
  align-self: flex-start;
  font-size: 0.875rem;
}
.notice {
  padding: 14px 18px;
  background: #fff2c0;
  border-radius: 12px;
  line-height: 1.5;
  margin-bottom: 20px;
  font-size: 0.875rem;
}
.result {
  padding: 20px;
  background: #dcefcf;
  border-bottom: 1px solid #c0d9b0;
  text-align: center;
}
.result h2 {
  margin: 0 0 7px;
  font-size: 1.7rem;
}
.result p {
  margin: 0;
}
.room-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 12px;
  background: #e3ece5;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.room-code {
  font-size: 1.2rem;
  letter-spacing: 3px;
  font-weight: 900;
}
.board-svg {
  display: block;
  width: 100%;
  max-height: 370px;
  margin: auto;
  overflow: visible;
}
.board-svg circle.dot {
  cursor: pointer;
  fill: #174c3c;
  stroke: #fff;
  stroke-width: 3;
}
.board-svg circle.dot.chosen {
  fill: #ce8b00;
  stroke: #ffe48b;
  stroke-width: 6;
}
.board-svg text {
  font: 700 13px system-ui;
  pointer-events: none;
}
.board-svg line.edge {
  stroke: #417661;
  stroke-width: 4;
}
.board-svg .danger {
  stroke: #c84143;
  stroke-width: 6;
}
.board-svg .triangle-fill {
  fill: #ffda69aa;
  stroke: none;
}
.sea {
  width: 100%;
  aspect-ratio: 1.5;
  background: linear-gradient(
    90deg,
    #dfeef3 0%,
    #dfeef3 49.7%,
    #5b7c86 49.7%,
    #5b7c86 50.3%,
    #edf4f4 50.3%
  );
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  touch-action: manipulation;
  cursor: crosshair;
}
.fleet-marker {
  position: absolute;
  width: 6.6%;
  aspect-ratio: 1;
  border: 2px solid #174c3c;
  border-radius: 50%;
  background: #4e8f79;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.8rem;
  pointer-events: none;
}
.fleet-marker.enemy {
  background: #d5a43e;
  border-color: #8e6424;
}
.fleet-marker.hit {
  background: #a65f5f;
  opacity: 0.4;
}
.shot {
  position: absolute;
  width: 9px;
  height: 9px;
  border: 2px solid #a92a35;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.sea-labels {
  display: flex;
  justify-content: space-around;
  font-size: 0.8rem;
  font-weight: 800;
  margin: 10px;
}
.fraction-builder {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px;
  margin: 15px 0;
}
.fraction-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}
.slot {
  border-style: dashed;
  font-size: 0.875rem;
  min-width: 95px;
}
.slot.active {
  background: #ffed9c;
  border-color: #9b7d16;
}
.meld-table {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.meld {
  background: #e6f0e0;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: Georgia, serif;
}
.ready {
  padding: 35px;
  text-align: center;
}
.ready h2 {
  font-size: 2rem;
}
.busy {
  opacity: 0.7;
  pointer-events: none;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  background: #273f34;
  color: white;
  border-radius: 12px;
  padding: 15px 22px;
  box-shadow: 0 8px 30px #0003;
  max-width: calc(100% - 30px);
  width: max-content;
  z-index: 30;
  display: none;
  font-size: 0.95rem;
  line-height: 1.5;
}
#toast.show {
  display: block;
}
.mobile-only {
  display: none;
}
@media (max-width: 1000px) {
  .catalog {
    grid-template-columns: repeat(3, 1fr);
  }
  .play-layout {
    grid-template-columns: minmax(0, 1fr) 250px;
  }
  .wrap {
    padding: 0 22px;
  }
  .play-body {
    padding: 22px;
  }
  .welcome {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
  }
}
@media (max-width: 760px) {
  .catalog {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .header {
    height: 74px;
  }
  .header-note {
    display: none;
  }
  .wrap {
    padding: 0 16px;
  }
  .welcome {
    padding-top: 28px;
  }
  h1 {
    letter-spacing: -1px;
  }
  .tile-top {
    height: 94px;
    padding: 18px;
  }
  .tile-symbol {
    font-size: 2.7rem;
  }
  .tile-text {
    padding: 15px;
  }
  .tile-title {
    font-size: 1rem;
  }
  .tile-desc {
    font-size: 0.82rem;
  }
  .play-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .play-head {
    padding: 20px;
  }
  .play-body {
    padding: 20px;
    min-height: 300px;
  }
  .side-card {
    padding: 20px;
  }
  .topline {
    flex-wrap: wrap;
  }
  .score {
    padding: 8px 11px;
  }
  .score b {
    margin-left: 7px;
  }
  .card {
    width: 56px;
    height: 78px;
  }
  .cards {
    gap: 7px;
  }
  .square {
    font-size: 0.72rem;
  }
  .hundred-grid {
    gap: 3px;
  }
  .stats-targets {
    gap: 6px;
  }
  .stat-box {
    min-width: 0;
    flex: 1;
    padding: 12px;
  }
  .modal {
    padding: 24px;
  }
  .big-number {
    font-size: 3.5rem;
  }
  .header .brand {
    font-size: 1.3rem;
  }
  .join-inline input {
    width: 140px;
  }
  .room-bar {
    padding: 12px 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Play screens prioritize the board and the current decision. */
html {
  scrollbar-gutter: stable;
}
body.modal-open {
  overflow: hidden;
}
.game-screen {
  max-width: 1020px;
  padding: 0 20px;
}
.game-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  justify-content: space-between;
}
.game-nav > div {
  display: flex;
  gap: 6px;
}
.game-nav .quiet {
  padding-left: 0;
}
.game-nav .play-mode {
  margin-right: auto;
}
.game-screen .play-layout {
  display: block;
}
.game-screen .play-card {
  overflow: visible;
  border-radius: 16px;
}
.game-screen .play-head {
  padding: 14px 20px;
  border-radius: 16px 16px 0 0;
}
.game-screen .play-head h1 {
  font-size: 1.35rem;
  margin: 0 0 4px;
}
.game-screen .scoreboard {
  gap: 6px;
  flex-shrink: 0;
}
.game-screen .score {
  padding: 7px 10px;
}
.game-screen .play-body {
  padding: 18px 20px;
  min-height: 0;
  max-width: 720px;
  margin: auto;
}
.game-screen .big-number {
  font-size: 3.5rem;
  margin: 14px 0;
}
.game-screen .actions {
  margin-top: 16px;
  gap: 8px;
}
.game-screen .cards {
  margin: 12px 0;
}
.game-screen .hand-title {
  margin-top: 12px;
}
.game-screen .math-line {
  margin: 14px 0;
}
.game-screen .room-bar {
  margin-bottom: 8px;
  padding: 5px 12px;
  gap: 10px;
  flex-wrap: nowrap;
  min-height: 42px;
}
.game-screen .room-code {
  font-size: 1rem;
  letter-spacing: 2px;
}
.room-status {
  margin-right: auto;
}
.game-screen .room-bar button {
  white-space: nowrap;
}
.game-secondary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 20px;
  font-size: 0.875rem;
}
.game-secondary > span {
  margin-left: auto;
}
.game-secondary details {
  max-width: 70%;
}
summary {
  cursor: pointer;
  min-height: 40px;
  padding: 9px 0;
  font-weight: 700;
  font-size: 0.875rem;
}
details .history {
  margin-top: 0;
}
.game-secondary > span {
  padding-top: 10px;
  font-size: 0.8rem;
}
.game-screen .stones {
  max-width: 350px;
  gap: 10px;
  margin: 18px auto;
}
.game-screen .stone {
  width: 38px;
  height: 38px;
}
.game-screen .board-svg {
  max-height: min(370px, 60svh);
}
.game-screen .tic-grid {
  max-width: 290px;
}
.game-screen .sea {
  max-width: 580px;
  margin: auto;
}
.game-screen .ready {
  padding: 28px 12px;
}
.game-screen .result {
  padding: 14px;
  border-radius: 0;
}
.game-screen .result h2 {
  font-size: 1.4rem;
}
.game-screen .result button {
  margin-top: 8px;
}
.game-screen .notice {
  margin: 12px 0 0;
}
.game-screen .form-row {
  margin: 12px 0;
}
.game-screen .side-card {
  margin: 0;
}
.hundred-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(200px, 240px);
  gap: 24px;
  justify-content: center;
  align-items: center;
}
.game-hundred .play-body {
  max-width: none;
}
.game-hundred .scoreboard {
  display: none;
}
.position-key {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 0.875rem;
}
.position-player {
  display: flex;
  align-items: center;
  gap: 6px;
}
.position-player::before {
  content: "";
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  background: #174c3c;
}
.position-player.player-1::before {
  background: #da773d;
}
.position-player strong {
  font-variant-numeric: tabular-nums;
}
.hundred-grid {
  width: 100%;
  gap: 3px;
}
.hundred-grid .square {
  font-size: 0.875rem;
  min-width: 0;
}
.hundred-controls {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.roll-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.roll-row .dice {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  margin: 0;
  font-size: 1.8rem;
}
.roll-row > div {
  flex: 1;
}
.roll-row button {
  width: 100%;
}
.move-instruction {
  font-size: 0.875rem;
  margin-top: 5px;
  color: var(--muted);
  text-align: center;
}
.hundred-controls .move-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}
.move-buttons button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1px;
  min-height: 49px;
  padding: 6px;
  min-width: 0;
}
.move-buttons strong {
  font-size: 1rem;
}
.move-buttons span {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.last-move {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  min-height: 38px;
  text-align: center;
}
.game-stats .stat-box {
  padding: 10px 16px;
}
.game-stats .stat-box strong {
  font-size: 1.7rem;
}
.stumped-options {
  margin: 12px auto 0;
  text-align: center;
}
.stumped-options .actions {
  margin: 0;
}
.decision-bar {
  position: sticky;
  bottom: 0;
  background: #fffef7f5;
  padding: 10px 0;
  z-index: 4;
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.game-rummy .play-body {
  max-width: none;
}
.discard-tray {
  margin: 4px 0 10px;
}
.discard-cards {
  flex-wrap: nowrap;
  justify-content: flex-start;
  overflow-x: auto;
  padding: 6px 2px 10px;
  scrollbar-width: thin;
}
.discard-cards .card {
  flex-shrink: 0;
}
.rummy-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(300px, 1.25fr);
  gap: 20px;
  align-items: start;
}
.rummy-hand {
  position: sticky;
  top: 0;
  z-index: 3;
  background: white;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line);
}
.rummy-hand .hand-title {
  margin-top: 0;
}
.rummy-hand .cards {
  max-height: 225px;
  overflow-y: auto;
  padding-top: 7px;
  scrollbar-width: thin;
}
.hand-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.hand-tools .subtle {
  font-size: 0.8rem;
}
.fraction-builder {
  margin: 8px 0;
  padding: 12px;
}
.fraction-group {
  display: grid;
  grid-template-columns: 16px repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0;
}
.fraction-group .slot {
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-wrap: anywhere;
}
.fraction-group .slot strong {
  font-family: Georgia, serif;
  font-size: 1.2rem;
}
.fraction-builder .actions {
  margin-top: 12px;
}
.meld-tray {
  margin-top: 12px;
}
.meld-table {
  padding: 8px 0;
}
.game-power .terms {
  gap: 7px;
}
.game-power .term input {
  width: 64px;
}
.game-power .term input.exponent {
  width: 54px;
}
.modal {
  overscroll-behavior: contain;
}
.modal h2 {
  font-size: 1.5rem;
}
.modal .hint-content {
  font-size: 1rem;
}
#toast {
  bottom: 12px;
}
@media (max-width: 760px) {
  .game-screen {
    padding: 0 12px;
  }
  .game-screen .play-head {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .game-screen .play-head h1 {
    font-size: 1.2rem;
  }
  .game-screen .score {
    font-size: 0.8rem;
  }
  .game-screen .play-body {
    padding: 14px;
  }
  .game-screen .big-number {
    font-size: 3rem;
  }
  .game-screen .room-status {
    display: none;
  }
  .game-screen .room-bar {
    justify-content: space-between;
  }
  .game-screen .room-bar .small {
    padding: 6px 9px;
  }
  .game-screen .cards {
    gap: 6px;
  }
  .game-screen .card {
    width: 52px;
    height: 70px;
    font-size: 1.5rem;
  }
  .game-screen .scoreboard {
    margin-left: auto;
  }
  .game-screen .game-nav .small {
    min-height: 40px;
  }
  .game-nav {
    gap: 8px;
  }
  .game-nav .play-mode {
    font-size: 0.8rem;
  }
  .game-secondary {
    padding-top: 4px;
  }
  .game-secondary > span {
    font-size: 0.75rem;
  }
  .rummy-workspace {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .rummy-hand .cards {
    max-height: 174px;
  }
  .rummy-hand {
    padding: 8px 0;
  }
  .fraction-builder {
    margin-top: 12px;
  }
  .hand-tools button {
    min-height: 40px;
  }
  .game-screen .stones {
    gap: 8px;
    max-width: 300px;
  }
  .game-screen .stone {
    width: 32px;
    height: 32px;
  }
  .game-screen .board-svg {
    max-height: 320px;
  }
  .game-screen .stats-targets {
    margin-top: 12px !important;
  }
  .game-screen .stat-box {
    padding: 8px 10px;
  }
  .game-screen .actions {
    gap: 6px;
  }
  .game-screen .actions button {
    padding: 10px 13px;
  }
}
@media (max-width: 600px) {
  .hundred-layout {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .hundred-board-area {
    width: min(100%, 360px, max(250px, calc(100svh - 300px)));
  }
  .hundred-controls {
    width: min(100%, 360px);
    gap: 8px;
    align-self: center;
  }
  .hundred-controls .move-buttons {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }
  .hundred-controls .move-buttons button {
    min-height: 46px;
    padding: 4px 2px;
  }
  .roll-row {
    gap: 10px;
  }
  .roll-row > div {
    display: flex;
    gap: 10px;
    align-items: center;
  }
  .roll-row button {
    width: auto;
    white-space: nowrap;
    padding: 9px 13px;
  }
  .move-instruction {
    margin: 0;
    text-align: left;
    font-size: 0.8rem;
  }
  .last-move {
    min-height: 20px;
  }
  .position-key {
    margin-bottom: 7px;
    font-size: 0.8rem;
  }
  .hundred-grid .square {
    font-size: 0.8rem;
  }
  .game-hundred .play-body {
    padding: 10px 12px;
  }
  .game-nav .play-mode {
    display: none;
  }
}
@media (min-width: 601px) and (max-height: 600px) {
  .hundred-layout {
    grid-template-columns: minmax(240px, 280px) minmax(220px, 300px);
    gap: 16px;
  }
  .hundred-controls {
    gap: 6px;
  }
  .hundred-controls .move-buttons {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }
  .game-screen .play-body {
    padding: 10px 16px;
  }
  .game-nav {
    min-height: 44px;
  }
  .game-screen .play-head {
    padding: 8px 16px;
  }
  .game-screen .room-bar {
    min-height: 36px;
  }
  .hundred-controls .move-buttons button {
    min-height: 46px;
  }
  .game-hundred .position-key {
    margin-bottom: 5px;
  }
}
@media (max-width: 600px) {
  .hundred-board-area {
    width: min(100%, 360px, max(220px, calc(100svh - 335px)));
  }
  body[data-play-mode="online"] .hundred-board-area {
    width: min(100%, 360px, max(220px, calc(100svh - 400px)));
  }
}
@media (max-width: 600px) and (max-height: 620px) {
  .game-hundred .game-nav {
    min-height: 44px;
  }
  .game-hundred .play-head {
    padding: 8px 12px;
  }
  .game-hundred .play-body {
    padding: 8px 10px;
  }
  .game-hundred .move-instruction {
    display: none;
  }
  .game-hundred .roll-row {
    height: 44px;
  }
  .game-hundred .roll-row .dice {
    width: 42px;
    height: 42px;
  }
  .game-hundred .roll-row button {
    min-height: 42px;
    width: 100%;
  }
  .game-hundred .room-bar {
    margin-bottom: 4px;
    min-height: 34px;
    padding: 2px 10px;
  }
  .game-hundred .room-bar button {
    min-height: 30px;
  }
  .game-hundred .hundred-controls {
    gap: 6px;
  }
  .game-hundred .hundred-grid .square {
    font-size: 12px;
  }
}
@media (min-width: 601px) and (max-height: 600px) {
  .hundred-layout {
    grid-template-columns: minmax(220px, 240px) minmax(220px, 300px);
  }
}
@media (min-width: 601px) and (max-height: 600px) {
  body[data-play-mode="online"] .game-hundred {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
  }
  body[data-play-mode="online"] .game-hundred .play-layout,
  body[data-play-mode="online"] .game-hundred .game-secondary {
    grid-column: 1/-1;
  }
  body[data-play-mode="online"] .game-hundred .room-bar {
    margin: 4px 0;
    align-self: center;
  }
  body[data-play-mode="online"] .game-hundred .room-status,
  body[data-play-mode="online"] .game-hundred .play-mode {
    display: none;
  }
}
@media (min-width: 601px) and (max-height: 600px) {
  body[data-play-mode="online"] .game-hundred .room-bar {
    margin: 0;
  }
}
/* Captioned demonstrations are isolated from the live board. */
.tutorial-modal {
  max-width: 580px;
  padding: 20px 24px;
}
.tutorial-modal .modal-head {
  gap: 12px;
  margin-bottom: 14px;
}
.tutorial-modal h2 {
  margin: 0 0 4px;
}
.tutorial-modal .modal-head button {
  flex-shrink: 0;
}
.demo-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.demo-tabs button {
  flex: 1;
  min-height: 42px;
  padding: 8px;
  font-size: 0.875rem;
}
.demo-tabs button[aria-pressed="true"] {
  background: #174c3c;
  color: white;
  border-color: #174c3c;
}
.demo-progress {
  font-size: 0.875rem;
  font-weight: 700;
  min-height: 24px;
  margin-bottom: 6px;
}
.demo-stage {
  border-radius: 14px;
  background: #f0f5ed;
  border: 1px solid #dce5d8;
  overflow: hidden;
}
.demo-stage svg {
  display: block;
  width: 100%;
  height: min(240px, 29svh);
}
.demo-stage text {
  font:
    16px "Avenir Next",
    system-ui,
    sans-serif;
  fill: #173d30;
}
.demo-stage .demo-label {
  font-size: 15px;
  font-weight: 700;
}
.demo-stage .demo-equation {
  font-size: 18px;
  font-weight: 800;
}
.demo-stage .demo-mark {
  font-size: 30px;
  font-weight: 800;
}
.demo-stage .demo-card-value {
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
}
.demo-stage .demo-card {
  fill: white;
  stroke: #9bb19f;
  stroke-width: 1.5;
}
.demo-stage .chosen {
  fill: #ffdf69;
  stroke: #a78524;
  stroke-width: 2;
}
.demo-stage .demo-line {
  stroke: #3c7259;
  stroke-width: 3;
  stroke-linecap: round;
}
.demo-stage .demo-fold {
  stroke: #82978a;
  stroke-width: 2;
  stroke-dasharray: 5 5;
}
.demo-stage .demo-dot,
.demo-stage .demo-token {
  fill: #174c3c;
}
.demo-stage .demo-gold {
  fill: #e9b847;
  stroke: #946f15;
  stroke-width: 2;
}
.demo-stage .demo-white {
  fill: white;
  font-size: 13px;
  font-weight: 700;
}
.demo-stage .demo-warning {
  fill: #ffcf8b;
  stroke: #bb4b30;
  stroke-width: 2;
}
.demo-stage .demo-success {
  fill: #174c3c;
  font-weight: 900;
}
.demo-caption {
  font-size: 1rem;
  line-height: 1.5;
  padding: 12px 0;
  min-height: 96px;
}
.demo-controls {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.demo-controls button {
  flex: 1;
  min-height: 44px;
  padding: 8px;
  font-size: 0.875rem;
}
.tutorial-back {
  margin-top: 12px;
  min-height: 42px;
  padding: 8px;
}
.demo-written p {
  font-size: 1rem;
  line-height: 1.65;
}
.demo-travel {
  animation: demo-travel 1.8s ease-in-out both;
}
.demo-lift {
  animation: demo-lift 0.6s ease-out both;
}
.demo-pop {
  transform-box: fill-box;
  transform-origin: center;
  animation: demo-pop 0.6s ease-out both;
}
.demo-draw {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: demo-draw 1.5s ease-out forwards;
}
.demo-away {
  animation: demo-away 1.2s ease-in both;
}
.demo-static .demo-travel {
  animation: none;
  transform: translateX(var(--dx));
}
.demo-static .demo-lift {
  animation: none;
  transform: translateY(-6px);
}
.demo-static .demo-pop {
  animation: none;
}
.demo-static .demo-draw {
  animation: none;
  stroke-dashoffset: 0;
}
.demo-static .demo-away {
  animation: none;
  opacity: 0;
}
.demo-visual[hidden],
.demo-written[hidden] {
  display: none;
}
@keyframes demo-travel {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(var(--dx));
  }
}
@keyframes demo-lift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-6px);
  }
}
@keyframes demo-pop {
  from {
    opacity: 0;
    transform: scale(0.65);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes demo-draw {
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes demo-away {
  to {
    opacity: 0;
    transform: translateY(40px);
  }
}
@media (max-width: 600px) {
  .tutorial-modal {
    padding: 16px;
    max-height: calc(100dvh - 24px);
  }
  .veil:has(.tutorial-modal) {
    padding: 12px;
  }
  .tutorial-modal .modal-head {
    margin-bottom: 10px;
  }
  .tutorial-modal h2 {
    font-size: 1.25rem;
  }
  .demo-tabs {
    margin-bottom: 8px;
  }
  .demo-caption {
    min-height: 96px;
    padding: 10px 0;
  }
  .demo-progress {
    font-size: 0.8rem;
  }
  .demo-stage svg {
    height: min(200px, 27svh);
  }
}
@media (prefers-reduced-motion: reduce) {
  .demo-travel,
  .demo-lift,
  .demo-pop,
  .demo-draw,
  .demo-away {
    animation: none;
  }
  .demo-travel {
    transform: translateX(var(--dx));
  }
  .demo-draw {
    stroke-dashoffset: 0;
  }
  .demo-away {
    opacity: 0;
  }
}

.demo-paused .demo-travel,
.demo-paused .demo-lift,
.demo-paused .demo-pop,
.demo-paused .demo-draw,
.demo-paused .demo-away {
  animation-play-state: paused;
}
