:root {
  color-scheme: dark;
  --ink: #f4ead3;
  --muted: #b8aa87;
  --paper: #0b1714;
  --panel: #17111b;
  --panel-2: #241520;
  --line: rgba(212, 165, 82, 0.28);
  --gold: #c99a3e;
  --gold-bright: #e2c072;
  --mint: #4fae91;
  --rose: #9e2f3f;
  --rose-bright: #c64a59;
  --blue: #3f8f9b;
  --violet: #4b2b55;
  --table: #123d31;
  --table-light: #236247;
  --black: #08080d;
  --shadow: 0 10px 0 rgba(0, 0, 0, 0.58), 0 26px 70px rgba(0, 0, 0, 0.48);
  font-family:
    "Courier New", "Pixelify Sans", "PingFang SC", "Microsoft YaHei", monospace;
  image-rendering: pixelated;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(226, 192, 114, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 192, 114, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 18% 8%, rgba(158, 47, 63, 0.28), transparent 32%),
    linear-gradient(135deg, rgba(20, 71, 53, 0.82), rgba(8, 21, 19, 0.92)),
    linear-gradient(135deg, #07090c 0%, #160d19 54%, #08110f 100%);
  background-size: 16px 16px, 16px 16px, auto, auto, auto;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.18) 0,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: multiply;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1160px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px;
  border: 2px solid rgba(201, 154, 62, 0.3);
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.16), transparent 36%),
    linear-gradient(180deg, rgba(23, 17, 27, 0.86), rgba(8, 8, 13, 0.74));
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.38), inset 0 0 0 1px rgba(244, 234, 211, 0.04);
}

.app-shell:has(.view-quiz) {
  padding-top: 12px;
  padding-bottom: 12px;
}

.app-shell:has(.view-quiz) .topbar {
  margin-bottom: 10px;
  padding: 8px;
}

.app-shell:has(.view-quiz) .brand-mark {
  width: 40px;
  height: 40px;
}

.app-shell:has(.view-quiz) .brand-title {
  font-size: 24px;
}

.app-shell:has(.view-quiz) .brand-subtitle {
  display: none;
}

.app-shell:has(.view-quiz) .stat {
  min-width: 76px;
  padding: 7px 9px;
}

.app-shell:has(.view-quiz) .stat span {
  font-size: 11px;
}

.app-shell:has(.view-quiz) .stat strong {
  margin-top: 2px;
  font-size: 15px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 3px solid var(--black);
  border-radius: 0;
  background:
    linear-gradient(145deg, #f4ead3, var(--gold) 44%, var(--rose) 44% 68%, var(--black) 68%);
  color: #16110f;
  font-size: 26px;
  font-weight: 900;
  box-shadow: 4px 4px 0 var(--black), 0 0 0 1px rgba(226, 192, 114, 0.24);
}

.brand-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

.brand-art[hidden],
.brand-mark span[hidden] {
  display: none !important;
}

.brand-title {
  margin: 0;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat {
  min-width: 86px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.06), rgba(8, 8, 13, 0.18)),
    rgba(18, 39, 33, 0.44);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
}

.stat-button {
  cursor: pointer;
  text-align: left;
}

.stat-button:hover {
  border-color: rgba(226, 192, 114, 0.62);
  background: rgba(201, 154, 62, 0.14);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 18px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.view-quiz {
  grid-template-columns: minmax(0, 1fr);
}

.view-quiz .sidebar {
  display: none;
}

.view-quiz .table-screen,
.view-quiz .play-table {
  min-height: auto;
}

.view-quiz .table-screen,
.view-quiz .play-table,
.view-quiz .table-stage,
.view-quiz .table-stage-top {
  overflow: visible;
}

.screen,
.sidebar,
.card,
.question,
.shop-item,
.result-row {
  border: 3px solid var(--black);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(18, 14, 22, 0.88);
  box-shadow: var(--shadow);
}

.screen {
  min-height: 620px;
  padding: clamp(18px, 3vw, 34px);
}

.sidebar {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

.table-screen {
  position: relative;
  min-height: calc(100vh - 136px);
  overflow: hidden;
  padding: clamp(14px, 2vw, 22px);
  background:
    linear-gradient(rgba(226, 192, 114, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(226, 192, 114, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 50% 18%, rgba(35, 98, 71, 0.48), transparent 42%),
    linear-gradient(135deg, rgba(18, 61, 49, 0.98), rgba(9, 38, 33, 0.98) 58%, rgba(15, 18, 24, 0.98));
  background-size: 18px 18px, 18px 18px, auto;
}

.table-screen::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.24), transparent 16%, transparent 84%, rgba(158, 47, 63, 0.22)),
    radial-gradient(circle at 50% 120%, rgba(201, 154, 62, 0.16), transparent 48%);
  opacity: 0.8;
}

.table-screen > * {
  position: relative;
}

.view-home .table-screen,
.view-name .table-screen,
.view-difficulty .table-screen,
.view-result .table-screen,
.view-collection .table-screen {
  padding: clamp(18px, 3vw, 34px);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(36, 21, 32, 0.96), rgba(8, 8, 13, 0.98)),
    linear-gradient(90deg, rgba(158, 47, 63, 0.16), transparent 44%),
    var(--panel);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.headline {
  max-width: 780px;
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: 0;
}

.copy {
  max-width: 740px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.dialogue {
  margin: 22px 0;
  padding: 18px;
  border-left: 4px solid var(--rose);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.18), rgba(201, 154, 62, 0.05)),
    rgba(12, 10, 15, 0.5);
  color: var(--ink);
  line-height: 1.8;
  animation: rewardPop 0.28s steps(3, end) both;
}

