.rabbit-trap-page {
  --rabbit-ink: #183148;
  --rabbit-green: #16866b;
  --rabbit-green-dark: #0d624f;
  --rabbit-orange: #f47c46;
  --rabbit-cream: #fffaf0;
  --rabbit-line: #dfe9e3;
  color: var(--rabbit-ink);
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}

.rabbit-trap-page main,
.rabbit-hero,
.rabbit-hero-grid,
.rabbit-layout,
.rabbit-layout > *,
.game-board,
.game-board-toolbar,
.game-board-actions,
.draw-stage,
.game-stats,
.game-detail-grid {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
}

.rabbit-hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 68px;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 211, 102, 0.34), transparent 24%),
    linear-gradient(135deg, #092f3b 0%, #126f61 68%, #dff7e9 68%);
}

.rabbit-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  align-items: center;
  gap: 48px;
}

.rabbit-breadcrumb { display: inline-block; margin-bottom: 24px; color: #d7fff0; font-weight: 800; }
.rabbit-hero .eyebrow { color: #9ee5cd; }
.rabbit-hero h1 { margin: 0; color: #fff; font-size: clamp(3.5rem, 7vw, 6.4rem); line-height: .92; letter-spacing: -.06em; text-shadow: 0 2px 16px rgba(0, 24, 29, .24); }
.rabbit-subtitle { margin: 14px 0 18px; color: #fff0b8; font-size: clamp(1.35rem, 3vw, 2rem); font-weight: 900; text-shadow: 0 2px 12px rgba(0, 24, 29, .28); }
.rabbit-hero .lead { max-width: 680px; margin: 0; color: #e8fff7; font-size: 1.08rem; text-shadow: 0 1px 8px rgba(0, 24, 29, .32); }
.rabbit-hero-art { position: relative; min-height: 290px; }
.rabbit-hero-art img:first-child { position: absolute; right: 42px; bottom: 0; width: 250px; filter: drop-shadow(0 26px 28px rgba(4, 37, 38, .2)); }
.rabbit-hero-art img:last-child { position: absolute; right: 0; top: 10px; width: 112px; transform: rotate(16deg); filter: drop-shadow(0 16px 18px rgba(4, 37, 38, .16)); }

.rabbit-layout { display: grid; gap: 24px; padding-top: 34px; padding-bottom: 72px; }
.game-panel { padding: clamp(20px, 4vw, 32px); border: 1px solid var(--rabbit-line); border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 16px 45px rgba(31, 63, 69, .08); }
.game-panel h2 { margin: 2px 0 10px; color: var(--rabbit-ink); font-size: clamp(1.35rem, 3vw, 1.75rem); }
.game-panel p { color: #5d6e72; }
.panel-kicker { margin: 0; color: var(--rabbit-green) !important; font-size: .73rem; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.mode-panel, .game-actions-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 320px); align-items: end; gap: 24px; }
.mode-select-label { display: block; margin-bottom: 8px; color: #53676b; font-size: .82rem; font-weight: 900; }
.mode-select { width: 100%; min-height: 50px; padding: 10px 42px 10px 14px; border: 2px solid #cde2d8; border-radius: 12px; background: #f8fffb; color: var(--rabbit-ink); font-weight: 900; }

.game-message { margin: 0; padding: 13px 16px; border: 1px solid #cfe0dc; border-radius: 12px; background: #f4faf8; color: #315d54; font-weight: 800; }
.game-message.is-success { border-color: #b9e7d1; background: #eafaf2; color: #17634f; }
.game-message.is-warning { border-color: #f4d79d; background: #fff8e7; color: #7c5610; }
.game-message.is-error { border-color: #f0b9af; background: #fff0ed; color: #8d3428; }

.rabbit-game-modes {
  display: grid;
  width: min(100%, 420px);
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-inline: auto;
  padding: 5px;
  border: 1px solid #cfe0dc;
  border-radius: 14px;
  background: #f4faf8;
}
.rabbit-game-mode { display: grid; min-height: 44px; place-items: center; border-radius: 10px; color: var(--rabbit-green-dark); font-weight: 900; text-decoration: none; }
.rabbit-game-mode.is-current { background: var(--rabbit-green); color: #fff; box-shadow: 0 7px 18px rgba(22, 134, 107, .2); }
.rabbit-game-mode:focus-visible { outline: 4px solid rgba(38, 140, 111, .25); outline-offset: 2px; }

.game-board { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(260px, 1.65fr) minmax(140px, 1fr); align-items: center; gap: clamp(18px, 4vw, 48px); min-height: 510px; padding: clamp(28px, 6vw, 64px); border-radius: 24px; background: radial-gradient(circle at 50% 38%, #fff8db, #eff9f2 52%, #d8ede3); box-shadow: inset 0 0 0 1px rgba(20, 101, 79, .08), 0 26px 70px rgba(26, 83, 67, .13); }
.deck-status-card { display: grid; justify-items: center; padding: 20px 12px; text-align: center; }
.deck-status-card img { width: min(130px, 90%); height: 130px; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(20, 73, 57, .15)); }
.deck-status-card span { margin-top: 14px; color: #58716b; font-weight: 800; }
.deck-status-card strong { color: var(--rabbit-green-dark); font-size: 3rem; line-height: 1; }
.deck-status-card small { color: #6e827d; font-weight: 800; }
.drawn-status-card img { opacity: .62; transform: rotate(8deg); }
.draw-stage { display: grid; justify-items: center; gap: 22px; perspective: 1100px; }
.current-card { position: relative; width: min(100%, 300px); aspect-ratio: 3 / 4; transform-style: preserve-3d; transition: transform .62s cubic-bezier(.2,.75,.25,1), filter .3s ease; }
.current-card.is-drawing { animation: rabbit-draw .62s cubic-bezier(.18,.78,.24,1); }
.card-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 28px; overflow: hidden; border: 8px solid #fff; border-radius: 24px; backface-visibility: hidden; box-shadow: 0 26px 55px rgba(31, 68, 62, .2); text-align: center; }
.card-back { background: linear-gradient(145deg, #0e7660, #0b4a55); color: #fff; transform: rotateY(180deg); }
.card-back::after { content: ""; position: absolute; inset: 14px; border: 2px dashed rgba(255,255,255,.45); border-radius: 14px; }
.card-back img { width: 65%; z-index: 1; }
.card-back span { z-index: 1; font-weight: 900; letter-spacing: .08em; }
.card-front { background: linear-gradient(160deg, #fff, #fff9e9); }
.card-front img { width: 54%; height: 42%; object-fit: contain; }
.card-front span { color: var(--rabbit-green); font-size: .82rem; font-weight: 900; letter-spacing: .1em; }
.card-front strong { max-width: 100%; color: var(--rabbit-ink); font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.25; }
.current-card.is-empty { transform: rotateY(180deg); }
.draw-button { min-width: 190px; min-height: 58px; padding: 13px 28px; border: 0; border-radius: 16px; background: linear-gradient(135deg, #ff945f, #e95f39); color: #fff; box-shadow: 0 14px 25px rgba(217, 76, 38, .28); font-size: 1.18rem; font-weight: 900; cursor: pointer; }

.game-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.game-button { min-height: 48px; padding: 10px 13px; border-radius: 12px; font-weight: 900; cursor: pointer; }
.game-button.secondary { border: 1px solid #c9dfd6; background: #f2faf6; color: var(--rabbit-green-dark); }
.game-button.danger { border: 1px solid #efc9bf; background: #fff3ef; color: #a44131; }
.draw-button:disabled, .game-button:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .52; transform: none; }
.draw-button:focus-visible, .game-button:focus-visible, .mode-select:focus-visible, .display-toggle input:focus-visible + span { outline: 4px solid rgba(38, 140, 111, .25); outline-offset: 3px; }

.game-detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; }
.display-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.display-toggle label { cursor: pointer; }
.display-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.display-toggle span { display: grid; place-items: center; min-height: 48px; padding: 8px; border: 1px solid #d4e3de; border-radius: 11px; background: #f7faf9; color: #5b6c70; font-weight: 900; }
.display-toggle input:checked + span { border-color: var(--rabbit-green); background: #e9f8f1; color: var(--rabbit-green-dark); box-shadow: inset 0 0 0 1px var(--rabbit-green); }
.display-help { min-height: 2.8em; }
.strategy-panel { margin-top: 20px; }
.strategy-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.strategy-summary div { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 14px; border-radius: 12px; background: #eff8f4; }
.strategy-summary span { grid-column: 1 / -1; color: #5f716d; font-size: .8rem; font-weight: 800; }
.strategy-summary strong { font-size: 1.6rem; }
.strategy-summary small { align-self: center; color: var(--rabbit-green); font-weight: 900; }
.probability-list { display: grid; gap: 7px; margin-top: 12px; }
.probability-list > div { display: grid; grid-template-columns: 1fr auto 64px; gap: 10px; align-items: center; padding: 9px 11px; border-bottom: 1px solid #edf1ef; }
.probability-list strong, .probability-list small { text-align: right; }
.empty-deck-message { padding: 10px; border-radius: 10px; background: #fff2de; color: #8a5a13 !important; font-weight: 900; text-align: center; }
.draw-history { display: grid; gap: 9px; margin: 18px 0 0; padding: 0; list-style: none; }
.draw-history li { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 10px; min-height: 48px; padding: 7px 10px; border: 1px solid #e4ebe8; border-radius: 11px; }
.draw-history img { width: 34px; height: 34px; }
.draw-history span { font-weight: 850; }
.draw-history small { color: #84918e; }
.draw-history .empty-history { display: block; padding: 20px; color: #7b8986; text-align: center; }

.rule-cards, .deck-guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.rule-cards article, .deck-guide-grid article { padding: 19px; border: 1px solid #e1eae6; border-radius: 14px; background: #fbfdfc; }
.rule-cards article > strong { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--rabbit-green); color: #fff; }
.rule-cards h3, .deck-guide-grid h3 { margin: 12px 0 6px; color: var(--rabbit-ink); }
.rule-cards p, .deck-guide-grid p { margin: 0; }
.deck-guide-grid article > strong { display: block; margin-top: 12px; color: var(--rabbit-green-dark); }
.original-notice { display: flex; gap: 18px; align-items: baseline; padding: 18px 22px; border: 1px dashed #c9ded5; border-radius: 14px; background: #f5faf8; }
.original-notice strong { flex: 0 0 auto; color: var(--rabbit-green-dark); }
.original-notice p { margin: 0; color: #64746f; }

.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

@keyframes rabbit-draw {
  0% { transform: translateX(-42px) rotateY(180deg) rotate(-4deg); filter: brightness(.9); }
  45% { transform: translateY(-22px) rotateY(92deg) rotate(2deg); }
  100% { transform: translate(0) rotateY(0); filter: brightness(1); }
}

@media (max-width: 820px) {
  .rabbit-hero { padding: 52px 0; background: linear-gradient(145deg, #092f3b, #126f61 76%, #dff7e9 76%); }
  .rabbit-hero-grid { grid-template-columns: 1fr; gap: 10px; }
  .rabbit-hero-art { min-height: 130px; }
  .rabbit-hero-art img:first-child { right: 18%; width: 145px; }
  .rabbit-hero-art img:last-child { right: 9%; width: 68px; }
  .mode-panel, .game-actions-panel, .game-detail-grid { grid-template-columns: 1fr; }
  .game-board { grid-template-columns: 1fr 1fr; min-height: auto; padding: 28px 16px; }
  .draw-stage { grid-column: 1 / -1; grid-row: 1; }
  .deck-status-card { grid-row: 2; padding: 8px; }
  .deck-status-card img { width: 82px; height: 72px; }
  .deck-status-card strong { font-size: 2.25rem; }
  .current-card { width: min(76vw, 280px); }
  .game-actions, .rule-cards, .deck-guide-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .rabbit-hero h1 { font-size: 3.5rem; }
  .rabbit-layout { padding-inline: 14px; }
  .game-panel { padding: 19px; border-radius: 15px; }
  .game-board { width: 100%; margin-inline: 0; border-radius: 15px; }
  .display-toggle, .strategy-summary { grid-template-columns: 1fr; }
  .original-notice { display: block; }
  .original-notice p { margin-top: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .current-card, .draw-button, .game-button { animation: none !important; transition: none !important; }
}

/* UX2: the board, rather than a form button, is the primary game control. */
.game-board {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  margin-inline: 0;
  padding: clamp(18px, 4vw, 38px);
  overflow-x: hidden;
  overflow-x: clip;
  gap: 22px;
}

.game-board-toolbar {
  display: flex;
  width: 100%;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.game-board-actions {
  display: flex;
  flex: 0 0 auto;
  max-width: 100%;
  align-items: center;
  gap: 8px;
}

.mode-control { min-width: 0; width: min(100%, 390px); }
.mode-control label { display: block; margin-bottom: 7px; color: #4f6862; font-size: .76rem; font-weight: 900; letter-spacing: .08em; }
.mode-control .mode-select { min-height: 46px; background-color: rgba(255, 255, 255, .88); }
.mode-description { margin: 8px 0 0; color: #687a75; font-size: .82rem; line-height: 1.45; }

.shuffle-control,
.sound-control {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(19, 104, 82, .2);
  border-radius: 50%;
  background: rgba(255, 255, 255, .78);
  color: var(--rabbit-green-dark);
  box-shadow: 0 8px 20px rgba(25, 80, 66, .1);
  cursor: pointer;
}

.shuffle-control > img { display: block; width: 26px; height: 26px; object-fit: contain; }
.sound-control > span { display: block; font-size: 1.25rem; line-height: 1; }
.shuffle-control:hover { background: #fff; transform: rotate(9deg); }
.sound-control:hover { background: #fff; transform: scale(1.04); }
.sound-control:active { transform: scale(.95); }
.sound-control[aria-pressed="false"] { background: #f1f4f2; color: #63716d; }
.shuffle-control:disabled { cursor: not-allowed; opacity: .4; transform: none; }
.shuffle-control:focus-visible, .sound-control:focus-visible, .draw-deck:focus-visible, .compact-primary:focus-visible, .dialog-actions button:focus-visible { outline: 4px solid rgba(38, 140, 111, .25); outline-offset: 4px; }

.draw-stage { width: 100%; gap: 14px; }
.current-card { width: min(72vw, 270px); }
.current-card.is-revealing { animation: rabbit-reveal-card .58s cubic-bezier(.18, .78, .24, 1); }

.draw-deck {
  --drag-y: 0px;
  --drag-rotate: 0deg;
  position: relative;
  width: 122px;
  height: 154px;
  margin-top: -6px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.draw-deck:active { cursor: grabbing; }
.deck-layer, .deck-top-card { position: absolute; inset: 0; display: block; border-radius: 14px; }
.deck-layer { border: 3px solid rgba(255, 255, 255, .9); background: #0b5b53; box-shadow: 0 10px 22px rgba(19, 68, 58, .15); }
.deck-layer-three { transform: translate(-9px, 8px) rotate(-5deg); opacity: .68; }
.deck-layer-two { transform: translate(8px, 5px) rotate(4deg); opacity: .86; }
.deck-top-card { overflow: hidden; background: #0e6f60; box-shadow: 0 18px 30px rgba(18, 74, 61, .25); transform: translate3d(0, var(--drag-y), 0) rotate(var(--drag-rotate)); transition: transform .22s ease; }
.deck-top-card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.draw-deck.is-dragging .deck-top-card { transition: none; }
.draw-deck.is-returning .deck-top-card { transition: transform .26s cubic-bezier(.2, .8, .3, 1); }
.draw-deck.is-committing .deck-top-card { animation: rabbit-deck-commit .58s cubic-bezier(.18, .78, .24, 1) forwards; }
.draw-deck.is-reshuffling .deck-top-card { animation: rabbit-deck-reshuffle .4s cubic-bezier(.2, .8, .3, 1); }
.draw-deck:disabled { cursor: not-allowed; opacity: .42; }
.draw-hint { margin: -3px 0 0; color: var(--rabbit-green-dark); font-size: .9rem; font-weight: 900; }
.draw-hint span { display: inline-block; margin-right: 4px; animation: rabbit-hint 1.4s ease-in-out infinite; }

.game-stats {
  display: grid;
  width: min(100%, 620px);
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid rgba(28, 106, 84, .13);
}

.game-stats > div { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 5px; padding: 12px; border-radius: 13px; background: rgba(255, 255, 255, .7); }
.game-stats span { grid-column: 1 / -1; color: #63746f; font-size: .75rem; font-weight: 850; }
.game-stats strong { color: var(--rabbit-green-dark); font-size: clamp(1.65rem, 5vw, 2.25rem); line-height: 1; }
.game-stats small { color: #71817d; font-weight: 800; }
.game-stats .carrot-stat { background: rgba(255, 243, 214, .82); }
.game-stats .carrot-stat strong { color: #bd632f; }

.deck-end-panel { width: min(100%, 620px); padding: 16px; border: 1px solid #d1e2db; border-radius: 14px; background: rgba(255, 255, 255, .86); text-align: center; }
.deck-end-panel strong { display: block; margin-bottom: 12px; color: var(--rabbit-ink); }
.compact-primary { min-height: 44px; padding: 9px 17px; border: 0; border-radius: 11px; background: var(--rabbit-green); color: #fff; font-weight: 900; cursor: pointer; }

.shuffle-dialog { box-sizing: border-box; width: min(92vw, 420px); max-width: calc(100vw - 32px); margin: auto; padding: 0; border: 0; border-radius: 18px; color: var(--rabbit-ink); box-shadow: 0 30px 90px rgba(13, 42, 39, .28); }
.shuffle-dialog::backdrop { background: rgba(8, 31, 30, .5); backdrop-filter: blur(3px); }
.shuffle-dialog form { box-sizing: border-box; max-width: 100%; padding: 28px; overflow-wrap: anywhere; }
.shuffle-dialog h2 { margin: 0 0 10px; font-size: 1.45rem; }
.shuffle-dialog p { margin: 0; color: #61716d; line-height: 1.65; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.dialog-actions button { min-height: 46px; border-radius: 11px; font-weight: 900; cursor: pointer; }
.dialog-cancel { border: 1px solid #d9e3df; background: #f5f8f7; color: #586864; }
.dialog-confirm { border: 0; background: var(--rabbit-green); color: #fff; }

.game-toast {
  position: fixed;
  z-index: 50;
  right: 16px;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 16px;
  box-sizing: border-box;
  width: min(440px, calc(100% - 32px));
  max-width: calc(100% - 32px);
  margin-inline: auto;
  padding: 13px 18px;
  border: 1px solid #b9e7d1;
  border-radius: 12px;
  background: #eafaf2;
  color: #17634f;
  box-shadow: 0 14px 40px rgba(13, 42, 39, .22);
  font-weight: 900;
  text-align: center;
}
.game-toast.is-warning { border-color: #f4d79d; background: #fff8e7; color: #7c5610; }
.game-toast.is-error { border-color: #f0b9af; background: #fff0ed; color: #8d3428; }
.game-toast[hidden] { display: none; }

.strategy-summary { grid-template-columns: repeat(3, 1fr); }

@keyframes rabbit-reveal-card {
  0% { transform: translateY(125px) rotateY(180deg) scale(.72); opacity: .35; }
  58% { transform: translateY(-9px) rotateY(76deg) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) rotateY(0) scale(1); opacity: 1; }
}

@keyframes rabbit-deck-commit {
  0% { transform: translate3d(0, var(--drag-y), 0) rotate(var(--drag-rotate)); opacity: 1; }
  100% { transform: translate3d(0, -150px, 0) rotate(4deg) scale(.72); opacity: 0; }
}

@keyframes rabbit-deck-reshuffle {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0); }
  35% { transform: translate3d(9px, -5px, 0) rotate(4deg); }
  70% { transform: translate3d(-8px, 3px, 0) rotate(-3deg); }
}

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

@media (max-width: 820px) {
  .game-board { padding: 18px 14px 24px; gap: 18px; }
  .game-board-toolbar { align-items: flex-start; }
  .mode-control { width: calc(100% - 62px); }
  .current-card { width: min(68vw, 245px); }
  .draw-deck { width: 108px; height: 137px; }
  .game-stats { gap: 6px; padding-top: 16px; }
  .game-stats > div { padding: 10px 7px; text-align: center; }
  .game-stats span { min-height: 2.3em; }
  .strategy-summary { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .mode-description { display: none; }
  .current-card { width: min(66vw, 220px); }
  .game-stats strong { font-size: 1.65rem; }
  .game-stats span { font-size: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .current-card.is-revealing { animation: rabbit-result-fade .12s linear !important; }
  .draw-deck.is-committing .deck-top-card { animation: none !important; opacity: 0; }
  .draw-deck.is-reshuffling .deck-top-card { animation: none !important; }
  .draw-hint span { animation: none; }
}

@keyframes rabbit-result-fade { from { opacity: .35; } to { opacity: 1; } }

/* UX4: softer family-board styling with one large reveal card and a physical deck. */
.game-board {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: clamp(22px, 5vw, 42px);
  gap: 24px;
  border: 1px solid rgba(50, 135, 108, .14);
  border-radius: 32px;
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 244, 189, .58), transparent 25%),
    linear-gradient(145deg, #f8fffc 0%, #eef9f4 56%, #e4f4ed 100%);
  box-shadow: 0 28px 70px rgba(24, 78, 64, .14), inset 0 0 0 7px rgba(255, 255, 255, .5);
}

.game-board-heading-group { flex: 1 1 auto; min-width: 0; }
.game-board-title { margin: 0; color: #123f3d; font-size: clamp(1.2rem, 3vw, 1.55rem); font-weight: 950; letter-spacing: -.02em; }
.game-board-title span { font-weight: 850; }
.mode-control { width: min(100%, 390px); margin: 24px auto 0; text-align: center; }
.mode-control label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mode-control .mode-select {
  width: auto;
  min-width: 174px;
  min-height: 46px;
  padding: 9px 42px 9px 20px;
  border: 1px solid #b9d9c9;
  border-radius: 999px;
  background-color: #e7f5dd;
  color: #187250;
  box-shadow: 0 7px 18px rgba(33, 111, 81, .09);
  font-size: 1rem;
}
.mode-description { max-width: 390px; margin: 9px auto 0; }

.shuffle-control,
.sound-control {
  flex-basis: 48px;
  width: 48px;
  height: 48px;
  border-color: #c9e2d5;
  border-radius: 15px;
  background: #eaf7e8;
  box-shadow: 0 8px 20px rgba(31, 104, 77, .12), inset 0 0 0 1px rgba(255, 255, 255, .7);
}
.shuffle-control > img { width: 26px; height: 26px; object-fit: contain; }
.shuffle-control:hover { background: #dcf1df; transform: rotate(10deg) scale(1.03); }
.shuffle-control:active { transform: rotate(-8deg) scale(.95); }
.sound-control:hover { background: #dcf1df; }

.draw-stage { gap: 18px; }
.current-card { width: min(78vw, 330px); aspect-ratio: 3 / 4; }
.card-face {
  gap: 0;
  padding: 12px;
  border: 0;
  border-radius: 30px;
  background: #fffdf8;
  box-shadow: 0 24px 50px rgba(40, 70, 61, .18), 0 0 0 1px rgba(46, 104, 86, .08);
}
.card-front { display: grid; grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; justify-content: stretch; }
.card-illustration {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border-radius: 22px 22px 9px 9px;
  background:
    radial-gradient(ellipse at 10% 58%, #fff8ea 0 17%, transparent 18%),
    radial-gradient(ellipse at 84% 54%, #fff8ea 0 19%, transparent 20%),
    radial-gradient(ellipse at 50% 112%, #91bd45 0 49%, transparent 50%),
    linear-gradient(180deg, #dff1f2 0%, #cfe8e9 63%, #f6f1d9 64%);
}
.card-illustration::after {
  content: "";
  position: absolute;
  right: -18%;
  bottom: -17%;
  left: 34%;
  height: 43%;
  border-radius: 50% 50% 0 0;
  background: #a6ce57;
  transform: rotate(-7deg);
}
.card-front .card-illustration > span {
  position: absolute;
  z-index: 3;
  top: 16px;
  right: 12px;
  left: 12px;
  color: #183f3d;
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: .05em;
}
.card-front .card-illustration img {
  position: relative;
  z-index: 2;
  width: auto;
  height: auto;
  max-width: 78%;
  max-height: 75%;
  margin-top: 28px;
  object-fit: contain;
  filter: drop-shadow(0 10px 9px rgba(37, 76, 62, .15));
}
.current-card[data-card-type="rotate"] .card-illustration img { max-width: 70%; max-height: 72%; }
.current-card[data-card-type="move_back"] .card-illustration img { max-width: 82%; max-height: 78%; }
.current-card.has-image-error .card-illustration::before {
  content: "圖片暫時無法載入";
  position: relative;
  z-index: 2;
  color: #64746f;
  font-size: .84rem;
  font-weight: 850;
}
.card-caption {
  display: grid;
  min-height: 76px;
  place-items: center;
  padding: 13px 12px 10px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, #fff7c8, #f3f0a8);
}
.card-front .card-caption strong { color: #243331; font-size: clamp(1.35rem, 5vw, 1.8rem); line-height: 1.22; }
.current-card[data-card-type="move_back"] .card-caption strong { color: #3f56a0; }
.card-back { padding: 17px; background: #fffdf8; }
.card-back::after { display: none; }
.card-back img { width: 100%; height: 100%; object-fit: contain; border-radius: 21px; }
.card-back span { position: absolute; bottom: 34px; padding: 7px 14px; border-radius: 999px; background: rgba(8, 72, 61, .88); }

.draw-deck {
  width: clamp(150px, 46vw, 180px);
  height: auto;
  aspect-ratio: 3 / 4;
  margin-top: 0;
  overflow: visible;
}
.deck-layer, .deck-top-card {
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 18px;
}
.deck-layer {
  border: 1px solid #d8d8d0;
  background: #fffdf7;
  box-shadow: 0 7px 14px rgba(44, 70, 62, .12);
  opacity: 1;
}
.deck-layer-five { transform: translateY(16px); }
.deck-layer-four { transform: translateY(12px); }
.deck-layer-three { transform: translateY(8px); }
.deck-layer-two { transform: translateY(4px); }
.deck-top-card {
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: 0 16px 30px rgba(17, 77, 62, .24);
}
.deck-top-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 2px solid rgba(150, 224, 191, .62);
  border-radius: 11px;
  display: none;
  pointer-events: none;
}
.deck-top-card img {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 18px;
  transform: none;
}
.draw-hint { display: grid; justify-items: center; gap: 3px; margin: 2px 0 0; text-align: center; }
.draw-hint strong { color: #164f3c; font-size: 1rem; }
.draw-hint strong span { font-size: 1.45rem; }
.draw-hint small { color: #6a7773; font-size: .78rem; font-weight: 750; }

.game-stats {
  width: min(100%, 590px);
  gap: 0;
  padding: 14px 8px;
  border: 1px solid #e0e8e3;
  border-radius: 20px;
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 14px 35px rgba(38, 77, 65, .1);
}
.game-stats > div { grid-template-columns: 1fr auto; padding: 7px 16px; border-radius: 0; background: transparent; }
.game-stats > div + div { border-left: 1px solid #dce5e0; }
.game-stats .carrot-stat { background: transparent; }
.game-stats span { color: #465a55; font-size: .78rem; }
.game-stats strong { font-size: clamp(1.9rem, 6vw, 2.65rem); }

.draw-history { gap: 0; }
.draw-history li { min-height: 54px; border: 0; border-radius: 0; border-bottom: 1px solid #e6ece9; }
.draw-history li:last-child { border-bottom: 0; }
.draw-history img { padding: 4px; border-radius: 10px; background: #eef7f2; object-fit: contain; }
.draw-history li.has-image-error::before { content: "圖"; display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: #eef7f2; color: #64746f; font-size: .72rem; font-weight: 900; }
.draw-history small { font-variant-numeric: tabular-nums; }

.shuffle-dialog { width: min(92vw, 480px); border-radius: 28px; }
.shuffle-dialog form { position: relative; padding: 30px; text-align: center; }
.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: #f1f4f2;
  color: #53615d;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}
.shuffle-dialog-icon { display: grid; width: 68px; height: 68px; margin: 2px auto 14px; place-items: center; border-radius: 22px; background: #e6f5e8; color: #16805b; }
.shuffle-dialog-icon img { width: 44px; height: 44px; object-fit: contain; }
.shuffle-dialog h2 { margin-bottom: 8px; font-size: 1.65rem; }
.shuffle-dialog .shuffle-dialog-description { max-width: 360px; margin-inline: auto; color: #657570; }
.shuffle-options { display: grid; gap: 12px; margin-top: 24px; text-align: left; }
.shuffle-option { box-sizing: border-box; display: grid; grid-template-columns: 56px minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; max-width: 100%; min-height: 96px; padding: 12px 14px; border: 1px solid #b9dbc8; border-radius: 17px; background: #f1fbf5; color: #174d3e; text-align: left; cursor: pointer; }
.shuffle-option.is-primary { border-color: #8fcbd2; background: #eef9fb; color: #164a50; }
.shuffle-option-image { display: block; width: 52px; height: 52px; object-fit: contain; }
.shuffle-option-content { display: grid; min-width: 0; gap: 5px; overflow-wrap: anywhere; text-align: left; }
.shuffle-option-title { display: block; font-size: 1.05rem; font-weight: 950; text-align: left; }
.shuffle-option-copy { display: block; color: #60736c; font-size: .84rem; line-height: 1.5; text-align: left; }
.shuffle-option.is-primary .shuffle-option-copy { color: #587075; }
.shuffle-option:hover { box-shadow: 0 9px 22px rgba(28, 102, 76, .12); transform: translateY(-1px); }
.shuffle-option:active { transform: translateY(1px); }
.shuffle-dialog .dialog-cancel { width: 100%; min-height: 48px; margin-top: 12px; border: 0; border-radius: 13px; background: transparent; color: #52645e; font-weight: 900; text-align: center; cursor: pointer; }
.shuffle-control:focus-visible, .sound-control:focus-visible, .draw-deck:focus-visible, .compact-primary:focus-visible, .dialog-close:focus-visible, .dialog-cancel:focus-visible, .shuffle-option:focus-visible { outline: 4px solid rgba(38, 140, 111, .28); outline-offset: 3px; }

@media (max-width: 600px) {
  .rabbit-layout { padding-inline: 12px; }
  .game-board { padding: 20px 14px 24px; border-radius: 24px; box-shadow: 0 18px 42px rgba(24, 78, 64, .12), inset 0 0 0 5px rgba(255, 255, 255, .44); }
  .game-board-toolbar { gap: 10px; }
  .game-board-actions { gap: 6px; }
  .game-board-title { font-size: 1.08rem; }
  .game-board-title span { display: inline; }
  .mode-control { width: 100%; margin-top: 19px; }
  .mode-control .mode-select { width: 100%; min-width: 0; max-width: 100%; }
  .mode-description { display: none; }
  .current-card { width: min(82vw, 310px); }
  .draw-deck { width: clamp(150px, 46vw, 180px); }
  .game-stats > div { padding-inline: 8px; text-align: center; }
  .game-stats span { min-height: auto; font-size: .7rem; }
  .game-stats strong { font-size: clamp(1.7rem, 9vw, 2.2rem); }
  .game-stats small { font-size: .72rem; }
  .shuffle-dialog { width: 100%; max-width: 100%; max-height: min(92dvh, 720px); margin: auto 0 0; border-radius: 28px 28px 0 0; }
  .shuffle-dialog form { padding: 26px 20px max(20px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .shuffle-dialog-icon { width: 58px; height: 58px; }
  .shuffle-dialog-icon img { width: 38px; height: 38px; }
  .shuffle-option { grid-template-columns: 52px minmax(0, 1fr); min-height: 92px; padding: 11px 12px; gap: 10px; }
  .shuffle-option-image { width: 48px; height: 48px; }
}

@media (max-width: 390px) {
  .game-board-title span { display: block; margin-top: 2px; }
  .current-card { width: min(82vw, 286px); }
  .draw-deck { width: clamp(150px, 46vw, 180px); }
  .card-caption { min-height: 68px; }
  .game-stats { padding-inline: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .shuffle-control, .sound-control, .shuffle-option { transition: none !important; }
  .shuffle-control:hover, .shuffle-control:active, .sound-control:hover, .sound-control:active, .shuffle-option:hover, .shuffle-option:active { transform: none !important; }
}
