:root {
  --ink: #17323a;
  --muted: #6f8589;
  --cream: #fff8e8;
  --paper: #fffdf8;
  --red: #e44d5f;
  --red-dark: #b83045;
  --gold: #f2b84b;
  --teal: #2c8e8b;
  --deep: #0b2934;
  --wood: #a8653a;
  --card-w: clamp(54px, 6.4vw, 76px);
  --card-h: calc(var(--card-w) * 1.4);
  --shadow: 0 16px 46px rgba(5, 26, 34, .26);
}

* { box-sizing: border-box; }

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

body {
  color: var(--ink);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: #0b2833;
  overscroll-behavior: none;
}

button, summary { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.is-hidden { display: none !important; }
.screen { min-height: 100dvh; }

.start-screen {
  position: relative;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 12%, rgba(144, 255, 210, .25), transparent 25%),
    linear-gradient(145deg, #0a2634 0%, #1b5666 55%, #7cb5ba 100%);
}

.start-screen::before,
.start-screen::after {
  content: "";
  position: absolute;
  inset: auto -8vw -25vh;
  height: 56vh;
  border-radius: 50% 50% 0 0;
  background: #dceff0;
  transform: rotate(-4deg);
  opacity: .72;
}

.start-screen::after {
  inset: auto -20vw -34vh;
  height: 65vh;
  background: #f5f2df;
  transform: rotate(4deg);
  opacity: .45;
}

.snow,
.snow::before,
.snow::after {
  position: absolute;
  content: "";
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 1.5px, transparent 2px),
    radial-gradient(circle, rgba(255,255,255,.7) 0 1px, transparent 1.5px);
  background-size: 83px 83px, 51px 51px;
  background-position: 0 0, 24px 12px;
  animation: snowfall 12s linear infinite;
}

.snow::before { opacity: .45; transform: scale(1.4); animation-duration: 19s; }
.snow::after { opacity: .3; transform: scale(.7); animation-duration: 8s; }
@keyframes snowfall { to { background-position: 83px 166px, 75px 114px; } }

.start-card {
  position: relative;
  z-index: 2;
  width: min(950px, 100%);
  min-height: min(720px, calc(100dvh - 48px));
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 40px;
  overflow: hidden;
  background: linear-gradient(130deg, rgba(255,252,241,.98) 0 53%, rgba(231,244,239,.96) 100%);
  box-shadow: 0 32px 100px rgba(3, 24, 32, .42);
}

.start-card::before {
  content: "";
  position: absolute;
  right: -8%; top: -12%; width: 58%; aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-radial-gradient(circle, rgba(40,142,139,.06) 0 13px, transparent 14px 28px);
}

.brand-mark {
  display: inline-flex;
  gap: 3px;
  padding: 8px 12px;
  color: var(--red);
  border: 1px solid rgba(228,77,95,.23);
  border-radius: 12px;
  background: white;
  transform: rotate(-3deg);
  box-shadow: 0 5px 14px rgba(64, 52, 40, .12);
}
.brand-mark span:last-child { color: var(--ink); }

.eyebrow {
  margin: 22px 0 9px;
  color: var(--teal);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
}

