@font-face {
  font-family: Canyon;
  src: local("Georgia");
  font-display: swap;
}
* {
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  font-family: "Trebuchet MS", Arial, sans-serif;
  color: #fae8be;
  background: #382820;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
select {
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid #ffc665;
  outline-offset: 5px;
}
button {
  color: inherit;
}
button:disabled {
  opacity: 0.38;
  cursor: default;
}
button svg,
svg.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
[hidden] {
  display: none !important;
}
:root {
  --ink: #3c2923;
  --cream: #fae8bd;
  --gold: #e4ad5f;
  --motion: 260ms;
}
.scene {
  position: fixed;
  inset: -1%;
  background: url("../image/backgrounds/lobby.webp") center 53% / cover
    no-repeat;
  transition:
    opacity 0.6s,
    filter 0.8s;
  z-index: -3;
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    #302d2917 0%,
    transparent 25%,
    #542d2010 63%,
    #381e2844 100%
  );
}
.scene.game-scene {
  background-image: url("../image/backgrounds/game.webp");
  background-position: center;
}
.scene.game-scene::after {
  background: #281c2240;
}
.scene.options-scene {
  filter: brightness(0.76);
}
#app,
.screen {
  width: 100%;
  height: 100%;
  height: 100dvh;
}
.screen {
  position: relative;
  animation: screen-enter 0.5s ease both;
}
.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3.2px;
  text-transform: uppercase;
}
.lobby-header {
  position: absolute;
  top: 34px;
  left: 44px;
  right: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 5;
}
.studio-mark {
  display: flex;
  gap: 12px;
  align-items: center;
  font-family: Georgia, serif;
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: 0 2px 3px #39231f88;
}
.diamond-mark {
  font-size: 32px;
  color: #f0c887;
}
.studio-mark small {
  display: block;
  font:
    8px "Trebuchet MS",
    sans-serif;
  letter-spacing: 3px;
  margin-top: 5px;
  color: #ead4b1;
}
.corner-actions {
  display: flex;
  gap: 12px;
}
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: #3e29262b;
  border: 1px solid #f3d3a74d;
  border-radius: 50%;
  transition:
    background 0.18s,
    transform 0.18s;
}
.icon-button:hover {
  background: #3e29268c;
  transform: translateY(-2px);
}
.icon-button:active {
  transform: scale(0.94);
}
.lobby-composition {
  position: absolute;
  top: 16.5%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  flex-direction: column;
  width: min(680px, 92vw);
  text-align: center;
}
.lobby-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #ffe9bf;
  text-shadow: 0 2px 4px #38251d88;
  margin: 0 0 1%;
  font-size: 10px;
  letter-spacing: 3px;
}
.lobby-eyebrow span {
  display: block;
  height: 1px;
  width: 35px;
  background: #f5d4a280;
}
.game-logo {
  display: block;
  width: min(580px, 84vw);
  height: clamp(180px, 28vh, 310px);
  object-fit: contain;
  filter: drop-shadow(0 7px 2px #39231e36);
  margin: -1% 0 -1.5%;
  transition: transform 0.5s;
}
.lobby-tagline {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 17px;
  letter-spacing: 0.35px;
  color: #fff0cf;
  text-shadow: 0 2px 4px #3c201d;
  margin: 8px 0 36px;
}
.menu-actions {
  width: 310px;
  display: grid;
  gap: 12px;
}
.art-button,
.small-art-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: transparent url("../image/ui/button-primary.webp") center/100%
    100% no-repeat;
  border: 0;
  color: #40291f;
  font-weight: 900;
  letter-spacing: 2px;
  filter: drop-shadow(0 5px 0 #3c251e42);
  transition:
    filter 0.2s,
    transform 0.2s;
}
.art-button {
  height: 76px;
  font-size: 25px;
  padding: 9px 36px;
  position: relative;
}
.art-button:hover,
.small-art-button:hover {
  transform: translateY(-3px) rotate(-0.35deg);
  filter: brightness(1.09) drop-shadow(0 7px 1px #3c251e50);
}
.art-button:active,
.small-art-button:active {
  transform: translateY(2px);
  filter: brightness(0.97) drop-shadow(0 2px 0 #3c251e40);
}
.primary-button svg {
  fill: currentColor;
  stroke-width: 0.8;
  width: 20px;
}
.button-spark {
  font-size: 19px;
  position: absolute;
  right: 35px;
  opacity: 0.55;
}
.secondary-button {
  background-image: url("../image/ui/button-secondary.webp");
  color: #f8dfb0;
  font-size: 19px;
  height: 61px;
  gap: 12px;
  letter-spacing: 2.5px;
}
.secondary-button svg {
  width: 20px;
}
.lobby-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 25px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 1px 4px #3a221f;
}
.segmented {
  display: flex;
  background: #482a2438;
  border: 1px solid #f3d7ad60;
  border-radius: 3px;
  padding: 3px;
  gap: 3px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 9px 11px;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1.3px;
  border-radius: 1px;
  color: #f5e1bd;
  transition: all 0.2s;
}
.segmented button[aria-pressed="true"] {
  background: #f0d6a3;
  color: #56392a;
  box-shadow: 0 1px 3px #4a2b2650;
  text-shadow: none;
}
.resume-note {
  font-size: 10px;
  letter-spacing: 0.4px;
  color: #eed8b5;
  margin-top: 15px;
}
.lobby-footer {
  position: absolute;
  bottom: 28px;
  left: 44px;
  right: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.7px;
  color: #f5dab6;
}
.lobby-footer i {
  font-size: 7px;
  font-style: normal;
  margin: 0 12px;
  color: #d9aa6c;
}
.text-button {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: none;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.3px;
  padding: 8px 0;
}
.text-button svg {
  width: 16px;
  height: 16px;
}
.text-button:hover {
  color: #fff;
}
.menu-header {
  position: absolute;
  top: 30px;
  left: 36px;
  right: 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.small-art-button {
  height: 48px;
  min-width: 112px;
  font-size: 11px;
  letter-spacing: 1.5px;
  gap: 9px;
  padding: 8px 20px;
}
.small-art-button svg {
  width: 19px;
  height: 19px;
}
.menu-header > .eyebrow {
  font-size: 9px;
  color: #e1c6a0;
}
.options-composition {
  position: absolute;
  left: 50%;
  top: 12%;
  transform: translateX(-50%);
  width: min(580px, 90vw);
  text-align: center;
}
.options-composition > .eyebrow {
  color: #efcf98;
  font-size: 10px;
}
.options-composition h1 {
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: 64px;
  letter-spacing: -2px;
  margin: 6px 0;
  color: #ffe9bb;
  text-shadow: 3px 4px 0 #472b24;
}
.menu-subtitle {
  font-size: 13px;
  color: #f6dfb9;
  letter-spacing: 0.5px;
  margin: 12px 0 24px;
}
.parchment {
  background: url("../image/ui/panel.webp") center/100% 100% no-repeat;
  color: var(--ink);
  filter: drop-shadow(0 12px 15px #281b2366);
}
.settings-panel {
  padding: 32px 45px 28px;
  text-align: left;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  border-bottom: 1px solid #7e573328;
  gap: 22px;
}
.setting-row label {
  display: block;
  font:
    600 17px Georgia,
    serif;
}
.setting-row small {
  display: block;
  font-size: 10px;
  margin-top: 6px;
  color: #876f51;
}
.toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #594132;
  border: 1px solid #422d22;
  padding: 4px 8px 4px 4px;
  min-width: 71px;
  height: 30px;
  border-radius: 16px;
  color: #f9e8c4;
  box-shadow: inset 0 2px 4px #33251c55;
}
.toggle span {
  height: 20px;
  width: 20px;
  border-radius: 50%;
  background: #f2dbac;
  box-shadow: 0 2px 2px #2d201e44;
}
.toggle b {
  font-size: 9px;
  letter-spacing: 1px;
}
.toggle[aria-checked="true"] {
  background: #a65b36;
  border-color: #8e4b2b;
}
.toggle[aria-checked="true"] span {
  background: #ffedc4;
}
.toggle[aria-checked="false"] {
  flex-direction: row-reverse;
  padding: 4px 4px 4px 8px;
  background: #9b8970;
}
.range-control {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 185px;
}
.range-control input {
  width: 140px;
  accent-color: #a04d30;
  height: 5px;
  cursor: pointer;
}
.range-control output {
  font-size: 10px;
  min-width: 30px;
}
select {
  appearance: none;
  border: 1px solid #92724855;
  border-radius: 3px;
  background: #b88e4520
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%235e402d' stroke-width='2'/%3E%3C/svg%3E")
    right 10px center/9px no-repeat;
  padding: 10px 27px 10px 12px;
  font-size: 11px;
  font-weight: bold;
  color: #66472f;
  cursor: pointer;
}
.settings-saved {
  text-align: center;
  font-size: 8px;
  letter-spacing: 1.2px;
  margin: 24px 0 2px;
  color: #987a52;
}
.settings-saved span {
  padding-right: 6px;
  color: #b27643;
}
.game-screen {
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  max-width: 1700px;
  margin: auto;
}
.game-header {
  height: 92px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e0bd8b25;
  gap: 24px;
}
.game-brand {
  display: flex;
  align-items: center;
  gap: 17px;
  width: 245px;
}
.game-brand > div {
  font:
    900 24px Georgia,
    serif;
  letter-spacing: 1.5px;
  text-shadow: 1px 2px #3f261f;
}
.game-brand small {
  display: block;
  font:
    8px "Trebuchet MS",
    sans-serif;
  letter-spacing: 2.4px;
  margin-top: 5px;
  color: #d8b98c;
}
.stats {
  display: flex;
  align-items: center;
  gap: 38px;
  text-align: center;
}
.stats div {
  min-width: 58px;
}
.stats span {
  display: block;
  font-size: 8px;
  letter-spacing: 2px;
  color: #dac09a;
  margin-bottom: 5px;
}
.stats b {
  font-size: 22px;
  font-weight: 400;
  color: #fae6bf;
  font-variant-numeric: tabular-nums;
}
.stats i {
  display: block;
  height: 25px;
  width: 1px;
  background: #e3bd7d2b;
}
.game-top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  width: 245px;
}
.board-surround {
  flex: 1;
  position: relative;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding-top: 20px;
}
.board {
  width: 100%;
  height: 100%;
  position: relative;
  touch-action: none;
  max-width: 1080px;
  isolation: isolate;
}
.pile-slot {
  position: absolute;
  border: 1.5px solid #e0b16e54;
  border-radius: 7px;
  background: #261e231f;
  box-shadow:
    inset 0 0 0 4px #cca16a09,
    inset 0 0 15px #21171d20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    border-color 0.2s;
  touch-action: none;
  padding: 0;
}
.pile-slot::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid #e2bc7822;
  border-radius: 3px;
  pointer-events: none;
}
.pile-slot svg {
  width: 29%;
  height: 29%;
  color: #ddae6a6b;
  stroke-width: 1.4;
}
.pile-slot .suit-watermark {
  font:
    46px Georgia,
    serif;
  color: #d2a3654f;
}
.pile-label {
  position: absolute;
  top: 100%;
  margin-top: 8px;
  left: 0;
  right: 0;
  font-size: 8px;
  letter-spacing: 2px;
  text-align: center;
  color: #d9b68788;
  pointer-events: none;
}
.stock-count {
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  font-size: 8px;
  letter-spacing: 1.2px;
  color: #d9b687b0;
  text-align: center;
  pointer-events: none;
}
.pile-slot.valid-destination {
  border-color: #ffe1a3;
  background: #dfb55d2c;
  box-shadow:
    0 0 18px #f2c27227,
    inset 0 0 0 3px #ffd68d30;
}
.card {
  position: absolute;
  cursor: grab;
  padding: 0;
  border: 0;
  border-radius: 6%;
  background: #f0deb8;
  box-shadow:
    0 2px 1px #26191c70,
    0 5px 9px #1c131a28;
  touch-action: none;
  will-change: transform;
  transition: box-shadow 0.16s;
  outline-offset: 1px;
  transform-style: preserve-3d;
}
.card img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6%;
  pointer-events: none;
  -webkit-user-drag: none;
}
.card.face-down {
  cursor: default;
}
.card.movable:hover {
  box-shadow:
    0 2px 1px #26191c70,
    0 7px 15px #1c131a55,
    0 0 0 2px #ffe0a981;
}
.card.selected {
  box-shadow:
    0 2px 4px #1e151d70,
    0 0 0 3px #ffdd8f,
    0 0 22px #ffd77744;
}
.card.hint-card {
  animation: hint-glow 1s ease-in-out 3;
}
.card.dragging {
  cursor: grabbing;
  box-shadow:
    0 15px 25px #170f1b66,
    0 0 0 1px #ffda8b99;
  transition: none;
  pointer-events: none;
}
.card.returning {
  transition: transform var(--motion) cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card.face-flip {
  animation: card-flip var(--motion) ease-in-out;
}
.status-line {
  height: 32px;
  flex-shrink: 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font:
    italic 12px Georgia,
    serif;
  color: #ddc4a0;
  letter-spacing: 0.25px;
  transition: opacity 0.2s;
  padding: 0 12px;
}
.game-footer {
  height: 83px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid #e0bd8b25;
}
.game-secondary,
.game-primary {
  display: flex;
  align-items: center;
  gap: 18px;
}
.game-primary {
  gap: 8px;
}
.tool-button {
  background: none;
  border: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 10px 0;
  color: #e8cda3;
}
.tool-button svg {
  width: 18px;
  height: 18px;
}
.tool-button:hover {
  color: #fff0cd;
}
.game-mode {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 8px;
  letter-spacing: 1px;
  color: #dabf94;
}
.game-mode select {
  font-size: 9px;
  background-color: #c9994e25;
  border-color: #d7b07144;
  color: #f2d5a7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23e8c392' stroke-width='2'/%3E%3C/svg%3E");
  padding: 9px 27px 9px 10px;
}
.game-mode option {
  color: #412d23;
  background: #eed8ad;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-scrim {
  position: absolute;
  inset: 0;
  background: #1f1723b5;
  backdrop-filter: blur(5px);
  animation: screen-enter 0.25s;
}
.modal-panel {
  position: relative;
  width: min(490px, 94vw);
  padding: 46px 42px 40px;
  text-align: center;
  animation: modal-enter 0.3s ease;
}
.modal-close {
  position: absolute;
  top: 23px;
  right: 23px;
  background: none;
  border: 0;
  padding: 0;
  color: #765739;
}
.modal-panel > .eyebrow {
  font-size: 8px;
  letter-spacing: 2px;
  color: #9a7445;
}
.modal-panel h2 {
  font:
    900 37px Georgia,
    serif;
  letter-spacing: -1px;
  margin: 15px 0;
  color: #563a27;
}
.modal-panel p {
  font-size: 13px;
  line-height: 1.8;
  color: #806146;
}
.modal-buttons {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 24px;
}
.modal-buttons .small-art-button {
  min-width: 153px;
}
.modal-buttons .quiet-button {
  background: none;
  border: 0;
  color: #8a6745;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  min-height: 38px;
  padding: 8px 18px;
}
.modal-panel ol {
  text-align: left;
  padding-left: 20px;
  font-size: 12px;
  line-height: 1.7;
  color: #795b3e;
}
.modal-panel li {
  padding: 4px 0;
}
.win-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 24px 0;
}
.win-stats b {
  font:
    26px Georgia,
    serif;
  display: block;
  color: #6c4327;
}
.win-stats span {
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #9a774e;
}
.victory-emblem svg {
  width: 58px;
  height: 58px;
  fill: #c78f38;
  stroke: #855c31;
  stroke-width: 1;
  filter: drop-shadow(0 3px #deb85d);
}
.toast {
  position: fixed;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 20px;
  max-width: 90vw;
  background: #f0d9b0;
  color: #5c3d29;
  border: 1px solid #a77b43;
  font-size: 12px;
  border-radius: 3px;
  box-shadow: 0 5px 15px #1f151e55;
  z-index: 50;
  text-align: center;
}
.loading-screen {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(#24191dbb, #24191dcc),
    url("../image/backgrounds/lobby.webp") center / cover no-repeat #3a2925;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #e9c690;
  transition: opacity 0.55s;
}
.loading-screen h1 {
  font:
    italic 25px Georgia,
    serif;
  margin: 10px 0 30px;
  color: #f5dfb7;
}
.loading-logo {
  width: min(340px, 70vw);
  max-height: 30vh;
  object-fit: contain;
  filter: drop-shadow(0 5px 10px #1b1010aa);
}
.loading-screen .eyebrow {
  font-size: 9px;
  letter-spacing: 3px;
}
.loading-track {
  width: min(260px, 65vw);
  height: 8px;
  overflow: hidden;
  border: 1px solid #e4b66b88;
  border-radius: 8px;
  background: #231719aa;
}
.loading-track span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #b56b35, #f5d58b);
  border-radius: inherit;
}
.loading-percent {
  margin-top: 8px;
  font-size: 12px;
  color: #f5dfb7;
}
.loading-screen > p:last-child {
  font-size: 9px;
  color: #b79b77;
  letter-spacing: 1px;
  margin-top: 14px;
}
.loading-screen.done {
  opacity: 0;
  pointer-events: none;
}
.loading-screen.error .loading-track span {
  background: #d57e56;
}
.paused .scene {
  filter: brightness(0.65);
}
@keyframes screen-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes card-flip {
  0% {
    transform: rotateY(90deg);
  }
  100% {
    transform: rotateY(0);
  }
}
@keyframes loading-breathe {
  50% {
    opacity: 0.4;
    transform: scale(0.9);
  }
}
@keyframes hint-glow {
  50% {
    box-shadow:
      0 0 0 3px #ffcf76,
      0 0 30px #ffcb7380;
  }
}
@media (min-width: 1700px) {
  .lobby-composition {
    top: 18%;
  }
  .game-logo {
    width: 660px;
    height: 33vh;
  }
  .menu-actions {
    width: 345px;
  }
  .art-button {
    height: 83px;
  }
  .secondary-button {
    height: 67px;
  }
  .lobby-tagline {
    margin-bottom: 40px;
  }
  .lobby-mode {
    margin-top: 30px;
  }
  .game-screen {
    padding: 0 50px;
  }
  .game-header {
    height: 106px;
  }
  .game-footer {
    height: 95px;
  }
  .board-surround {
    padding-top: 25px;
  }
  .board {
    max-width: 1180px;
  }
}
@media (max-height: 760px) and (min-width: 700px) {
  .lobby-composition {
    top: 13.5%;
  }
  .game-logo {
    height: 28vh;
  }
  .lobby-tagline {
    font-size: 14px;
    margin: 3px 0 21px;
  }
  .menu-actions {
    gap: 9px;
    width: 276px;
  }
  .art-button {
    height: 65px;
    font-size: 22px;
  }
  .secondary-button {
    height: 52px;
    font-size: 16px;
  }
  .lobby-mode {
    margin-top: 17px;
  }
  .lobby-header {
    top: 25px;
  }
  .lobby-footer {
    bottom: 20px;
  }
  .lobby-eyebrow {
    font-size: 8px;
  }
  .options-composition {
    top: 7%;
  }
  .options-composition h1 {
    font-size: 47px;
  }
  .options-composition > .eyebrow {
    font-size: 8px;
  }
  .menu-subtitle {
    margin: 8px 0 14px;
  }
  .settings-panel {
    padding: 22px 40px;
  }
  .setting-row {
    min-height: 61px;
  }
  .settings-saved {
    margin-top: 17px;
  }
  .game-header {
    height: 70px;
  }
  .game-footer {
    height: 66px;
  }
  .board-surround {
    padding-top: 15px;
  }
  .status-line {
    height: 25px;
  }
}
@media (max-width: 900px) {
  .game-screen {
    padding: 0 16px;
  }
  .game-brand {
    width: 190px;
    gap: 10px;
  }
  .game-brand > div {
    font-size: 20px;
  }
  .game-top-actions {
    width: 190px;
  }
  .stats {
    gap: 18px;
  }
  .game-secondary {
    gap: 13px;
  }
  .game-primary .small-art-button {
    min-width: 90px;
    padding: 7px 13px;
    height: 44px;
    font-size: 10px;
  }
  .game-mode {
    gap: 5px;
  }
  .game-footer {
    gap: 10px;
  }
  .game-secondary .tool-button {
    font-size: 8px;
    gap: 5px;
  }
  .lobby-header {
    left: 28px;
    right: 28px;
  }
  .lobby-footer {
    left: 28px;
    right: 28px;
  }
}
@media (max-width: 600px) {
  .scene {
    background-position: 53% center;
  }
  .lobby-header {
    top: max(24px, env(safe-area-inset-top));
    left: 21px;
    right: 20px;
  }
  .studio-mark {
    font-size: 10px;
    letter-spacing: 1.5px;
    gap: 9px;
  }
  .studio-mark small {
    font-size: 6px;
    letter-spacing: 1.7px;
  }
  .diamond-mark {
    font-size: 25px;
  }
  .corner-actions {
    gap: 7px;
  }
  .icon-button {
    height: 36px;
    width: 36px;
  }
  .icon-button svg {
    width: 18px;
    height: 18px;
  }
  .lobby-composition {
    top: 24%;
    width: 96vw;
  }
  .lobby-eyebrow {
    font-size: 7px;
    letter-spacing: 2px;
    gap: 10px;
  }
  .lobby-eyebrow span {
    width: 20px;
  }
  .game-logo {
    width: 94vw;
    height: 23vh;
    margin: 4px 0 -6px;
  }
  .lobby-tagline {
    font-size: 12px;
    letter-spacing: 0;
    margin: 11px 0 30px;
  }
  .menu-actions {
    width: 255px;
    gap: 10px;
  }
  .art-button {
    font-size: 22px;
    height: 68px;
  }
  .secondary-button {
    height: 55px;
    font-size: 16px;
  }
  .lobby-mode {
    margin-top: 23px;
    gap: 11px;
    font-size: 8px;
  }
  .segmented button {
    font-size: 8px;
    padding: 8px 9px;
  }
  .lobby-footer {
    bottom: max(23px, env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    justify-content: center;
    gap: 15px;
    flex-direction: column;
  }
  .lobby-footer > span {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .lobby-footer i {
    margin: 0 8px;
  }
  .text-button {
    font-size: 8px;
  }
  .resume-note {
    font-size: 8px;
    max-width: 260px;
    line-height: 1.7;
  }
  .menu-header {
    top: 22px;
    left: 16px;
    right: 16px;
  }
  .menu-header > .eyebrow {
    display: none;
  }
  .menu-header .small-art-button {
    min-width: 95px;
    height: 43px;
    font-size: 9px;
  }
  .options-composition {
    top: 13.5%;
    width: 94vw;
  }
  .options-composition h1 {
    font-size: 47px;
  }
  .options-composition > .eyebrow {
    font-size: 8px;
  }
  .menu-subtitle {
    font-size: 11px;
    margin: 12px 0 22px;
  }
  .settings-panel {
    padding: 24px 27px;
  }
  .setting-row {
    min-height: 73px;
    gap: 10px;
  }
  .setting-row label {
    font-size: 15px;
  }
  .setting-row small {
    font-size: 8px;
    max-width: 160px;
    line-height: 1.5;
  }
  .range-control {
    width: 135px;
    gap: 8px;
  }
  .range-control input {
    width: 98px;
  }
  .range-control output {
    font-size: 9px;
  }
  select {
    font-size: 10px;
    padding-left: 8px;
    padding-right: 23px;
  }
  .settings-saved {
    font-size: 6px;
    letter-spacing: 1px;
    margin-top: 23px;
  }
  .game-screen {
    padding: 0 9px;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .game-header {
    height: 70px;
    gap: 6px;
    flex-wrap: wrap;
    align-content: center;
    position: relative;
  }
  .game-brand {
    width: auto;
    gap: 6px;
  }
  .game-brand > div {
    font-size: 15px;
    letter-spacing: 0.3px;
  }
  .game-brand small {
    font-size: 5px;
    letter-spacing: 1.4px;
  }
  .game-brand .icon-button {
    width: 28px;
    height: 28px;
  }
  .game-top-actions {
    width: auto;
    gap: 5px;
  }
  .game-top-actions .icon-button {
    height: 28px;
    width: 28px;
  }
  .game-top-actions .icon-button svg {
    height: 15px;
    width: 15px;
  }
  .stats {
    gap: 8px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 12px;
  }
  .stats div {
    min-width: 36px;
  }
  .stats span {
    font-size: 6px;
    letter-spacing: 1px;
    margin-bottom: 5px;
  }
  .stats b {
    font-size: 16px;
  }
  .stats i {
    height: 20px;
  }
  .game-brand small {
    max-width: 80px;
  }
  .game-header {
    height: 85px;
    align-content: flex-start;
    padding-top: 12px;
  }
  .stats {
    top: 51px;
    gap: 23px;
  }
  .stats div {
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .stats span {
    margin-bottom: 0;
  }
  .stats b {
    font-size: 14px;
  }
  .stats i {
    height: 12px;
  }
  .board-surround {
    padding-top: 14px;
  }
  .status-line {
    height: 35px;
    font-size: 10px;
    line-height: 1.5;
  }
  .game-footer {
    height: 111px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    align-content: center;
  }
  .game-primary {
    grid-column: 1/3;
    grid-row: 1;
    justify-content: center;
    gap: 7px;
    margin-bottom: 8px;
  }
  .game-primary .small-art-button {
    width: 30%;
    height: 43px;
    font-size: 10px;
    min-width: 0;
  }
  .game-secondary {
    gap: 15px;
    justify-content: flex-start;
  }
  .game-secondary .tool-button {
    font-size: 7px;
    padding: 4px 0;
    gap: 5px;
  }
  .game-secondary .tool-button svg {
    width: 14px;
    height: 14px;
  }
  .game-mode {
    justify-content: flex-end;
    font-size: 7px;
  }
  .game-mode select {
    padding-top: 7px;
    padding-bottom: 7px;
    font-size: 8px;
  }
  .pile-slot {
    border-radius: 4px;
  }
  .pile-slot::after {
    inset: 3px;
  }
  .pile-slot .suit-watermark {
    font-size: 25px;
  }
  .pile-label {
    font-size: 5px;
    letter-spacing: 0.8px;
    margin-top: 6px;
  }
  .stock-count {
    font-size: 6px;
    letter-spacing: 0.6px;
    bottom: -15px;
  }
  .card {
    box-shadow:
      0 1px 1px #26191c99,
      0 3px 5px #1c131a33;
  }
  .modal-panel {
    padding: 40px 29px 30px;
  }
  .modal-panel h2 {
    font-size: 31px;
  }
  .modal-panel p {
    font-size: 12px;
  }
  .modal-panel ol {
    font-size: 11px;
  }
  .modal-panel > .eyebrow {
    font-size: 7px;
  }
  .toast {
    bottom: 140px;
    font-size: 10px;
    min-width: 230px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-header {
    top: 15px;
    left: 22px;
    right: 22px;
  }
  .studio-mark {
    font-size: 10px;
  }
  .studio-mark small {
    font-size: 6px;
  }
  .corner-actions .icon-button {
    width: 32px;
    height: 32px;
  }
  .lobby-composition {
    top: 10%;
  }
  .lobby-eyebrow {
    display: none;
  }
  .game-logo {
    height: 35vh;
    width: 380px;
  }
  .lobby-tagline {
    font-size: 11px;
    margin: 2px 0 13px;
  }
  .menu-actions {
    width: 235px;
    gap: 5px;
  }
  .art-button {
    height: 49px;
    font-size: 17px;
  }
  .secondary-button {
    height: 40px;
    font-size: 13px;
  }
  .lobby-mode {
    margin-top: 10px;
    font-size: 7px;
  }
  .segmented button {
    padding: 6px 8px;
    font-size: 8px;
  }
  .lobby-footer {
    bottom: 12px;
    font-size: 6px;
  }
  .resume-note {
    display: none;
  }
  .game-header {
    height: 48px;
    padding: 0;
    align-content: center;
    flex-wrap: nowrap;
  }
  .game-brand > div {
    font-size: 18px;
  }
  .game-brand small {
    display: none;
  }
  .game-brand {
    width: 180px;
  }
  .game-top-actions {
    width: 180px;
  }
  .game-header .icon-button {
    width: 29px;
    height: 29px;
  }
  .stats {
    position: static;
    transform: none;
    gap: 12px;
  }
  .stats div {
    display: block;
    min-width: 45px;
  }
  .stats span {
    font-size: 6px;
    margin-bottom: 2px;
  }
  .stats b {
    font-size: 15px;
  }
  .board-surround {
    padding-top: 9px;
  }
  .game-footer {
    height: 47px;
    display: flex;
  }
  .game-primary {
    margin: 0;
  }
  .game-primary .small-art-button {
    height: 36px;
    min-width: 80px;
    width: auto;
  }
  .game-secondary {
    gap: 10px;
  }
  .game-secondary .tool-button {
    font-size: 7px;
  }
  .game-mode {
    font-size: 7px;
  }
  .status-line {
    height: 20px;
    font-size: 9px;
  }
  .options-composition {
    top: 7%;
    width: 480px;
  }
  .options-composition > .eyebrow,
  .menu-subtitle {
    display: none;
  }
  .options-composition h1 {
    font-size: 34px;
    margin: 0 0 5px;
  }
  .settings-panel {
    padding: 13px 36px;
  }
  .setting-row {
    min-height: 48px;
  }
  .setting-row label {
    font-size: 13px;
  }
  .setting-row small {
    font-size: 7px;
    margin-top: 3px;
  }
  .settings-saved {
    margin: 12px 0;
    font-size: 6px;
  }
  .menu-header {
    top: 16px;
    left: 18px;
  }
  .menu-header > .eyebrow {
    display: none;
  }
  .menu-header .small-art-button {
    height: 38px;
    min-width: 85px;
    font-size: 9px;
  }
  .modal-panel {
    padding: 28px 30px;
    max-height: 95dvh;
    overflow: auto;
  }
  .modal-panel h2 {
    font-size: 27px;
    margin: 8px 0;
  }
  .modal-panel p {
    margin: 8px 0;
  }
  .modal-panel > .eyebrow {
    font-size: 7px;
  }
  .modal-buttons {
    margin-top: 15px;
  }
  .modal-panel ol {
    font-size: 10px;
    line-height: 1.45;
  }
  .win-stats {
    margin: 12px;
  }
  .victory-emblem svg {
    width: 34px;
    height: 34px;
  }
  .toast {
    bottom: 70px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 600px) and (max-height: 700px) and (orientation: portrait) {
  .lobby-composition {
    top: 18%;
  }
  .game-logo {
    height: 22vh;
  }
  .lobby-tagline {
    font-size: 11px;
    margin: 9px 0 22px;
  }
  .menu-actions {
    gap: 8px;
    width: 235px;
  }
  .art-button {
    height: 62px;
    font-size: 20px;
  }
  .secondary-button {
    height: 49px;
    font-size: 14px;
  }
  .lobby-mode {
    margin-top: 18px;
  }
  .lobby-footer {
    bottom: 18px;
    gap: 9px;
  }
  .lobby-footer > span {
    font-size: 6px;
  }
  .resume-note {
    font-size: 7px;
    margin-top: 8px;
    max-width: 240px;
  }
  .options-composition {
    top: 10%;
    width: 96vw;
  }
  .options-composition > .eyebrow {
    font-size: 7px;
    margin: 0 0 6px;
  }
  .options-composition h1 {
    font-size: 38px;
    margin: 0 0 4px;
  }
  .menu-subtitle {
    font-size: 10px;
    margin: 6px 0 12px;
  }
  .settings-panel {
    padding: 18px 25px;
  }
  .setting-row {
    min-height: 56px;
    gap: 8px;
  }
  .setting-row label {
    font-size: 13px;
  }
  .setting-row small {
    font-size: 7px;
    margin-top: 4px;
    max-width: 125px;
  }
  .setting-row select {
    font-size: 9px;
  }
  .range-control {
    width: 121px;
    gap: 5px;
  }
  .range-control input {
    width: 86px;
  }
  .range-control output {
    font-size: 8px;
  }
  .settings-saved {
    margin-top: 16px;
    font-size: 5.5px;
    letter-spacing: 0.65px;
  }
  .toggle {
    min-width: 64px;
    height: 28px;
  }
  .toggle span {
    height: 18px;
    width: 18px;
  }
  .toggle b {
    font-size: 8px;
  }
}
.card[data-source-type="stock"] {
  cursor: pointer;
}
.settings-panel {
  padding: 52px 72px 48px;
}
@media (max-height: 760px) and (min-width: 700px) {
  .settings-panel {
    padding: 44px 70px 42px;
  }
}
@media (max-width: 600px) {
  .settings-panel {
    padding: 40px 48px 45px;
  }
  .setting-row {
    min-height: 68px;
    gap: 12px;
  }
  .setting-row small {
    max-width: 130px;
  }
  .settings-saved {
    margin-top: 20px;
  }
}
@media (max-width: 600px) and (max-height: 700px) and (orientation: portrait) {
  .options-composition {
    top: 13%;
  }
  .options-composition > .eyebrow {
    display: none;
  }
  .settings-panel {
    padding: 40px 42px 38px;
  }
  .setting-row {
    min-height: 52px;
    gap: 8px;
  }
  .setting-row small {
    max-width: 110px;
  }
  .settings-saved {
    margin-top: 16px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .settings-panel {
    padding: 30px 60px;
  }
  .setting-row {
    min-height: 44px;
  }
  .settings-saved {
    margin: 12px 0 0;
  }
}

/* The original lettering is bundled locally, including for offline play. */
@font-face {
  font-family: "Kalam";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/kalam-regular.ttf") format("truetype");
}
@font-face {
  font-family: "Kalam";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/kalam-bold.ttf") format("truetype");
}
/* Handwritten lettering and parchment covers for the game statistics. */
body,
button,
input,
select,
.studio-mark,
.studio-mark small,
.game-brand > div,
.game-brand small,
.setting-row label,
.options-composition h1,
.modal-panel h2,
.win-stats b,
.status-line,
.loading-screen h1,
.lobby-tagline {
  font-family: "Kalam", Georgia, serif;
}
.stats {
  gap: 4px;
}
.stats div {
  min-width: 100px;
  padding: 10px 18px;
  background: url("../image/ui/button-primary.webp") center/100% 100% no-repeat;
  filter: drop-shadow(0 3px 1px #3c251e55);
}
.stats span {
  color: #68442b;
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 0;
}
.stats b {
  color: #40291f;
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
}
.stats i {
  display: none;
}
@media (max-width: 600px) {
  .stats {
    gap: 2px;
  }
  .stats div {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 64px;
    padding: 6px 10px;
  }
  .stats span {
    font-size: 8px;
    letter-spacing: 0.8px;
  }
  .stats b {
    font-size: 16px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .stats {
    gap: 2px;
  }
  .stats div {
    min-width: 67px;
    padding: 5px 10px;
  }
  .stats span {
    font-size: 8px;
    margin: 0;
  }
  .stats b {
    font-size: 16px;
  }
}

/* Larger statistic plaques, with compact sizing on small screens. */
.stats div {
  min-width: 132px;
  min-height: 68px;
  padding: 13px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 600px) {
  .stats div {
    min-width: 78px;
    min-height: 46px;
    padding: 6px 12px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .stats div {
    min-width: 85px;
    min-height: 40px;
    padding: 5px 12px;
  }
}
/* Keep secondary labels legible without changing the main layout. */
.eyebrow,
.lobby-eyebrow,
.menu-header > .eyebrow,
.options-composition > .eyebrow {
  font-size: 12px;
}
.studio-mark small,
.game-brand small,
.lobby-mode,
.lobby-footer,
.text-button,
.resume-note,
.settings-saved,
.setting-row small,
.toggle b,
.range-control output,
.stats span,
.pile-label,
.stock-count,
.tool-button,
.game-mode,
.game-mode select,
.modal-panel > .eyebrow,
.win-stats span,
.loading-screen .eyebrow,
.loading-screen > p:last-child {
  font-size: 11px;
}
.segmented button,
.small-art-button,
select,
.modal-buttons .quiet-button {
  font-size: 12px;
}
@media (max-width: 600px) {
  .eyebrow,
  .lobby-eyebrow,
  .options-composition > .eyebrow,
  .studio-mark small,
  .game-brand small,
  .lobby-mode,
  .lobby-footer > span,
  .text-button,
  .resume-note,
  .setting-row small,
  .settings-saved,
  .toggle b,
  .range-control output,
  .stats span,
  .pile-label,
  .stock-count,
  .game-secondary .tool-button,
  .game-mode,
  .game-mode select,
  .modal-panel > .eyebrow,
  .win-stats span {
    font-size: 9px;
  }
  .segmented button,
  .game-primary .small-art-button,
  .setting-row select {
    font-size: 10px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .studio-mark small,
  .lobby-mode,
  .lobby-footer,
  .stats span,
  .game-secondary .tool-button,
  .game-mode,
  .pile-label,
  .stock-count,
  .settings-saved,
  .setting-row small,
  .modal-panel > .eyebrow {
    font-size: 9px;
  }
  .segmented button,
  .game-primary .small-art-button {
    font-size: 10px;
  }
}

.corner-actions .icon-button,
.game-top-actions .icon-button {
  background: transparent url("../image/ui/button-circle.webp") center/contain
    no-repeat;
  border: 0;
  color: #40291f;
  width: 52px;
  height: 52px;
  filter: drop-shadow(0 3px 2px #26150c99);
}
.corner-actions .icon-button:hover,
.game-top-actions .icon-button:hover {
  background-color: transparent;
  filter: brightness(1.1) drop-shadow(0 4px 2px #26150c99);
}

@media (max-width: 600px) {
  .corner-actions .icon-button,
  .game-top-actions .icon-button {
    width: 38px;
    height: 38px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .corner-actions .icon-button,
  .game-top-actions .icon-button {
    width: 34px;
    height: 34px;
  }
}

#back-lobby,
.corner-actions .icon-button,
.game-top-actions .icon-button {
  background: transparent url("../image/ui/button-circle.webp") center/contain
    no-repeat;
  border: 0;
  color: #40291f;
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 3px 2px #26150c99);
}
#back-lobby:hover {
  background-color: transparent;
  filter: brightness(1.1) drop-shadow(0 4px 2px #26150c99);
}

@media (max-width: 600px) {
  #back-lobby,
  .corner-actions .icon-button,
  .game-top-actions .icon-button {
    width: 46px;
    height: 46px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  #back-lobby,
  .corner-actions .icon-button,
  .game-top-actions .icon-button {
    width: 40px;
    height: 40px;
  }
}
.settings-wrap {
  position: relative;
  z-index: 20;
}
.settings-menu {
  position: absolute;
  right: 0;
  top: 100%;
  width: 190px;
  display: grid;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease,
    transform 0.35s ease,
    visibility 0s linear 0.35s;
  pointer-events: none;
}
.settings-trigger[aria-expanded="true"] + .settings-menu {
  max-height: 260px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease,
    transform 0.35s ease,
    visibility 0s;
  pointer-events: auto;
}
.settings-menu button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 43px;
  border: 0;
  padding: 8px 20px;
  background: transparent url("../image/ui/button-primary.webp") center/100%
    100% no-repeat;
  color: #40291f;
  font-size: 12px;
  font-weight: 700;
  filter: drop-shadow(0 3px 2px #26150c88);
}
.settings-menu button:hover {
  filter: brightness(1.1) drop-shadow(0 3px 2px #26150c88);
}
.settings-menu button:focus-visible {
  outline-offset: -3px;
}
.settings-menu b {
  font-size: 11px;
}
.game-header {
  z-index: 10;
}
@media (max-height: 500px) {
  .settings-menu {
    width: 160px;
  }
  .settings-menu button {
    height: 35px;
    font-size: 10px;
  }
  .settings-trigger[aria-expanded="true"] + .settings-menu {
    max-height: 190px;
  }
}

/* Illustrated controls include their own icons. */
#back-lobby {
  background-image: url("../image/ui/button-back.webp");
}
.corner-actions .settings-trigger,
.game-top-actions .settings-trigger {
  background-image: url("../image/ui/button-settings.webp");
}
.corner-actions .sound-toggle,
.game-top-actions .sound-toggle {
  background-image: url("../image/ui/button-sound.webp");
}
.corner-actions .sound-toggle.muted,
.game-top-actions .sound-toggle.muted {
  filter: grayscale(0.8) brightness(0.8) drop-shadow(0 3px 2px #26150c99);
}
.sound-toggle.muted::after {
  content: "KAPALI";
  position: absolute;
  bottom: 5px;
  color: #40291f;
  background: #f2d9a5;
  font:
    700 9px Arial,
    sans-serif;
  line-height: 1;
}
/* A light dark veil keeps the lobby artwork visible while improving contrast. */
.scene.lobby-scene::after {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.42) 0%,
    rgba(0, 0, 0, 0.3) 50%,
    rgba(0, 0, 0, 0.44) 100%
  );
}

/* Compact illustrated settings controls, with a small state indicator. */

.settings-menu {
  width: 76px;
  justify-items: center;
  gap: 2px;
  overflow: hidden;
}
.settings-menu button {
  position: relative;
  display: flex;
  justify-content: center;
  width: 64px;
  height: 55px;
  padding: 0;
  background: transparent url("../image/ui/button-primary.webp") center/100%
    100% no-repeat;
}
.settings-menu button b {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font:
    700 8px Arial,
    sans-serif;
  letter-spacing: 0;
  color: #5c3624;
}
.settings-trigger[aria-expanded="true"] + .settings-menu {
  max-height: 300px;
}
@media (max-height: 500px) {
  .settings-menu {
    width: 58px;
    gap: 0;
  }
  .settings-menu button {
    width: 52px;
    height: 39px;
  }
  .settings-menu button b {
    bottom: 3px;
    font-size: 7px;
  }
  .settings-trigger[aria-expanded="true"] + .settings-menu {
    max-height: 200px;
  }
}

/* Settings controls use the same square artwork and dimensions as the header. */
.settings-menu {
  width: 64px;
  gap: 0;
}
.settings-menu button {
  width: 64px;
  height: 64px;
  padding: 0;
  background: center/contain no-repeat;
  filter: drop-shadow(0 3px 2px #26150c99);
}
.settings-menu button[data-setting="sound"] {
  background-image: url("../image/ui/button-sound.webp");
}
.settings-menu button[aria-pressed="false"] {
  filter: grayscale(0.8) brightness(0.75) drop-shadow(0 3px 2px #26150c99);
}
.settings-trigger[aria-expanded="true"] + .settings-menu {
  max-height: 330px;
}
@media (max-width: 600px) {
  .settings-menu {
    width: 46px;
  }
  .settings-menu button {
    width: 46px;
    height: 46px;
  }
  .settings-trigger[aria-expanded="true"] + .settings-menu {
    max-height: 240px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .settings-menu {
    width: 40px;
  }
  .settings-menu button {
    width: 40px;
    height: 40px;
  }
  .settings-trigger[aria-expanded="true"] + .settings-menu {
    max-height: 205px;
  }
}
.settings-menu button[data-setting="volume"] {
  background-image: url("../image/ui/button-volume.webp");
}
.settings-menu button[data-setting="speed"] {
  background-image: url("../image/ui/button-speed.webp");
}
.settings-menu button[data-setting="hand"] {
  background-image: url("../image/ui/button-hand.webp");
}
.settings-menu button[data-setting="auto"] {
  background-image: url("../image/ui/button-auto-foundation.webp");
}

/* Dedicated illustrated states retain the parchment colors. */
.corner-actions .sound-toggle.muted,
.game-top-actions .sound-toggle.muted {
  background-image: url("../image/ui/button-sound-muted.webp");
  filter: drop-shadow(0 3px 2px #26150c99);
}
.sound-toggle.muted::after {
  content: none;
}
.corner-actions .settings-trigger[aria-expanded="true"],
.game-top-actions .settings-trigger[aria-expanded="true"] {
  background-image: url("../image/ui/button-settings-open.webp");
}
.settings-menu button[aria-pressed="false"] {
  filter: drop-shadow(0 3px 2px #26150c99);
}
.settings-menu button[data-setting="sound"][data-state="false"] {
  background-image: url("../image/ui/button-sound-muted.webp");
}
.settings-menu button[data-setting="auto"][data-state="false"] {
  background-image: url("../image/ui/button-auto-off.webp");
}
.settings-menu button[data-setting="hand"][data-state="left"] {
  background-image: url("../image/ui/button-hand-left.webp");
}
.settings-menu button[data-setting="speed"][data-state="fast"] {
  background-image: url("../image/ui/button-speed-fast.webp");
}
.settings-menu button[data-setting="speed"][data-state="slow"] {
  background-image: url("../image/ui/button-speed-slow.webp");
}

/* The Canyon Trail shares the original canyon, hand lettering and UI artwork. */
.lobby-composition {
  top: 14%;
}
.lobby-tagline {
  margin-bottom: 24px;
}
.menu-actions {
  gap: 7px;
}
.menu-actions .secondary-button {
  height: 56px;
  font-size: 17px;
  letter-spacing: 1.7px;
}
.lobby-mode {
  margin-top: 17px;
}
.resume-note {
  margin: 10px 0 0;
}
.resume-challenge {
  margin-top: 8px;
  color: #ffe4a8;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.levels-screen {
  overflow: hidden;
  overscroll-behavior: contain;
}
.trail-header {
  position: relative;
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 38px 0;
  z-index: 5;
}
.trail-back {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  background: transparent url("../image/ui/button-back.webp") center/contain
    no-repeat;
  border: 0;
  filter: drop-shadow(0 3px 2px #26150c99);
}
.trail-back:hover {
  filter: brightness(1.1) drop-shadow(0 4px 2px #26150c99);
}
.trail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
  font-size: 12px;
  letter-spacing: 2px;
}
.trail-brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2.6px;
  color: #e8c89e;
  margin-top: 2px;
}
.trail-brand .diamond-mark {
  font-size: 23px;
}
.trail-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 40px 20px;
}
.trail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.trail-heading .eyebrow {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: #f5cf93;
  margin: 0 0 4px;
}
.trail-heading h1 {
  font-size: clamp(36px, 4.8vw, 60px);
  font-weight: 700;
  line-height: 1.18;
  text-shadow: 2px 4px 1px #41281f;
  margin: 0;
  color: #ffebbc;
}
.trail-heading p:last-child {
  font-size: 14px;
  margin: 5px 0 0;
  color: #f1dab4;
}
.trail-total {
  text-align: center;
  min-width: 110px;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 8px;
}
.trail-total > span {
  font-size: 32px;
  color: #edbd70;
  filter: drop-shadow(0 2px #7d4b2e);
}
.trail-total b {
  font-size: 22px;
  white-space: nowrap;
}
.trail-total small {
  grid-column: 1/3;
  font-size: 9px;
  letter-spacing: 2px;
  color: #edc994;
}
.trail-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  max-width: 780px;
  margin-top: 22px;
}
.trail-modes button {
  background: transparent url("../image/ui/button-secondary.webp") center/100%
    100% no-repeat;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 20px;
  color: #f7deb0;
  filter: drop-shadow(0 3px 2px #281b1b66);
  transition:
    transform 0.2s,
    filter 0.2s;
}
.trail-modes button[aria-pressed="true"] {
  background-image: url("../image/ui/button-primary.webp");
  color: #503221;
}
.trail-modes button:hover {
  filter: brightness(1.1) drop-shadow(0 3px 2px #281b1b66);
  transform: translateY(-2px);
}
.trail-modes svg {
  width: 21px;
  height: 21px;
}
.trail-modes span {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: left;
}
.trail-modes small {
  display: block;
  font-size: 10px;
  letter-spacing: 0;
  font-weight: 400;
  opacity: 0.86;
}
.trail-summary {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #e9c48d55;
  padding: 16px 0 12px;
  font-size: 11px;
  color: #f1d2a4;
}
#trail-progress {
  font-size: 10px;
  letter-spacing: 1.5px;
  white-space: nowrap;
}
.trail-resume {
  border: 1px solid #e9c48d77;
  background: #3c2923c9;
  color: #ffe5ad;
  padding: 9px 16px;
  margin: 12px 0 0;
  border-radius: 3px;
  font-size: 12px;
  text-align: left;
  width: 100%;
}
.trail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 30px;
  align-items: start;
  margin-top: 20px;
}
.trail-map {
  display: grid;
  gap: 21px;
  min-width: 0;
}
.trail-chapter header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 9px;
}
.chapter-index {
  font-size: 11px;
  letter-spacing: 1px;
  color: #f0bd72;
  border: 1px solid #ddac6a66;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: #3b272b77;
}
.chapter-index span {
  transform: rotate(-45deg);
}
.trail-chapter h2 {
  font-size: 18px;
  margin: 0;
  line-height: 1.2;
  color: #ffe5b4;
  font-weight: 700;
}
.trail-chapter p {
  font-size: 10px;
  margin: 0;
  color: #e9c595;
}
.chapter-deal {
  margin-left: auto;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: #f0c78c;
}
.chapter-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  position: relative;
}
.chapter-levels::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed #edc08299;
  z-index: -1;
}
.level-node {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
  min-height: 119px;
  background: transparent url("../image/ui/panel.webp") center/100% 100%
    no-repeat;
  border: 0;
  color: #513522;
  padding: 14px 8px 12px;
  filter: drop-shadow(0 4px 3px #291b2077);
  transition:
    transform 0.18s,
    filter 0.18s;
}
.level-node:hover:enabled {
  transform: translateY(-3px);
  filter: brightness(1.08) drop-shadow(0 6px 4px #291b2088);
}
.level-node[aria-pressed="true"] {
  filter: brightness(1.09) drop-shadow(0 0 5px #ffc565);
}
.level-node[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #b47839;
  border-radius: 2px;
  pointer-events: none;
}
.level-node:disabled {
  opacity: 0.65;
  filter: sepia(0.35) brightness(0.75);
  cursor: default;
}
.level-node-number {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
}
.level-node-name {
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}
.level-node-goal {
  font-size: 9px;
  margin-top: 4px;
  color: #806044;
}
.level-node-stars {
  font-size: 16px;
  letter-spacing: 2px;
  line-height: 1.3;
  color: #9d632c;
  margin-top: 2px;
}
.level-lock {
  height: 18px;
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  margin-top: 2px;
}
.level-detail {
  position: sticky;
  top: 18px;
  padding: 42px 30px 44px;
  text-align: center;
  min-height: 437px;
}
.level-detail > .eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #8a6039;
  margin: 0 0 9px;
}
.selected-number {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 13px;
  background: transparent url("../image/ui/button-circle.webp") center/contain
    no-repeat;
  font-size: 29px;
  font-weight: 700;
  filter: drop-shadow(0 3px 2px #78502d44);
}
.detail-chapter {
  font-size: 9px;
  letter-spacing: 1.7px;
  margin: 0;
  color: #936a43;
}
.level-detail h2 {
  font-size: 29px;
  line-height: 1.2;
  margin: 6px 0 0;
  color: #553620;
}
.detail-stars {
  font-size: 23px;
  letter-spacing: 4px;
  color: #a96f2b;
  margin: 3px 0 6px;
}
.detail-description {
  font-size: 12px;
  line-height: 1.6;
  margin: 0 0 10px;
  color: #7c593a;
  min-height: 38px;
}
.level-facts {
  margin: 6px 0 12px;
  border-top: 1px solid #805c3333;
}
.level-facts > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0 6px;
  border-bottom: 1px solid #805c3333;
}
.level-facts dt {
  font-size: 9px;
  letter-spacing: 1px;
  color: #93714e;
}
.level-facts dd {
  font-size: 12px;
  font-weight: 700;
  margin: 0;
  color: #604129;
}
.detail-record {
  font-size: 10px;
  color: #8b6744;
  min-height: 16px;
  margin: 0 0 11px;
  line-height: 1.5;
}
.level-detail > .small-art-button {
  width: 100%;
  min-width: 0;
}
.level-detail > .text-button {
  font-size: 9px;
  letter-spacing: 0.6px;
  justify-content: center;
  color: #81603c;
  margin: 8px auto 0;
}
.trail-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 9px;
  color: #ebc79a;
  letter-spacing: 1px;
  padding: 23px 0 0;
}
.challenge-hud {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 10px 8px;
  min-height: 77px;
  border-bottom: 1px solid #e0bd8b33;
  flex-shrink: 0;
}
.challenge-context {
  min-width: 155px;
  max-width: 245px;
  display: flex;
  flex-direction: column;
}
.challenge-context b {
  font-size: 14px;
  color: #ffe2ac;
}
.challenge-context span {
  font-size: 11px;
  color: #e9c59a;
}
.race-contestant {
  flex: 1;
  max-width: 260px;
  min-width: 0;
}
.race-contestant > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.8px;
}
.race-contestant b {
  font-weight: 700;
  color: #ffe2ac;
}
.race-contestant progress {
  display: block;
  width: 100%;
  height: 7px;
  appearance: none;
  border: 1px solid #c29a6555;
  border-radius: 8px;
  overflow: hidden;
  background: #30232b80;
  margin-top: 4px;
}
.race-contestant progress::-webkit-progress-bar {
  background: #30232b80;
}
.race-contestant progress::-webkit-progress-value {
  background: linear-gradient(90deg, #b67b3c, #f3cd83);
  border-radius: 8px;
  transition: width 0.2s;
}
.race-contestant progress::-moz-progress-bar {
  background: #f3cd83;
  border-radius: 8px;
}
.rival-contestant progress::-webkit-progress-value {
  background: linear-gradient(90deg, #b47363, #e5ac8e);
}
.rival-contestant small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 9px;
  color: #e4c39e;
  min-height: 13px;
  margin-top: 2px;
}
.challenge-hud > .tool-button {
  margin-left: auto;
  white-space: nowrap;
  font-size: 10px;
  color: #f3d1a0;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.game-screen.is-challenge .game-mode select:disabled {
  opacity: 0.8;
  color: #f2d5a7;
  cursor: default;
}
.game-screen.is-challenge .board-surround {
  padding-top: 12px;
}
.result-stars {
  font-size: 31px;
  color: #ac762c;
  letter-spacing: 6px;
  margin: 5px 0;
}
.result-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid #936c3a44;
  border-bottom: 1px solid #936c3a44;
  padding: 12px 0;
  margin: 15px 0;
}
.result-table > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: #886441;
}
.result-table b {
  font-size: 16px;
  color: #654326;
}
.result-table strong {
  font-size: 25px;
  color: #654326;
}
.modal-panel {
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}
.settings-menu {
  overflow: visible;
}
@media (min-width: 601px) and (max-width: 1000px) and (min-height: 501px) {
  .game-header {
    gap: 12px;
  }
  .game-brand {
    width: auto;
    min-width: 0;
    gap: 9px;
  }
  .game-brand > div {
    font-size: 18px;
  }
  .game-top-actions {
    width: auto;
    flex-shrink: 0;
  }
  .stats div {
    min-width: 104px;
    min-height: 60px;
    padding: 11px 15px;
  }
  .stats b {
    font-size: 21px;
  }
}
@media (min-width: 601px) and (max-width: 760px) and (min-height: 501px) {
  .game-brand > div {
    font-size: 15px;
  }
  .game-brand small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .stats div {
    min-width: 80px;
    padding: 10px;
  }
  .stats b {
    font-size: 19px;
  }
  #back-lobby,
  .game-top-actions .icon-button {
    width: 52px;
    height: 52px;
  }
}
@media (max-width: 1000px) {
  .trail-layout {
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 265px;
  }
  .trail-content {
    padding: 18px 28px 20px;
  }
  .trail-header {
    padding: 20px 28px 0;
  }
  .level-detail {
    padding: 42px 30px 44px;
  }
  .chapter-levels {
    gap: 6px;
  }
  .level-node-name {
    font-size: 10px;
  }
  .challenge-hud {
    gap: 14px;
  }
  .challenge-context {
    min-width: 130px;
  }
  .challenge-context b {
    font-size: 12px;
  }
}
@media (max-width: 760px) {
  .trail-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .level-detail {
    position: relative;
    top: auto;
    grid-row: 1;
    display: grid;
    grid-template-columns: 65px 1fr auto;
    column-gap: 14px;
    align-items: center;
    min-height: 0;
    padding: 24px 25px;
    text-align: left;
  }
  .level-detail > .eyebrow {
    grid-column: 2;
    margin: 0;
    font-size: 9px;
  }
  .selected-number {
    grid-column: 1;
    grid-row: 1/5;
    margin: 0;
    width: 60px;
    height: 60px;
  }
  .detail-chapter {
    grid-column: 2;
    grid-row: 2;
    font-size: 8px;
  }
  .level-detail h2 {
    grid-column: 2;
    grid-row: 3;
    font-size: 24px;
    margin: 0;
  }
  .detail-stars {
    grid-column: 3;
    grid-row: 1/3;
    font-size: 17px;
    white-space: nowrap;
    margin: 0;
    letter-spacing: 1px;
  }
  .detail-description {
    grid-column: 1/4;
    min-height: 0;
    margin: 10px 0 3px;
  }
  .level-facts {
    grid-column: 1/4;
    width: 100%;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin: 4px 0 6px;
  }
  .level-facts > div {
    display: block;
    border: 0;
    padding: 8px 0 3px;
  }
  .level-facts dt {
    font-size: 8px;
  }
  .level-facts dd {
    font-size: 12px;
  }
  .detail-record {
    grid-column: 1/4;
    margin-bottom: 8px;
    min-height: 0;
  }
  .level-detail > .small-art-button {
    grid-column: 1/4;
    max-width: 300px;
    justify-self: center;
    height: 43px;
  }
  .level-detail > .text-button {
    grid-column: 1/4;
    margin-top: 5px;
    padding-bottom: 0;
  }
  .trail-map {
    gap: 22px;
  }
  .level-node {
    min-height: 122px;
  }
  .trail-summary {
    flex-direction: column;
    gap: 4px;
  }
  .trail-modes {
    gap: 7px;
  }
  .trail-modes button {
    padding: 10px 12px;
    gap: 7px;
  }
  .trail-modes span {
    font-size: 11px;
  }
  .trail-modes small {
    font-size: 9px;
  }
  .trail-modes svg {
    width: 18px;
    height: 18px;
  }
}
@media (max-width: 600px) {
  .lobby-composition {
    top: 17%;
  }
  .game-logo {
    height: 23vh;
  }
  .lobby-tagline {
    margin: 8px 0 18px;
  }
  .menu-actions .secondary-button {
    height: 52px;
    font-size: 14px;
  }
  .resume-challenge {
    font-size: 10px;
    margin-top: 6px;
  }
  .lobby-mode {
    margin-top: 13px;
  }
  .trail-header {
    padding: 17px 17px 0;
    gap: 11px;
  }
  .trail-back {
    width: 46px;
    height: 46px;
  }
  .trail-brand {
    font-size: 9px;
    letter-spacing: 1px;
    gap: 7px;
  }
  .trail-brand small {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .trail-brand .diamond-mark {
    display: none;
  }
  .trail-header .corner-actions {
    gap: 4px;
  }
  .trail-header .corner-actions .icon-button {
    width: 40px;
    height: 40px;
  }
  .trail-content {
    padding: 20px 19px;
  }
  .trail-heading {
    gap: 9px;
  }
  .trail-heading .eyebrow {
    font-size: 8px;
    letter-spacing: 1.2px;
  }
  .trail-heading h1 {
    font-size: 36px;
  }
  .trail-heading p:last-child {
    font-size: 12px;
    max-width: 220px;
  }
  .trail-total {
    min-width: 74px;
    gap: 0 3px;
  }
  .trail-total > span {
    font-size: 24px;
  }
  .trail-total b {
    font-size: 17px;
  }
  .trail-total small {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .trail-modes {
    margin-top: 16px;
    gap: 5px;
  }
  .trail-modes button {
    padding: 12px 5px;
    min-height: 65px;
    flex-direction: column;
    gap: 2px;
  }
  .trail-modes span {
    font-size: 9px;
    letter-spacing: 0.6px;
    text-align: center;
  }
  .trail-modes small {
    font-size: 8px;
    letter-spacing: 0;
  }
  .trail-modes svg {
    width: 16px;
    height: 16px;
  }
  .trail-summary {
    font-size: 10px;
    line-height: 1.5;
    padding-top: 13px;
  }
  .trail-layout {
    margin-top: 14px;
  }
  .level-detail {
    padding: 23px 21px;
    column-gap: 9px;
    grid-template-columns: 57px 1fr auto;
  }
  .selected-number {
    width: 54px;
    height: 54px;
    font-size: 25px;
  }
  .level-detail h2 {
    font-size: 22px;
  }
  .detail-stars {
    font-size: 15px;
  }
  .chapter-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .level-node {
    min-height: 124px;
  }
  .level-node-name {
    font-size: 12px;
  }
  .level-node-number {
    font-size: 30px;
  }
  .level-node-goal {
    font-size: 10px;
  }
  .trail-chapter h2 {
    font-size: 19px;
  }
  .trail-chapter p {
    font-size: 9px;
  }
  .trail-footer {
    flex-direction: column;
    gap: 6px;
    font-size: 8px;
  }
  .challenge-hud {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px 14px;
    padding: 9px 4px;
    min-height: 94px;
  }
  .challenge-context {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .challenge-context b {
    font-size: 11px;
    line-height: 1.2;
  }
  .challenge-context span {
    font-size: 9px;
  }
  .challenge-hud > .tool-button {
    grid-column: 2;
    grid-row: 1;
    margin-left: auto;
    font-size: 9px;
    padding: 5px 0;
  }
  .race-contestant {
    max-width: none;
    grid-row: 2;
  }
  .race-contestant > div {
    font-size: 9px;
  }
  .race-contestant small {
    font-size: 8px;
    min-height: 10px;
  }
  .game-screen.solo-challenge .challenge-hud {
    min-height: 77px;
  }
  .game-screen.solo-challenge .race-contestant {
    grid-column: 1/3;
  }
  .game-screen.is-challenge .status-line {
    height: 29px;
    font-size: 9px;
  }
  .game-screen.is-challenge .board-surround {
    padding-top: 7px;
  }
  .modal-panel {
    padding: 38px 30px 30px;
  }
  .result-table {
    gap: 8px;
  }
}
@media (max-width: 360px) {
  .trail-heading h1 {
    font-size: 30px;
  }
  .trail-heading .eyebrow {
    font-size: 7px;
  }
  .trail-total {
    min-width: 65px;
  }
  .trail-content {
    padding: 17px 14px;
  }
  .trail-header {
    padding: 14px 12px 0;
  }
  .trail-brand {
    font-size: 8px;
  }
  .trail-brand small {
    font-size: 6px;
  }
  .level-detail h2 {
    font-size: 19px;
  }
  .detail-stars {
    font-size: 13px;
  }
  .lobby-composition {
    top: 16%;
  }
  .resume-note {
    font-size: 8px;
    line-height: 1.4;
  }
  .lobby-mode {
    margin-top: 8px;
  }
  .resume-challenge {
    font-size: 9px;
    padding-top: 4px;
  }
  .lobby-footer {
    gap: 4px;
    bottom: 11px;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .game-header {
    height: 116px;
  }
  .stats {
    top: 64px;
  }
}
/* Keep lettering inside the illustrated frame's thicker edges. */
@media (max-width: 760px) {
  .level-detail {
    padding: 34px 34px 32px;
  }
  .level-detail h2 {
    grid-column: 2/4;
  }
  .level-facts {
    gap: 10px;
  }
  .level-facts > div {
    flex: 1;
    min-width: 0;
  }
  .level-facts dt {
    white-space: nowrap;
  }
  .level-facts dd {
    font-size: 11px;
    line-height: 1.4;
  }
}
@media (max-width: 600px) {
  .modal-panel {
    padding: 40px 34px 34px;
  }
}
@media (max-height: 700px) and (min-width: 601px) {
  .lobby-composition {
    top: 12%;
  }
  .game-logo {
    height: 24vh;
    min-height: 120px;
  }
  .lobby-tagline {
    margin: 2px 0 12px;
  }
  .menu-actions .art-button {
    height: 59px;
  }
  .menu-actions .secondary-button {
    height: 47px;
    font-size: 14px;
  }
  .lobby-mode {
    margin-top: 10px;
  }
  .resume-note {
    margin-top: 6px;
  }
  .resume-challenge {
    padding-top: 2px;
    margin-top: 3px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .lobby-composition {
    top: 9%;
    width: 600px;
    max-width: 76vw;
  }
  .lobby-eyebrow {
    display: none;
  }
  .game-logo {
    height: 28vh;
    min-height: 90px;
    width: 330px;
    margin: 0;
  }
  .lobby-tagline {
    font-size: 11px;
    margin: 0 0 7px;
  }
  .menu-actions {
    grid-template-columns: 1fr 1fr;
    width: 460px;
    max-width: 80vw;
    gap: 10px;
  }
  .menu-actions .art-button {
    height: 48px;
    font-size: 17px;
    padding: 5px 15px;
  }
  .menu-actions .secondary-button {
    font-size: 12px;
  }
  .lobby-mode {
    margin-top: 9px;
  }
  .resume-note {
    margin-top: 5px;
    font-size: 8px;
  }
  .resume-challenge {
    font-size: 9px;
    margin-top: 0;
    padding: 3px;
  }
  .trail-header {
    padding-top: 10px;
  }
  .trail-back {
    width: 40px;
    height: 40px;
  }
  .trail-content {
    padding-top: 12px;
  }
  .trail-heading h1 {
    font-size: 36px;
  }
  .trail-modes {
    margin-top: 13px;
  }
  .trail-modes button {
    min-height: 55px;
  }
  .challenge-hud {
    display: flex;
    min-height: 48px;
    padding: 5px;
    gap: 17px;
  }
  .challenge-context {
    min-width: 135px;
  }
  .challenge-context b {
    font-size: 10px;
  }
  .challenge-context span {
    font-size: 9px;
  }
  .race-contestant > div {
    font-size: 9px;
  }
  .race-contestant small {
    display: none;
  }
  .challenge-hud > .tool-button {
    font-size: 9px;
  }
  .game-screen.is-challenge .board-surround {
    padding-top: 4px;
  }
  .game-screen.is-challenge .status-line {
    height: 19px;
    font-size: 9px;
  }
  .game-screen.solo-challenge .challenge-hud {
    min-height: 43px;
  }
  .modal-panel {
    padding: 30px 38px 24px;
  }
  .modal-panel h2 {
    font-size: 29px;
    margin: 6px 0;
  }
  .modal-panel p {
    font-size: 12px;
    line-height: 1.5;
  }
  .modal-buttons {
    margin-top: 13px;
  }
  .result-table {
    padding: 7px 0;
    margin: 9px 0;
  }
  .result-stars {
    font-size: 24px;
  }
}

/* The trail has a viewport budget; pagination keeps every control in view. */
#levels {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.trail-header {
  flex: none;
  width: 100%;
  margin: 0 auto;
  padding-top: clamp(8px, 2dvh, 22px);
}
.trail-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
  gap: clamp(6px, 1dvh, 12px);
  padding-top: 10px;
  padding-bottom: 12px;
}
.trail-intro {
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.5dvh, 16px);
}
.trail-heading h1 {
  font-size: clamp(32px, 6dvh, 54px);
}
.trail-modes {
  width: 100%;
  margin: 0;
}
.trail-modes button {
  min-height: clamp(44px, 7dvh, 62px);
  padding-top: 6px;
  padding-bottom: 6px;
}
.trail-summary {
  padding: 4px 0 7px;
}
.trail-resume {
  flex: none;
  margin: 0;
  padding: 6px 12px;
}
.trail-layout {
  flex: 1;
  min-height: 0;
  margin: 0;
  align-items: start;
  gap: 24px;
}
.trail-map {
  gap: 12px;
}
.chapter-levels {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.level-node {
  min-height: clamp(100px, 14dvh, 130px);
  padding-top: 10px;
  padding-bottom: 10px;
}
.level-detail {
  position: relative;
  top: auto;
  min-height: 0;
  padding: clamp(30px, 4dvh, 40px) 30px;
}
.level-detail > .eyebrow {
  margin-bottom: 5px;
}
.selected-number {
  width: 50px;
  height: 50px;
  margin-bottom: 6px;
  font-size: 25px;
}
.level-detail h2 {
  font-size: 27px;
  margin-top: 3px;
}
.detail-stars {
  font-size: 21px;
  margin: 2px 0 4px;
}
.detail-description {
  min-height: 0;
  margin-bottom: 5px;
  line-height: 1.45;
}
.level-facts {
  margin: 4px 0 6px;
}
.level-facts > div {
  padding: 5px 0;
}
.detail-record {
  margin-bottom: 6px;
  min-height: 0;
  line-height: 1.4;
}
.level-detail > .text-button {
  margin-top: 4px;
}
.trail-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: none;
  margin: 0;
}
.trail-pagination span {
  font-size: 11px;
  letter-spacing: 1.5px;
  white-space: nowrap;
}
.trail-pagination .small-art-button {
  min-width: 125px;
  height: 42px;
}
.trail-footer {
  flex: none;
  padding: 0;
}
@media (min-width: 761px) and (max-height: 920px) {
  .trail-intro {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
  }
  .trail-heading {
    flex: 1;
  }
  .trail-heading h1 {
    font-size: clamp(30px, 3.4vw, 44px);
  }
  .trail-heading .eyebrow {
    font-size: 8px;
    letter-spacing: 1.4px;
  }
  .trail-total {
    min-width: 80px;
  }
  .trail-modes {
    flex: 1;
    max-width: 570px;
    gap: 6px;
  }
  .trail-modes button {
    padding-inline: 10px;
    gap: 6px;
  }
  .trail-modes span {
    font-size: 10px;
  }
  .trail-modes small {
    font-size: 8px;
  }
}
/* A short identity row leaves room for the facts and play action. */
@media (max-height: 920px), (max-width: 760px) {
  .level-detail {
    display: grid;
    grid-template-columns: 50px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    text-align: left;
    padding: 22px 25px;
  }
  .level-detail > .eyebrow {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    font-size: 9px;
  }
  .selected-number {
    grid-column: 1;
    grid-row: 1 / 4;
    margin: 0;
  }
  .detail-chapter {
    grid-column: 2;
    grid-row: 2;
  }
  .level-detail h2 {
    grid-column: 2 / 4;
    grid-row: 3;
    font-size: 23px;
    margin: 0;
  }
  .detail-stars {
    grid-column: 3;
    grid-row: 1 / 3;
    margin: 0;
    font-size: 17px;
    letter-spacing: 1px;
    white-space: nowrap;
  }
  .detail-description,
  .level-facts,
  .detail-record,
  .level-detail > .small-art-button,
  .level-detail > .text-button {
    grid-column: 1 / 4;
  }
  .detail-description {
    margin: 5px 0 2px;
  }
  .level-detail > .small-art-button {
    height: 42px;
    max-width: none;
  }
}
@media (max-width: 760px) {
  .trail-header {
    padding: 8px 18px 0;
    gap: 8px;
  }
  .trail-content {
    padding: 8px 18px 10px;
    gap: 6px;
  }
  .trail-intro {
    gap: 8px;
  }
  .trail-heading h1 {
    font-size: clamp(28px, 4.8dvh, 36px);
  }
  .trail-heading .eyebrow {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .trail-heading p:last-child {
    margin-top: 2px;
    font-size: 11px;
  }
  .trail-modes button {
    min-height: 50px;
    padding: 6px 4px;
    gap: 2px;
  }
  .trail-summary {
    gap: 2px;
    padding: 2px 0 5px;
    font-size: 9px;
    line-height: 1.3;
  }
  .trail-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-content: start;
    gap: 8px;
  }
  .trail-map {
    grid-row: 1;
  }
  .level-detail {
    grid-row: 2;
    padding: 22px 30px;
  }
  .chapter-levels {
    gap: 5px;
  }
  .trail-chapter header {
    margin-bottom: 5px;
  }
  .trail-chapter h2 {
    font-size: 17px;
  }
  .level-node {
    min-height: 96px;
    padding: 10px 5px;
  }
  .level-node-number {
    font-size: 23px;
  }
  .level-node-name {
    font-size: 10px;
  }
  .level-node-goal {
    font-size: 8px;
    margin-top: 2px;
  }
  .level-node-stars {
    font-size: 14px;
  }
  .level-facts {
    display: grid;
    grid-template-columns: 1.25fr 1.4fr 0.8fr;
    gap: 8px;
    margin: 3px 0;
  }
  .level-facts > div {
    display: block;
    padding: 3px 0;
    border: 0;
  }
  .level-facts dd {
    font-size: 10px;
    white-space: nowrap;
  }
  .detail-description {
    font-size: 11px;
  }
  .detail-record {
    margin: 2px 0;
    font-size: 9px;
  }
  .trail-pagination {
    gap: 8px;
  }
  .trail-pagination .small-art-button {
    min-width: 96px;
    height: 36px;
    font-size: 10px;
    padding-inline: 10px;
  }
  .trail-pagination span {
    font-size: 10px;
    letter-spacing: 0.5px;
  }
  .trail-footer {
    display: none;
  }
}
@media (max-width: 760px) and (min-height: 950px) {
  .chapter-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .level-node {
    min-height: 96px;
  }
}
#levels[data-page-size="2"] .chapter-levels {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#levels[data-page-size="2"] .level-node-name {
  font-size: 12px;
}
#levels[data-page-size="2"] .level-node-goal {
  font-size: 9px;
}
@media (max-width: 760px) and (max-height: 779px) and (orientation: portrait) {
  .trail-heading .eyebrow,
  .trail-heading p:last-child,
  .trail-modes small {
    display: none;
  }
  .trail-modes button {
    min-height: 44px;
  }
  .trail-heading h1 {
    font-size: 28px;
    white-space: nowrap;
  }
  .trail-total {
    min-width: 62px;
  }
  .trail-total b {
    font-size: 15px;
  }
  .trail-total > span {
    font-size: 20px;
  }
  .level-detail > .small-art-button {
    height: 36px;
  }
}
@media (max-height: 700px) and (min-width: 761px) {
  .trail-footer {
    display: none;
  }
  .detail-description,
  .detail-record {
    display: none;
  }
  .level-facts {
    display: grid;
    grid-template-columns: 1.25fr 1.4fr 0.8fr;
    gap: 6px;
  }
  .level-facts > div {
    display: block;
    padding: 3px 0;
    border: 0;
  }
  .level-facts dt {
    font-size: 7px;
    letter-spacing: 0.3px;
  }
  .level-facts dd {
    font-size: 10px;
  }
}
@media (max-width: 760px) and (max-height: 700px) and (orientation: portrait) {
  .trail-header {
    padding-inline: 12px;
  }
  .trail-content {
    padding-inline: 12px;
    gap: 4px;
  }
  .trail-heading h1 {
    font-size: 25px;
  }
  .trail-summary #mode-description,
  .detail-description,
  .detail-record {
    display: none;
  }
  .trail-intro {
    gap: 4px;
  }
  .trail-layout {
    gap: 5px;
  }
  .level-detail {
    padding: 18px 28px;
  }
}
@media (max-width: 760px) and (max-height: 620px) and (orientation: portrait) {
  .trail-total small,
  .trail-chapter header p,
  .level-detail .detail-chapter {
    display: none;
  }
  .level-detail {
    padding-block: 14px;
  }
  .level-detail h2 {
    grid-row: 2 / 4;
    font-size: 20px;
  }
  .selected-number {
    width: 40px;
    height: 40px;
  }
  .level-detail > .text-button {
    margin-top: 0;
    padding-block: 2px;
    line-height: 1.3;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .trail-header {
    padding: 5px 20px 0;
  }
  .trail-content {
    padding: 4px 20px 6px;
    gap: 4px;
  }
  .trail-intro {
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }
  .trail-heading {
    flex: 1;
  }
  .trail-heading h1 {
    font-size: 28px;
  }
  .trail-heading .eyebrow,
  .trail-heading p:last-child,
  .trail-total small,
  .trail-modes small,
  .trail-summary,
  .trail-footer {
    display: none;
  }
  .trail-modes {
    flex: 1;
    gap: 4px;
  }
  .trail-modes button {
    min-height: 40px;
    padding: 5px;
  }
  .trail-modes span {
    font-size: 9px;
  }
  .trail-modes svg {
    display: none;
  }
  .trail-resume {
    padding: 3px 10px;
    font-size: 10px;
  }
  .trail-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 40%);
    grid-template-rows: auto;
    gap: 12px;
  }
  .trail-map,
  .level-detail {
    grid-row: 1;
  }
  .level-detail {
    padding: 14px 22px;
    grid-template-columns: 40px minmax(0, 1fr) auto;
    row-gap: 0;
  }
  .selected-number {
    width: 38px;
    height: 38px;
    font-size: 21px;
  }
  .level-detail > .eyebrow,
  .detail-chapter {
    font-size: 8px;
  }
  .level-detail h2 {
    font-size: 20px;
  }
  .detail-stars {
    grid-column: 3;
    grid-row: 1 / 3;
    font-size: 14px;
    letter-spacing: 0;
  }
  .level-detail > .eyebrow,
  .detail-chapter {
    grid-column: 2;
  }
  .detail-description {
    font-size: 10px;
    margin: 2px 0;
  }
  .level-facts {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin: 2px 0;
  }
  .level-facts > div {
    display: block;
    border: 0;
    padding: 2px 0;
  }
  .level-facts dt {
    font-size: 7px;
  }
  .level-facts dd {
    font-size: 10px;
  }
  .detail-record {
    font-size: 8px;
    margin: 2px 0;
  }
  .level-detail > .small-art-button {
    height: 32px;
    font-size: 10px;
  }
  .level-detail > .text-button {
    margin: 0 auto;
    padding: 2px;
    font-size: 8px;
  }
  .trail-pagination .small-art-button {
    height: 30px;
  }
}
@media (max-height: 360px) and (orientation: landscape) {
  .detail-description,
  .detail-record {
    display: none;
  }
  .level-detail {
    padding-block: 12px;
  }
  .level-detail > .eyebrow,
  .detail-chapter {
    line-height: 1.1;
  }
}
@media (max-height: 400px) and (orientation: landscape) {
  /* The selected level already provides the Continue action in this layout. */
  .trail-resume,
  .detail-record {
    display: none;
  }
}

.modal-panel {
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
}
/* Music toggle: matching illustrated on and off states. */
.corner-actions .music-toggle,
.game-top-actions .music-toggle {
  background: transparent url("../image/ui/button-music.webp") center/contain
    no-repeat;
  border: 0;
  color: #40291f;
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 3px 2px #26150c99);
}
.corner-actions .music-toggle.muted,
.game-top-actions .music-toggle.muted {
  background-image: url("../image/ui/button-music-muted.webp");
}
@media (max-width: 600px) {
  .corner-actions .music-toggle,
  .game-top-actions .music-toggle {
    width: 46px;
    height: 46px;
  }
}
@media (max-height: 500px) and (orientation: landscape) {
  .corner-actions .music-toggle,
  .game-top-actions .music-toggle {
    width: 40px;
    height: 40px;
  }
}
