/* screens.css: retained cascade position */ /* Match: a legible score sheet alongside the dice surface. */
.game-top {
  display: flex;
  align-items: center;
  gap: 26px;
  justify-content: space-between;
  margin-bottom: 18px;
}
.game-top h1 {
  font-size: 25px;
}
.game-top .section-label {
  margin-bottom: 5px;
}
.game-top > div:first-child {
  min-width: 0;
}
.game-top > div:first-child h1,
.game-top .section-label {
  overflow-wrap: anywhere;
}
.game-mode {
  display: inline-block;
  font-size: 11px;
  padding: 3px 7px;
  margin: 0 0 5px;
  background: #e8eddb;
  border: 1px solid #99a580;
  color: #4f6149;
  border-radius: 4px;
}
.turn-clock {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
  white-space: nowrap;
}
.turn-clock > span {
  font-size: 12px;
  color: #6c715e;
}
.turn-clock > strong {
  font-size: 34px;
  color: #2e4d5b;
  font-weight: 600;
  min-width: 66px;
  font-variant-numeric: tabular-nums;
}
.turn-clock small {
  font-size: 13px;
  margin-left: 4px;
}
.turn-clock .urgent {
  color: #ac3c2d;
}
.game-top > .quiet {
  font-size: 12px;
  color: #8e4434;
  border: 1px solid #bb7b5a77;
  background: #fff8ec;
}
.game-players {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.mini-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
  background: #fffaf0eb;
  border: 1px solid #b4ad947a;
  border-radius: 7px;
  min-width: 0;
}
.mini-player.active {
  border-color: #ae843c;
  box-shadow: inset 0 0 0 1px #bb9a51;
  background: #fff2cd;
}
.mini-player.forfeited {
  opacity: 0.55;
}
.mini-player > div {
  flex: 1;
  min-width: 0;
}
.mini-player strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.mini-player small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
.mini-player strong small {
  display: inline;
  color: #85632c;
}
.mini-player > b {
  font-size: 23px;
  font-weight: 600;
  white-space: nowrap;
}
.mini-player > b small {
  text-align: right;
}
.mini-player .bot-badge {
  font-size: 9px;
}
.effect-tag {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  color: #9e4a37;
}
.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(410px, 1fr);
  gap: 24px;
  align-items: start;
}
.play-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dice-board {
  border: 6px solid #a38a5b;
  border-radius: 12px;
  padding: 22px 22px 25px;
  box-shadow:
    inset 0 0 0 2px #ebd8a244,
    inset 0 4px 25px #12282b55,
    0 8px 20px #3446321c;
  background: radial-gradient(ellipse at 50% 20%, #507a70, #2e554e 70%);
  color: #fff7de;
  text-align: center;
  position: relative;
}
.board-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #dbdbc0;
}
.board-top b {
  font-size: 16px;
  color: #fff5cf;
}
.dice-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 38px 0 28px;
  min-height: 74px;
}
.die {
  position: relative;
  width: 62px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid #bbaa86;
  border-bottom: 5px solid #c4b28a;
  background: linear-gradient(135deg, #fffef7, #f3e7ce);
  padding: 11px;
  box-shadow: 0 6px 10px #152e3544;
  color: #324c50;
  transition: translate 0.12s;
}
.die:disabled {
  opacity: 1;
  cursor: default;
}
.die.held {
  translate: 0 -7px;
  outline: 3px solid #f1d48f;
  outline-offset: 4px;
}
.die.stuck {
  outline: 3px dashed #d79e72;
  outline-offset: 4px;
}
.die small {
  position: absolute;
  top: calc(100% + 11px);
  left: -10px;
  right: -10px;
  font-size: 10px;
  color: #f8ebc3;
  white-space: nowrap;
}
.die.unrolled {
  display: grid;
  place-items: center;
  font-size: 28px;
  opacity: 0.65;
}
.pips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  gap: 2px;
}
.pip {
  width: 8px;
  height: 8px;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: #30464e;
  visibility: hidden;
}
.face-1 .p4,
.face-2 .p0,
.face-2 .p8,
.face-3 .p0,
.face-3 .p4,
.face-3 .p8,
.face-4 .p0,
.face-4 .p2,
.face-4 .p6,
.face-4 .p8,
.face-5 .p0,
.face-5 .p2,
.face-5 .p4,
.face-5 .p6,
.face-5 .p8,
.face-6 .p0,
.face-6 .p2,
.face-6 .p3,
.face-6 .p5,
.face-6 .p6,
.face-6 .p8 {
  visibility: visible;
}
.dice-hint {
  font-size: 11px;
  color: #dbe0c9;
  margin-bottom: 19px;
  min-height: 19px;
}
.roll-button {
  min-width: 210px;
  color: #3f432f;
  background: linear-gradient(#f2d99e, #d8b66c);
  border-color: #f5e3b8;
  box-shadow: 0 3px 0 #7a6944;
  font-size: 14px;
}
.roll-button:disabled {
  opacity: 0.6;
}
.current-effect {
  padding: 7px 12px;
  margin-top: 15px;
  background: #f4dca927;
  border: 1px solid #d7b9776b;
  font-size: 11px;
  border-radius: 4px;
}
.insurance-tag {
  display: block;
  font-size: 11px;
  color: #ebddac;
  margin-top: 12px;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-heading h2 {
  font-size: 16px;
}
.panel-heading small {
  font-size: 10px;
  color: var(--muted);
}
.count {
  font-size: 12px;
  color: #8a6e3e;
  font-weight: 400;
  margin-left: 6px;
}
.hand,
.draft-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 15px;
  gap: 10px;
}
.hand > .muted {
  grid-column: 1/-1;
  padding: 8px 2px;
  font-size: 12px;
}
.item-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border: 1px solid #c1b18e;
  border-radius: 6px;
  padding: 13px 11px;
  background: #f7f0df;
  min-width: 0;
  gap: 8px;
}
.item-card:disabled {
  opacity: 0.65;
}
.item-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border: 1px solid #b3a47d;
  background: #fdf8e9;
  border-radius: 7px;
  font-size: 25px;
  color: #6e613b;
}
.attack .item-icon {
  background: #f8e3d7;
  color: #9b4837;
  border-color: #c2947c;
}
.buff .item-icon {
  background: #edf0d8;
  color: #687644;
  border-color: #a4b388;
}
.defense .item-icon {
  background: #e0eaeb;
  color: #456d7f;
  border-color: #94afb2;
}
.item-card strong {
  font-size: 12px;
}
.item-card small {
  font-size: 10px;
  line-height: 1.6;
  color: #66695c;
}
.draft-panel {
  border-color: #aa8848;
  box-shadow:
    inset 0 0 0 1px #d5b86e55,
    var(--shadow);
}
.draft-panel > .text-button {
  margin: 0 12px 10px;
  font-size: 12px;
}
.activity {
  font-size: 12px;
}
.activity summary {
  cursor: pointer;
  padding: 15px 20px;
  font-weight: 700;
  color: #686450;
}
.activity > div {
  padding: 0 20px 14px;
  max-height: 150px;
  overflow: auto;
}
.activity p {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0;
}
.score-panel {
  min-width: 0;
  overflow: hidden;
  background: #fffbf1;
  border: 1px solid #ac986c;
  border-radius: 8px;
  box-shadow: var(--shadow);
  scroll-margin-top: 100px;
}
.score-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.score-heading h2 {
  font-size: 19px;
}
.score-heading small {
  font-size: 11px;
  color: #7b6b4e;
}
.score-scroll {
  width: 100%;
  overflow: auto;
}
.score-scroll table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 410px;
  table-layout: fixed;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.score-scroll th,