.character-dialogue {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.dialogue-avatar {
  width: 82px;
  height: 82px;
  background: transparent;
  image-rendering: pixelated;
  object-fit: contain;
}

.dialogue-avatar[hidden] {
  display: none !important;
}

.dialogue-text {
  min-width: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.play-table,
.shop-table {
  display: grid;
  min-height: calc(100vh - 184px);
  gap: 14px;
}

.play-table {
  grid-template-rows: auto minmax(0, 1fr);
}

.table-stage,
.shop-board,
.shop-hand-zone {
  border: 3px solid var(--black);
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.045), rgba(8, 8, 13, 0.28)),
    rgba(12, 24, 24, 0.76);
  box-shadow: inset 0 0 0 2px rgba(201, 154, 62, 0.12), 5px 5px 0 rgba(0, 0, 0, 0.42);
}

.table-stage {
  padding: 12px;
}

.table-stage-main {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
}

.stage-header,
.shop-command {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.stage-header .headline,
.shop-command .headline {
  max-width: 620px;
  font-size: clamp(24px, 3.2vw, 44px);
}

.stage-header .pill-row,
.shop-command .pill-row {
  justify-content: flex-end;
  margin: 0;
}

.zone-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.zone-title strong {
  color: var(--gold);
}

.joker-strip,
.table-hand,
.shop-hand-grid {
  scrollbar-color: rgba(201, 154, 62, 0.6) rgba(0, 0, 0, 0.32);
  scrollbar-width: thin;
}

.joker-strip {
  display: flex;
  gap: 12px;
  min-height: 266px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 4px 10px;
}

.joker-strip .joker-card,
.shop-hand-grid .joker-card {
  flex: 0 0 158px;
  min-height: 252px;
}

.joker-strip .joker-portrait,
.shop-hand-grid .joker-portrait {
  min-height: 108px;
}

.joker-strip .joker-art,
.shop-hand-grid .joker-art {
  width: min(104px, 84%);
  height: 102px;
}

.joker-strip .joker-card-body,
.shop-hand-grid .joker-card-body {
  gap: 7px;
  padding: 10px;
}

.joker-strip .joker-card-title h3,
.shop-hand-grid .joker-card-title h3 {
  font-size: 15px;
}

.joker-strip .joker-slogan,
.shop-hand-grid .joker-slogan,
.joker-strip .joker-mechanic,
.shop-hand-grid .joker-mechanic {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.joker-strip .price,
.shop-hand-grid .price {
  margin-top: 2px;
  font-size: 11px;
}

.joker-strip .actions,
.shop-hand-grid .actions {
  margin-top: 2px;
}

.joker-strip .btn,
.shop-hand-grid .btn {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.empty-table-slot {
  display: grid;
  flex: 0 0 158px;
  min-height: 252px;
  place-items: center;
  border: 3px dashed rgba(201, 154, 62, 0.34);
  color: rgba(244, 234, 211, 0.58);
  font-weight: 850;
}

.table-stage-top .joker-strip {
  min-height: 96px;
  overflow: visible;
  padding-bottom: 4px;
}

.table-stage-top .empty-table-slot {
  flex-basis: 132px;
  min-height: 88px;
  font-size: 14px;
}

.table-stage-top .joker-card {
  flex: 1 1 96px;
  min-width: 92px;
  max-width: 124px;
  min-height: 96px;
  grid-template-rows: 56px auto;
}

.table-stage-top .table-joker-card {
  position: relative;
  overflow: visible;
}

.table-stage-top .table-joker-card.info-open {
  z-index: 30;
}

.joker-info-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 40;
  display: grid;
  width: min(282px, calc(100vw - 56px));
  gap: 5px;
  padding: 10px;
  border: 2px solid rgba(226, 192, 114, 0.82);
  background:
    linear-gradient(180deg, rgba(36, 21, 32, 0.98), rgba(8, 8, 13, 0.98)),
    var(--panel);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.joker-info-popover::after {
  position: absolute;
  bottom: -8px;
  left: 52px;
  width: 12px;
  height: 12px;
  border-right: 2px solid rgba(226, 192, 114, 0.82);
  border-bottom: 2px solid rgba(226, 192, 114, 0.82);
  background: rgba(8, 8, 13, 0.98);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.table-stage-top .table-joker-4 .joker-info-popover,
.table-stage-top .table-joker-5 .joker-info-popover {
  right: 0;
  left: auto;
}

.table-stage-top .table-joker-4 .joker-info-popover::after,
.table-stage-top .table-joker-5 .joker-info-popover::after {
  right: 52px;
  left: auto;
}

.joker-info-popover strong {
  color: var(--gold-bright);
  font-size: 13px;
}

.joker-info-popover span {
  color: var(--ink);
}

.joker-info-popover small {
  color: var(--muted);
  line-height: 1.35;
}

.table-stage-top .joker-portrait {
  min-height: 56px;
  border-bottom-width: 3px;
}

.table-stage-top .table-joker-card .joker-portrait,
.table-stage-top .table-joker-card .joker-card-title {
  cursor: pointer;
}

.table-stage-top .joker-art {
  width: min(56px, 72%);
  height: 52px;
}

.table-stage-top .jester-face {
  width: 38px;
  height: 38px;
  border-width: 3px;
  font-size: 14px;
}

.table-stage-top .jester-collar,
.table-stage-top .joker-slogan,
.table-stage-top .joker-mechanic,
.table-stage-top .price {
  display: none;
}

.table-stage-top .joker-card-body {
  gap: 5px;
  padding: 7px;
}

.table-stage-top .joker-card-title h3 {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-stage-top .actions {
  margin-top: 0;
}

.table-stage-top .btn {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 11px;
}

.table-stage-main .stage-header .headline {
  font-size: clamp(20px, 2.4vw, 30px);
}

.table-hand {
  display: grid;
  grid-template-columns: repeat(var(--question-count, 5), minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: visible;
  padding: 4px;
}

.table-hand .question {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  min-height: 236px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.09), rgba(13, 10, 16, 0.95)),
    linear-gradient(90deg, rgba(158, 47, 63, 0.13), transparent 36%),
    var(--panel);
}

.table-hand .options {
  grid-template-columns: 1fr;
}

.table-hand .option {
  min-height: 38px;
}

.submit-btn {
  min-width: 160px;
}

.quiz-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.shop-table {
  align-content: start;
}

.shop-board {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.shop-actions {
  display: grid;
  align-content: start;
  gap: 10px;
}

.shop-actions .btn {
  width: 100%;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 3px solid var(--black);
  border-radius: 0;
  background:
    linear-gradient(180deg, var(--gold-bright), var(--gold) 56%, #8f6726);
  color: #160f08;
  cursor: pointer;
  font-weight: 850;
  box-shadow: 4px 4px 0 var(--black), inset 0 0 0 1px rgba(244, 234, 211, 0.25);
  transition:
    transform 0.16s ease,
    opacity 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--black), 0 0 18px rgba(201, 154, 62, 0.18);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--black);
}

.btn.secondary {
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.055), rgba(8, 8, 13, 0.18)),
    rgba(23, 17, 27, 0.78);
  color: var(--ink);
}

.btn.danger {
  background:
    linear-gradient(180deg, var(--rose-bright), var(--rose) 62%, #641b27);
  color: #fff4e0;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
  box-shadow: 2px 2px 0 var(--black);
}

.field {
  display: grid;
  gap: 8px;
  max-width: 360px;
  margin-top: 22px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 0;
  outline: none;
  background: rgba(8, 8, 13, 0.5);
  color: var(--ink);
}

.field input:focus {
  border-color: var(--gold);
}

.account-panel,
.leaderboard {
  margin-top: 18px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.045), rgba(8, 8, 13, 0.18)),
    rgba(12, 22, 21, 0.48);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title strong {
  font-size: 15px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
}

.player-list,
.rank-list,
.leaderboards {
  display: grid;
  gap: 8px;
}

.leaderboards {
  margin-top: 18px;
}

.player-row,
.rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 9px 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: rgba(8, 8, 13, 0.22);
  color: var(--muted);
  text-align: left;
}

.player-row {
  cursor: pointer;
}

.player-row.active,
.rank-row.active {
  border-color: rgba(226, 192, 114, 0.6);
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.16), rgba(201, 154, 62, 0.12));
  color: var(--ink);
}

