:root {
  --navy: #073b8e;
  --blue: #0c65c9;
  --turquoise: #10b7c9;
  --aqua: #dff8f8;
  --ivory: #fffaf0;
  --gold: #f2b92f;
  --gold-deep: #c98509;
  --burgundy: #9f2048;
  --red: #d73345;
  --green: #178a54;
  --ink: #153154;
  --muted: #60738d;
  --shadow: 0 20px 45px rgba(5, 42, 96, 0.18);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; background: #eef9ff; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Assistant, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255,255,255,.95) 0 9%, transparent 24%),
    radial-gradient(circle at 86% 15%, rgba(253, 201, 59, .2), transparent 25%),
    linear-gradient(145deg, #e9fbff 0%, #fff9e9 49%, #eaf6ff 100%);
}

.site-header h1, .welcome-copy h2, .setup-card h2, .ending-card h2, .game-toolbar h2, .dialog-card h2, .button {
  font-family: Rubik, Assistant, Arial, sans-serif;
}

.corner-fruit {
  position: fixed;
  z-index: 0;
  width: 250px;
  height: auto;
  opacity: .78;
  filter: drop-shadow(0 12px 18px rgba(119, 16, 40, .2));
  pointer-events: none;
}
.corner-fruit-right { right: -84px; top: 95px; transform: rotate(14deg); }
.corner-fruit-left { left: -100px; bottom: 55px; transform: scaleX(-1) rotate(12deg); }

.page-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
  width: min(1440px, calc(100% - 32px));
  margin: 14px auto 0;
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  color: white;
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 24px;
  background: linear-gradient(135deg, #062e75, #0872cf 58%, #0ca8bd);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.28);
}

.site-header h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.35rem); line-height: 1.05; }
.eyebrow { margin: 0 0 4px; font-size: .88rem; font-weight: 800; letter-spacing: .03em; opacity: .85; }
.header-tagline { margin: 4px 0 0; font-size: clamp(.76rem, 1.5vw, 1rem); font-weight: 900; color: #fff4b7; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(#ffe99c, #e7a71c); color: #6b4200; font-size: 1.45rem; box-shadow: inset 0 2px 4px rgba(255,255,255,.9); }
.icon-button { margin-inline-start: auto; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.25rem; cursor: pointer; background: rgba(255,255,255,.17); color: white; }

main { width: min(1440px, calc(100% - 32px)); margin: 16px auto; flex: 1; }
.screen { display: none; }
.screen.active { display: block; animation: reveal .45s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } }

