:root {
  color-scheme: dark;
  --game-scale: 1;
  --game-width: 420px;
  --game-height: 880px;
  --ink: #f6f2e7;
  --muted: #a9c4bf;
  --felt: #104342;
  --felt-deep: #071e22;
  --panel: rgba(5, 35, 39, 0.9);
  --gold: #f0d48e;
  --red: #c74e46;
  --green: #208878;
  --paper: #f3ecd7;
  --black: #14201e;
}

* { box-sizing: border-box; }

html, body { margin: 0; width: 100%; height: 100%; min-height: 100%; background: #061619; }

body {
  min-width: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(38, 126, 116, .22), transparent 34rem),
    linear-gradient(145deg, #061619, #09292c 55%, #041215);
}

button { font: inherit; touch-action: manipulation; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.preview-shell {
  width: 100%;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  display: grid;
  grid-template-columns: max-content minmax(260px, 390px);
  gap: clamp(26px, 5vw, 76px);
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
}

.phone-frame {
  width: var(--game-width);
  height: var(--game-height);
  min-width: 0;
  min-height: 0;
}

.phone {
  position: relative;
  width: 420px;
  height: 880px;
  overflow: hidden;
  border: 1px solid rgba(240, 212, 142, .25);
  border-radius: 32px;
  background:
    repeating-linear-gradient(-8deg, transparent 0 44px, rgba(255,255,255,.022) 44px 46px),
    var(--felt);
  box-shadow: 0 35px 90px rgba(0,0,0,.52), inset 0 0 0 7px rgba(2,21,23,.72);
  padding: 14px 18px 10px;
  display: grid;
  grid-template-rows: 52px 126px minmax(240px, 1fr) 130px 116px;
  gap: 8px;
  transform: scale(var(--game-scale));
  transform-origin: top left;
}

.app-bar, .name-row, .player-head, .zone-title { display: flex; align-items: center; justify-content: space-between; }
h1, h2, p { margin: 0; }
h1 { font-size: 22px; letter-spacing: -.04em; }
.eyebrow { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.wallet { text-align: right; display: grid; gap: 3px; }
.wallet strong { font-size: 13px; }
.wallet span { font-size: 9px; color: #8bd0c3; }
.wallet i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #58c5a9; box-shadow: 0 0 9px #58c5a9; }

.main-menu-screen { position: absolute; inset: 0; z-index: 38; padding: 82px 34px 24px; display: flex; flex-direction: column; align-items: center; background: radial-gradient(circle at 50% 18%, #175b57 0, #0b3436 42%, #06191c 100%); text-align: center; }
.main-menu-screen.hidden { display: none; }
.main-menu-screen h2 { margin-top: 8px; font-size: 38px; letter-spacing: -.06em; }
.main-subtitle { margin-top: 5px; color: var(--muted); font-size: 12px; }
.main-card-fan { position: relative; width: 228px; height: 188px; margin-top: 24px; }
.main-card-fan img { position: absolute; top: 18px; left: 78px; width: 72px; height: 108px; object-fit: contain; filter: drop-shadow(0 12px 12px rgba(0,0,0,.38)); }
.main-card-fan img:first-child { transform: translate(-58px,18px) rotate(-11deg); }
.main-card-fan img:nth-child(2) { z-index: 2; transform: translateY(-2px); }
.main-card-fan img:last-child { transform: translate(58px,18px) rotate(11deg); }
.main-profile { width: 100%; min-height: 70px; padding: 13px 17px; display: grid; grid-template-columns: 1fr 1fr; text-align: left; }
.main-profile strong { color: var(--gold); font-size: 15px; }
.main-profile span { text-align: right; font-size: 12px; }
.main-profile small { grid-column: 1 / -1; margin-top: 8px; color: #8bd0c3; text-align: center; font-size: 9px; }
.main-actions { width: 100%; margin-top: 20px; display: grid; gap: 10px; }
.main-actions button { width: 100%; min-height: 62px; border: 0; border-radius: 16px; color: white; font-size: 17px; font-weight: 900; cursor: pointer; box-shadow: 0 8px 18px rgba(0,0,0,.26); }
.main-actions button small { display: block; margin-top: 3px; color: #d5e6e2; font-size: 9px; }
.online-button { background: #215b7e; }
.rules-button { min-height: 50px !important; background: #4f4a44; font-size: 13px !important; }
.main-legal { margin-top: auto; color: #729d96; font-size: 8px; }
.rules-guide-dialog { max-height: 82%; padding: 22px 18px; text-align: left; overflow-y: auto; }
#rulesGuide { z-index: 45; }
.rule-book-grid { margin-top: 18px; display: grid; gap: 9px; }
.rule-book-grid section { padding: 11px; border-radius: 12px; background: rgba(255,255,255,.05); }
.rule-book-grid strong { color: var(--gold); font-size: 12px; }
.rule-book-grid p { margin-top: 5px; font-size: 10px; }

.panel { border: 1px solid rgba(255,255,255,.08); background: var(--panel); border-radius: 17px; }
.opponent { position: relative; padding: 10px 14px; display: grid; grid-template-columns: 42px 1fr; gap: 10px; overflow: hidden; }
.avatar { width: 40px; height: 40px; border-radius: 13px; background: #ead08b; color: #183330; display: grid; place-items: center; font-weight: 900; }
.opponent-copy { min-width: 0; }
.name-row { gap: 8px; }
.name-row strong { font-size: 14px; }
.name-row span { color: var(--gold); font-size: 12px; }
.opponent-name-button { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 0; border: 0; background: transparent; color: white; cursor: pointer; }
.opponent-name-button strong { white-space: nowrap; }
.opponent-name-button small { padding: 2px 5px; border: 1px solid rgba(240,212,142,.24); border-radius: 999px; color: var(--gold); font-size: 8px; font-weight: 800; }
.opponent-name-button:hover small, .opponent-name-button:focus-visible small { background: rgba(240,212,142,.13); }
.opponent-name-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 5px; }
.opponent-copy p { max-width: 176px; margin-top: 5px; color: var(--muted); font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opponent-copy p.fallback { color: #ffd08b; }
.opponent-hand { position: absolute; right: 10px; top: 47px; width: 116px; height: 38px; }
.mini-back { position: absolute; width: 24px; height: 36px; border-radius: 4px; background: url("assets/hwatu/card_back_crimson_v2.png") center / contain no-repeat; box-shadow: -2px 0 4px rgba(0,0,0,.25); }

.table-zone { position: relative; min-height: 0; padding: 0 5px; }
.zone-title { height: 24px; color: var(--muted); font-size: 11px; font-weight: 750; }
.field { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-right: 54px; align-content: start; }
.field.dense { grid-template-columns: repeat(6, 1fr); gap: 6px; }
.field.dense .game-card { border-radius: 6px; }
.field-drop-slot { visibility: hidden; box-shadow: none; pointer-events: none; }
.deck { position: absolute; right: 3px; bottom: 3px; display: grid; justify-items: center; gap: 2px; transform: scale(.72); transform-origin: bottom right; }
.deck span { font-size: 11px; color: var(--muted); }

.game-card {
  position: relative;
  aspect-ratio: 2 / 3;
  min-width: 0;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  box-shadow: 0 3px 8px rgba(0,0,0,.28);
  display: block;
  cursor: default;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.card-art { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; }

button.game-card { cursor: pointer; }
button.game-card:hover, button.game-card:focus-visible { transform: translateY(-7px); outline: none; box-shadow: 0 9px 18px rgba(0,0,0,.38), 0 0 0 3px var(--gold); }
.game-card.match-choice { animation: choicePulse 1s infinite alternate; cursor: pointer; }
.card-back { width: 48px; height: 72px; border-radius: 7px; background: url("assets/hwatu/card_back_crimson_v2.png") center / contain no-repeat; box-shadow: 0 4px 9px rgba(0,0,0,.28); }

.player { position: relative; padding: 10px 14px; }
.player-head > div { display: flex; align-items: baseline; gap: 10px; }
.me { font-size: 17px; font-weight: 900; }
.player-head strong { color: var(--gold); font-size: 14px; }
.player-head > span { font-size: 10px; color: var(--muted); }
.player > p { margin-top: 5px; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.capture-strip {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  cursor: pointer;
  appearance: none;
}

.opponent-strip { position: absolute; left: 66px; right: 132px; bottom: 5px; height: 70px; }
.player-strip { margin-top: 7px; width: 100%; height: 86px; }
.capture-pile {
  position: relative;
  min-width: 0;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.055);
  overflow: hidden;
  box-shadow: none;
}
.capture-pile.kind-bright { background: rgba(240,212,142,.09); }
.capture-pile.kind-animal { background: rgba(79,142,118,.11); }
.capture-pile.kind-ribbon { background: rgba(196,78,70,.09); }
.capture-mini-card { position: absolute; top: 2px; width: 46px; height: 69px; object-fit: contain; filter: none; }
.player-strip .capture-mini-card { width: 54px; height: 81px; }
.capture-empty-slot { display: none; }
.capture-strip:hover .capture-pile, .capture-strip:focus-visible .capture-pile { background-color: rgba(240,212,142,.11); }
.capture-strip:focus-visible { outline: none; }

.flight-layer { position: absolute; inset: 0; z-index: 24; pointer-events: none; overflow: hidden; }
.opening-deal-flight { position: absolute; z-index: 3; filter: drop-shadow(0 10px 10px rgba(0,0,0,.44)); will-change: transform, opacity; }
.opening-deal-flight .game-card, .opening-deal-back { width: 100%; height: 100%; }
.opening-deal-back { border-radius: 8px; background: url("assets/hwatu/card_back_crimson_v2.png") center / contain no-repeat; box-shadow: 0 4px 10px rgba(0,0,0,.34); }
.flying-stack { position: absolute; width: 62px; height: 93px; filter: drop-shadow(0 12px 12px rgba(0,0,0,.42)); isolation: isolate; will-change: transform; }
.flying-stack .game-card { width: 100%; height: 100%; }
.flying-stack .capture-flight-card { position: absolute; width: 100%; height: 100%; will-change: transform; }
.flying-stack .capture-flight-card[data-capture-layer="top"] { filter: drop-shadow(0 5px 5px rgba(0,0,0,.38)); }
.flying-stack.draw-flight { width: 72px; height: 108px; perspective: 700px; }
.flight-flip-card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.flight-face { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flight-front { transform: rotateY(180deg); }
.flight-back { border-radius: 8px; background: url("assets/hwatu/card_back_crimson_v2.png") center / contain no-repeat; box-shadow: 0 8px 18px rgba(0,0,0,.42); }
.phone.animating .capture-strip, .phone.animating .hand { pointer-events: none; }
.phone.impact .table-zone { animation: tableImpact .17s cubic-bezier(.22,.9,.3,1); }

.event-callout { position: absolute; inset: 0; z-index: 29; display: grid; place-items: center; padding: 34px; pointer-events: none; overflow: hidden; }
.event-callout.hidden { display: none; }
.event-callout-card {
  position: relative;
  width: 100%;
  min-height: 144px;
  border: 4px solid #f6c746;
  border-radius: 24px;
  background: #14685b;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 14px 0 #071e22;
  transform-origin: center;
  animation: eventBurst .82s cubic-bezier(.16,.86,.24,1) both;
}
.event-callout-card::before, .event-callout-card::after {
  content: "";
  position: absolute;
  top: 27px;
  width: 72px;
  height: 70px;
  border-top: 5px solid #f6c746;
  border-bottom: 5px solid #f6c746;
}
.event-callout-card::before { left: -82px; transform: skewY(12deg); }
.event-callout-card::after { right: -82px; transform: skewY(-12deg); }
.event-callout.is-opponent .event-callout-card { border-color: #ee5b4b; background: #802b2a; }
.event-callout.is-opponent .event-callout-card::before, .event-callout.is-opponent .event-callout-card::after { border-color: #ee5b4b; }
.event-callout-card span { color: #f6c746; font-size: 9px; font-weight: 950; letter-spacing: .16em; }
.event-callout.is-opponent .event-callout-card span { color: #ffd0c9; }
.event-callout-card strong { margin-top: 7px; font-size: 42px; line-height: 1; letter-spacing: -.06em; text-shadow: 0 4px 0 #083d36; }
.event-callout.is-opponent .event-callout-card strong { text-shadow: 0 4px 0 #491615; }
.event-callout-card small { margin-top: 12px; font-size: 12px; font-weight: 850; }

.hand { position: relative; height: 132px; }
.hand .game-card { position: absolute; top: 2px; width: 74px; height: 111px; }
.hand .game-card:nth-child(even) { top: 7px; }
.hand .game-card.pending-hand-card { transform: scale(1.2); transform-origin: center bottom; z-index: 20; }

.overlay { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0,12,14,.68); backdrop-filter: blur(5px); padding: 26px; }
.hidden { display: none; }
.dialog { width: 100%; border-radius: 24px; border: 1px solid rgba(240,212,142,.25); background: #071f23; padding: 26px 22px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.dialog-kicker { color: var(--gold); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.dialog h2 { margin-top: 8px; font-size: 26px; }
.dialog p { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.capture-dialog { padding: 20px 16px 18px; text-align: left; max-height: 82%; overflow: auto; }
.capture-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; }
.capture-dialog h2 { margin-top: 4px; font-size: 22px; }
.capture-dialog > p { margin-top: 5px; }
.close-button { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.14); border-radius: 11px; background: rgba(255,255,255,.07); color: white; font-size: 24px; line-height: 1; cursor: pointer; }
.opponent-setup-dialog { padding: 21px 18px 18px; text-align: left; }
.opponent-setup-dialog h2 { margin-top: 4px; font-size: 24px; }
.setup-section { margin: 18px 0 0; padding: 0; border: 0; }
.setup-section legend { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.mode-grid, .difficulty-grid { display: grid; gap: 7px; }
.mode-grid { grid-template-columns: 1fr 1fr; }
.difficulty-grid { grid-template-columns: repeat(3, 1fr); }
.setup-option { position: relative; min-width: 0; cursor: pointer; }
.setup-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.setup-option > span { min-height: 58px; padding: 10px 8px; display: grid; place-content: center; text-align: center; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.045); transition: border-color .15s ease, background .15s ease, transform .15s ease; }
.setup-option strong { font-size: 12px; }
.setup-option small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.setup-option input:checked + span { border-color: var(--gold); background: rgba(240,212,142,.13); box-shadow: inset 0 0 0 1px rgba(240,212,142,.18); }
.setup-option input:focus-visible + span { outline: 2px solid white; outline-offset: 2px; }
.setup-option:hover > span { transform: translateY(-1px); }
.difficulty-option > span { min-height: 54px; }
.difficulty-help { min-height: 18px; margin-top: 13px !important; color: #d9e7e3 !important; text-align: center; }
.matchmaking-status { min-height: 34px; margin-top: 4px !important; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.04); text-align: center; font-size: 10px !important; }
.matchmaking-status[data-tone="searching"] { color: var(--gold); animation: statusPulse .8s ease-in-out infinite alternate; }
.matchmaking-status[data-tone="fallback"] { color: #ffd08b; background: rgba(199,78,70,.12); }
.matchmaking-status[data-tone="connected"] { color: #8ee2cf; background: rgba(32,136,120,.14); }
.setup-start { min-height: 54px; margin-top: 10px; font-size: 15px; }
.setup-start:disabled { cursor: wait; opacity: .58; }
.capture-groups { margin-top: 15px; display: grid; gap: 9px; }
.capture-group { min-height: 92px; border-radius: 14px; padding: 9px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.07); }
.capture-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.capture-group-head strong { font-size: 11px; color: var(--gold); }
.capture-group-head span { font-size: 9px; color: var(--muted); }
.capture-card-row { display: flex; min-height: 61px; overflow-x: auto; padding: 1px 2px 4px; scrollbar-width: thin; }
.capture-card-row .game-card { width: 40px; min-width: 40px; height: 60px; margin-right: -12px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0,0,0,.38); }
.capture-card-row .game-card:last-child { margin-right: 0; }
.capture-empty { color: #678b85; font-size: 10px; align-self: center; }
.decision-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.primary, .danger { min-height: 64px; border: 0; border-radius: 16px; color: white; font-weight: 900; font-size: 19px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.28); }
.primary { background: var(--green); }
.danger { background: var(--red); }
.primary small, .danger small { display: block; margin-top: 3px; font-size: 9px; color: #d8e6e2; }
.wide { width: 100%; margin-top: 20px; }
.settlement { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.settlement div { background: rgba(255,255,255,.055); border-radius: 10px; padding: 10px 4px; }
.settlement strong { display: block; color: var(--gold); font-size: 17px; }
.settlement span { font-size: 8px; color: var(--muted); }

#interstitialAd.interstitial-ad {
  z-index: 70;
  padding: 14px;
  background: #081c20;
  backdrop-filter: none;
}
.interstitial-ad-shell {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 14px;
  border: 2px solid #c79b3a;
  border-radius: 18px;
  background: #102f31;
  box-shadow: inset 0 0 0 4px #061719;
}
.interstitial-ad-head { display: flex; align-items: center; justify-content: space-between; }
.interstitial-ad-head span {
  color: #f0d48e;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}
.interstitial-ad-head button {
  min-width: 58px;
  min-height: 38px;
  border: 1px solid #d6b15a;
  border-radius: 999px;
  color: #fff7dd;
  background: #432112;
  font-weight: 900;
  cursor: pointer;
}
.interstitial-ad-creative {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 24px;
  border: 3px solid #dfbd68;
  border-radius: 16px;
  color: #fff8e3;
  background: linear-gradient(145deg, #6f1615, #2d0907 54%, #08463d 55%, #062a26);
  text-align: center;
}
.interstitial-ad-mark {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border: 2px solid #f1cf78;
  border-radius: 50%;
  color: #2b1308;
  background: #f0cc70;
  font-size: 22px;
  font-weight: 950;
}
.interstitial-ad-creative strong { font-size: clamp(27px, 8cqw, 38px); }
.interstitial-ad-creative p { max-width: 260px; margin: 0; color: #eee2c4; font-size: 12px; line-height: 1.6; }
.interstitial-ad-caption { margin: 0; color: #b8cec8; font-size: 10px; text-align: center; }

.build-note { align-self: center; }
.build-note h2 { margin-top: 13px; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.05em; line-height: 1.18; }
.build-note ul { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 15px; }
.build-note li { color: #c6d8d4; font-size: 14px; display: flex; align-items: center; gap: 12px; }
.build-note li span { color: var(--gold); font-size: 10px; font-weight: 900; border: 1px solid rgba(240,212,142,.3); border-radius: 999px; padding: 5px 7px; }
.hint { margin-top: 28px; color: #7fa9a1; font-size: 12px; }

@keyframes choicePulse { from { box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(0,0,0,.3); } to { box-shadow: 0 0 0 5px #ff6a59, 0 7px 18px rgba(0,0,0,.45); } }
@keyframes tableImpact {
  0% { transform: translateY(0) scale(1); filter: brightness(1); }
  36% { transform: translateY(4px) scale(.992); filter: brightness(1.3); }
  68% { transform: translateY(-2px) scale(1.004); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
@keyframes statusPulse { from { opacity: .64; } to { opacity: 1; } }
@keyframes eventBurst {
  0% { transform: translateX(-120%) skewX(-10deg) scale(.5); }
  18% { transform: translateX(0) skewX(2deg) scale(1.16); }
  34% { transform: skewX(-1deg) scale(.96); }
  50% { transform: skewX(0) scale(1.04); }
  68% { transform: scale(1); }
  100% { transform: translateY(-34px) scale(.94); }
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .preview-shell {
    grid-template-columns: 1fr;
    place-items: stretch;
    padding: 0;
  }
  .phone-frame { width: 100%; height: 100%; }
  .phone {
    width: 100%;
    height: 100%;
    padding:
      max(14px, env(safe-area-inset-top, 0px))
      max(18px, env(safe-area-inset-right, 0px))
      max(10px, env(safe-area-inset-bottom, 0px))
      max(18px, env(safe-area-inset-left, 0px));
    border-radius: 0;
    border: 0;
    box-shadow: none;
    transform: none;
  }
  .build-note { display: none; }
}

@media (max-width: 760px) and (max-height: 720px),
       (hover: none) and (pointer: coarse) and (max-height: 720px) {
  .phone {
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      max(14px, env(safe-area-inset-right, 0px))
      max(8px, env(safe-area-inset-bottom, 0px))
      max(14px, env(safe-area-inset-left, 0px));
    grid-template-rows: 46px 110px minmax(0, 1fr) 108px 96px;
    gap: 6px;
  }
  .field { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .field.dense { grid-template-columns: repeat(6, 1fr); }
  .opponent { padding: 8px 12px; }
  .opponent-strip { left: 62px; right: 126px; bottom: 4px; height: 58px; }
  .capture-mini-card { width: 40px; height: 60px; }
  .player { padding: 7px 10px; }
  .player-strip { height: 68px; margin-top: 5px; }
  .player-strip .capture-mini-card { width: 43px; height: 64px; }
  .hand { height: 100%; }
  .hand .game-card { width: 62px; height: 93px; }
}

@media (max-width: 760px) and (max-height: 620px),
       (hover: none) and (pointer: coarse) and (max-height: 620px) {
  .phone {
    grid-template-rows: 40px 96px minmax(0, 1fr) 94px 82px;
    gap: 4px;
  }
  .opponent-strip { left: 58px; right: 112px; height: 48px; }
  .player-strip { height: 56px; }
  .capture-mini-card { width: 34px; height: 51px; }
  .player-strip .capture-mini-card { width: 37px; height: 55px; }
  .hand .game-card { width: 54px; height: 81px; }
}

@media (min-width: 761px) and (max-height: 620px) {
  .preview-shell {
    grid-template-columns: 1fr;
    place-items: center;
    padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
  .build-note { display: none; }
}

/* 1.6.1 · 어르신 가독성 + 군용 모포 화투판 */
:root {
  --ink: #fffdf2;
  --muted: #e0e4cd;
  --felt: #3d4f32;
  --felt-deep: #172117;
  --panel: rgba(18, 31, 19, .96);
  --gold: #ffda73;
  --red: #c74234;
  --green: #607f42;
  --khaki: #c9b37a;
  --stitch: #9f3e33;
}

body {
  font-weight: 650;
  background:
    radial-gradient(circle at 22% 8%, rgba(126, 145, 82, .22), transparent 30rem),
    linear-gradient(145deg, #11180f, #283521 54%, #0c130b);
}

.phone {
  grid-template-rows: 64px 136px minmax(220px, 1fr) 138px 122px;
  gap: 8px;
  padding: 12px 15px 8px;
  border: 3px solid #776741;
  border-radius: 24px;
  background-color: var(--felt);
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.028) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(-8deg, transparent 0 54px, rgba(201,179,122,.075) 54px 56px),
    radial-gradient(circle at 18% 10%, rgba(133,154,91,.24), transparent 48%);
  box-shadow:
    0 28px 80px rgba(0,0,0,.58),
    inset 0 0 0 5px #26331f,
    inset 0 0 0 7px rgba(220,196,132,.28);
}

.app-bar {
  min-width: 0;
  padding: 3px 6px 5px;
  border-bottom: 2px dashed rgba(255,218,115,.52);
}

h1 {
  margin-top: 1px;
  font-size: 27px;
  line-height: 1;
  letter-spacing: -.055em;
  text-shadow: 0 2px 0 rgba(0,0,0,.52);
}

.eyebrow {
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .13em;
}

.wallet {
  min-width: 112px;
  padding: 6px 9px;
  gap: 2px;
  border: 2px solid rgba(201,179,122,.72);
  border-radius: 8px;
  background: #26331f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 3px 0 rgba(0,0,0,.24);
}

.wallet strong { color: white; font-size: 16px; line-height: 1.1; }
.wallet span { color: #cce6bd; font-size: 11px; font-weight: 850; }
.wallet i { width: 8px; height: 8px; background: #8fd36c; box-shadow: 0 0 7px #8fd36c; }

.panel {
  border: 2px solid var(--khaki);
  border-radius: 13px;
  background:
    linear-gradient(100deg, rgba(255,255,255,.025), transparent 38%),
    var(--panel);
  box-shadow: 0 5px 0 rgba(16,22,13,.42), inset 0 0 0 2px rgba(255,255,255,.035);
}

.opponent {
  padding: 11px 12px;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  border-left: 6px solid var(--stitch);
}

.avatar {
  width: 48px;
  height: 48px;
  border: 3px solid #fff0b8;
  border-radius: 50%;
  background: var(--gold);
  color: #172117;
  font-size: 20px;
  box-shadow: 0 3px 0 #806a31;
}

.name-row { gap: 7px; }
.name-row strong { font-size: 18px; }
.name-row span { color: var(--gold); font-size: 16px; font-weight: 950; white-space: nowrap; }
.opponent-name-button { min-height: 38px; gap: 6px; }
.opponent-name-button small {
  padding: 5px 7px;
  border: 2px solid var(--khaki);
  border-radius: 7px;
  color: #fff3bf;
  font-size: 11px;
  background: #3d4b2b;
}

.opponent-copy p {
  max-width: 205px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.opponent-hand { right: 10px; top: 62px; width: 126px; height: 44px; }
.mini-back { width: 28px; height: 42px; border-radius: 4px; box-shadow: -2px 1px 0 rgba(0,0,0,.48); }
.opponent-strip { left: 70px; right: 142px; bottom: 7px; height: 57px; }

.table-zone { padding: 0 4px; }
.zone-title {
  height: 28px;
  color: #fffce9;
  font-size: 15px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(0,0,0,.48);
}
.zone-title span:last-child {
  padding: 3px 7px;
  border-radius: 6px;
  color: #1b2417;
  background: var(--gold);
  text-shadow: none;
}

.field { gap: 8px; padding-right: 50px; }
.game-card { border-radius: 7px; box-shadow: 0 4px 0 #161b12, 0 7px 12px rgba(0,0,0,.3); }
button.game-card:hover, button.game-card:focus-visible {
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 8px 0 #161b12, 0 0 0 4px var(--gold);
}
.card-back { width: 52px; height: 78px; border: 2px solid #e3b44c; box-shadow: 0 4px 0 #171b12; }
.deck { right: 0; bottom: 4px; transform: none; }
.deck span { color: white; font-size: 14px; font-weight: 950; text-shadow: 0 2px #000; }

.capture-strip { gap: 5px; min-height: 44px; }
.capture-pile {
  border: 1px solid rgba(201,179,122,.42);
  border-radius: 7px;
  background: rgba(255,255,255,.075);
  box-shadow: inset 0 0 7px rgba(0,0,0,.25);
}
.capture-pile::after {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 5;
  padding: 2px 4px;
  border-radius: 4px;
  color: #fff8d7;
  background: rgba(8,14,8,.82);
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
}
.capture-pile.kind-bright::after { content: "광"; }
.capture-pile.kind-animal::after { content: "열끗"; }
.capture-pile.kind-ribbon::after { content: "띠"; }
.capture-pile.kind-junk::after { content: "피"; }
.capture-pile.kind-bright { background: rgba(255,218,115,.15); }
.capture-pile.kind-animal { background: rgba(137,167,91,.17); }
.capture-pile.kind-ribbon { background: rgba(199,66,52,.17); }
.capture-pile.kind-junk { background: rgba(255,255,255,.085); }
.capture-mini-card { filter: drop-shadow(1px 2px 1px rgba(0,0,0,.42)); }

.player {
  padding: 10px 12px;
  border-left: 6px solid var(--gold);
}
.player-head > div { gap: 9px; }
.me { font-size: 22px; }
.player-head strong { color: var(--gold); font-size: 18px; }
.player-head > span { color: #fffce9; font-size: 13px; font-weight: 900; }
.player-strip { height: 88px; margin-top: 7px; }
.hand { --hand-card-width: 78px; height: 100%; }
.hand .game-card { width: var(--hand-card-width); height: calc(var(--hand-card-width) * 1.5); }

.main-menu-screen {
  padding: 72px 28px 22px;
  background-color: var(--felt);
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.02) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.03) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 50% 17%, #637949 0, #35462c 43%, #192218 100%);
  box-shadow: inset 0 0 0 8px #26331f, inset 0 0 0 10px rgba(201,179,122,.55);
}
.main-menu-screen::before {
  content: "추억의 모포 화투판";
  margin-bottom: 3px;
  padding: 5px 12px;
  border: 2px dashed #e6c76f;
  color: #fff0b6;
  background: rgba(33,45,26,.78);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
}
.main-menu-screen h2 { margin-top: 7px; color: #fffdf2; font-size: 42px; text-shadow: 0 4px 0 #1d2818; }
.main-subtitle { margin-top: 7px; color: #f5edcb; font-size: 16px; font-weight: 800; }
.main-card-fan { height: 178px; margin-top: 16px; }
.main-card-fan img { width: 78px; height: 117px; filter: drop-shadow(0 9px 0 rgba(20,25,15,.78)); }
.main-profile { min-height: 78px; padding: 14px 16px; }
.main-profile strong { color: var(--gold); font-size: 19px; }
.main-profile span { font-size: 16px; font-weight: 900; }
.main-profile small { color: #eef0d8; font-size: 12px; }
.main-actions { margin-top: 14px; gap: 9px; }
.main-actions button {
  min-height: 68px;
  border: 2px solid #f3d47a;
  border-radius: 10px;
  font-size: 21px;
  box-shadow: 0 5px 0 #182015;
}
.main-actions button small { margin-top: 3px; color: #fffbe8; font-size: 12px; }
.primary { background: #57783d; }
.online-button { background: #4d6654; }
.rules-button { min-height: 54px !important; background: #6b4a35; font-size: 17px !important; }
.main-legal { color: #d7dac4; font-size: 11px; }

.overlay { background: rgba(11,16,9,.82); backdrop-filter: blur(3px); padding: 18px; }
.dialog { border: 3px solid var(--khaki); border-radius: 14px; background: #1d291b; box-shadow: 0 8px 0 #0b1009; }
.dialog-kicker { font-size: 12px; }
.dialog h2 { font-size: 30px; }
.dialog p { font-size: 16px; line-height: 1.55; }
.close-button { width: 48px; height: 48px; border: 2px solid var(--khaki); border-radius: 8px; font-size: 32px; }
.setup-section legend { font-size: 14px; }
.setup-option > span { min-height: 70px; border: 2px solid rgba(255,255,255,.18); border-radius: 9px; }
.setup-option strong { font-size: 16px; }
.setup-option small { font-size: 12px; }
.difficulty-help, .matchmaking-status { font-size: 14px !important; }
.setup-start { min-height: 62px; font-size: 19px; }
.rule-book-grid strong { font-size: 17px; }
.rule-book-grid p { font-size: 14px; }
.capture-group-head strong { font-size: 15px; }
.capture-group-head span, .capture-empty { font-size: 13px; }
.primary, .danger { border: 2px solid #f1d078; border-radius: 10px; font-size: 22px; }
.primary small, .danger small { font-size: 12px; }

.event-callout-card { border-radius: 12px; background: #526f39; box-shadow: 0 8px 0 #182015; }
.event-callout-card span { font-size: 12px; }

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .phone {
    padding:
      max(10px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      max(7px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
    border: 0;
    border-radius: 0;
    box-shadow: inset 0 0 0 5px #26331f, inset 0 0 0 7px rgba(201,179,122,.28);
  }
}

@media (max-width: 760px) and (max-height: 720px),
       (hover: none) and (pointer: coarse) and (max-height: 720px) {
  .phone { grid-template-rows: 54px 112px minmax(0, 1fr) 112px 96px; gap: 6px; }
  h1 { font-size: 22px; }
  .wallet { min-width: 98px; padding: 4px 7px; }
  .wallet strong { font-size: 13px; }
  .wallet span { font-size: 9px; }
  .opponent { padding: 7px 9px; grid-template-columns: 43px 1fr; }
  .avatar { width: 40px; height: 40px; font-size: 17px; }
  .name-row strong { font-size: 15px; }
  .name-row span { font-size: 13px; }
  .opponent-copy p { font-size: 10px; }
  .opponent-hand { top: 53px; }
  .opponent-strip { left: 60px; right: 132px; height: 48px; }
  .zone-title { height: 24px; font-size: 13px; }
  .field { grid-template-columns: repeat(5, 1fr); }
  .player { padding: 7px 9px; }
  .me { font-size: 18px; }
  .player-head strong { font-size: 15px; }
  .player-strip { height: 66px; margin-top: 4px; }
  .hand { --hand-card-width: 62px; }
  .main-menu-screen { padding: 24px 24px 14px; }
  .main-menu-screen h2 { font-size: 34px; }
  .main-card-fan { height: 112px; margin-top: 8px; }
  .main-card-fan img { top: 4px; width: 60px; height: 90px; }
  .main-profile { min-height: 62px; padding: 9px 13px; }
  .main-actions { margin-top: 8px; gap: 6px; }
  .main-actions button { min-height: 54px; font-size: 18px; }
  .rules-button { min-height: 46px !important; }
}

@media (max-width: 760px) and (max-height: 620px),
       (hover: none) and (pointer: coarse) and (max-height: 620px) {
  .phone { grid-template-rows: 48px 98px minmax(0, 1fr) 96px 84px; gap: 4px; }
  .app-bar { padding-top: 0; }
  .eyebrow { font-size: 9px; }
  h1 { font-size: 20px; }
  .opponent-name-button { min-height: 32px; }
  .opponent-hand { top: 45px; }
  .opponent-strip { left: 56px; right: 116px; height: 43px; bottom: 4px; }
  .capture-pile::after { font-size: 8px; }
  .zone-title { height: 21px; font-size: 12px; }
  .player-strip { height: 55px; }
  .hand { --hand-card-width: 54px; }
  .main-menu-screen::before { display: none; }
  .main-menu-screen h2 { font-size: 30px; }
  .main-subtitle { font-size: 13px; }
  .main-card-fan { height: 88px; }
  .main-card-fan img { width: 52px; height: 78px; }
  .main-actions button { min-height: 48px; font-size: 16px; }
  .main-actions button small { font-size: 10px; }
  .main-legal { font-size: 9px; }
}

/* Uploaded lacquered-wood lobby resource composition. */
.game-title-group { display: flex; align-items: center; gap: 8px; }
.game-home-button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid #d7a84d;
  border-radius: 50%;
  color: #fff2bf;
  background: linear-gradient(#7c351d, #32140d);
  font-size: 19px;
  font-weight: 900;
  line-height: 28px;
  cursor: pointer;
  box-shadow: 0 3px 0 #120806;
}
.game-home-button:hover, .game-home-button:focus-visible { outline: 2px solid #fff2bf; outline-offset: 2px; transform: translateY(-1px); }

.main-menu-screen {
  inset: 0;
  z-index: 50;
  padding: 0 !important;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(124,47,22,.35), transparent 55%),
    #140805;
  box-shadow: none;
}
.main-menu-screen::before { content: none !important; display: none !important; }
.main-menu-screen.hidden { display: none; }
.lobby-artboard {
  position: relative;
  width: 100%;
  aspect-ratio: 941 / 1672;
  max-height: 100%;
  overflow: hidden;
  filter: drop-shadow(0 14px 28px rgba(0,0,0,.58));
}
.lobby-artboard > img, .lobby-artboard img { display: block; user-select: none; -webkit-user-drag: none; }
.lobby-frame-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.lobby-floral-ornament {
  position: absolute;
  z-index: 2;
  left: 4%;
  top: 7.6%;
  width: 92%;
  height: 19%;
  object-fit: contain;
  pointer-events: none;
}
.lobby-title-plaque { position: absolute; z-index: 2; top: 2.6%; left: 6%; width: 88%; height: auto; }
.lobby-brand-line { position: absolute; z-index: 2; top: 12.4%; left: 17%; width: 66%; height: auto; }
.lobby-main-title { position: absolute; z-index: 3; top: 15.1%; left: 12.5%; width: 75%; height: auto; filter: drop-shadow(0 5px 2px rgba(0,0,0,.58)); }
.lobby-main-subtitle { position: absolute; z-index: 3; top: 25.6%; left: 18%; width: 64%; height: auto; }
.lobby-main-stamp { position: absolute; z-index: 4; top: 20.6%; right: 8.5%; width: 9.5%; height: auto; }

.lobby-hero-card {
  z-index: 5;
  object-fit: contain;
  transform-origin: 50% 92%;
  filter: drop-shadow(0 8px 5px rgba(0,0,0,.58));
  pointer-events: none;
}
.hero-plum { z-index: 6; }

.main-profile-frame { z-index: 4; object-fit: fill; pointer-events: none; }
.main-stat-coins, .main-stat-record {
  z-index: 5;
  display: flex;
  align-items: center;
  color: #fff4bd;
  font-family: Georgia, "Apple SD Gothic Neo", serif;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 3px 0 #34150c, 0 0 7px rgba(255,202,86,.25);
  white-space: nowrap;
}
.main-stat-record { justify-content: center; color: #fff; text-align: center; }
.fairness-copy { z-index: 5; object-fit: contain; pointer-events: none; }

.main-menu-screen .main-actions { position: absolute; z-index: 6; inset: 0; width: 100%; height: 100%; margin: 0; display: block; pointer-events: none; }
.main-menu-screen .lobby-menu-button {
  position: absolute;
  aspect-ratio: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  cursor: pointer;
  box-shadow: none;
  pointer-events: auto;
  transition: transform .16s ease, filter .16s ease;
}
.lobby-menu-board { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.lobby-menu-copy, .lobby-menu-decoration { z-index: 8; object-fit: contain; pointer-events: none; filter: drop-shadow(0 3px 2px rgba(0,0,0,.45)); }
.lobby-menu-decoration { z-index: 9; }
.main-menu-screen .lobby-menu-button:hover, .main-menu-screen .lobby-menu-button:focus-visible { transform: translateY(-2px) scale(1.012); filter: brightness(1.12); outline: none; }
.main-menu-screen .lobby-menu-button:focus-visible::after { content: ""; position: absolute; inset: 8%; z-index: 8; border: 3px solid #fff4bd; border-radius: 12px; pointer-events: none; }
.main-menu-screen .lobby-menu-button:active { transform: translateY(2px) scale(.992); }

.main-menu-screen .main-legal { position: absolute; z-index: 4; left: 18%; bottom: 2.5%; width: 64%; height: auto; margin: 0; }
.rules-guide-dialog { border-color: #d6a84d; background: linear-gradient(rgba(42,16,9,.96), rgba(18,9,6,.98)), url("assets/lobby/menu_brown.png") center / cover; }
#rulesGuide { z-index: 70; }
.rules-guide-dialog .rule-book-grid section { border: 1px solid rgba(222,177,83,.35); background: rgba(17,10,6,.74); }

.lobby-layout-reference { position: absolute; inset: 0; z-index: 40; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.lobby-layout-editor {
  position: fixed;
  z-index: 1000;
  top: 14px;
  right: 14px;
  width: min(292px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  overflow: auto;
  padding: 14px;
  border: 1px solid #e4bd68;
  border-radius: 14px;
  color: #fff8df;
  background: rgba(22,12,8,.96);
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
  font: 12px/1.3 "Apple SD Gothic Neo", sans-serif;
}
.lobby-layout-editor strong, .lobby-layout-editor select, .lobby-layout-editor label { display: block; width: 100%; margin-bottom: 9px; }
.lobby-layout-editor select, .lobby-layout-editor button, .lobby-layout-editor textarea { box-sizing: border-box; width: 100%; color: inherit; background: #3a2115; border: 1px solid #8e6e3c; border-radius: 7px; }
.lobby-layout-editor select, .lobby-layout-editor button { min-height: 34px; padding: 6px 8px; }
.lobby-layout-editor label { display: grid; grid-template-columns: 42px 1fr 38px; align-items: center; gap: 6px; }
.lobby-layout-editor input { width: 100%; }
.lobby-layout-editor output { text-align: right; }
.lobby-layout-editor textarea { height: 230px; margin-top: 10px; padding: 8px; font: 10px/1.3 ui-monospace, monospace; }

@media (max-width: 760px), (hover: none) and (pointer: coarse) {
  .lobby-artboard { width: min(100%, calc(100dvh * 941 / 1672)); }
}

/* 1.9.0 · 자개·금장 플레이 화면 모듈 */
.game-artboard {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: min(100%, calc(100dvh * 941 / 1672));
  max-height: 100%;
  overflow: hidden;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(rgba(18, 6, 3, .18), rgba(18, 6, 3, .18)),
    repeating-linear-gradient(0deg, #2c0b04 0 2px, #491207 2px 5px, #210704 5px 8px);
  box-shadow: inset 0 0 0 2px rgba(216, 163, 66, .48);
}
.game-artboard.hidden { display: none; }
.game-ui-art { display: block; z-index: 1; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.game-ui-fill { object-fit: fill; }
.game-header-panel, .game-brand-art, .game-title-art, .game-security-art,
.game-title-floral-art,
.game-opponent-panel, .game-field-panel, .game-player-panel, .game-hand-panel,
.game-footer-ornament, .game-field-label, .game-player-label, .game-captured-label,
.game-opponent-settings { z-index: 1; }

.game-artboard .app-bar,
.game-artboard .opponent,
.game-artboard .opponent-copy,
.game-artboard .name-row,
.game-artboard .table-zone,
.game-artboard .player,
.game-artboard .player-head,
.game-artboard .player-head > div {
  position: static;
  display: contents;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.game-artboard .game-home-button {
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 226, 139, .78);
  border-radius: 50%;
  color: #fff0b6;
  background: linear-gradient(#7c3b17, #351308);
  box-shadow: inset 0 0 0 2px rgba(25, 8, 2, .55), 0 2px 5px rgba(0,0,0,.45);
  line-height: 1;
  cursor: pointer;
}
.game-artboard .game-home-button:hover,
.game-artboard .game-home-button:focus-visible { filter: brightness(1.2); outline: 2px solid #fff1b6; outline-offset: 1px; }

.game-title-floral-art {
  position: absolute;
  z-index: 2;
  left: 5%;
  top: .3%;
  width: 64%;
  height: 8.4%;
  object-fit: contain;
}
.game-brand-art, .game-title-art { z-index: 3; }

.game-artboard .wallet {
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: center;
}
.game-artboard .wallet strong {
  color: #fff2be;
  font-size: inherit;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.055em;
  text-shadow: 0 .19cqw 0 #321006, 0 .35cqw .5cqw rgba(0,0,0,.7);
}
.game-artboard .game-security-art { z-index: 3; }

.game-artboard .avatar {
  z-index: 4;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: #190b05;
  background: none;
  box-shadow: none;
}
.game-artboard .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.game-artboard .avatar span { position: relative; z-index: 2; padding-top: 7%; font-size: inherit; font-weight: 950; line-height: 1; }

.game-artboard .opponent-name-button {
  z-index: 5;
  display: flex;
  align-items: center;
  padding: 0;
  border: 0;
  color: #fffdf3;
  background: transparent;
  cursor: pointer;
}
.game-artboard .opponent-name-button strong {
  font-size: inherit;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.045em;
  text-shadow: 0 .22cqw .24cqw rgba(0,0,0,.78);
  white-space: nowrap;
}
.game-artboard .game-opponent-settings { z-index: 4; }
.game-artboard .opponent-name-button:hover + .game-opponent-settings,
.game-artboard .opponent-name-button:focus-visible + .game-opponent-settings { filter: brightness(1.2); }
.game-artboard .opponent-name-button:focus-visible { border-radius: 1cqw; outline: 2px solid #ffe79a; outline-offset: .35cqw; }

.game-artboard #opponentScore,
.game-artboard #playerScore {
  z-index: 4;
  display: flex;
  align-items: center;
  color: #ffe5a0;
  font-size: inherit;
  font-weight: 950;
  line-height: 1;
  letter-spacing: -.045em;
  text-shadow: 0 .22cqw .25cqw rgba(0,0,0,.75);
  white-space: nowrap;
}
.game-artboard #opponentScore { justify-content: flex-end; }
.game-artboard .opponent-copy > p {
  z-index: 4;
  display: flex;
  align-items: center;
  max-width: none;
  overflow: visible;
  color: #fff2c7;
  font-size: inherit;
  font-weight: 780;
  line-height: 1;
  text-overflow: clip;
  text-shadow: 0 .18cqw .2cqw rgba(0,0,0,.7);
  white-space: nowrap;
}
.game-artboard .opponent-copy > p.fallback { color: #ffd675; }

.game-artboard .capture-strip {
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .72cqw;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.game-artboard .capture-pile {
  height: 100%;
  border: 1px solid rgba(224, 180, 77, .55);
  border-radius: 1.05cqw;
  background: url("assets/game-ui/capture_slot_brown.png") center / 100% 100% no-repeat;
  box-shadow: inset 0 0 .65cqw rgba(0,0,0,.55);
  overflow: hidden;
}
.game-artboard .capture-pile.kind-bright,
.game-artboard .capture-pile.kind-animal { background-image: url("assets/game-ui/capture_slot_green.png"); }
.game-artboard .capture-mini-card { top: .3cqw; width: 8.2cqw; height: 12.3cqw; }
.game-artboard .player-strip .capture-mini-card { width: 10.4cqw; height: 15.6cqw; }
.game-artboard .opponent-hand { z-index: 4; overflow: visible; }
.game-artboard .mini-back { width: 7.15cqw; height: 10.72cqw; border-radius: .72cqw; background-image: url("assets/hwatu/card_back_crimson_v2.png"); }

.game-artboard .game-field-label,
.game-artboard .game-player-label,
.game-artboard .game-captured-label { z-index: 5; }
.game-artboard .zone-title {
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 0;
  border: .22cqw solid #d7a33c;
  border-radius: 1.6cqw;
  color: #fffdf1;
  background: url("assets/game-ui/label_plaque_right.png") center / 100% 100% no-repeat;
  font-size: inherit;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 .2cqw .25cqw rgba(0,0,0,.8);
}
.game-artboard .field {
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.65cqw 2.2cqw;
  padding: 0;
  align-content: start;
  overflow: visible;
}
.game-artboard .field.dense { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.05cqw; }
.game-artboard .field .game-card { width: 100%; height: auto; }
.game-artboard .deck {
  z-index: 5;
  display: block;
  padding: 0;
  transform: none;
}
.game-artboard .deck .game-deck-frame { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 .7cqw .8cqw rgba(0,0,0,.4)); }
.game-artboard .deck .card-back { display: none; }
.game-artboard .deck span {
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, .2cqw);
  color: #fff5c9;
  font-size: inherit;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 .18cqw .2cqw #1e0904;
}

.game-artboard .player-strip { z-index: 4; }
.game-artboard .hand {
  z-index: 5;
  --hand-card-width: 14.78cqw;
  overflow: visible;
}
.game-artboard .hand .game-card {
  top: -1.2cqw;
  width: var(--hand-card-width);
  height: calc(var(--hand-card-width) * 1.5);
  filter: drop-shadow(0 .7cqw .55cqw rgba(0,0,0,.4));
}
.game-artboard .hand .game-card:nth-child(even) { top: -.35cqw; }
.game-artboard .hand .game-card.pending-hand-card { transform: translateY(-2.2cqw) scale(1.12); }
.game-artboard .game-footer-ornament { z-index: 2; }

.game-layout-reference { position: absolute; inset: 0; z-index: 40; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.game-layout-editor { position: fixed; z-index: 1000; top: 14px; right: 14px; width: min(292px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow: auto; padding: 14px; border: 1px solid #e4bd68; border-radius: 14px; color: #fff8df; background: rgba(22,12,8,.96); box-shadow: 0 14px 40px rgba(0,0,0,.5); font: 12px/1.3 "Apple SD Gothic Neo", sans-serif; }
.game-layout-editor strong, .game-layout-editor select, .game-layout-editor label { display: block; width: 100%; margin-bottom: 9px; }
.game-layout-editor select, .game-layout-editor button, .game-layout-editor textarea { box-sizing: border-box; width: 100%; color: inherit; background: #3a2115; border: 1px solid #8e6e3c; border-radius: 7px; }
.game-layout-editor select, .game-layout-editor button { min-height: 34px; padding: 6px 8px; }
.game-layout-editor label { display: grid; grid-template-columns: 42px 1fr 38px; align-items: center; gap: 6px; }
.game-layout-editor input { width: 100%; }
.game-layout-editor output { text-align: right; }
.game-layout-editor textarea { height: 230px; margin-top: 10px; padding: 8px; font: 10px/1.3 ui-monospace, monospace; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