.rank-row strong {
  color: var(--gold);
}

.difficulty-grid,
.shop-grid,
.jokers-grid,
.collection-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.collection-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.shop-board .shop-grid {
  grid-template-columns: repeat(3, minmax(168px, 1fr));
  align-items: stretch;
  margin-top: 0;
}

.jokers-grid.shop-hand-grid {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  margin-top: 12px;
  padding: 4px 4px 10px;
}

.card,
.shop-item {
  min-height: 150px;
  padding: 14px;
}

.card h3,
.shop-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.card p,
.shop-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.joker-card {
  display: grid;
  min-height: 330px;
  overflow: hidden;
  border: 4px solid var(--black);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.08), rgba(8, 8, 13, 0.22)),
    linear-gradient(90deg, rgba(158, 47, 63, 0.1), transparent 38%),
    var(--panel);
  box-shadow: var(--shadow);
  animation: cardPop 0.28s steps(4, end) both;
  transition:
    transform 0.18s steps(3, end),
    box-shadow 0.18s ease,
    filter 0.18s ease;
}

.joker-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.62), 0 30px 70px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(201, 154, 62, 0.22);
}

.joker-card.buff {
  border-color: rgba(79, 174, 145, 0.42);
}

.joker-card.debuff {
  border-color: rgba(158, 47, 63, 0.56);
}