.score-scroll td {
  text-align: center;
  border-bottom: 1px solid #cbbd9c50;
  padding: 7px 5px;
  height: 41px;
}
.score-scroll th:first-child {
  width: 118px;
  text-align: left;
  padding-left: 14px;
  position: sticky;
  left: 0;
  background: #fff9ec;
  z-index: 1;
  font-size: 11px;
}
.score-scroll thead th {
  height: 65px;
  font-size: 11px;
  background: #efe6d0;
  color: #52605c;
  overflow-wrap: anywhere;
}
.score-scroll thead th:first-child {
  background: #efe6d0;
  z-index: 2;
}
.score-scroll th small {
  display: block;
  font-size: 9px;
  color: #987947;
  margin-top: 4px;
}
.score-scroll .current-col {
  background: #f3e9c7;
}
.score-scroll thead .current-col {
  background: #e5d6a6;
  color: #4a534c;
}
.score-scroll .bot-badge {
  display: block;
  width: max-content;
  margin: 4px auto 0;
  font-size: 8px;
  padding: 1px 4px;
}
.category-face {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: 6px;
  font-size: 10px;
  border: 1px solid #bcab7e;
  border-radius: 3px;
  background: #f4ebd4;
  color: #7c6844;
}
.score-choice {
  min-height: 35px;
  width: 100%;
  font-weight: 700;
  color: #6b5428;
  border: 1px dashed #b59c5c;
  border-radius: 4px;
  background: #e6ce7c38;
}
.score-choice:hover {
  background: #e4c87770;
}
.blank {
  color: #b7b6a4;
}
.preview {
  color: #8b7e5b;
}
.section-start > th,
.section-start > td,
.subtotal > th,
.subtotal > td {
  border-top: 2px solid #c2af7b;
}
.subtotal th,
.subtotal td {
  font-size: 10px;
  color: #777252;
}
.score-scroll tfoot th,
.score-scroll tfoot td {
  background: #304d53;
  color: #fff2ce;
  height: 58px;
  font-size: 21px;
  border-bottom: 0;
}
.score-scroll tfoot th:first-child {
  background: #304d53;
  color: #fff2ce;
  font-size: 13px;
}
.score-note {
  font-size: 10px;
  padding: 12px 18px;
  color: #74745e;
}
.mobile-actions {
  display: none;
}
.hand .item-card:disabled {
  opacity: 1;
  cursor: default;
}
.item-availability {
  margin-top: auto;
  padding-top: 7px;
  border-top: 1px solid #c1b18e80;
  width: 100%;
  font-size: 10px;
  line-height: 1.5;
  color: #7b6242;
}
/* Results and collection */
.results-head {
  text-align: center;
  margin: 6px 0 24px;
}
.results-head h1 {
  font-size: 32px;
}
.results-head p {
  font-size: 13px;
  margin-top: 12px;
  color: #66695c;
}
.results-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  max-width: 1040px;
  gap: 45px;
  align-items: center;
  margin: auto;
}
.result-character {
  height: 500px;
  position: relative;
  text-align: center;
}
.result-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 15px #20354428);
}
.earned {
  position: absolute;
  bottom: 0;
  left: 50%;
  translate: -50% 0;
  background: #263f51f5;
  color: #f7dfaa;
  border: 2px solid #bc9f64;
  border-radius: 5px;
  padding: 13px 38px;
  white-space: nowrap;
  box-shadow: 0 7px 20px #25374c22;
}
.earned small {
  display: block;
  font-size: 11px;
  color: #e2d2ac;
}
.earned strong {
  display: block;
  font-size: 30px;
  margin-top: 4px;
  font-weight: 600;
}
.result-list {
  padding: 18px 22px;
}
.result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 3px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.result-row > div {
  flex: 1;
  min-width: 0;
}
.result-row strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}
.result-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
.result-row .rank {
  font-size: 28px;
  width: 32px;
  font-weight: 600;
  text-align: center;
  flex-shrink: 0;
}
.result-row > b:last-child {
  font-size: 26px;
  font-weight: 600;
  text-align: right;
}
.result-row.mine {
  color: #9b6b2c;
}
.result-row .bot-badge {
  font-size: 9px;
}
.result-actions {
  display: grid;
  gap: 12px;
  margin: 25px 0 16px;
}
.result-list > .muted {
  text-align: center;
  font-size: 11px;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.character-card {
  border: 1px solid #bca675;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.character-art {
  position: relative;
  height: 340px;
  background: radial-gradient(ellipse at 50% 70%, #e3d2a9, #f5edda 65%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.shop-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}
.character-badge {
  position: absolute;
  top: 13px;
  left: 13px;
  padding: 5px 9px;
  background: #fff9e8ef;
  border: 1px solid #bca16b;
  border-radius: 4px;
  font-size: 11px;
  color: #6e582d;
}
.temporary {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  text-align: center;
  background: #f8efdebb;
  color: #736956;
  font-size: 10px;
  padding: 3px;
  border-radius: 3px;
}
.character-info {
  padding: 20px;
}
.character-info h2 {
  font-size: 20px;
}
.character-info p {
  font-size: 11px;
  color: var(--muted);
  margin: 7px 0 18px;
}
.character-info button {
  width: 100%;
  font-size: 12px;
  padding: 10px;
}
.history-list details {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.history-list details:last-child {
  border-bottom: 0;
}
.history-list summary {
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  font-size: 14px;
  list-style: none;
}
.history-list summary:before {
  content: '+';
  font-size: 20px;
  color: #9a7944;
}
.history-list details[open] summary:before {
  content: '−';
}
.history-list summary > span:first-of-type {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}
.history-list summary > b {
  color: #957034;
  min-width: 65px;
  text-align: right;
}
.history-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  padding: 20px 0 5px;
  color: #5c645b;
}
.history-detail p {
  width: 100%;
}
.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.prose {
  padding: 28px;
}
.prose h2 {
  font-size: 19px;
  color: #7a5b2f;
  margin: 25px 0 13px;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose p {
  font-size: 13px;
  line-height: 1.9;
  color: #55615b;
  margin: 12px 0;
}
.prose dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 13px;
  font-size: 12px;
  line-height: 1.6;
}
.prose dt {
  font-weight: 700;
  color: #79643d;
}
.prose dd {
  margin: 0;
  color: #55615b;
}
.all-items {
  grid-column: 1/-1;
}
.rules-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 25px;
  margin-top: 24px;
}
.rules-items h3 {
  margin-top: 12px;
  font-size: 14px;
}
.rules-items p {
  font-size: 12px;
}
/* Shared three-second item cutscene */
.cutscene {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: radial-gradient(ellipse at 40% 50%, #6d8974, #142e38f7 70%);
  color: #fff4dd;
  overflow: hidden;
}
.cutscene.attack {
  background: radial-gradient(ellipse at 40% 50%, #91635c, #302633f7 70%);
}
.cutscene.defense {
  background: radial-gradient(ellipse at 40% 50%, #668c9a, #1c304bf7 70%);
}
.cutscene > .scene-character,
.scene-art {
  position: absolute;
  top: 6%;
  left: 9%;
  width: min(50vw, 58vh);
  aspect-ratio: 2/3;
  height: auto;
}
.scene-character {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 30px #ffe4ad22);
}
.scene-text {
  position: absolute;
  left: 57%;
  right: 5%;
  top: 32%;
  z-index: 3;
}
.scene-text .eyebrow {
  font-size: 13px;
  letter-spacing: 3px;
  color: #edd5a7;
}
.scene-text h2 {
  font:
    700 clamp(30px, 4vw, 54px) Batang,
    serif;
  letter-spacing: -1px;
  margin: 20px 0;
}
.scene-text p {
  font-size: 16px;
  color: #f1e2c9;
}
.scene-text > strong {
  display: block;
  font-size: 60px;
  color: #f6d68f;
  margin: 20px 0;
}
.scene-text small {
  font-size: 13px;
  color: #e3dbc8;
}
.scene-ring {
  position: absolute;
  left: 12%;
  top: 20%;
  width: 450px;
  height: 450px;
  border: 1px solid #ebcc8b50;
  border-radius: 50%;
  box-shadow:
    0 0 0 40px #e6d2a509,
    0 0 0 100px #e6d2a505;
  pointer-events: none;
}
.scene-spark {
  position: absolute;
  color: #ffe1a1;
  font-size: 42px;
  text-shadow: 0 0 25px #ffe4aa;
  transform: translate(-50%, -50%);
}
.scene-caption {
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  color: #dfd4bc;
}
.scene-exit {
  position: absolute;
  right: 25px;
  top: 22px;
  color: #fff0d2;
  border: 1px solid #e3c78a6b;
  background: #122c3c44;
}
.cutscene:not(.reduced) .scene-character {
  animation: scene-enter 3s both;
  animation-delay: var(--elapsed);
}
.cutscene:not(.reduced) .scene-spark {
  animation: spark 1.3s ease-in-out infinite;
}
.image-fallback {
  display: inline-block;
  padding: 15px;
  color: #856a36;
  font-size: 12px;
  background: #f7edda;
  border: 1px solid #b59b64;
  border-radius: 5px;
}
.scene-art .image-fallback {
  position: absolute;
  top: 45%;
  left: 30%;
}
.lobby-character .image-fallback {
  position: absolute;
  bottom: 40%;
  left: 30%;
}
@keyframes scene-enter {
  0% {
    opacity: 0;
    translate: -40px 10px;
    scale: 0.97;
  }
  15% {
    opacity: 1;
    translate: 0 0;
    scale: 1;
  }
  80% {
    opacity: 1;
    translate: 4px -4px;
    scale: 1.02;
  }
  100% {
    opacity: 0;
    translate: 20px -5px;
    scale: 1.03;
  }
}
@keyframes spark {
  50% {
    scale: 1.15;
    opacity: 0.65;
  }
}
[data-reduced='true'] *,
[data-reduced='true'] *:before,
[data-reduced='true'] *:after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Match the black-fan full-body source to the silver sorceress shop framing. */
.character-card[data-character='black_fan_01'] .shop-art {
  transform: translateY(-11%) scale(1.55);
  transform-origin: 50% 0;
}
/* responsive.css: retained cascade position */
@media (min-width: 1600px) {
  .lobby-hero {
    padding-left: 10%;
    padding-right: 10%;
  }
  .mode-menu {
    max-width: 550px;
  }
  .mode-button {
    min-height: 135px;
  }
}
@media (max-width: 1150px) {
  .topbar {
    padding: 12px 25px;
    gap: 20px;
  }
  .brand strong {
    font-size: 19px;
  }
  #main {
    padding: 25px;
  }
  .screen-lobby #main {
    padding: 0 25px;
  }
  .lobby-hero {
    padding: 15px 0 20px;
    gap: 0 5%;
    min-height: 620px;
  }
  .mode-menu {
    gap: 23px;
  }
  .mode-button {
    padding: 18px 25px;
    min-height: 112px;
    gap: 20px;
  }
  .mode-title {
    font-size: 33px;
  }
  .mode-symbol {
    width: 48px;
    height: 48px;
  }
  .mode-symbol .ui-icon {
    width: 29px;
    height: 29px;
  }
  .hero-character {
    max-width: 130%;
    max-height: calc(100dvh - 135px);
  }
  .game-grid {
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 1fr);
  }
  .dice-board {
    padding: 20px 12px;
  }
  .dice-row {
    gap: 10px;
  }
  .die {
    width: 54px;
    height: 56px;
    padding: 9px;
  }
  .pip {
    width: 7px;
    height: 7px;
  }
  .character-art {
    height: 285px;
  }
  .character-info {
    padding: 16px;
  }
  .character-info h2 {
    font-size: 18px;
  }
  .auth-page {
    padding: 35px;
    gap: 25px;
  }
  .auth-brand h1 {
    font-size: 29px;
  }
  .auth-panel#main {
    padding: 30px;
  }
}
@media (max-width: 900px) {
  .brand strong {
    display: none;
  }
  .topbar {
    gap: 18px;
  }
  .header-button > span {
    display: none;
  }
  .header-button {
    padding: 8px;
    min-width: 42px;
  }
  .lobby-hero {
    gap: 0 2%;
    min-height: 600px;
  }
  .mode-title {
    font-size: 29px;
  }
  .mode-button {
    gap: 15px;
    padding: 18px 22px;
  }
  .mode-symbol {
    width: 42px;
    height: 42px;
  }
  .mode-arrow .ui-icon {
    width: 19px;
    height: 19px;
  }
  .lobby-character {
    min-height: 450px;
  }
  .hero-character {
    max-width: 150%;
    height: 650px;
  }
  .game-grid {
    grid-template-columns: 1fr;
  }
  .game-players {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dice-row {
    gap: 23px;
  }
  .die {
    width: 66px;
    height: 67px;
    padding: 11px;
  }
  .pip {
    width: 8px;
    height: 8px;
  }
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .character-art {
    height: 320px;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }
  .rules-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .results-layout {
    gap: 22px;
  }
  .result-list {
    padding: 15px;
  }
  .result-character {
    height: 440px;
  }
  .result-row {
    gap: 10px;
  }
  .result-row .avatar {
    width: 37px;
    height: 37px;
  }
  .result-row strong {
    font-size: 12px;
  }
  .auth-page {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    padding: 25px;
    gap: 10px;
  }
  .auth-brand {
    gap: 10px;
  }
  .auth-brand h1 {
    font-size: 24px;
  }
  .auth-brand > .ui-icon {
    width: 43px;
    height: 43px;
  }
  .auth-character {
    max-width: 160%;
  }
  .history-list summary {
    gap: 14px;
  }
}
@media (max-width: 600px) {
  body:before {
    background-position: 48% center;
  }
  .topbar {
    min-height: 72px;
    padding: 10px 14px;
    gap: 11px;
  }
  .brand > .ui-icon {
    width: 34px;
    height: 34px;
    padding: 5px;
    border-radius: 8px;
  }
  .player-profile {
    gap: 7px;
    flex: 1;
  }
  .player-profile .avatar {
    width: 33px;
    height: 33px;
  }
  .account-name {
    font-size: 12px;
    max-width: 90px;
  }
  .connection-label {
    display: none;
  }
  .connection {
    margin-top: 4px;
  }
  .top-account {
    gap: 6px;
    margin-left: 0;
  }
  .coin {
    padding: 7px 9px;
    font-size: 12px;
    gap: 4px;
    min-height: 37px;
  }
  .coin .ui-icon {
    width: 19px;
    height: 19px;
  }
  .header-button {
    min-width: 35px;
    min-height: 38px;
    padding: 7px;
  }
  .header-button .ui-icon {
    width: 18px;
    height: 18px;
  }
  #main {
    padding: 20px 16px 30px;
  }
  .page-heading {
    gap: 12px;
    margin-bottom: 19px;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .page-heading p {
    font-size: 11px;
  }
  .page-heading > .outline {
    padding: 8px 13px;
    font-size: 12px;
    min-height: 40px;
  }
  .page-heading > .outline .ui-icon {
    width: 17px;
    height: 17px;
  }
  .section-label {
    font-size: 10px;
  }
  .primary,
  .outline {
    padding: 10px 18px;
    font-size: 13px;
  }
  .banner {
    font-size: 11px;
    padding: 12px;
  }
  .screen-lobby #main {
    padding: 0 18px 18px;
  }
  .lobby-hero {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
    padding: 0;
    gap: 0;
  }
  .lobby-character {
    flex: 1;
    min-height: 230px;
    max-height: 365px;
    height: 34dvh;
    overflow: hidden;
    align-self: stretch;
  }
  .hero-character {
    height: calc(100% + 85px);
    max-height: none;
    max-width: none;
    bottom: -90px;
    left: 50%;
    transform: translateX(-50%);
  }
  .mode-menu {
    width: 100%;
    max-width: 430px;
    align-self: center;
    padding: 10px 0 0;
    margin: 0;
    gap: 13px;
  }
  .mode-button {
    min-height: 69px;
    padding: 12px 24px;
    gap: 18px;
    border-width: 3px;
    border-radius: 7px;
    box-shadow:
      0 4px 0 #6c5339,
      0 8px 15px #253d4538;
  }
  .mode-button:before {
    inset: 5px;
  }
  .mode-button:after {
    width: 11px;
    height: 11px;
    top: -8px;
    right: 25px;
    border-width: 2px;
  }
  .mode-symbol {
    width: 34px;
    height: 34px;
    outline-offset: 3px;
  }
  .mode-symbol .ui-icon {
    width: 23px;
    height: 23px;
  }
  .mode-title {
    font-size: 27px;
    letter-spacing: 2px;
  }
  .mode-arrow .ui-icon {
    width: 20px;
    height: 20px;
  }
  .mode-button:hover:not(:disabled) {
    translate: none;
    box-shadow:
      0 4px 0 #6c5339,
      0 8px 15px #253d4538;
  }
  .lobby-dock {
    margin-top: 22px;
    width: 100%;
    justify-content: space-between;
    max-width: 430px;
    align-self: center;
  }
  .dock-button {
    padding: 7px 4px 8px;
    min-width: 0;
    flex: 1;
    font-size: 11px;
    gap: 3px;
    border-radius: 6px;
    white-space: nowrap;
  }
  .dock-icon {
    width: 34px;
    height: 30px;
  }
  .dock-icon .ui-icon {
    width: 26px;
    height: 26px;
  }
  .maintenance-note {
    font-size: 10px;
    padding: 8px;
  }
  .auth-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 22px 30px;
    min-height: 100dvh;
  }
  .auth-art {
    height: 245px;
    min-height: 245px;
    width: 100%;
    max-width: 390px;
    align-self: center;
    overflow: hidden;
  }
  .auth-brand {
    position: absolute;
    top: 20px;
  }
  .auth-brand h1 {
    font-size: 25px;
  }
  .auth-character {
    max-height: none;
    max-width: none;
    left: 65%;
    bottom: -95px;
  }
  .auth-character-name {
    left: 0;
    bottom: 20px;
    transform: none;
    font-size: 15px;
    padding: 8px 20px;
  }
  .auth-panel#main {
    width: 100%;
    max-width: 390px;
    margin: 0;
    padding: 26px;
    flex: 0;
  }
  .auth-box > h2 {
    font-size: 25px;
    margin-bottom: 15px;
  }
  .tabs {
    margin-bottom: 19px;
  }
  .auth-note {
    font-size: 10px;
    margin-top: 16px;
  }
  .form-row {
    gap: 12px;
  }
  dialog {
    padding: 20px;
    max-height: 90dvh;
  }
  .dialog-head {
    margin-bottom: 18px;
  }
  .dialog-head h2 {
    font-size: 21px;
  }
  .join-code-row {
    gap: 9px;
  }
  .join-code-row button {
    font-size: 12px;
    padding: 10px 13px;
  }
  .code-input {
    font-size: 17px;
    letter-spacing: 2px;
  }
  .room-row {
    gap: 9px;
    padding: 14px 0;
  }
  .room-symbol {
    width: 33px;
    height: 33px;
  }
  .room-symbol .ui-icon {
    width: 21px;
    height: 21px;
  }
  .room-info strong {
    font-size: 12px;
  }
  .room-info small {
    font-size: 10px;
  }
  .room-row > button {
    min-width: 65px;
    padding: 8px 10px;
    font-size: 11px;
  }
  .dialog-copy {
    font-size: 13px;
  }
  .invite-strip {
    padding: 10px 12px;
    gap: 7px;
  }
  .invite-strip > span {
    font-size: 10px;
  }
  .invite-strip strong {
    font-size: 18px;
    letter-spacing: 2px;
    margin-left: 7px;
  }
  .invite-strip .quiet {
    font-size: 11px;
    padding: 8px;
  }
  .invite-strip > small {
    font-size: 11px;
  }
  .bot-notice {
    gap: 7px 12px;
    font-size: 11px;
    margin-bottom: 17px;
  }
  .bot-notice small {
    flex-basis: 100%;
    margin: 0;
    font-size: 10px;
  }
  .player-seats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .seat {
    padding: 11px 9px 15px;
  }
  .seat-label {
    gap: 4px;
    flex-wrap: wrap;
    font-size: 9px;
  }
  .seat-label .bot-badge {
    font-size: 8px;
    padding: 2px 4px;
  }
  .seat-art {
    height: 210px;
    margin: 5px 0;
  }
  .seat h2 {
    font-size: 15px;
  }
  .seat p {
    font-size: 10px;
    margin: 5px 0 8px;
  }
  .status-tag {
    font-size: 11px;
  }
  .seat .quiet {
    font-size: 10px;
    min-height: 37px;
  }
  .seat.vacant {
    min-height: 350px;
  }
  .seat.vacant > .ui-icon {
    width: 38px;
    height: 38px;
  }
  .seat.vacant h3 {
    font-size: 15px;
  }
  .seat.vacant .outline {
    font-size: 12px;
    padding: 9px 14px;
  }
  .waiting-actions {
    gap: 12px;
    margin-top: 22px;
  }
  .waiting-actions button {
    min-width: 125px;
  }
  .waiting-actions .muted {
    font-size: 11px;
  }
  .game-top {
    position: sticky;
    top: 0;
    z-index: 15;
    margin: -20px -16px 15px;
    padding: 13px 16px;
    background: #fff8e9f5;
    border-bottom: 1px solid #c1ac77;
    gap: 10px;
    backdrop-filter: blur(8px);
    align-items: center;
  }
  .game-top h1 {
    font-size: 19px;
  }
  .game-top .section-label {
    font-size: 9px;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
  }
  .game-mode {
    font-size: 9px;
    margin-bottom: 4px;
    padding: 2px 5px;
  }
  .turn-clock {
    gap: 7px;
  }
  .turn-clock > span {
    font-size: 10px;
    max-width: 35px;
    white-space: normal;
  }
  .turn-clock > strong {
    font-size: 28px;
    min-width: 48px;
  }
  .turn-clock small {
    font-size: 10px;
  }
  .game-top > .quiet {
    font-size: 11px;
    padding: 7px;
    min-width: 40px;
    min-height: 39px;
  }
  .game-players {
    gap: 8px;
    margin-bottom: 15px;
  }
  .mini-player {
    padding: 10px 8px;
    gap: 7px;
  }
  .mini-player .avatar {
    width: 30px;
    height: 30px;
    border-width: 1px;
  }
  .mini-player strong {
    font-size: 10px;
  }
  .mini-player small {
    font-size: 9px;
    margin-top: 3px;
  }
  .mini-player > b {
    font-size: 19px;
  }
  .mini-player .bot-badge {
    font-size: 8px;
    padding: 1px 3px;
  }
  .effect-tag {
    font-size: 8px;
  }
  .game-grid {
    gap: 16px;
  }
  .play-column {
    gap: 16px;
  }
  .dice-board {
    padding: 18px 10px 22px;
    border-width: 5px;
  }
  .board-top {
    font-size: 10px;
  }
  .dice-row {
    gap: 12px;
    margin-top: 33px;
  }
  .die {
    width: 48px;
    height: 51px;
    padding: 8px;
  }
  .pip {
    width: 6px;
    height: 6px;
  }
  .die small {
    font-size: 9px;
  }
  .dice-hint {
    font-size: 10px;
  }
  .roll-button {
    min-width: 200px;
    font-size: 13px;
  }
  .panel-heading {
    padding: 15px;
  }
  .panel-heading h2 {
    font-size: 15px;
  }
  .panel-heading small {
    font-size: 9px;
  }
  .hand,
  .draft-cards {
    padding: 12px;
    gap: 8px;
  }
  .item-card {
    padding: 10px 8px;
    gap: 7px;
  }
  .item-icon {
    width: 32px;
    height: 32px;
    font-size: 21px;
  }
  .item-card strong {
    font-size: 11px;
  }
  .item-card small {
    font-size: 10px;
    line-height: 1.55;
  }
  .draft-panel .panel-heading {
    flex-wrap: wrap;
    gap: 5px;
  }
  .score-heading {
    padding: 15px;
  }
  .score-heading h2 {
    font-size: 17px;
  }
  .score-heading small {
    font-size: 10px;
  }
  .score-scroll th,
  .score-scroll td {
    height: 46px;
  }
  .score-choice {
    min-height: 37px;
  }
  .score-note {
    font-size: 9px;
  }
  .mobile-actions {
    display: flex;
    position: fixed;
    z-index: 25;
    bottom: 0;
    left: 0;
    right: 0;
    gap: 12px;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
    background: #fff8e9f5;
    border-top: 1px solid #c1ac77;
    backdrop-filter: blur(8px);
  }
  .mobile-actions button {
    flex: 1;
    min-width: 0;
    font-size: 13px;
  }
  .screen-game #main {
    padding-bottom: 100px;
  }
  .score-panel {
    scroll-margin-top: 115px;
  }
  .results-head {
    margin: 3px 0 15px;
  }
  .results-head h1 {
    font-size: 27px;
  }
  .results-head p {
    font-size: 11px;
  }
  .results-layout {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .result-character {
    height: 305px;
  }
  .result-art {
    height: 320px;
  }
  .earned {
    padding: 9px 30px;
  }
  .earned strong {
    font-size: 26px;
  }
  .earned small {
    font-size: 10px;
  }
  .result-list {
    padding: 16px 18px;
  }
  .result-row {
    padding: 18px 0;
    gap: 12px;
  }
  .result-row strong {
    font-size: 13px;
  }
  .result-row small {
    font-size: 10px;
  }
  .result-row .rank {
    font-size: 26px;
  }
  .result-row .avatar {
    width: 40px;
    height: 40px;
  }
  .result-row > b:last-child {
    font-size: 25px;
  }
  .shop-grid {
    gap: 12px;
  }
  .character-art {
    height: 225px;
  }
  .character-badge {
    font-size: 9px;
    padding: 4px 6px;
    top: 9px;
    left: 9px;
  }
  .character-info {
    padding: 14px 11px;
  }
  .character-info h2 {
    font-size: 16px;
  }
  .character-info p {
    font-size: 10px;
    margin-bottom: 14px;
  }
  .character-info button {
    font-size: 11px;
    padding: 9px 4px;
  }
  .temporary {
    font-size: 9px;
  }
  .history-list details {
    padding: 15px;
  }
  .history-list summary {
    flex-wrap: wrap;
    gap: 9px;
    font-size: 12px;
  }
  .history-list summary > span:first-of-type {
    font-size: 10px;
    flex-basis: calc(100% - 30px);
  }
  .history-list summary > b {
    margin-left: auto;
    min-width: 50px;
  }
  .history-detail {
    font-size: 11px;
    gap: 10px;
  }
  .rules-grid {
    gap: 16px;
  }
  .prose {
    padding: 21px;
  }
  .prose h2 {
    font-size: 17px;
  }
  .prose p {
    font-size: 12px;
  }
  .prose dl {
    grid-template-columns: 105px 1fr;
    font-size: 11px;
    gap: 12px;
  }
  .rules-items {
    gap: 19px;
  }
  .rules-items h3 {
    font-size: 13px;
  }
  .rules-items p {
    font-size: 11px;
  }
  .cutscene > .scene-character,
  .scene-art {
    left: 50%;
    translate: -50% 0;
    top: 5%;
    width: min(78vw, 43vh);
    height: auto;
  }
  .scene-text {
    left: 18px;
    right: 18px;
    top: auto;
    bottom: 9%;
    text-align: center;
  }
  .scene-text .eyebrow {
    font-size: 10px;
    letter-spacing: 2px;
  }
  .scene-text h2 {
    font-size: 29px;
    margin: 10px 0;
  }
  .scene-text p {
    font-size: 12px;
  }
  .scene-text > strong {
    font-size: 28px;
    margin: 7px 0;
  }
  .scene-text small {
    font-size: 11px;
    display: block;
  }
  .scene-caption {
    bottom: 23px;
    font-size: 10px;
  }
  .scene-ring {
    left: 50%;
    translate: -50% 0;
    top: 20%;
    width: 270px;
    height: 270px;
  }
  .scene-exit {
    right: 14px;
    top: 14px;
    font-size: 11px;
  }
}
@media (max-width: 360px) {
  .topbar {
    padding: 9px 10px;
    gap: 8px;
  }
  .player-profile {
    gap: 5px;
  }
  .player-profile .avatar {
    width: 28px;
    height: 28px;
  }
  .account-name {
    max-width: 54px;
    font-size: 11px;
  }
  .top-account {
    gap: 4px;
  }
  .coin {
    padding: 7px 6px;
    font-size: 11px;
  }
  .header-button {
    min-width: 32px;
    padding: 6px;
  }
  .brand > .ui-icon {
    width: 30px;
    height: 30px;
  }
  .dice-row {
    gap: 9px;
  }
  .die {
    width: 43px;
    height: 47px;
    padding: 7px;
  }
  .pip {
    width: 5px;
    height: 5px;
  }
  .mode-title {
    font-size: 25px;
  }
  .dock-button {
    font-size: 10px;
  }
  .seat-label {
    font-size: 8px;
  }
  .seat-art {
    height: 180px;
  }
  .seat.vacant {
    min-height: 320px;
  }
}
@media (max-width: 600px) and (max-height: 740px) {
  .lobby-character {
    min-height: 160px;
    height: 27dvh;
    max-height: 220px;
  }
  .mode-button {
    min-height: 62px;
    padding-top: 9px;
    padding-bottom: 9px;
  }
  .mode-menu {
    gap: 11px;
  }
  .lobby-dock {
    margin-top: 18px;
  }
  .dock-button {
    padding-top: 5px;
    padding-bottom: 6px;
  }
  .dock-icon {
    height: 27px;
  }
  .auth-art {
    height: 190px;
    min-height: 190px;
  }
  .auth-character {
    height: 290px;
  }
  .auth-panel#main {
    padding: 22px;
  }
  .auth-brand h1 {
    font-size: 22px;
  }
}