h1 { position: relative; margin: 0; font-size: clamp(46px, 7vw, 82px); line-height: .96; letter-spacing: -.07em; }
h1 em { color: var(--red); font-style: normal; }
.subtitle { max-width: 390px; margin: 20px 0 28px; color: #5e7175; font-size: clamp(15px, 2vw, 18px); line-height: 1.7; }

.hero-wrap { position: absolute; z-index: 1; right: 3.5%; bottom: 5%; width: 49%; aspect-ratio: .96; }
.hero-glow { position: absolute; inset: 14% 4% 3%; border-radius: 50%; background: radial-gradient(circle, #fff7c9 0 18%, #b6e1d7 55%, transparent 71%); filter: blur(8px); }
.hero-penguin { position: absolute; inset: 4% 4% 0; width: 92%; height: 92%; object-fit: cover; object-position: 51% 48%; border-radius: 48% 48% 42% 42%; filter: drop-shadow(0 24px 18px rgba(39,52,48,.24)); }
.speech { position: absolute; top: 2%; left: -9%; padding: 12px 17px; border: 2px solid #24454d; border-radius: 18px 18px 5px 18px; background: white; font-weight: 900; transform: rotate(-4deg); box-shadow: 0 8px 18px rgba(23,50,58,.14); }
.floating-card { position: absolute; display: grid; place-items: center; width: 58px; height: 82px; color: var(--red); border-radius: 10px; background: white; box-shadow: 0 8px 25px rgba(15,41,47,.18); font-family: Georgia, serif; font-size: 20px; line-height: 1; }
.floating-card span { font-size: 26px; }
.card-one { right: 2%; top: 16%; transform: rotate(12deg); }
.card-two { left: -3%; bottom: 9%; transform: rotate(-14deg); }

.start-actions { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 13px; width: min(330px, 45%); }
.primary-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 235px;
  padding: 15px 24px;
  color: white;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 11px 25px rgba(187,48,68,.28);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary-btn::after { content: "→"; position: absolute; right: 20px; top: 50%; font-size: 24px; transform: translateY(-50%); }
.primary-btn span, .primary-btn { font-weight: 900; font-size: 18px; }
.primary-btn small { margin-top: 3px; font-size: 11px; font-weight: 600; opacity: .75; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 15px 31px rgba(187,48,68,.35); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn.compact { display: block; min-width: 190px; margin: 20px auto 0; text-align: center; }
.primary-btn.compact::after { display: none; }
.text-btn { padding: 6px 3px; color: var(--ink); border: 0; border-bottom: 1px dashed #8fa3a5; background: transparent; font-weight: 800; cursor: pointer; }

.record-strip { position: absolute; z-index: 3; left: clamp(28px, 5vw, 64px); bottom: clamp(24px, 4vw, 48px); display: flex; width: min(370px, 43%); border-top: 1px solid #d7dfda; }
.record-strip div { flex: 1; padding: 14px 10px 0 0; }
.record-strip strong, .record-strip span { display: block; }
.record-strip strong { font-size: 20px; }
.record-strip span { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 800; }
.start-foot { position: absolute; z-index: 3; bottom: 4px; margin: 0; color: rgba(255,255,255,.65); font-size: 10px; letter-spacing: .08em; }

/* Game scene */
.game-screen {
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 20%, rgba(86,193,188,.25), transparent 23%),
    linear-gradient(180deg, #071e29 0%, #164b58 38%, #d5e6df 100%);
  touch-action: manipulation;
}

.game-header { position: relative; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; max-width: 1180px; height: 48px; margin: 0 auto 8px; color: white; }
.mini-brand { font-weight: 950; letter-spacing: -.03em; }.mini-brand .heart { color: #ff7180; }
.round-chip { display: flex; align-items: baseline; gap: 4px; padding: 7px 15px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(5,25,33,.38); backdrop-filter: blur(10px); font-size: 11px; font-weight: 800; }
.round-chip strong { color: #ffd479; font-size: 18px; }
.header-actions { display: flex; justify-content: flex-end; gap: 7px; }
.icon-btn { width: 34px; height: 34px; padding: 0; color: white; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; background: rgba(5,25,33,.42); font-weight: 900; cursor: pointer; }
.icon-btn.is-off { opacity: .46; text-decoration: line-through; }

.cafe-scene { position: relative; max-width: 1180px; height: calc(100dvh - 76px); min-height: 610px; margin: 0 auto; overflow: hidden; border: 1px solid rgba(255,255,255,.15); border-radius: 26px; background: linear-gradient(180deg, rgba(18,60,70,.6), rgba(219,226,205,.88)); box-shadow: 0 18px 60px rgba(3,20,27,.42); }
.cafe-scene::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center 23%, rgba(255,218,143,.27), transparent 42%); pointer-events: none; }
.cafe-scene.is-shaking { animation: sceneShake .48s ease; }
@keyframes sceneShake { 20% { transform: translateX(-5px) rotate(-.25deg); } 40% { transform: translateX(5px) rotate(.25deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.aurora-window { position: absolute; top: 34px; left: 50%; width: 230px; height: 130px; overflow: hidden; border: 9px solid #a5c6c4; border-radius: 110px 110px 20px 20px; background: linear-gradient(#103547, #275f65); transform: translateX(-50%); box-shadow: inset 0 0 0 5px #6d9698, 0 8px 20px rgba(11,41,52,.3); }
.aurora-window::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(circle, white 0 1px, transparent 2px); background-size: 30px 34px; opacity: .55; }
.aurora-window i { position: absolute; top: 4px; left: -40%; width: 110%; height: 50px; border-radius: 50%; border-top: 12px solid rgba(115,255,194,.47); filter: blur(6px); transform: rotate(-12deg); animation: aurora 5s ease-in-out infinite alternate; }
.aurora-window i:nth-child(2) { top: 30px; left: 5%; border-color: rgba(105,213,255,.37); animation-delay: -2s; }
.aurora-window i:nth-child(3) { top: 55px; border-color: rgba(203,146,255,.26); animation-delay: -4s; }
@keyframes aurora { to { transform: translateX(22px) rotate(4deg) scaleY(1.2); } }

.fireplace { position: absolute; left: 24px; top: 92px; width: 95px; height: 96px; border: 8px solid #708f8a; border-bottom-width: 12px; border-radius: 48px 48px 8px 8px; background: #263c3d; box-shadow: 0 0 45px rgba(255,161,62,.28); }
.flame { position: absolute; bottom: 13px; left: 31px; width: 28px; height: 49px; border-radius: 70% 30% 70% 30%; background: #ffb43e; transform: rotate(45deg); animation: fire .7s ease-in-out infinite alternate; box-shadow: 0 0 18px #ff8d38; }
.flame.f2 { left: 45px; width: 20px; height: 33px; background: #ff6650; animation-delay: -.3s; }
.log { position: absolute; left: 15px; right: 15px; bottom: 7px; height: 9px; border-radius: 9px; background: #73432f; }
@keyframes fire { to { transform: rotate(48deg) scale(.85, 1.08); } }

.opponents { position: absolute; z-index: 5; top: 18px; left: 50%; display: flex; justify-content: space-between; width: min(890px, calc(100% - 230px)); transform: translateX(-50%); }
.opponent { position: relative; width: 178px; padding: 9px 10px 9px 62px; border: 1px solid rgba(255,255,255,.65); border-radius: 18px; background: rgba(255,252,240,.88); box-shadow: 0 8px 22px rgba(8,35,40,.17); backdrop-filter: blur(8px); transition: transform .25s ease, box-shadow .25s ease; }
.opponent.is-turn { transform: translateY(6px) scale(1.04); box-shadow: 0 0 0 3px #ffd36b, 0 12px 26px rgba(8,35,40,.25); }
.opponent-avatar { position: absolute; left: -7px; bottom: -5px; width: 64px; height: 64px; overflow: hidden; border: 3px solid var(--accent, #75a7ad); border-radius: 50%; background: #dce9e5; }
.opponent-avatar img { width: 100%; height: 100%; object-fit: cover; }
.opponent[data-id="1"] img { filter: hue-rotate(9deg) saturate(.8); }
.opponent[data-id="2"] img { filter: grayscale(.5) contrast(1.15); }
.opponent[data-id="3"] img { filter: hue-rotate(66deg) saturate(.8); }
.accessory { position: absolute; right: -3px; top: -5px; display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--accent); color: white; font-size: 12px; font-weight: 950; }
.opponent-name { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.opponent-name strong { font-size: 13px; }.opponent-name small { color: var(--muted); font-size: 9px; }
.opponent-score { margin-top: 4px; color: var(--red-dark); font-size: 19px; font-weight: 950; }
.opponent-score span { color: var(--muted); font-size: 9px; font-weight: 800; }
.opponent-cards { position: absolute; left: 70px; bottom: -17px; display: flex; }
.tiny-card { width: 14px; height: 21px; margin-left: -4px; border: 1px solid #e9f5f4; border-radius: 3px; background: repeating-linear-gradient(45deg, #275d6a, #275d6a 3px, #3e7b85 3px, #3e7b85 6px); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.opponent-thought { position: absolute; top: 82px; left: 50%; width: max-content; max-width: 155px; padding: 7px 10px; border-radius: 12px 12px 12px 3px; background: white; font-size: 10px; font-weight: 800; opacity: 0; transform: translate(-50%, -5px); transition: .2s ease; box-shadow: 0 6px 14px rgba(0,0,0,.12); }
.opponent.is-thinking .opponent-thought { opacity: 1; transform: translate(-50%, 0); }

.table-shell { position: absolute; z-index: 3; left: 50%; top: 130px; width: min(920px, 92%); height: calc(100% - 340px); min-height: 265px; transform: translateX(-50%); }
.table-rim { width: 100%; height: 100%; padding: 13px; border-radius: 48% / 27%; background: linear-gradient(145deg, #7d472d, #d09967 52%, #60341f); box-shadow: 0 25px 32px rgba(45,29,18,.28), inset 0 2px 2px rgba(255,255,255,.55); }
.wood-table { position: relative; width: 100%; height: 100%; overflow: hidden; border: 2px solid rgba(73,39,24,.4); border-radius: 48% / 27%; background:
  radial-gradient(ellipse at center, rgba(255,218,166,.3), transparent 64%),
  repeating-linear-gradient(88deg, transparent 0 44px, rgba(81,45,28,.08) 45px 48px),
  linear-gradient(90deg, #a9633c, #c98552 48%, #a45e39);
  box-shadow: inset 0 0 55px rgba(73,36,17,.38);
}
.wood-table::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 8px rgba(255,219,171,.09); }
.table-topline { position: absolute; z-index: 4; top: 36px; left: 14%; right: 14%; display: flex; align-items: center; justify-content: space-between; }
.deck-stack { display: grid; grid-template-columns: 30px auto; grid-template-rows: auto auto; align-items: center; column-gap: 7px; color: rgba(255,255,255,.85); }
.deck-stack .mini-back { grid-row: 1 / 3; width: 30px; height: 41px; border: 2px solid #f0e6c9; border-radius: 5px; background: repeating-linear-gradient(45deg, #246273, #246273 4px, #3d8390 4px, #3d8390 8px); transform: rotate(-4deg); box-shadow: 2px 2px 0 #f0e6c9, 4px 4px 0 #27606c; }
.deck-stack strong { line-height: 1; font-size: 16px; }.deck-stack span { font-size: 9px; font-weight: 800; }
.turn-banner { padding: 7px 15px; color: #49331f; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; background: rgba(255,244,207,.88); font-size: 12px; font-weight: 950; box-shadow: 0 5px 12px rgba(75,44,25,.14); }
.log-btn { padding: 6px 10px; color: rgba(255,255,255,.9); border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(70,39,24,.25); font-size: 9px; font-weight: 850; cursor: pointer; }

.table-cards { position: absolute; z-index: 2; top: 62px; bottom: 42px; left: 11%; right: 11%; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: clamp(3px, .7vw, 9px); overflow: auto; padding: 8px; scrollbar-width: thin; }
.table-hint { position: absolute; z-index: 4; bottom: 14px; left: 50%; color: rgba(255,255,255,.86); font-size: 10px; font-weight: 800; transform: translateX(-50%); white-space: nowrap; }
.table-hint span { padding: 4px 9px; border-radius: 9px; background: rgba(73,39,23,.3); }
.pending-flip { position: absolute; z-index: 8; right: 7%; top: 50%; display: flex; align-items: center; gap: 7px; padding: 8px; border: 2px solid #ffd56f; border-radius: 12px; background: rgba(255,248,224,.95); transform: translateY(-50%); box-shadow: 0 8px 22px rgba(64,39,20,.24); }
.pending-flip::before { content: "翻牌"; writing-mode: vertical-rl; color: #8a6338; font-size: 9px; font-weight: 900; }

.playing-card { position: relative; flex: 0 0 var(--card-w); width: var(--card-w); height: var(--card-h); padding: 0; overflow: hidden; color: #1b2a2e; border: 1px solid #d4d3ca; border-radius: calc(var(--card-w) * .12); background: linear-gradient(145deg, #fff, #fffaf0); box-shadow: 0 5px 9px rgba(42,27,17,.25); cursor: pointer; user-select: none; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.playing-card.red { color: #d94152; }
.playing-card::after { content: ""; position: absolute; inset: 4px; border: 1px solid currentColor; border-radius: calc(var(--card-w) * .08); opacity: .13; pointer-events: none; }
.playing-card .corner { position: absolute; top: 5px; left: 6px; display: flex; flex-direction: column; align-items: center; font-family: Georgia, serif; font-weight: 900; line-height: .85; }
.playing-card .corner b { font-size: calc(var(--card-w) * .24); }.playing-card .corner span { margin-top: 3px; font-size: calc(var(--card-w) * .2); }
.playing-card .corner.bottom { top: auto; left: auto; right: 6px; bottom: 5px; transform: rotate(180deg); }
.playing-card .card-center { position: absolute; inset: 22% 12%; display: grid; place-items: center; font-family: Georgia, serif; }
.playing-card .big-rank { font-size: calc(var(--card-w) * .46); font-weight: 800; line-height: 1; }.playing-card .big-suit { font-size: calc(var(--card-w) * .38); line-height: 1; }
.playing-card.face .card-center { border: 2px solid currentColor; border-radius: 8px; background: repeating-linear-gradient(135deg, transparent 0 7px, currentColor 8px 9px); }
.playing-card.face .big-rank { padding: 2px 7px; background: #fffdf7; }
.playing-card.special .card-center::after { content: "🐟"; position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #ffd66e; font-size: 11px; }
.playing-card.is-selected { transform: translateY(-16px) rotate(-1deg); box-shadow: 0 0 0 4px #ffd96c, 0 14px 20px rgba(41,27,17,.35); }
.playing-card.is-match { animation: matchGlow 1s ease-in-out infinite alternate; }
.playing-card.is-target { box-shadow: 0 0 0 4px #fff, 0 0 0 8px #6cf0ce, 0 10px 18px rgba(21,87,77,.35); transform: translateY(-4px) scale(1.04); }
.playing-card.is-disabled { opacity: .46; filter: grayscale(.35); cursor: not-allowed; }
.playing-card.is-entering { animation: cardDeal .35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes matchGlow { to { box-shadow: 0 0 0 3px #8df4d6, 0 0 22px #91ffe0; transform: translateY(-3px); } }
@keyframes cardDeal { from { opacity: 0; transform: translate(20px,-80px) rotate(15deg) scale(.6); } }

.player-zone { position: absolute; z-index: 9; left: 20px; right: 20px; bottom: 12px; min-height: 205px; padding: 12px 18px 10px 124px; border: 1px solid rgba(255,255,255,.6); border-radius: 25px; background: linear-gradient(105deg, rgba(255,253,245,.97), rgba(231,243,236,.95)); box-shadow: 0 -8px 30px rgba(23,49,50,.16); }
.player-profile { position: absolute; left: 13px; top: 13px; bottom: 13px; width: 105px; overflow: hidden; border-radius: 18px; background: #d8e9e6; }
.player-profile > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 42%; }
.player-profile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 48%, rgba(8,37,43,.86)); }
.player-copy { position: absolute; z-index: 2; left: 9px; right: 9px; bottom: 49px; color: white; }.player-copy strong { display: block; font-size: 13px; }.player-copy strong span { padding: 2px 5px; border-radius: 5px; background: #f1b648; color: #46351e; font-size: 8px; }.player-copy small { font-size: 9px; opacity: .8; }
.score-jar { position: absolute; z-index: 3; left: 8px; right: 8px; bottom: 7px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 3px 6px; padding: 5px 7px; color: var(--ink); border-radius: 10px; background: rgba(255,255,255,.9); }
.score-jar .jar-label, .score-jar small { font-size: 7px; font-weight: 800; }.score-jar strong { color: var(--red-dark); font-size: 17px; line-height: 1; text-align: right; }.score-meter { grid-column: 1 / 3; height: 4px; overflow: hidden; border-radius: 5px; background: #dfe6df; }.score-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #56b5a0, #f4bd4e); transition: width .4s ease; }

.player-hand { display: flex; align-items: flex-end; justify-content: center; min-height: calc(var(--card-h) + 16px); gap: clamp(4px, .8vw, 10px); padding: 7px 0 0; }
.player-hand .playing-card:nth-child(1) { transform: rotate(-4deg); }.player-hand .playing-card:nth-child(2) { transform: rotate(-2deg); }.player-hand .playing-card:nth-last-child(2) { transform: rotate(2deg); }.player-hand .playing-card:nth-last-child(1) { transform: rotate(4deg); }
.player-hand .playing-card.is-selected { transform: translateY(-16px) rotate(0); }
.player-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 38px; margin-top: 3px; }
.selection-label { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.play-btn { min-width: 130px; padding: 9px 18px; color: white; border: 0; border-radius: 12px; background: linear-gradient(135deg, #e44d5f, #b83045); font-weight: 950; box-shadow: 0 7px 15px rgba(184,48,69,.22); cursor: pointer; }
.play-btn:disabled { color: #849395; background: #d9e1df; box-shadow: none; cursor: not-allowed; }

.toast { position: fixed; z-index: 100; top: max(68px, env(safe-area-inset-top)); left: 50%; max-width: min(440px, calc(100% - 30px)); padding: 11px 17px; color: white; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(10,37,46,.94); box-shadow: 0 10px 28px rgba(0,0,0,.28); font-size: 12px; font-weight: 850; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, -12px); transition: .25s ease; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-special { color: #4d2d1d; background: #ffda72; animation: toastPop .6s ease; }
@keyframes toastPop { 40% { transform: translate(-50%, 0) scale(1.1); } }

/* Modals */
.modal { width: 100%; height: 100%; max-width: none; max-height: none; padding: 18px; border: 0; background: rgba(4,23,29,.66); backdrop-filter: blur(7px); }
.modal::backdrop { background: transparent; }
.modal[open] { display: grid; place-items: center; }
.modal-card { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 36px); overflow: auto; padding: clamp(24px, 5vw, 42px); border-radius: 28px; background: var(--cream); box-shadow: 0 30px 80px rgba(0,0,0,.42); animation: modalIn .3s ease both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-card h2 { margin: 0 0 14px; font-size: clamp(26px, 5vw, 38px); letter-spacing: -.04em; }.modal-card .eyebrow { margin-top: 0; }
.close-btn { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; color: var(--ink); border: 0; border-radius: 50%; background: rgba(20,50,58,.08); font-size: 24px; cursor: pointer; }
.rule-visual { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0; padding: 18px; border-radius: 18px; background: #e5f0eb; }.rule-visual i { font-style: normal; font-weight: 900; }.rule-visual > strong { color: var(--red); font-size: 25px; }
.demo-card { display: grid; place-items: center; width: 52px; height: 72px; border: 1px solid #ddd3c4; border-radius: 8px; background: white; box-shadow: 0 4px 8px rgba(0,0,0,.1); font-family: Georgia,serif; }.demo-card span { font-size: 20px; }.demo-card.red, .red { color: var(--red); }
.rule-steps { margin: 0; padding-left: 24px; }.rule-steps li { margin: 10px 0; padding-left: 5px; color: #506469; font-size: 13px; line-height: 1.6; }.rule-steps b { color: var(--ink); }
.score-guide { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 18px 0; padding: 13px; border: 1px solid #e7ddc9; border-radius: 16px; background: white; }.score-guide h3 { grid-column: 1 / -1; margin: 0 0 4px; font-size: 12px; }.score-guide div { text-align: center; }.score-guide span,.score-guide b { display: block; }.score-guide span { font-family: Georgia,serif; font-size: 12px; }.score-guide b { margin-top: 3px; font-size: 10px; }
details { padding: 12px 14px; border-radius: 14px; background: #f3eadb; font-size: 12px; line-height: 1.6; } summary { font-weight: 900; cursor: pointer; } details p { margin: 9px 0; }
.game-log { display: flex; flex-direction: column; gap: 8px; min-height: 200px; }.log-item { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 9px 10px; border-radius: 11px; background: rgba(255,255,255,.7); font-size: 11px; line-height: 1.5; }.log-item time { color: var(--teal); font-weight: 900; }.log-item.is-special { background: #ffe8a8; }
.result-card { text-align: center; overflow: hidden; }.result-subtitle { color: var(--muted); font-size: 13px; }.result-scores { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 20px 0; }.result-player { padding: 12px 5px; border: 1px solid #e4dccb; border-radius: 15px; background: rgba(255,255,255,.75); }.result-player.is-winner { border-color: #e8b33f; background: #fff0b8; transform: translateY(-4px); box-shadow: 0 8px 18px rgba(184,129,35,.18); }.result-player .crown { height: 18px; color: #d99523; font-size: 18px; }.result-player strong,.result-player span,.result-player small { display: block; }.result-player strong { margin: 5px 0; font-size: 12px; }.result-player span { color: var(--red-dark); font-size: 24px; font-weight: 950; }.result-player small { color: var(--muted); font-size: 8px; }.result-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; min-height: 28px; }.badge { padding: 6px 10px; border-radius: 999px; background: #e0f0eb; color: #22665f; font-size: 10px; font-weight: 900; }.badge.gold { color: #704b09; background: #ffe397; }.result-actions { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; }
.confetti { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(circle, #e75566 0 3px, transparent 4px), radial-gradient(circle, #f0bd47 0 3px, transparent 4px), radial-gradient(circle, #4cb9a1 0 3px, transparent 4px); background-size: 63px 79px, 91px 67px, 73px 89px; opacity: .22; animation: confettiMove 5s linear infinite; } @keyframes confettiMove { to { background-position: 0 158px, 0 134px, 0 178px; } }

@media (max-width: 840px) {
  :root { --card-w: clamp(48px, 8vw, 64px); }
  .start-card { min-height: calc(100dvh - 50px); padding: 32px; }
  .hero-wrap { right: -1%; width: 51%; }
  .opponents { top: 20px; width: calc(100% - 45px); }
  .opponent { width: 145px; padding-left: 54px; }.opponent-avatar { width: 57px; height: 57px; }.opponent-name small { display:none; }
  .table-shell { top: 129px; width: 98%; }.table-cards { left: 7%; right: 7%; }
  .fireplace,.aurora-window { opacity: .62; }
}

@media (max-width: 620px), (max-height: 700px) {
  :root { --card-w: clamp(45px, 13vw, 59px); }
  .start-screen { padding: 10px; }
  .start-card { display: flex; flex-direction: column; min-height: calc(100dvh - 20px); padding: 24px 23px; border-radius: 28px; }
  h1 { font-size: clamp(44px, 16vw, 68px); }.subtitle { max-width: 76%; margin: 14px 0 18px; font-size: 14px; }
  .hero-wrap { right: -9%; bottom: 14%; width: 67%; opacity: .92; }.speech { top: -4%; left: -1%; font-size: 10px; }.floating-card { width: 42px; height: 60px; font-size: 15px; }
  .start-actions { width: 100%; margin-top: auto; }.primary-btn { min-width: 210px; }.record-strip { left: 23px; bottom: 22px; width: calc(100% - 46px); }.record-strip div { padding-top: 10px; }.start-actions { margin-bottom: 78px; }
  .game-screen { padding: max(5px, env(safe-area-inset-top)) 5px max(5px, env(safe-area-inset-bottom)); }
  .game-header { height: 39px; margin-bottom: 4px; padding: 0 5px; }.mini-brand { font-size: 12px; }.round-chip { padding: 4px 10px; }.round-chip strong { font-size: 15px; }.icon-btn { width: 29px; height: 29px; }
  .cafe-scene { height: calc(100dvh - 50px); min-height: 550px; border-radius: 20px; }
  .aurora-window { top: 22px; width: 138px; height: 83px; border-width: 6px; }.fireplace { display:none; }
  .opponents { top: 10px; width: calc(100% - 18px); align-items: flex-start; }
  .opponent { width: 31.5%; min-height: 52px; padding: 6px 5px 6px 43px; border-radius: 13px; }
  .opponent-avatar { left: -2px; bottom: 2px; width: 43px; height: 43px; border-width: 2px; }.accessory { width: 18px; height: 18px; font-size: 8px; }
  .opponent-name strong { font-size: 10px; }.opponent-score { margin-top: 1px; font-size: 15px; }.opponent-score span { display:none; }.opponent-cards { left: 45px; bottom: -9px; }.tiny-card { width: 10px; height: 15px; }.opponent-thought { top: 57px; max-width: 98px; font-size: 8px; }
  .table-shell { top: 76px; height: calc(100% - 288px); min-height: 245px; }.table-rim { padding: 8px; border-radius: 40% / 18%; }.wood-table { border-radius: 40% / 18%; }
  .table-topline { top: 23px; left: 13%; right: 13%; }.deck-stack { grid-template-columns: 22px auto; }.deck-stack .mini-back { width: 22px; height: 31px; }.deck-stack strong { font-size: 13px; }.turn-banner { padding: 5px 9px; font-size: 9px; }.log-btn { padding: 5px 7px; font-size: 7px; }
  .table-cards { top: 47px; bottom: 34px; left: 2%; right: 2%; align-content: center; gap: 3px; padding: 4px; }.table-hint { bottom: 9px; font-size: 8px; }.pending-flip { right: 2%; padding: 4px; transform: translateY(-45%) scale(.86); transform-origin: right center; }
  .player-zone { left: 6px; right: 6px; bottom: 5px; min-height: 202px; padding: 8px 8px 7px 70px; border-radius: 18px; }
  .player-profile { left: 7px; top: 7px; bottom: 7px; width: 58px; border-radius: 12px; }.player-copy { bottom: 55px; }.player-copy strong { font-size: 10px; }.player-copy small { display:none; }.score-jar { grid-template-columns: 1fr; text-align:center; }.score-jar .jar-label { display:none; }.score-jar strong { text-align:center; }.score-jar small { font-size: 6px; }.score-meter { grid-column: 1; }
  .player-hand { min-height: calc(var(--card-h) + 15px); gap: 2px; padding-top: 5px; }.player-actions { height: 36px; }.selection-label { font-size: 9px; }.play-btn { min-width: 100px; padding: 8px 10px; font-size: 11px; }
  .score-guide { grid-template-columns: repeat(3,1fr); }.result-scores { gap: 4px; }.result-player { padding: 9px 2px; }.result-player span { font-size: 19px; }
}

@media (max-height: 610px) and (orientation: landscape) {
  :root { --card-w: 47px; }
  .game-header { height: 32px; }.cafe-scene { height: calc(100dvh - 42px); min-height: 500px; }
  .opponents { top: 6px; }.table-shell { top: 70px; height: calc(100% - 250px); }.player-zone { min-height: 170px; padding-left: 88px; }.player-profile { width: 73px; }.player-hand { min-height: calc(var(--card-h) + 4px); }.player-actions { height: 29px; }.play-btn { padding: 6px 11px; }
}

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