.joker-card.locked {
  filter: grayscale(0.85);
  opacity: 0.62;
}

.joker-card.empty-slot {
  border-style: dashed;
  opacity: 0.78;
}

.joker-card.empty-slot .jester-face {
  animation: none;
}

.sold-out-portrait {
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.03), rgba(8, 8, 13, 0.18)),
    rgba(8, 8, 13, 0.1);
}

.sold-out-art {
  width: min(168px, 90%);
  height: 112px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.5));
}

.shop-hand-grid {
  margin-top: 12px;
}

.joker-portrait {
  position: relative;
  display: grid;
  min-height: 132px;
  place-items: center;
  border-bottom: 4px solid var(--black);
  background:
    linear-gradient(135deg, rgba(201, 154, 62, 0.24), transparent 42%),
    linear-gradient(225deg, rgba(158, 47, 63, 0.2), transparent 48%),
    rgba(8, 8, 13, 0.28);
}

.joker-art {
  width: min(132px, 86%);
  height: 126px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.45));
  animation: idleBounce 1.4s steps(2, end) infinite;
}

.joker-art[hidden],
.jester-face[hidden],
.joker-portrait.has-art .jester-face,
.joker-portrait.has-art .jester-collar {
  display: none !important;
}

.jester-face {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border: 4px solid rgba(244, 234, 211, 0.82);
  border-radius: 0;
  background:
    linear-gradient(90deg, #f4ead3 0 50%, var(--rose) 50% 100%);
  color: #17110f;
  font-size: 23px;
  font-weight: 950;
  box-shadow:
    -14px -16px 0 -8px var(--gold),
    14px -16px 0 -8px var(--rose),
    4px 4px 0 rgba(0, 0, 0, 0.45);
  animation: idleBounce 1.4s steps(2, end) infinite;
}

.jester-collar {
  position: absolute;
  bottom: 16px;
  width: 112px;
  height: 22px;
  border-radius: 0;
  background:
    linear-gradient(90deg, transparent 0 12%, rgba(201, 154, 62, 0.95) 12% 28%, transparent 28% 36%, rgba(79, 174, 145, 0.9) 36% 56%, transparent 56% 66%, rgba(158, 47, 63, 0.96) 66% 84%, transparent 84%);
}

.joker-card-body {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.joker-card-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.joker-card-title h3 {
  margin: 0;
  font-size: 18px;
}

.joker-slogan {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.joker-mechanic {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.joker-double .joker-portrait,
.joker-triple .joker-portrait {
  background:
    linear-gradient(135deg, rgba(201, 154, 62, 0.32), transparent 46%),
    rgba(0, 0, 0, 0.18);
}

.joker-lucky .joker-portrait,
.joker-chaos .joker-portrait {
  background:
    linear-gradient(135deg, rgba(79, 174, 145, 0.3), transparent 46%),
    rgba(0, 0, 0, 0.18);
}

.joker-evil .joker-portrait,
.joker-amnesia .joker-portrait {
  background:
    linear-gradient(135deg, rgba(158, 47, 63, 0.36), transparent 46%),
    rgba(0, 0, 0, 0.18);
}

.price {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--gold);
  font-weight: 800;
}

.question-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.question-list.table-hand {
  display: grid;
  grid-template-columns: repeat(var(--question-count, 5), minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  overflow: visible;
  margin-top: 12px;
  padding: 4px;
}

.question {
  padding: 16px;
}

.question-list.table-hand .question {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  min-height: 236px;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.09), rgba(13, 10, 16, 0.95)),
    linear-gradient(90deg, rgba(158, 47, 63, 0.13), transparent 36%),
    var(--panel);
}

.question-title {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.question-word-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.question-index {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.word {
  display: block;
  min-width: 0;
  overflow: hidden;
  max-width: 100%;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.level {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.question-list.table-hand .options {
  grid-template-columns: 1fr;
}

.question-list.table-hand .word {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
}

.question-list.table-hand .option {
  min-height: 38px;
}

.option {
  min-height: 48px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(244, 234, 211, 0.045), rgba(8, 8, 13, 0.12)),
    rgba(8, 8, 13, 0.28);
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  transition:
    transform 0.14s steps(2, end),
    background 0.14s ease,
    border-color 0.14s ease;
}

.option:hover {
  transform: translateX(3px);
}

.option.selected {
  border-color: var(--gold);
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.18), rgba(201, 154, 62, 0.18));
  animation: pixelBlink 0.5s steps(2, end) 1;
}

.option.correct {
  border-color: var(--mint);
  background: rgba(79, 174, 145, 0.16);
}

.option.wrong {
  border-color: var(--rose);
  background: rgba(158, 47, 63, 0.2);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.pill {
  padding: 7px 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  background: rgba(8, 8, 13, 0.2);
  color: var(--muted);
  font-size: 13px;
}

.joker-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.joker-chip {
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(158, 47, 63, 0.08), rgba(201, 154, 62, 0.055)),
    rgba(8, 8, 13, 0.24);
}

.joker-chip strong {
  display: block;
  margin-bottom: 4px;
}

.joker-chip small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

.result-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.result-row {
  padding: 12px;
  animation: rewardPop 0.24s steps(3, end) both;
}

.result-row strong {
  color: var(--gold);
}

@keyframes cardPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes idleBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes pixelBlink {
  0%,
  100% {
    box-shadow: none;
  }
  50% {
    box-shadow: inset 0 0 0 3px rgba(201, 154, 62, 0.46);
  }
}

@keyframes rewardPop {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.notice {
  margin-top: 16px;
  padding: 12px;
  border: 2px solid rgba(79, 174, 145, 0.36);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(79, 174, 145, 0.12), rgba(201, 154, 62, 0.06)),
    rgba(8, 8, 13, 0.28);
  color: var(--mint);
}

.round-notice {
  margin: 6px 0 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
}

.muted {
  color: var(--muted);
}

.empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
    width: 100%;
  }

  .stat {
    flex: 1 1 92px;
  }

  .app-shell:has(.view-quiz) .topbar {
    align-items: center;
    flex-direction: row;
  }

  .app-shell:has(.view-quiz) .stats {
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: auto;
  }

  .app-shell:has(.view-quiz) .stat {
    flex: 0 0 auto;
    min-width: 70px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .screen {
    min-height: auto;
  }

  .difficulty-grid,
  .shop-grid,
  .jokers-grid,
  .collection-grid,
  .options {
    grid-template-columns: 1fr;
  }

  .character-dialogue {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 12px;
  }

  .dialogue-avatar {
    width: 56px;
    height: 56px;
  }

  .question-list.table-hand {
    gap: 8px;
  }

  .question-list.table-hand .question {
    min-height: 218px;
    padding: 8px;
  }
}

@media (max-width: 640px) {
  body {
    background-size: 12px 12px, 12px 12px, auto, auto, auto;
  }

  .app-shell {
    padding: 10px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px;
  }

  .brand {
    width: 100%;
    gap: 9px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--black);
  }

  .brand-title {
    font-size: 24px;
  }

  .brand-subtitle {
    display: none;
  }

  .stats {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stat {
    min-width: 0;
    padding: 7px 6px;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
  }

  .stat span {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stat strong {
    overflow: hidden;
    margin-top: 2px;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell:has(.view-quiz) {
    padding: 8px;
  }

  .app-shell:has(.view-quiz) .topbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px;
  }

  .app-shell:has(.view-quiz) .brand {
    width: 100%;
  }

  .app-shell:has(.view-quiz) .brand-mark {
    width: 32px;
    height: 32px;
  }

  .app-shell:has(.view-quiz) .brand-title {
    font-size: 20px;
  }

  .app-shell:has(.view-quiz) .stats {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .app-shell:has(.view-quiz) .stat {
    min-width: 0;
    padding: 5px 5px;
  }

  .layout {
    gap: 10px;
  }

  .screen,
  .table-screen {
    padding: 10px;
  }

  .headline {
    font-size: clamp(28px, 11vw, 42px);
  }

  .copy {
    font-size: 15px;
    line-height: 1.65;
  }

  .dialogue {
    margin: 14px 0;
    padding: 12px;
    line-height: 1.55;
  }

  .character-dialogue {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .dialogue-avatar {
    width: 50px;
    height: 50px;
  }

  .play-table,
  .shop-table {
    gap: 8px;
    min-height: auto;
  }

  .table-stage {
    padding: 8px;
  }

  .stage-header,
  .shop-command {
    display: grid;
    gap: 8px;
  }

  .stage-header .headline,
  .shop-command .headline {
    font-size: 21px;
  }

  .pill-row {
    gap: 5px;
  }

  .pill {
    padding: 6px 7px;
    font-size: 11px;
  }

  .zone-title {
    margin: 6px 0;
  }

  .table-stage-top .joker-strip {
    min-height: 88px;
    gap: 7px;
  }

  .table-stage-top .joker-card {
    min-width: 76px;
    max-width: 92px;
    min-height: 86px;
    grid-template-rows: 46px auto;
  }

  .table-stage-top .joker-portrait {
    min-height: 46px;
  }

  .table-stage-top .joker-art {
    width: min(48px, 74%);
    height: 44px;
  }

  .table-stage-top .joker-card-body {
    padding: 5px;
  }

  .table-stage-top .joker-card-title h3 {
    font-size: 11px;
  }

  .table-stage-top .btn {
    min-height: 26px;
    padding: 4px 6px;
    font-size: 10px;
  }

  .joker-info-popover {
    width: min(260px, calc(100vw - 28px));
    padding: 9px;
    font-size: 12px;
  }

  .question-list.table-hand {
    gap: 7px;
    margin-top: 8px;
    padding: 2px;
  }

  .question-list.table-hand.questions-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .question-list.table-hand.questions-4,
  .question-list.table-hand.questions-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-list.table-hand .question {
    min-height: 190px;
    padding: 7px;
    border-width: 2px;
  }

  .question-title {
    margin-bottom: 6px;
  }

  .question-word-row {
    gap: 3px;
    overflow: visible;
  }

  .question-index {
    font-size: 10px;
  }

  .question-list.table-hand .word {
    max-width: none;
    overflow: visible;
    letter-spacing: 0;
  }

  .level {
    font-size: 10px;
  }

  .question-list.table-hand .options {
    gap: 6px;
  }

  .question-list.table-hand .option {
    min-height: 34px;
  }

  .option {
    padding: 6px;
    font-size: 12px;
    line-height: 1.25;
  }

  .quiz-submit-row {
    position: sticky;
    bottom: 8px;
    z-index: 20;
    justify-content: stretch;
    margin-top: 8px;
  }

  .submit-btn {
    width: 100%;
    min-height: 46px;
  }

  .shop-board {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .shop-actions {
    grid-template-columns: 1fr 1fr;
  }

  .shop-board .shop-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 0;
    padding: 4px 4px 10px;
    scroll-snap-type: x mandatory;
  }

  .shop-board .shop-grid .joker-card {
    flex: 0 0 min(76vw, 230px);
    scroll-snap-align: start;
  }

  .jokers-grid.shop-hand-grid .joker-card {
    flex-basis: min(72vw, 210px);
  }

  .collection-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .collection-grid .joker-card {
    min-height: 260px;
  }

  .leaderboards,
  .account-panel {
    margin-top: 12px;
  }

  .player-row,
  .rank-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
