:root {
  --ink: #f6efe2;
  --muted: #d8cab2;
  --line: #745a43;
  --panel: #22180fcc;
  --panel-strong: #140f0be6;
  --gold: #e3b35e;
  --gold-deep: #bc8b3a;
  --door-red: #8f201e;
  --door-red-dark: #5e1413;
  --wood-1: #6b4128;
  --wood-2: #8a5a37;
  --wood-3: #4f311e;
  --shadow: 0 16px 36px #00000066;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Yu Gothic", Meiryo, sans-serif;
  background:
    radial-gradient(1400px 840px at 50% -26%, #4de3ff33 0%, transparent 62%),
    radial-gradient(1200px 700px at 10% 18%, #70b8ff22 0%, transparent 58%),
    linear-gradient(180deg, #081322 0%, #0a1a2c 44%, #070f1b 100%);
  overflow-x: hidden;
}

.grain,
.rays {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.grain {
  opacity: 0.22;
  background:
    radial-gradient(circle at 20px 18px, #ffffff1a 0 5px, transparent 5px),
    radial-gradient(circle at 34px 18px, #ffffff1a 0 5px, transparent 5px),
    radial-gradient(12px 9px at 27px 30px, #ffffff14 0 70%, transparent 71%),
    radial-gradient(circle at 20px 40px, #ffffff14 0 4px, transparent 4px),
    radial-gradient(circle at 34px 40px, #ffffff14 0 4px, transparent 4px);
  background-size: 54px 54px;
}

.rays {
  opacity: 0.25;
  background:
    radial-gradient(920px 520px at 50% -8%, #72ecff2f 0, transparent 64%),
    radial-gradient(860px 430px at 50% 110%, #4aa6ff22 0, transparent 72%);
}

.shell {
  width: min(1240px, 96vw);
  margin: 20px auto 30px;
  position: relative;
  z-index: 1;
}

.panel {
  border: 1px solid #8a694e;
  border-radius: 20px;
  background: linear-gradient(160deg, var(--panel), var(--panel-strong));
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.setup-panel {
  padding: 40px 30px;
  max-width: 800px;
  margin: 0 auto;
}

.game-panel {
  padding: 14px;
}

.hidden {
  display: none;
}

h2,
h3 {
  margin: 0 0 24px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  letter-spacing: 0.1em;
  text-align: center;
}

.setup-panel h2 {
  font-size: clamp(30px, 4.4vw, 46px);
  letter-spacing: 0.14em;
  color: #f6e4c2;
  text-shadow: 0 0 16px #d6a55b44, 0 6px 12px #00000055;
  position: relative;
  padding-bottom: 14px;
}

.setup-panel h2::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(280px, 72%);
  height: 2px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #d6a55b, transparent);
  box-shadow: 0 0 10px #d6a55b66;
}

.title-logo-wrap {
  text-align: center;
}

.title-logo-wrap::after {
  display: none;
}

.title-logo-img {
  max-width: min(480px, 90%);
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 4px 16px #00000088);
}

.setup-grid {
  display: grid;
  gap: 32px;
}

.field {
  display: grid;
  gap: 12px;
}

.field>span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(18px, 2.1vw, 24px);
  color: #f0d19a;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-shadow: 0 2px 8px #00000055;
  padding: 0 0 6px;
  border-bottom: 1px solid #9a764f;
}

.field>span::before {
  content: "◆";
  color: #d6a55b;
  font-size: 0.8em;
  transform: translateY(-1px);
}

select,
button {
  font: inherit;
}

select {
  width: 190px;
  background: #1d130d;
  color: var(--ink);
  border: 1px solid #8b6c4e;
  border-radius: 10px;
  padding: 9px 10px;
}

.toggle-picker {
  display: flex;
  gap: 8px;
}

.toggle-picker button {
  flex: 1;
  max-width: 100px;
  background: #1d130d;
  color: var(--muted);
  border: 1px solid #8b6c4e;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-picker button:hover {
  border-color: var(--gold-deep);
}

.toggle-picker button.selected {
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  color: #2a1b0f;
  border-color: var(--gold);
  font-weight: 800;
  box-shadow: 0 4px 12px #e3b35e33;
}

.heart-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.pick-card {
  background: linear-gradient(180deg, #3f2a1f, #22160f);
  border: 1px solid #8a6a4d;
  border-radius: 12px;
  padding: 8px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pick-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px #00000055;
}

.pick-card.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #e3b35e66 inset;
}

.pick-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
}

.pick-name {
  margin-top: 6px;
}

.setup-foot {
  margin-top: 48px;
  display: grid;
  place-items: center;
  gap: 12px;
}

.rule-btn-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 14px;
}

.rules-btn {
  border: 1px solid #b08a61;
  border-radius: 999px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #5d3a24, #412819);
  color: #f0dfc5;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 8px 14px #00000055;
}

.rules-btn:hover {
  border-color: #d6a55b;
}

.rules-btn--inline {
  justify-self: end;
  align-self: center;
  margin-left: auto;
}

.cta {
  border: 0;
  border-radius: 999px;
  padding: 16px 60px;
  font-size: 18px;
  letter-spacing: 0.2em;
  background: linear-gradient(120deg, var(--gold), var(--gold-deep));
  color: #2a1b0f;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 24px #00000066;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cta:hover {
  transform: scale(1.05) translateY(-2px);
  box-shadow: 0 16px 32px #00000088;
}

.cta:active {
  transform: scale(0.98);
}

.boardgame-link {
  display: inline-block;
  margin-top: 10px;
  padding: 12px 36px;
  font-size: 16px;
  letter-spacing: 0.08em;
  background: linear-gradient(120deg, #6aa84f, #4f7f3b);
  color: #f6f3e8;
  text-decoration: none;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  margin-bottom: 10px;
}

.status-box {
  border: 1px solid #906f52;
  border-radius: 12px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #3f281a, #2a1a11);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.status-box span {
  color: var(--muted);
  letter-spacing: 0.16em;
  font-size: 11px;
}

.status-box strong {
  color: #ffe0a8;
  font-size: clamp(15px, 2.2vw, 20px);
}

.tableau {
  position: relative;
  min-height: 720px;
  border: 1px solid #77563e;
  border-radius: 24px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background:
    radial-gradient(ellipse at 50% 45%, #2d6f97 0%, #214d72 42%, #173857 68%, #11253c 100%),
    repeating-linear-gradient(14deg,
      #00000010 0 12px,
      #72ecff08 12px 18px,
      #00000010 18px 28px);
  box-shadow: inset 0 0 0 3px #00000024, inset 0 22px 30px #72ecff14, inset 0 -24px 30px #0000004d;
}

.table-center {
  grid-area: 1 / 1;
  place-self: center;
  width: min(720px, 94%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 2;
  pointer-events: none;
  transform: translateY(30px);
}

.center-action {
  pointer-events: auto;
  width: 112px;
  min-height: 48px;
  border: 1px solid #a18162;
  border-radius: 12px;
  background: linear-gradient(180deg, #6a452d, #4d311f);
  color: var(--ink);
  letter-spacing: 0.1em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 16px #00000045;
}

.center-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.limit-door {
  width: min(300px, 80%);
  aspect-ratio: 1.6 / 1;
  border: 4px solid #d5a55e;
  border-radius: 46% 46% 20px 20px;
  background:
    linear-gradient(160deg, #b83430 0%, var(--door-red) 40%, var(--door-red-dark) 100%);
  box-shadow:
    inset 0 0 0 2px #ffd79b66,
    inset 0 -22px 28px #00000035,
    0 16px 34px #00000066;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
  position: relative;
}

.limit-door::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 2px solid #ffdca66e;
  border-radius: 44% 44% 14px 14px;
}

.limit-door span {
  color: #ffe7bf;
  letter-spacing: 0.25em;
  font-size: 12px;
  z-index: 1;
}

.limit-door strong {
  z-index: 1;
  font-size: clamp(54px, 7vw, 88px);
  line-height: 1;
  color: #fff8e9;
  text-shadow: 0 5px 18px #0000007a;
}

.table-center[data-count="3"],
.table-center[data-count="4"] {
  gap: 10px;
}

.table-center[data-count="3"] .limit-door,
.table-center[data-count="4"] .limit-door {
  width: min(210px, 50%);
  aspect-ratio: 1.4 / 1;
}

.table-center[data-count="3"] .limit-door strong,
.table-center[data-count="4"] .limit-door strong {
  font-size: clamp(40px, 6vw, 68px);
}

.table-center[data-count="4"] .deck-stack-wrap,
.table-center[data-count="4"] .pass-btn-side {
  width: 80px;
}

.table-center[data-count="4"] .draw-overlay-btn {
  width: 72px;
  font-size: 13px;
}

.deck-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.deck-stack-wrap {
  position: relative;
  width: 100px;
  height: 120px;
  display: grid;
  place-items: center;
}

.deck-stack {
  position: absolute;
  width: 72px;
  height: 104px;
  border-radius: 10px;
  border: 1px solid #c39b6d;
  background:
    repeating-linear-gradient(45deg, #6f1820, #6f1820 6px, #4f1016 6px, #4f1016 12px),
    linear-gradient(170deg, #88313b, #58141d);
  box-shadow:
    6px 6px 0 #00000033,
    12px 12px 0 #00000022;
}

.draw-overlay-btn {
  position: relative;
  z-index: 2;
  width: 90px;
  min-height: 48px;
  border: 1px solid #a18162;
  border-radius: 12px;
  background: linear-gradient(180deg, #6a452ddd, #4d311fdf);
  backdrop-filter: blur(2px);
  color: var(--ink);
  letter-spacing: 0.1em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 16px #00000066;
  pointer-events: auto;
  transition: transform 0.2s ease;
}

.draw-main {
  display: block;
}

.draw-sub {
  display: none;
}

.draw-overlay-btn:hover {
  transform: scale(1.05);
}

.draw-overlay-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.deck-label {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.deck-label span {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #f2dec0;
}

#deckCount {
  font-size: 28px;
  color: #fff4dc;
}

.pass-btn-side {
  pointer-events: auto;
  width: 100px;
  min-height: 48px;
  border: 1px solid #a18162;
  border-radius: 12px;
  background: linear-gradient(180deg, #6a452d, #4d311f);
  color: var(--ink);
  letter-spacing: 0.12em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 16px #00000055;
  transition: transform 0.2s ease;
}

.pass-btn-side:hover {
  transform: scale(1.05);
}

.pass-btn-side:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.players {
  grid-area: 1 / 1;
  padding: 20px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: minmax(170px, 1fr) minmax(240px, 1fr) minmax(170px, 1fr);
  gap: 10px 12px;
  z-index: 3;
  pointer-events: none;
}

.player-card {
  width: min(330px, 100%);
  max-width: 360px;
  border: 1px solid #8e6c4f;
  border-radius: 14px;
  background: linear-gradient(170deg, #2f1e14e6, #1a120de6);
  padding: 10px;
  box-shadow: 0 12px 24px #00000059;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  pointer-events: auto;
  align-self: end;
  justify-self: center;
}

.player-card.turning {
  box-shadow: 0 0 0 2px #e3b35e77 inset, 0 14px 26px #00000066;
}

.player-card.dead {
  opacity: 0.52;
  filter: grayscale(0.4);
}

.player-slot-top-left {
  grid-area: 1 / 1;
  align-self: start;
}

.player-slot-top-center {
  grid-area: 1 / 2;
  align-self: start;
}

.player-slot-top-right {
  grid-area: 1 / 3;
  align-self: start;
}

.player-slot-middle-left {
  grid-area: 2 / 1;
  align-self: center;
}

.player-slot-middle-right {
  grid-area: 2 / 3;
  align-self: center;
}

.player-slot-bottom-left {
  grid-area: 3 / 1;
  align-self: end;
}

.player-slot-bottom-center {
  grid-area: 3 / 2;
  align-self: end;
}

.player-slot-bottom-right {
  grid-area: 3 / 3;
  align-self: end;
}

.player-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #d0a464;
  background:
    radial-gradient(circle at 35% 30%, #fff2d8 0%, #d7af73 45%, #8f6a3f 100%);
  color: #3e2818;
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.player-meta strong {
  display: block;
  font-size: 15px;
}

.player-meta span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.12em;
}

.chips {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid #916f52;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  color: #f0ddc0;
}

.chip.warn {
  border-color: #c46a6a;
  color: #ffd6d6;
}

.hearts {
  margin-top: 8px;
  padding-right: 82px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.heart-mini {
  width: 70px;
  height: 104px;
  border: 1px solid #9f7c5b;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 6px 12px #00000055;
  background: #2a1b13;
}

.heart-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.heart-mini.facedown::after {
  content: "♡";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 30px;
  line-height: 1;
  color: #ffe0b8;
  text-shadow: 0 2px 10px #00000088;
  background:
    repeating-linear-gradient(45deg, #70472d, #70472d 6px, #53341f 6px, #53341f 12px);
}

.heart-mini.rested {
  transform: rotate(90deg) translate(22px, -20px);
  transform-origin: center;
}

.heart-mini.usable {
  cursor: pointer;
  border-color: #ffd799;
  box-shadow: 0 0 0 2px #ffd79966 inset, 0 0 18px #ffd79944;
}

.heart-mini.selected-skill {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #e3b35e99 inset, 0 0 16px #e3b35e66;
}

.hand {
  margin-top: 6px;
  min-height: 92px;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.hand .num,
.hand .back {
  width: 42px;
  height: 58px;
  border-radius: 8px;
  margin-left: -14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  box-shadow: 0 6px 10px #0000004f;
  transform-origin: center 120px;
}

.hand .num {
  background: linear-gradient(170deg, #fffef9, #ebdcc8);
  border: 1px solid #b39372;
  color: #3d2819;
  overflow: hidden;
  padding: 0;
}

.hand .num img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hand .back {
  border: 1px solid #a88665;
  background:
    repeating-linear-gradient(45deg, #7d1c26, #7d1c26 6px, #58131b 6px, #58131b 12px);
}

.hand> :first-child {
  margin-left: 0;
}

.hand> :only-child {
  transform: none;
}

.hand> :nth-child(1) {
  transform: rotate(-16deg) translateY(8px);
}

.hand> :nth-child(2) {
  transform: rotate(-8deg) translateY(4px);
}

.hand> :nth-child(3) {
  transform: rotate(0deg);
}

.hand> :nth-child(4) {
  transform: rotate(8deg) translateY(4px);
}

.hand> :nth-child(5) {
  transform: rotate(16deg) translateY(8px);
}

.hand-empty {
  font-size: 12px;
  color: #e2cfb3;
}

.bottom-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 10px;
}

.actions,
.log {
  border: 1px solid #8f6d4f;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(170deg, #2d1e14cf, #1b120dcc);
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-buttons button {
  border: 1px solid #a18162;
  border-radius: 10px;
  background: linear-gradient(180deg, #6a452d, #4d311f);
  color: var(--ink);
  padding: 8px 12px;
  cursor: pointer;
}

.action-buttons button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.action-modal-note {
  margin: 0;
  color: #ff8c8c;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.hint {
  margin: 6px 0 0;
  min-height: 1.35em;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.result-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #0f0805aa;
  backdrop-filter: blur(4px);
}

.result-modal.hidden {
  display: none;
}

.skill-cast-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 20, 10, 0.85);
  backdrop-filter: blur(7px) saturate(92%);
}

.skill-cast-overlay.hidden {
  display: none;
}

.skill-cast-card {
  width: min(420px, 92vw);
  border: 1px solid #b38a60;
  border-radius: 18px;
  padding: 18px 18px 20px;
  background:
    radial-gradient(120% 75% at 50% -15%, #8f201e40 0%, transparent 64%),
    linear-gradient(165deg, #3a2417f0, #20140df0);
  box-shadow: 0 18px 34px #00000088;
  text-align: center;
  display: grid;
  gap: 10px;
}

.skill-cast-title {
  color: #d8bb90;
  letter-spacing: 0.16em;
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
}

.skill-cast-card img {
  width: min(210px, 66vw);
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #d8aa6a;
  box-shadow: 0 10px 20px #00000066;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity 0.28s ease, transform 0.3s ease;
}

.skill-cast-card.show img {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.skill-cast-name {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(22px, 3.8vw, 30px);
  color: #f6d9aa;
  text-shadow: 0 0 16px #e3b35e55;
}

.skill-cast-desc {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #886548;
  border-radius: 10px;
  background: #2a1b12d0;
  color: #e7d5bc;
  font-size: 13px;
  line-height: 1.5;
}

.winner-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(40, 20, 10, 0.85);
  backdrop-filter: blur(7px) saturate(90%);
}

.winner-overlay.hidden {
  display: none;
}

.winner-card {
  width: min(680px, 92vw);
  border: 1px solid #a78663;
  border-radius: 18px;
  padding: clamp(22px, 4.2vw, 36px) clamp(20px, 5vw, 44px);
  background:
    radial-gradient(120% 90% at 50% -12%, #8f201e44 0%, transparent 64%),
    linear-gradient(160deg, #382316ee, #22150dee);
  box-shadow: 0 22px 44px #00000088, inset 0 0 0 1px #ffffff12;
  text-align: center;
  display: grid;
  gap: 12px;
}

.winner-kicker {
  display: inline-flex;
  justify-self: center;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.18em;
  font-size: 14px;
  font-weight: 700;
  color: #d7bf95;
  text-transform: uppercase;
}

.winner-paw {
  font-size: 16px;
  color: #e3b35e;
  filter: drop-shadow(0 0 8px #d8a44f66);
}

.winner-name {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(34px, 6.6vw, 58px);
  line-height: 1.15;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #ffe5b4 0%, #e3b35e 52%, #a97936 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 22px #e3b35e66, 0 8px 14px #00000066;
}

.winner-actions {
  margin-top: 8px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

.winner-replay-btn {
  width: min(330px, 86vw);
  min-height: 56px;
  border: 2px solid #d6ab70;
  border-radius: 12px;
  background: linear-gradient(180deg, #6a452ddd, #4d311fdf);
  color: #f6efe2;
  font-size: 18px;
  letter-spacing: 0.08em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 22px #00000066;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.winner-replay-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 26px #00000088;
}

.winner-shop-link {
  width: min(330px, 86vw);
  min-height: 52px;
  border: 2px solid #80b96b;
  border-radius: 12px;
  background: linear-gradient(120deg, #6aa84f, #4f7f3b);
  color: #f6f3e8;
  font-size: 16px;
  letter-spacing: 0.08em;
  font-weight: 800;
  display: grid;
  place-items: center;
  text-decoration: none;
  box-shadow: 0 10px 20px #00000066;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.winner-shop-link:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 24px #00000088;
}

.winner-title-btn {
  border: 0;
  background: transparent;
  color: #dcc7a8;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  opacity: 0.9;
}

.winner-title-btn:hover {
  color: #f2dfc2;
  opacity: 1;
}

.result-card {
  width: min(660px, 92vw);
  border: 1px solid #a58464;
  border-radius: 16px;
  background: linear-gradient(165deg, #352214ee, #21150dee);
  box-shadow: 0 18px 35px #00000088;
  padding: 16px;
  display: grid;
  gap: 12px;
}

.rules-card {
  width: min(900px, 94vw);
  max-height: min(86vh, 920px);
}

.rules-close-btn {
  border: 1px solid #8f6d4f;
  border-radius: 8px;
  background: #2f1d12;
  color: #e6cfab;
  width: 36px;
  height: 36px;
  cursor: pointer;
}

.rules-body {
  max-height: min(68vh, 680px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.rules-section {
  border: 1px solid #8d6d4f;
  border-radius: 12px;
  background: #2a1b12;
  padding: 10px 12px;
}

.rules-heading {
  margin: 0 0 8px;
  font-size: 18px;
  color: #f0d19a;
  text-align: left;
}

.rules-section p {
  margin: 8px 0;
  line-height: 1.65;
  color: #ead8bf;
}

.rules-section ul,
.rules-section ol {
  margin: 6px 0;
  padding-left: 18px;
  line-height: 1.6;
}

.rules-heart-list li {
  margin-bottom: 4px;
}

.rules-section--tip {
  border-color: #b08a61;
  background: linear-gradient(180deg, #2f2117, #26190f);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.result-limit strong {
  margin-left: 8px;
  font-size: 34px;
  line-height: 1;
  color: #ffe0a8;
}

.result-summary,
.result-row,
.reveal-item,
.action-option {
  border: 1px solid #8d6d4f;
  border-radius: 10px;
  background: #2a1b12;
}

.result-summary {
  margin: 0;
  padding: 10px 12px;
  font-weight: 700;
}

.result-totals {
  display: grid;
  gap: 8px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
}

.result-player {
  min-width: 0;
}

.result-name {
  display: block;
  font-weight: 700;
}

.result-hand {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.35;
  color: #dec6aa;
  word-break: break-word;
}

.result-row .score {
  font-size: 22px;
  font-weight: 800;
  color: #ffd89b;
  margin-left: auto;
  align-self: center;
}

.result-row.loser {
  border-color: #b36b6b;
  background: #3a2020;
}

.reveal-card {
  width: min(980px, 94vw);
}

.action-main-img {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid var(--gold);
  box-shadow: 0 10px 24px #00000088;
  margin: 10px auto;
  display: block;
}

.action-main-img.hidden {
  display: none;
}

.action-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.reveal-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 300px));
  justify-content: center;
  gap: 10px;
}

.reveal-item,
.reveal-item {
  padding: 8px;
  cursor: pointer;
}

.reveal-item img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
}

.reveal-item.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #e3b35e88 inset;
}

.action-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(161, 129, 98, 0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 80px;
}

.action-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold);
}

.action-option.active {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.4), rgba(75, 0, 130, 0.4));
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(213, 165, 94, 0.3);
}

.option-img {
  width: 50px;
  height: 66px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--gold-deep);
  flex-shrink: 0;
}

.option-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.action-option .title {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold);
}

.action-option .sub {
  font-size: 12px;
  color: #ebdcc8;
  opacity: 0.85;
  line-height: 1.4;
}

.num-badge {
  width: 34px;
  height: 44px;
  display: grid;
  place-content: center;
  background: linear-gradient(170deg, #fffef9, #ebdcc8);
  border: 1px solid #b39372;
  border-radius: 6px;
  color: #3d2819;
  font-weight: 900;
  font-size: 20px;
  flex-shrink: 0;
}

#logList {
  margin: 0;
  padding-left: 20px;
  max-height: 260px;
  overflow-y: auto;
}

#logList li {
  margin-bottom: 5px;
}

.detail-card {
  width: min(340px, 90vw);
  text-align: center;
  gap: 16px;
}

.detail-card .result-head {
  justify-content: center;
}

.detail-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.detail-body img {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--gold);
  box-shadow: 0 12px 28px #00000088;
  transition: transform 0.3s ease;
}

.detail-body img:hover {
  transform: scale(1.04);
}

.detail-body p {
  width: 100%;
  font-size: 15px;
  line-height: 1.6;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #77563e;
}

.detail-card .action-buttons {
  justify-content: center;
}

.heart-mini.inspectable,
.num.inspectable {
  cursor: help;
}

.num.special-card {
  background: linear-gradient(135deg, #4b0082, #8b0000);
  border: 2px solid var(--gold);
  box-shadow: 0 0 10px var(--gold-deep);
  color: #fff;
}

.heart-mini.usable {
  cursor: pointer;
}

@media (max-width: 980px) {
  .tableau {
    min-height: 820px;
  }

  .table-center {
    width: min(480px, 96%);
  }

  .center-action {
    width: 96px;
  }

  .player-card {
    width: min(300px, 94%);
  }

  .players {
    padding: 18px 10px;
    gap: 8px;
  }
}

@media (max-width: 860px) {
  .table-center {
    flex-direction: column;
    gap: 12px;
    transform: translateY(10px);
  }

  .limit-door {
    order: -1;
  }

  .center-action,
  .pass-btn-side {
    width: min(240px, 80vw);
  }

  .players {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 10px;
  }

  .player-slot-top-left,
  .player-slot-top-center,
  .player-slot-top-right,
  .player-slot-middle-left,
  .player-slot-middle-right,
  .player-slot-bottom-left,
  .player-slot-bottom-center,
  .player-slot-bottom-right {
    order: 1;
  }

  .player-slot-bottom-left,
  .player-slot-bottom-right {
    order: 2;
  }

  .player-slot-bottom-center {
    order: 3;
    width: 100%;
    display: grid;
    justify-items: center;
  }
}

@media (max-width: 760px) {

  .status-row,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .tableau {
    min-height: 920px;
  }

  .limit-door {
    width: min(210px, 78%);
  }

  .hearts {
    min-height: 120px;
    padding-right: 48px;
  }

  .heart-mini {
    width: 62px;
    height: 92px;
  }

  .player-card {
    width: min(330px, 94vw);
  }

  .reveal-list {
    grid-template-columns: repeat(1, minmax(240px, 300px));
  }
}

@media (max-width: 640px) {
  .shell {
    width: 100vw;
    margin: 10px auto 16px;
    padding: 0 8px;
  }

  .panel {
    border-radius: 14px;
  }

  .setup-panel {
    padding: 20px 12px;
  }

  .game-panel {
    padding: 8px;
  }

  .setup-grid {
    gap: 18px;
  }

  .heart-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .cta {
    width: min(320px, 100%);
    padding: 14px 18px;
    letter-spacing: 0.12em;
    font-size: 16px;
  }

  .status-row {
    gap: 8px;
  }

  .rules-btn--inline {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .tableau {
    min-height: 0;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 8px 12px;
  }

  .table-center {
    order: 1;
    width: 100%;
    transform: none;
    gap: 8px;
  }

  .deck-stack,
  .deck-label {
    display: none;
  }

  .deck-stack-wrap {
    width: 100%;
    height: auto;
  }

  .deck-pile {
    width: min(240px, 80vw);
  }

  .draw-overlay-btn {
    width: 100%;
    min-height: 56px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 8px 12px;
    line-height: 1.2;
  }

  .draw-main {
    font-size: 15px;
    letter-spacing: 0.12em;
    font-weight: 900;
  }

  .draw-sub {
    display: block;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: #f2dec0;
    font-weight: 700;
  }

  .limit-door {
    width: min(200px, 96%);
  }

  .players {
    order: 2;
    padding: 0;
    gap: 8px;
    align-content: flex-start;
  }

  .player-slot-bottom-center {
    order: 0;
  }

  .player-card {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    padding: 8px;
  }

  .player-avatar {
    width: 40px;
    height: 40px;
  }

  .hearts {
    padding-right: 0;
    min-height: 0;
    flex-wrap: wrap;
    justify-content: center;
  }

  .heart-mini {
    width: 56px;
    height: 84px;
  }

  .heart-mini.rested {
    transform: rotate(90deg) translate(16px, -14px);
  }

  .hand {
    min-height: 72px;
  }

  .hand .num,
  .hand .back {
    width: 38px;
    height: 52px;
    margin-left: -11px;
    transform-origin: center 100px;
  }

  .result-modal {
    padding: 10px;
  }

  .result-card,
  .rules-card,
  .reveal-card {
    width: 100%;
    max-height: 92vh;
    overflow: auto;
  }

  .rules-body {
    max-height: none;
  }

  #roundResultModal .result-head {
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-direction: column;
  }

  #roundResultModal .result-summary {
    text-align: center;
  }

  #roundResultModal .result-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
  }

  #roundResultModal .result-player {
    text-align: center;
  }

  #roundResultModal .result-row .score {
    margin-left: 0;
  }

  #roundResultModal #resultNextBtn {
    display: block;
    margin: 0 auto;
  }

  #gameOverOverlay .winner-card,
  #gameOverOverlay .winner-kicker,
  #gameOverOverlay .winner-name {
    text-align: center;
  }

  #gameOverOverlay .winner-actions {
    justify-items: center;
  }
}

@media (max-width: 420px) {
  .field>span {
    font-size: 17px;
  }

  .toggle-picker button {
    padding: 8px 6px;
  }

  .center-action,
  .pass-btn-side {
    width: 100%;
    min-height: 46px;
  }

  .deck-pile {
    width: 100%;
  }

  .draw-overlay-btn {
    width: 100%;
    min-height: 52px;
    font-size: 14px;
  }

  .limit-door strong {
    font-size: clamp(46px, 16vw, 62px);
  }

  .action-option {
    gap: 10px;
    padding: 10px;
  }
}