.welcome-screen {
  min-height: min(70vh, 740px);
  grid-template-columns: minmax(300px, .95fr) minmax(360px, 1.05fr);
  align-items: center;
  overflow: hidden;
  padding: clamp(26px, 5vw, 70px);
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 36px;
  background:
    radial-gradient(circle at 73% 35%, rgba(255, 221, 99, .75), transparent 24%),
    linear-gradient(125deg, rgba(255,255,255,.98), rgba(229,250,255,.94) 52%, rgba(255,246,210,.96));
  box-shadow: var(--shadow);
}
.welcome-screen.active { display: grid; }
.welcome-copy { max-width: 620px; }
.glow-pill { display: inline-flex; color: var(--navy); font-weight: 900; border: 1px solid #9edfe9; background: #e9fcff; border-radius: 999px; padding: 8px 15px; }
.welcome-copy h2 { margin: 18px 0 8px; font-size: clamp(2.6rem, 6vw, 5.5rem); line-height: .94; color: var(--navy); }
.welcome-copy p { margin: 0; max-width: 510px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.55; }
.welcome-copy .welcome-tagline { margin: 0 0 12px; color: var(--burgundy); font-size: clamp(1.35rem, 2.6vw, 2rem); font-weight: 900; line-height: 1.2; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.button { min-height: 52px; border: 0; border-radius: 16px; padding: 13px 22px; font: inherit; font-size: 1.06rem; font-weight: 900; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.button:hover { transform: translateY(-2px); filter: brightness(1.03); }
.button:focus-visible, .icon-button:focus-visible, .die-button:focus-visible, .small-button:focus-visible, .mode-card:focus-visible { outline: 4px solid rgba(242,185,47,.55); outline-offset: 3px; }
.button.primary { color: white; background: linear-gradient(135deg, #0b70d4, #09aeb9); box-shadow: 0 10px 24px rgba(7, 96, 184, .25); }
.button.secondary { color: var(--navy); border: 2px solid #b8d6ee; background: white; }
.button.install { color: white; background: linear-gradient(135deg, #178a54, #20aa70); box-shadow: 0 10px 24px rgba(23,138,84,.25); }
.button.wide { width: 100%; }

.welcome-visual { position: relative; align-self: stretch; min-height: 500px; }
.welcome-character { position: absolute; z-index: 2; height: min(86%, 550px); bottom: -8%; filter: drop-shadow(0 22px 16px rgba(10,53,99,.22)); }
.welcome-boy { right: -1%; transform: rotate(2deg); }
.welcome-girl { right: 29%; z-index: 1; height: min(78%, 500px); transform: rotate(-2deg); }
.preview-cell { position: absolute; left: 6%; bottom: 11%; width: 170px; height: 170px; display: grid; place-items: center; border: 8px solid var(--gold); border-radius: 28px; color: var(--navy); font-size: 5rem; font-weight: 900; background: linear-gradient(145deg, white, var(--aqua)); box-shadow: var(--shadow); }
.floating-die { position: absolute; left: 22%; top: 17%; font-size: 6rem; color: var(--navy); filter: drop-shadow(0 10px 12px rgba(7,59,142,.18)); animation: float 2.7s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-12px) rotate(8deg); } }

.setup-card, .ending-card {
  width: min(780px, 100%);
  margin: 26px auto;
  padding: clamp(24px, 4vw, 48px);
  border: 2px solid white;
  border-radius: 30px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.setup-card h2, .ending-card h2 { margin: 0 0 22px; text-align: center; color: var(--navy); font-size: clamp(1.8rem, 4vw, 3rem); }
.back-button { float: left; border: 0; color: var(--navy); background: transparent; font: inherit; font-weight: 800; cursor: pointer; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mode-card { min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 3px solid #d8e6f2; border-radius: 24px; color: var(--ink); background: #f9fcff; font: inherit; cursor: pointer; }
.mode-card.selected { border-color: var(--turquoise); background: #eaffff; box-shadow: 0 8px 20px rgba(16,183,201,.16); }
.mode-card strong { font-size: 1.25rem; }
.mode-card small { color: var(--muted); font-size: .95rem; }
.mode-icon { font-size: 2.35rem; }
.level-picker { display: flex; flex-wrap: wrap; gap: 18px; margin: 22px 0; padding: 18px; border: 2px solid #d8e6f2; border-radius: 18px; }
.level-picker legend, .character-picker legend { color: var(--navy); font-weight: 900; padding: 0 8px; }
.level-picker label { font-weight: 800; cursor: pointer; }
.level-picker input { width: 19px; height: 19px; vertical-align: middle; accent-color: var(--turquoise); }
.character-picker { margin: 0 0 22px; padding: 14px; border: 2px solid #d8e6f2; border-radius: 18px; }
.character-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.character-card { min-height: 125px; display: flex; align-items: center; justify-content: center; gap: 12px; overflow: hidden; border: 3px solid #d8e6f2; border-radius: 18px; color: var(--ink); background: #f9fcff; font: inherit; font-size: 1.08rem; cursor: pointer; }
.character-card.selected { border-color: var(--turquoise); background: #eaffff; box-shadow: 0 7px 18px rgba(16,183,201,.16); }
.character-card img { align-self: flex-end; width: 70px; height: 112px; object-fit: contain; object-position: bottom; }
.class-options { margin: 0 0 20px; padding: 18px; border-radius: 18px; background: #f0f9ff; }
.class-options label { display: block; margin-bottom: 7px; font-weight: 900; }
.class-options select, .group-inputs input, .resolution-area input { width: 100%; min-height: 46px; border: 2px solid #b9d0e5; border-radius: 12px; padding: 9px 12px; font: inherit; background: white; }
.group-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.game-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 12px 18px; border-radius: 20px; background: rgba(255,255,255,.86); box-shadow: 0 8px 20px rgba(7,59,142,.1); }
.game-toolbar h2 { margin: 0; color: var(--navy); font-size: clamp(1.35rem, 3vw, 2.1rem); }
.toolbar-actions { display: flex; gap: 8px; }
.small-button { min-height: 42px; border: 1px solid #c4d8ea; border-radius: 12px; padding: 8px 13px; color: var(--navy); font: inherit; font-weight: 800; cursor: pointer; background: white; }
.small-button.danger { color: #9a2242; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; direction: ltr; }
.board-column, .control-panel { direction: rtl; }
.board-column { position: relative; padding-bottom: 96px; }
.board-frame { position: relative; width: min(100%, 920px); aspect-ratio: 1; margin: auto; padding: 10px; border: 5px solid var(--gold); border-radius: 27px; background: #084493; box-shadow: var(--shadow), inset 0 0 0 3px rgba(255,255,255,.4); }
.board { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: repeat(10, 1fr); width: 100%; height: 100%; overflow: hidden; border-radius: 15px; direction: ltr; }
.cell { position: relative; min-width: 0; display: flex; align-items: flex-start; justify-content: flex-start; padding: 4px; border: 1px solid rgba(7,59,142,.22); color: #133d70; background: rgba(255,250,240,.95); }
.cell.alt { background: rgba(218,248,250,.96); }
.cell-number { position: relative; z-index: 6; display: grid; place-items: center; min-width: 21px; height: 21px; border-radius: 7px; color: var(--navy); font-size: clamp(.62rem, 1.15vw, .9rem); font-weight: 900; background: rgba(255,255,255,.76); }
.cell.light-cell { box-shadow: inset 0 0 0 3px rgba(246,195,52,.65), inset 0 0 24px rgba(255,226,111,.75); }
.cell.light-cell::after { content: "✨"; position: absolute; right: 5px; bottom: 3px; font-size: clamp(.7rem, 1.5vw, 1.15rem); filter: drop-shadow(0 1px 3px #fff); }
.cell.gift-cell::after { content: "🎁"; position: absolute; right: 7px; bottom: 3px; z-index: 5; font-size: clamp(.85rem, 2vw, 1.4rem); filter: drop-shadow(0 2px 3px rgba(90,20,40,.28)); }
.cell.finish-cell { background: linear-gradient(145deg, #ffe78b, #ffba31); }
.cell.finish-cell::after { content: "❤"; position: absolute; inset: 0; display: grid; place-items: center; color: #c52042; font-size: clamp(1.1rem, 3vw, 2rem); opacity: .85; }
.cell.landed { z-index: 7; animation: landedPulse .85s ease; }
.cell.landed::before { content: ""; position: absolute; inset: 4px; border: 4px solid #fff2a4; border-radius: 10px; box-shadow: 0 0 0 3px var(--gold), 0 0 22px 8px rgba(255,205,52,.82); pointer-events: none; }
@keyframes landedPulse { 40% { transform: scale(1.09); } }
.board-lines { position: absolute; z-index: 3; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); pointer-events: none; overflow: visible; }
.rope-path { fill: none; stroke: var(--burgundy); stroke-width: 15; stroke-linecap: round; filter: drop-shadow(0 5px 4px rgba(61,8,27,.28)); }
.rope-highlight { fill: none; stroke: #ec6b89; stroke-width: 4; stroke-linecap: round; opacity: .8; }
.ladder-rail { stroke: #d48b0b; stroke-width: 13; stroke-linecap: round; filter: drop-shadow(0 4px 3px rgba(90,55,0,.28)); }
.ladder-shine { stroke: #ffe47b; stroke-width: 5; stroke-linecap: round; }
.ladder-rung { stroke: #f2ae22; stroke-width: 11; stroke-linecap: round; }
.token-stack { position: absolute; inset: 25% 7% 5%; z-index: 8; display: flex; flex-wrap: wrap; align-content: flex-end; justify-content: center; gap: 2px; pointer-events: none; }
.player-token { width: clamp(14px, 2vw, 25px); height: clamp(14px, 2vw, 25px); border: 2px solid white; border-radius: 50%; display: grid; place-items: center; color: white; font-size: .65rem; font-weight: 900; box-shadow: 0 2px 6px rgba(6,31,65,.42); }
.player-token.avatar-token { width: clamp(20px, 2.8vw, 34px); height: clamp(20px, 2.8vw, 34px); overflow: hidden; background: white !important; }
.player-token.avatar-token.active-token { outline: 3px solid var(--gold); box-shadow: 0 0 14px 4px rgba(255,205,52,.85); animation: tokenPop .24s ease; }
.player-token.avatar-token img { width: 100%; height: 125%; object-fit: cover; object-position: 50% 8%; transform: translateY(4%); }
.player-token.computer-token { width: clamp(20px, 2.8vw, 34px); height: clamp(20px, 2.8vw, 34px); font-size: clamp(.9rem, 2vw, 1.3rem); background: #e8f1ff !important; }
.player-token.computer-token.active-token { outline: 3px solid var(--gold); box-shadow: 0 0 14px 4px rgba(255,205,52,.85); animation: tokenPop .24s ease; }
@keyframes tokenPop { from { transform: scale(.5); } }
.player-token.step-hop { animation: stepHop .38s cubic-bezier(.2,.85,.35,1.25); }
@keyframes stepHop {
  0% { transform: translateY(0) scale(.86); }
  45% { transform: translateY(-16px) scale(1.13); }
  100% { transform: translateY(0) scale(1); }
}
.move-count { position: absolute; z-index: 14; left: 50%; top: 3%; width: clamp(28px, 4vw, 42px); height: clamp(28px, 4vw, 42px); display: grid; place-items: center; border: 3px solid white; border-radius: 50%; color: white; font-size: clamp(1rem, 2.5vw, 1.45rem); font-weight: 900; background: linear-gradient(145deg, var(--burgundy), var(--red)); box-shadow: 0 5px 14px rgba(95,17,48,.35); transform: translateX(-50%); animation: countPop .36s ease both; pointer-events: none; }
@keyframes countPop { from { opacity: 0; transform: translateX(-50%) scale(.45); } }
.player-token.path-hidden { visibility: hidden; }
.path-traveler { --traveler-tilt: 0deg; position: absolute; z-index: 16; left: 0; top: 0; width: clamp(34px, 5.2vw, 64px); height: clamp(45px, 7.2vw, 88px); display: grid; place-items: center; color: #173b73; font-size: clamp(1.8rem, 4vw, 3.2rem); filter: drop-shadow(0 7px 6px rgba(5,35,75,.32)); transform: translate(-50%, -63%) rotate(var(--traveler-tilt)); transform-origin: 50% 78%; pointer-events: none; }
.path-traveler img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.path-traveler.ladder-traveler img { animation: climbingBody .32s ease-in-out infinite alternate; }
.path-traveler.rope-traveler { filter: drop-shadow(0 7px 6px rgba(95,17,48,.35)); }
@keyframes climbingBody { to { transform: translateY(-5px) rotate(3deg); } }
.end-flag { position: absolute; z-index: 9; right: -10px; top: -21px; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 3px solid white; border-radius: 999px; color: white; font-weight: 900; background: linear-gradient(135deg, #c41f3b, #e34654); box-shadow: 0 8px 15px rgba(129,19,44,.25); }
.start-dock { position: absolute; z-index: 10; right: 0; bottom: 0; width: clamp(118px, 18vw, 165px); min-height: 78px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 7px; padding: 9px 10px; border: 4px solid var(--gold); border-radius: 18px; color: white; background: linear-gradient(145deg, #117a52, #0b9b72); box-shadow: 0 10px 22px rgba(11,91,64,.25), inset 0 2px rgba(255,255,255,.32); pointer-events: none; }
.start-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: clamp(.75rem, 1.5vw, 1rem); letter-spacing: .04em; }
.start-token-stack { min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px; }
.start-token-stack .player-token { width: clamp(28px, 4vw, 42px); height: clamp(28px, 4vw, 42px); }
.start-token-stack .player-token.avatar-token { width: clamp(34px, 5vw, 50px); height: clamp(48px, 6.5vw, 66px); overflow: visible; border: 0; border-radius: 0; background: transparent !important; box-shadow: none; }
.start-token-stack .player-token.avatar-token img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; transform: none; filter: drop-shadow(0 5px 4px rgba(4,45,35,.28)); }
.start-dock.empty .start-token-stack::after { content: "מכאן מתחילים"; color: rgba(255,255,255,.88); font-size: .75rem; font-weight: 800; text-align: center; }

.control-panel { position: sticky; top: 14px; display: flex; flex-direction: column; gap: 12px; }
.turn-card, .legend { padding: 17px; border: 2px solid white; border-radius: 20px; background: rgba(255,255,255,.94); box-shadow: 0 9px 22px rgba(7,59,142,.11); }
.turn-card { text-align: center; }
.turn-label { display: block; color: var(--muted); font-weight: 700; }
.turn-card strong { display: block; margin: 5px 0 10px; color: var(--navy); font-size: 1.35rem; }
.player-swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 2px #d5e2ee; }
.swatch.active { box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); }
.die-button { min-height: 152px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 4px solid #ffe286; border-radius: 25px; color: white; font: inherit; font-size: 1.25rem; font-weight: 900; cursor: pointer; background: linear-gradient(145deg, #0967c8, #08aaba); box-shadow: 0 15px 26px rgba(6,88,166,.25), inset 0 2px rgba(255,255,255,.38); }
.die-button:disabled { cursor: wait; filter: grayscale(.25); opacity: .7; }
.die { font-size: 4.5rem; line-height: 1; color: white; text-shadow: 0 5px 10px rgba(0,32,86,.3); }
.die.rolling { animation: roll .15s linear infinite; }
@keyframes roll { to { transform: rotate(90deg) scale(1.08); } }
.dice-result-overlay { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(3, 31, 79, .6); backdrop-filter: blur(4px); }
.dice-result-card { min-width: min(360px, 90vw); padding: 25px 32px; display: flex; flex-direction: column; align-items: center; gap: 7px; border: 5px solid #ffe58b; border-radius: 30px; color: var(--navy); background: linear-gradient(145deg, white, #fff8d9); box-shadow: 0 25px 65px rgba(0,22,57,.42), inset 0 2px white; animation: diceReveal .42s cubic-bezier(.2,.9,.3,1.25); }
.dice-result-card > span { font-size: 1.15rem; font-weight: 800; color: var(--muted); }
.dice-result-face { font-size: clamp(6rem, 18vw, 9rem); line-height: .9; color: var(--blue); text-shadow: 0 7px 14px rgba(7,59,142,.18); }
.dice-result-card > b { font-size: clamp(1.8rem, 6vw, 2.7rem); color: var(--navy); }
@keyframes diceReveal { from { opacity: 0; transform: scale(.55) rotate(-8deg); } }
.status-message { min-height: 52px; margin: 0; padding: 12px; text-align: center; border-radius: 14px; color: #6b4200; font-weight: 800; background: #fff4c7; }
.legend h3 { margin: 0 0 12px; color: var(--navy); }
.legend span { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: .9rem; }
.legend-dot { width: 18px; height: 18px; border-radius: 5px; }
.legend-dot.light { background: #ffe16d; box-shadow: 0 0 8px #efbd18; }
.legend-dot.gift { background: var(--burgundy); }
.legend-line { width: 28px; height: 6px; border-radius: 6px; }
.legend-line.ladder { background: var(--gold); }
.legend-line.rope { background: var(--burgundy); }

dialog { border: 0; }
dialog::backdrop { background: rgba(2, 20, 55, .68); backdrop-filter: blur(5px); }
.dialog-card { width: min(570px, calc(100% - 28px)); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; padding: 30px; border: 3px solid #f3c94d; border-radius: 26px; color: var(--ink); background: linear-gradient(150deg, #fff, #fff9e8); box-shadow: 0 25px 65px rgba(0,22,57,.35); }
.dialog-card h2 { margin: 0 0 13px; color: var(--navy); text-align: center; font-size: 1.8rem; }
.dialog-card ol { padding-right: 22px; line-height: 1.7; }
.dialog-close { position: absolute; left: 12px; top: 10px; border: 0; color: var(--navy); background: transparent; font-size: 2rem; cursor: pointer; }
.dialog-note { padding: 10px 13px; border-radius: 12px; color: #6b4200; background: #fff0ba; }
.install-dialog-icon { margin: 0 auto 8px; font-size: 3.2rem; }
.game-title-tagline { margin: 3px 0 0; color: var(--burgundy); font-weight: 900; font-size: clamp(.74rem, 1.6vw, .96rem); }
.event-dialog { text-align: center; }
.event-dialog #eventContinueButton { position: sticky; bottom: 0; z-index: 2; margin-top: 12px; box-shadow: 0 -8px 18px rgba(255,249,232,.92), 0 8px 18px rgba(0,22,57,.18); }
.event-icon { margin: -4px auto 8px; font-size: 3.5rem; }
.feedback-hearts { min-height: 42px; margin: 7px 0 3px; direction: ltr; }
.feedback-hearts span { display: inline-block; margin: 0 3px; color: #e33159; font-size: clamp(1.6rem, 6vw, 2.35rem); filter: drop-shadow(0 5px 5px rgba(159,32,72,.22)); animation: heartCheer .8s cubic-bezier(.2,.75,.32,1.35) both; }
.feedback-hearts span:nth-child(2) { animation-delay: .08s; }
.feedback-hearts span:nth-child(3) { animation-delay: .16s; }
.feedback-hearts span:nth-child(4) { animation-delay: .24s; }
.feedback-hearts span:nth-child(5) { animation-delay: .32s; }
@keyframes heartCheer { from { opacity: 0; transform: translateY(20px) scale(.35) rotate(-12deg); } 55% { opacity: 1; transform: translateY(-8px) scale(1.18) rotate(6deg); } to { opacity: 1; transform: translateY(0) scale(1); } }
.event-dialog.rope-event { border-color: #d16483; background: linear-gradient(150deg, #fff, #fff0f4); }
.event-dialog.ladder-event { border-color: #f0bd26; background: linear-gradient(150deg, #fff, #fff8dc); }
.question-area, .resolution-area { margin: 16px 0; padding: 15px; border-radius: 16px; text-align: right; background: #edf9ff; }
.question-text { margin: 0 0 11px; color: var(--navy); font-size: 1.08rem; font-weight: 900; }
.answer-buttons { display: grid; gap: 8px; }
.answer-button { min-height: 45px; border: 2px solid #bfd7ea; border-radius: 12px; padding: 8px 11px; color: var(--ink); font: inherit; font-weight: 800; text-align: right; cursor: pointer; background: white; }
.answer-button:hover { border-color: var(--turquoise); }
.answer-button.correct { border-color: #3db778; background: #e5f9ee; animation: correctPulse .55s ease both; }
.answer-button.wrong { border-color: #dc6a82; background: #fff0f3; animation: tryAgainShake .42s ease both; }
.answer-button:disabled { cursor: default; opacity: .72; }
.answer-button.correct:disabled { opacity: 1; }
@keyframes correctPulse { 50% { transform: scale(1.035); box-shadow: 0 0 0 5px rgba(61,183,120,.17); } }
@keyframes tryAgainShake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.resolution-area label { display: block; margin-bottom: 7px; color: var(--navy); font-weight: 900; }
.compact-dialog { text-align: center; }
.dialog-actions, .ending-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.danger-button { color: white; background: var(--burgundy); }

.ending-card { text-align: center; overflow: hidden; }
.celebration-stars { color: var(--gold); font-size: 2.4rem; letter-spacing: .3em; animation: sparkle 1.3s ease-in-out infinite alternate; }
@keyframes sparkle { to { transform: scale(1.06); filter: brightness(1.2); } }
.heart-output { width: min(520px, 96%); aspect-ratio: 1.08; margin: 20px auto; padding: 21% 15% 18%; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 7px; color: white; background: #d72f4b; clip-path: polygon(50% 100%, 43% 93%, 25% 76%, 10% 58%, 3% 40%, 4% 25%, 12% 12%, 25% 6%, 37% 9%, 50% 23%, 63% 9%, 75% 6%, 88% 12%, 96% 25%, 97% 40%, 90% 58%, 75% 76%, 57% 93%); filter: drop-shadow(0 18px 18px rgba(147,20,50,.25)); }
.heart-chip { max-width: 42%; padding: 5px 9px; border-radius: 999px; font-size: clamp(.72rem, 1.7vw, 1rem); font-weight: 900; background: rgba(255,255,255,.22); }

footer { width: min(1440px, calc(100% - 32px)); margin: 0 auto 14px; padding: 12px 16px; text-align: center; color: #46617f; font-size: .9rem; }
footer a { color: var(--navy); font-weight: 900; text-decoration: none; }

@media (max-width: 980px) {
  .welcome-screen.active { grid-template-columns: 1fr; }
  .welcome-copy { text-align: center; margin: auto; }
  .welcome-actions { justify-content: center; }
  .welcome-visual { min-height: 360px; }
  .welcome-character { height: 370px; }
  .welcome-boy { right: 23%; }
  .welcome-girl { right: 42%; height: 340px; }
  .preview-cell { left: 13%; width: 125px; height: 125px; font-size: 3.8rem; }
  .game-layout { grid-template-columns: 1fr; }
  .control-panel { order: -1; position: sticky; top: max(6px, env(safe-area-inset-top)); z-index: 20; display: grid; grid-template-columns: 1fr 1fr; padding: 10px; border: 2px solid rgba(255,255,255,.95); border-radius: 22px; background: linear-gradient(145deg, rgba(240,251,255,.97), rgba(255,248,218,.97)); box-shadow: 0 12px 28px rgba(7,59,142,.2); backdrop-filter: blur(10px); }
  .legend { display: none; }
  .status-message { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
  .corner-fruit { width: 150px; opacity: .52; }
  .site-header, main, footer { width: min(100% - 18px, 1440px); }
  .site-header { min-height: 68px; border-radius: 18px; padding: 10px 12px; }
  .site-header h1 { font-size: 1.35rem; }
  .site-header .eyebrow { font-size: .72rem; }
  .header-tagline { max-width: 220px; font-size: .68rem; line-height: 1.15; }
  .brand-mark { width: 40px; height: 40px; }
  .welcome-screen { padding: 24px 16px; border-radius: 24px; }
  .welcome-copy h2 { font-size: 2.35rem; }
  .welcome-visual { min-height: 315px; }
  .welcome-character { height: 315px; }
  .welcome-boy { right: 15%; }
  .welcome-girl { right: 39%; height: 285px; }
  .preview-cell { left: 3%; bottom: 10%; width: 95px; height: 95px; border-width: 5px; font-size: 3rem; }
  .floating-die { left: 4%; top: 14%; font-size: 4.4rem; }
  .choice-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 115px; }
  .group-inputs { grid-template-columns: 1fr; }
  .game-toolbar { align-items: flex-start; }
  .game-toolbar .eyebrow { font-size: .75rem; }
  .toolbar-actions { flex-direction: column; }
  .small-button { min-height: 36px; padding: 6px 9px; font-size: .78rem; }
  .board-frame { padding: 5px; border-width: 3px; border-radius: 17px; }
  .board-lines { inset: 5px; width: calc(100% - 10px); height: calc(100% - 10px); }
  .cell { padding: 1px; }
  .cell-number { min-width: 15px; height: 15px; border-radius: 4px; font-size: .55rem; }
  .board-column { padding-bottom: 76px; }
  .start-dock { min-height: 62px; padding: 6px 7px; border-width: 3px; border-radius: 13px; }
  .start-token-stack { min-height: 40px; gap: 3px; }
  .start-token-stack .player-token { width: 27px; height: 27px; }
  .start-token-stack .player-token.avatar-token { width: 31px; height: 43px; }
  .path-traveler { width: 38px; height: 53px; }
  .end-flag { right: -5px; top: -16px; padding: 5px 9px; font-size: .74rem; }
  .control-panel { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 8px; border-radius: 18px; }
  .turn-card { min-height: 70px; padding: 8px 10px; border-width: 1px; border-radius: 15px; text-align: right; box-shadow: none; }
  .turn-label { font-size: .73rem; }
  .turn-card strong { margin: 2px 0 5px; font-size: 1.08rem; }
  .player-swatches { justify-content: flex-start; gap: 5px; }
  .swatch { width: 12px; height: 12px; }
  .die-button { min-width: 126px; min-height: 70px; flex-direction: row; gap: 7px; padding: 7px 10px; border-width: 3px; border-radius: 16px; font-size: .9rem; line-height: 1.1; box-shadow: 0 7px 15px rgba(6,88,166,.22), inset 0 2px rgba(255,255,255,.38); }
  .die { font-size: 2.7rem; }
  .status-message { min-height: 0; padding: 7px 9px; border-radius: 11px; font-size: .78rem; line-height: 1.25; }
  .dialog-card { max-height: calc(100dvh - 12px); padding: 24px 18px 14px; }
  footer span { display: none; }
  footer a { display: block; margin-top: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .player-token.step-hop, .path-traveler img, .feedback-hearts span, .answer-button.correct, .answer-button.wrong { animation: none; }
}

@media print {
  body * { visibility: hidden; }
  .ending-card, .ending-card * { visibility: visible; }
  .ending-card { position: fixed; inset: 0; width: 100%; box-shadow: none; }
  .ending-actions { display: none; }
}
