:root {
  --ink: #102f35;
  --paper: #fffaf0;
  --orange: #ff7a32;
  --yellow: #ffd65a;
  --mint: #7ad7c3;
  --line: rgba(16, 47, 53, .18);
  --shadow: 0 14px 38px rgba(19, 42, 54, .16);
  --world-game-bg: #06182a;
  --world-game-surface: #0a2238;
  --world-game-surface-strong: #0e2b45;
  --world-game-panel: #f8f4ea;
  --world-game-line: rgba(181, 216, 232, .24);
  --world-game-muted: #afc5d2;
  --world-game-accent: #ff7a32;
  --world-game-radius-sm: 8px;
  --world-game-radius-md: 16px;
  --world-game-space-2: 8px;
  --world-game-space-3: 12px;
  --world-game-space-4: 16px;
  --world-game-motion: 180ms;
  --world-dice-roll: 720ms;
  --world-token-step: 150ms;
  --world-motion-ease: cubic-bezier(.2, .8, .2, 1);
  --world-ad-rail: clamp(56px, 8vw, 140px);
  --world-ad-gap: 10px;
  --world-ad-min-height: 600px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
button { cursor: pointer; }
body.world-page {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 214, 90, .24), transparent 22rem),
    #f4efe5;
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
body.world-page.is-playing { color: #f4f6f8; background: var(--world-game-bg); }
body.world-page.is-playing .world-header { height: 60px; }
body.world-page.is-playing .world-brand { color: #f4f6f8; }
body.world-page.is-playing .world-room-code,
body.world-page.is-playing .icon-button { color: #f4f6f8; border-color: var(--world-game-line); background: var(--world-game-surface); }

.world-header {
  width: min(1520px, calc(100% - 32px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.world-brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.world-brand-mark {
  width: 43px; height: 43px; display: grid; place-items: center;
  border: 3px solid var(--ink); border-radius: 15px 15px 13px 13px;
  background: var(--orange); color: #fff; font-weight: 950; transform: rotate(-3deg);
  box-shadow: 0 4px 0 var(--ink);
}
.world-brand b { display: block; font-size: 19px; line-height: 1; }
.world-brand small { display: block; margin-top: 4px; letter-spacing: .16em; font-size: 9px; font-weight: 800; opacity: .62; }
.world-header-actions { display: flex; align-items: center; gap: 9px; }
.world-room-code, .icon-button {
  border: 2px solid var(--ink); border-radius: 12px; background: rgba(255,255,255,.86);
  min-height: 40px; padding: 8px 12px; color: var(--ink); font-size: 13px; font-weight: 800;
}
.world-room-code b { margin-left: 5px; color: var(--orange); letter-spacing: .12em; font-size: 17px; }

.world-ad-layout {
  width: min(1800px, calc(100% - 12px));
  display: grid;
  grid-template-columns: var(--world-ad-rail) minmax(0, 1520px) var(--world-ad-rail);
  align-items: start;
  justify-content: center;
  gap: var(--world-ad-gap);
  margin-inline: auto;
}
.world-main { width: 100%; min-width: 0; margin: 0 auto 48px; }
.world-side-ad {
  position: sticky;
  top: 12px;
  min-width: 0;
  min-height: var(--world-ad-min-height);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--world-game-radius-sm);
  background: rgba(255,255,255,.5);
  color: #748286;
  text-align: center;
}
.world-side-ad > span, .world-bottom-ad > span { padding: 7px 8px; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 900; }
.world-side-ad > div, .world-bottom-ad > div { min-height: 0; display: grid; place-items: center; font-size: 11px; }
body.world-page.is-playing .world-side-ad { border-color: var(--world-game-line); background: var(--world-game-surface); color: var(--world-game-muted); }
body.world-page.is-playing .world-side-ad > span { border-bottom-color: var(--world-game-line); }
body.world-page.is-ad-free .world-side-ad,
body.world-page.is-ad-free .world-bottom-ad { display: none; }
body.world-page.is-ad-free .world-ad-layout { grid-template-columns: minmax(0, 1520px); }
.world-screen { min-height: calc(100vh - 120px); }
.world-setup {
  display: grid; grid-template-columns: minmax(360px, 1fr) minmax(400px, 520px);
  align-items: center; gap: clamp(32px, 7vw, 110px); padding: 30px 5vw 60px;
}
.setup-art { position: relative; min-height: 620px; }
.setup-map-card {
  position: absolute; inset: 6% 0 7% 0; border: 5px solid var(--ink); border-radius: 36px;
  background: center/cover no-repeat url("./assets/board-space-v2.png"); box-shadow: var(--shadow);
  transform: rotate(-3deg); overflow: hidden;
}
.setup-map-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(5,23,37,.38)); }
.character {
  background: url("./assets/character-pieces.png") no-repeat; background-size: 200% 200%;
  border-radius: 0; box-shadow: none; mix-blend-mode: multiply;
}
.character--gomgom { background-position: 0 0; }
.character--kkankkan { background-position: 100% 0; }
.character--meokbo { background-position: 0 100%; }
.character--pinggeul { background-position: 100% 100%; }
.setup-panel { position: relative; padding: 32px 0; }
.setup-progress { display: flex; gap: 7px; margin-bottom: 22px; }
.setup-progress i { width: 28px; height: 5px; border-radius: 99px; background: rgba(16,47,53,.15); }
.setup-progress i.active { width: 54px; background: var(--orange); }
.back-button { border: 0; background: transparent; color: var(--ink); padding: 0 0 16px; font-weight: 850; }
.back-button::before { content: "← "; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 13px; font-weight: 900; }
.setup-panel h1 { margin: 0 0 10px; font-size: clamp(38px, 5vw, 64px); line-height: 1.06; letter-spacing: -.055em; }
.setup-panel .lead { margin: 0 0 28px; color: #5f7074; font-size: 17px; line-height: 1.55; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card {
  position: relative; min-height: 132px; padding: 20px; border: 3px solid var(--ink); border-radius: 20px;
  background: rgba(255,255,255,.8); color: var(--ink); text-align: left; box-shadow: 0 6px 0 var(--ink);
  transition: transform .15s ease, background .15s ease;
}
.choice-card:hover, .choice-card:focus-visible { transform: translateY(-3px); background: #fff; }
.choice-card.selected { border-color: var(--orange); box-shadow: 0 6px 0 #b84b18; background: #fff5e6; }
.choice-card b { display: block; margin-bottom: 6px; font-size: 21px; }
.choice-card span { color: #66777a; font-size: 13px; line-height: 1.45; }
.choice-card .choice-icon { display: block; margin-bottom: 12px; font-size: 30px; }
.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 850; }
.field input, .field select {
  width: 100%; min-height: 54px; border: 2px solid rgba(16,47,53,.32); border-radius: 14px;
  padding: 0 15px; background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,122,50,.16); }
.primary-button {
  width: 100%; min-height: 56px; border: 0; border-radius: 15px; padding: 0 20px;
  background: var(--orange); color: #fff; font-weight: 950; box-shadow: 0 6px 0 #b74a19;
}
.primary-button:active { transform: translateY(3px); box-shadow: 0 3px 0 #b74a19; }
.secondary-button { min-height: 54px; border: 3px solid var(--ink); border-radius: 15px; background: #fff; color: var(--ink); font-weight: 900; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.form-error { min-height: 22px; margin: 16px 0 0; color: #c6352f; font-weight: 750; font-size: 13px; }
.character-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.character-choice { border: 3px solid transparent; border-radius: 18px; padding: 6px; background: rgba(255,255,255,.68); color: var(--ink); font-weight: 850; }
.character-choice.selected { border-color: var(--orange); background: #fff; }
.character-choice .character { display: block; width: 100%; aspect-ratio: 1; }

.world-lobby { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: center; padding: 30px 7vw 70px; }
.lobby-card, .lobby-chat, .mission-card, .chat-card {
  border: 3px solid var(--ink); border-radius: 24px; background: rgba(255,255,255,.9); box-shadow: 0 8px 0 var(--ink);
}
.lobby-card { max-width: 900px; width: 100%; margin: auto; padding: clamp(24px, 5vw, 54px); text-align: center; }
.invite-code { border: 0; background: transparent; color: var(--ink); font-size: clamp(54px, 8vw, 94px); font-weight: 950; letter-spacing: .13em; }
.lobby-card h1 { margin: 0 0 12px; font-size: 28px; }
.lobby-rules { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin-bottom: 24px; }
.rule-chip { padding: 7px 11px; border-radius: 99px; background: #e7f5f1; font-size: 12px; font-weight: 850; }
.player-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 26px; }
.lobby-player { min-height: 132px; padding: 12px 8px; border: 2px solid var(--line); border-radius: 17px; background: #fffaf2; }
.lobby-player .character { width: 70px; aspect-ratio: 1; margin: -5px auto -6px; }
.lobby-player b { display: block; }
.lobby-player small { color: #768386; }
.team-switch { margin-top: 7px; border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; background: #fff; color: var(--ink); font-size: 10px; font-weight: 850; }
.lobby-status { margin: 14px 0 0; color: #66777a; font-size: 13px; }
.lobby-chat { height: 520px; display: grid; grid-template-rows: auto 1fr auto; overflow: hidden; }
.chat-head { padding: 16px 18px; border-bottom: 2px solid var(--line); }

.world-game { min-width: 0; max-width: 100%; padding: var(--world-game-space-2) 0 60px; }
.game-topbar { min-width: 0; max-width: 100%; display: grid; grid-template-columns: 154px minmax(0, 1fr); gap: var(--world-game-space-2); margin-bottom: var(--world-game-space-2); }
.turn-summary, .player-strip {
  min-height: 58px; border: 1px solid var(--world-game-line); border-radius: var(--world-game-radius-sm); background: var(--world-game-surface);
}
.turn-summary { display: grid; align-content: center; padding: var(--world-game-space-2) var(--world-game-space-3); }
.turn-summary span { font-size: 11px; color: var(--world-game-muted); font-weight: 800; }
.turn-summary b { font-size: 17px; }
.player-strip { min-width: 0; width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--world-game-space-2); padding: 5px; }
.player-pill { display: grid; grid-template-columns: 34px 1fr; align-items: center; min-width: 0; padding: 3px var(--world-game-space-2); border: 1px solid transparent; border-radius: var(--world-game-radius-sm); background: var(--world-game-panel); color: var(--ink); }
.player-pill.active { border-color: var(--world-game-accent); background: #fff2e8; }
.player-pill.bankrupt { opacity: .45; filter: grayscale(1); }
.player-pill .character { width: 32px; aspect-ratio: 1; }
.player-pill b, .player-pill small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-pill b { font-size: 13px; }
.player-pill small { color: #627275; font-size: 11px; }
.game-layout { min-width: 0; max-width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: var(--world-game-space-3); }
.board-column { min-width: 0; max-width: 100%; }
.board-stage {
  position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden;
  border: 1px solid var(--world-game-line); border-radius: var(--world-game-radius-md); background: var(--world-game-surface); box-shadow: 0 16px 36px rgba(0, 0, 0, .22);
}
.board-map {
  position: absolute; inset: 0;
  overflow: hidden; border-radius: calc(var(--world-game-radius-md) - 1px); background: var(--world-game-surface);
}
.board-map::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 24px rgba(3,19,31,.18); pointer-events: none; }
.board-background { width: 100%; height: 100%; object-fit: cover; }
.board-cells, .board-tokens { position: absolute; inset: 0; }
.board-tokens { pointer-events: none; }
.board-cell {
  position: absolute; min-width: 0; min-height: 0; display: grid; place-items: center; transform: translate(-50%, -50%);
  border: 2px solid transparent; border-radius: var(--world-game-radius-sm); background: transparent; color: #fff; box-shadow: none; overflow: visible;
  transition: transform var(--world-game-motion) ease, border-color var(--world-game-motion) ease;
}
.board-cell:hover { transform: translate(-50%, -50%) scale(1.025); z-index: 4; }
.board-cell:focus-visible, .board-cell.selected { outline: 3px solid var(--world-game-accent); outline-offset: 1px; z-index: 5; }
.board-cell[data-owner="p1"], .board-cell[data-owner="team-a"] { border-color: #ff6038; box-shadow: inset 0 0 0 2px rgba(255,96,56,.42); }
.board-cell[data-owner="p2"], .board-cell[data-owner="team-b"] { border-color: #3daee9; box-shadow: inset 0 0 0 2px rgba(61,174,233,.42); }
.board-cell[data-owner="p3"] { border-color: #e6bd26; box-shadow: inset 0 0 0 2px rgba(230,189,38,.42); }
.board-cell[data-owner="p4"] { border-color: #42bb76; box-shadow: inset 0 0 0 2px rgba(66,187,118,.42); }
.cell-plaque { position: absolute; z-index: 3; left: 50%; bottom: 5%; width: 82%; min-width: 0; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 3px; overflow: hidden; color: #f4f6f8; line-height: 1; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.cell-plaque b { min-width: 0; overflow: hidden; font-size: clamp(7px, .67vw, 10px); text-overflow: ellipsis; }
.cell-plaque small { flex: 0 0 auto; color: #ffd65a; font-size: clamp(6px, .58vw, 8px); font-weight: 900; }
.board-stage[data-map="korea"] .board-cell[data-edge="top"] .cell-plaque { bottom: 6%; }
.board-stage[data-map="korea"] .board-cell[data-edge="right"] .cell-plaque,
.board-stage[data-map="korea"] .board-cell[data-edge="left"] .cell-plaque { bottom: 9%; }
.board-stage[data-map="korea"] .board-cell[data-edge="bottom"] .cell-plaque { bottom: 18%; }
.board-stage[data-map="world"] .board-cell[data-edge="top"] .cell-plaque { bottom: 16%; }
.board-stage[data-map="world"] .board-cell[data-edge="right"] .cell-plaque,
.board-stage[data-map="world"] .board-cell[data-edge="left"] .cell-plaque { bottom: 3%; }
.board-stage[data-map="world"] .board-cell[data-edge="bottom"] .cell-plaque { bottom: 15%; }
.board-stage[data-map="space"] .cell-plaque { bottom: 25%; }
.cell-icon { font-size: clamp(12px, 1.45vw, 22px); filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.board-cell[data-cell-type="property"] .cell-icon { display: none; }
.cell-building { position: absolute; left: 50%; top: 42%; width: 58%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 18%; background: url("./assets/buildings-space.png") no-repeat; background-size: 200% 200%; filter: drop-shadow(0 3px 2px rgba(0,0,0,.3)); }
.building-stage-2 { width: 66%; }
.building-stage-3 { width: 74%; }
.building-stage-1 { background-position: 0 0; }
.building-stage-2 { background-position: 100% 0; }
.building-stage-3 { background-position: 0 100%; }
.board-center {
  min-width: 0; display: grid; grid-template-columns: 108px minmax(0, 1fr); align-items: center; gap: var(--world-game-space-3);
  padding: var(--world-game-space-2) var(--world-game-space-4); color: #fff;
}
.dice-result { min-width: 0; display: grid; grid-template-columns: auto 24px; align-items: center; gap: 7px; }
.dice-pair { display: flex; align-items: center; gap: 5px; }
.die {
  width: 34px; height: 34px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  gap: 2px; padding: 5px; border: 1px solid #d7e0e4; border-radius: var(--world-game-radius-sm);
  background: #fff; box-shadow: 0 3px 0 #9fb4bd, 0 6px 12px rgba(0,0,0,.22); transform-origin: center;
}
.die i { width: 5px; height: 5px; place-self: center; border-radius: 50%; background: var(--ink); opacity: 0; }
.die[data-value="1"] i:nth-child(5),
.die[data-value="2"] i:nth-child(1), .die[data-value="2"] i:nth-child(9),
.die[data-value="3"] i:nth-child(1), .die[data-value="3"] i:nth-child(5), .die[data-value="3"] i:nth-child(9),
.die[data-value="4"] i:nth-child(1), .die[data-value="4"] i:nth-child(3), .die[data-value="4"] i:nth-child(7), .die[data-value="4"] i:nth-child(9),
.die[data-value="5"] i:nth-child(1), .die[data-value="5"] i:nth-child(3), .die[data-value="5"] i:nth-child(5), .die[data-value="5"] i:nth-child(7), .die[data-value="5"] i:nth-child(9),
.die[data-value="6"] i:nth-child(1), .die[data-value="6"] i:nth-child(3), .die[data-value="6"] i:nth-child(4), .die[data-value="6"] i:nth-child(6), .die[data-value="6"] i:nth-child(7), .die[data-value="6"] i:nth-child(9) { opacity: 1; }
.dice-total { display: grid; place-items: center; min-width: 24px; color: #fff; font-size: 18px; font-weight: 950; }
.dice-total::before { content: "합"; display: block; color: var(--world-game-muted); font-size: 8px; font-weight: 800; }
.dice-result.is-rolling .die:first-child { animation: dice-compact-roll-a var(--world-dice-roll) linear infinite; }
.dice-result.is-rolling .die:last-child { animation: dice-compact-roll-b calc(var(--world-dice-roll) * .86) linear infinite reverse; }
.dice-result.is-settling .die { animation: dice-land 320ms var(--world-motion-ease); }
.dice-result.is-double .die, .dice-throw-layer.is-double .die { border-color: var(--yellow); box-shadow: 0 3px 0 #b48d12, 0 0 0 3px rgba(255,214,90,.28), 0 8px 18px rgba(0,0,0,.3); }
.dice-throw-layer {
  position: absolute; left: 50%; top: 50%; z-index: 12; display: grid; justify-items: center; gap: var(--world-game-space-3);
  transform: translate(-50%, -50%); pointer-events: none; filter: drop-shadow(0 16px 18px rgba(0,0,0,.38));
}
.dice-throw-layer::before { content: ""; position: absolute; left: 50%; bottom: 22px; width: 156px; height: 36px; border-radius: 50%; background: rgba(3,14,25,.52); transform: translateX(-50%); filter: blur(8px); }
.dice-throw-pair { position: relative; z-index: 1; display: flex; align-items: center; gap: 20px; }
.die--large { width: 76px; height: 76px; gap: 5px; padding: 12px; border-width: 2px; border-radius: 18px; box-shadow: 0 8px 0 #8ea7b2, 0 15px 26px rgba(0,0,0,.36); }
.die--large i { width: 11px; height: 11px; }
.dice-throw-total { position: relative; z-index: 1; min-width: 72px; border: 1px solid rgba(255,255,255,.24); border-radius: 999px; padding: 7px 15px; background: rgba(3,20,35,.88); color: #fff; text-align: center; font-size: 22px; }
.dice-throw-layer.is-rolling { animation: dice-layer-in 220ms var(--world-motion-ease) both; }
.dice-throw-layer.is-rolling .die:first-child { animation: dice-throw-a var(--world-dice-roll) linear infinite; }
.dice-throw-layer.is-rolling .die:last-child { animation: dice-throw-b calc(var(--world-dice-roll) * .9) linear infinite reverse; }
.dice-throw-layer.is-settling .die:first-child { animation: dice-land-left 360ms var(--world-motion-ease) both; }
.dice-throw-layer.is-settling .die:last-child { animation: dice-land-right 360ms var(--world-motion-ease) both; }
.dice-throw-layer.is-leaving { animation: dice-layer-out 240ms ease-in both; }
.event-copy { min-width: 0; border-left: 3px solid var(--world-game-muted); padding-left: 10px; }
.event-copy b, .event-copy span { display: block; overflow: hidden; text-overflow: ellipsis; }
.event-copy b { color: #fff; font-size: 13px; line-height: 1.25; white-space: nowrap; }
.event-copy span { margin-top: 3px; color: var(--world-game-muted); font-size: 10px; line-height: 1.25; }
.event-copy[data-event-kind="reward"] { border-left-color: #56d795; }
.event-copy[data-event-kind="danger"] { border-left-color: #ff6f61; }
.event-copy[data-event-kind="transport"] { border-left-color: #63c8df; }
.event-copy[data-event-kind="bank"] { border-left-color: #ffd44a; }
.event-copy[data-event-kind="property"] { border-left-color: var(--world-game-accent); }
.board-token { position: absolute; width: clamp(26px, 3.2vw, 48px); aspect-ratio: 1; z-index: 7; transition: left var(--world-token-step) var(--world-motion-ease), top var(--world-token-step) var(--world-motion-ease); transform: translate(-50%, -58%); filter: drop-shadow(0 4px 3px rgba(0,0,0,.42)); will-change: left, top, transform; }
.board-token.is-moving { z-index: 11; animation: token-hop var(--world-token-step) var(--world-motion-ease); filter: drop-shadow(0 9px 5px rgba(0,0,0,.5)); }
.board-token.is-landing { z-index: 11; animation: token-land 340ms var(--world-motion-ease); }
.board-cell.is-route-step { z-index: 6; border-color: rgba(255,214,90,.88); box-shadow: inset 0 0 0 3px rgba(255,214,90,.34), 0 0 20px rgba(255,214,90,.36); }
.board-cell.is-built .cell-building { animation: building-rise 700ms var(--world-motion-ease); }
.board-stage.is-resolving { box-shadow: 0 18px 42px rgba(0,0,0,.34), 0 0 0 2px rgba(255,122,50,.45); }
.board-float-reward { position: absolute; left: 50%; top: 46%; z-index: 15; min-width: 108px; transform: translate(-50%, -50%); border: 2px solid var(--yellow); border-radius: 999px; padding: 9px 18px; background: rgba(3,20,35,.92); color: var(--yellow); text-align: center; font-size: 24px; font-weight: 950; box-shadow: 0 10px 24px rgba(0,0,0,.34); animation: board-reward-rise 740ms var(--world-motion-ease) both; pointer-events: none; }
.player-pill.is-paying { animation: player-payment 620ms var(--world-motion-ease); border-color: #ff6f61; }
.event-copy.is-rewarding { animation: reward-pop 740ms var(--world-motion-ease); }

@keyframes dice-compact-roll-a { 0% { transform: rotate(0) translateY(0); } 45% { transform: rotate(190deg) translateY(-5px) scale(.94); } 100% { transform: rotate(360deg) translateY(0); } }
@keyframes dice-compact-roll-b { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(-210deg) translateY(-7px) scale(.9); } 100% { transform: rotate(-360deg) translateY(0); } }
@keyframes dice-layer-in { from { opacity: 0; transform: translate(-50%, -35%) scale(.72); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes dice-layer-out { from { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; transform: translate(-50%, -64%) scale(.88); } }
@keyframes dice-throw-a { 0% { transform: translate(-44px, -34px) rotate(0) scale(.82); } 40% { transform: translate(18px, 12px) rotate(240deg) scale(1.08); } 72% { transform: translate(-10px, -5px) rotate(430deg) scale(.96); } 100% { transform: translate(0, 0) rotate(720deg) scale(1); } }
@keyframes dice-throw-b { 0% { transform: translate(48px, -28px) rotate(0) scale(.78); } 42% { transform: translate(-22px, 15px) rotate(-260deg) scale(1.05); } 74% { transform: translate(12px, -3px) rotate(-470deg) scale(.95); } 100% { transform: translate(0, 0) rotate(-720deg) scale(1); } }
@keyframes dice-land { 0% { transform: translateY(-8px) scale(1.08); } 55% { transform: translateY(3px) scale(.96); } 100% { transform: translateY(0) scale(1); } }
@keyframes dice-land-left { 0% { transform: translate(-8px, -26px) rotate(-28deg); } 62% { transform: translate(2px, 5px) rotate(4deg); } 100% { transform: translate(0, 0) rotate(0); } }
@keyframes dice-land-right { 0% { transform: translate(9px, -31px) rotate(31deg); } 62% { transform: translate(-2px, 5px) rotate(-4deg); } 100% { transform: translate(0, 0) rotate(0); } }
@keyframes token-hop { 0% { transform: translate(-50%, -58%) scale(1); } 46% { transform: translate(-50%, -84%) scale(1.14); } 100% { transform: translate(-50%, -58%) scale(1); } }
@keyframes token-land { 0% { transform: translate(-50%, -78%) scale(1.18); } 58% { transform: translate(-50%, -50%) scale(.92); } 100% { transform: translate(-50%, -58%) scale(1); } }
@keyframes building-rise { 0% { transform: translate(-50%, -30%) scale(.2); opacity: 0; } 58% { transform: translate(-50%, -56%) scale(1.18); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes player-payment { 0%, 100% { transform: translateX(0); } 24% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 74% { transform: translateX(-2px); } }
@keyframes reward-pop { 0% { transform: scale(.94); opacity: .7; } 48% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes board-reward-rise { 0% { transform: translate(-50%, -16%) scale(.76); opacity: 0; } 34% { transform: translate(-50%, -50%) scale(1.08); opacity: 1; } 72% { transform: translate(-50%, -64%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -92%) scale(.96); opacity: 0; } }
.board-token.token-with-building { transform: translate(-18%, -72%) scale(.82); }
.token-stack-1 { margin-left: -8px; margin-top: -6px; }
.token-stack-2 { margin-left: 8px; margin-top: -6px; }
.token-stack-3 { margin-left: 0; margin-top: 8px; }
.board-controls { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); min-height: 68px; margin-top: var(--world-game-space-2); overflow: hidden; border: 1px solid var(--world-game-line); border-radius: var(--world-game-radius-md); background: var(--world-game-surface-strong); }
.action-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--world-game-space-2); min-height: 68px; padding: var(--world-game-space-2) var(--world-game-space-3); }
.action-button { min-width: 112px; min-height: 46px; border: 1px solid var(--world-game-line); border-radius: var(--world-game-radius-sm); padding: 0 var(--world-game-space-4); background: var(--world-game-surface); color: #fff; font-weight: 900; }
.action-button.primary { border-color: var(--world-game-accent); background: var(--world-game-accent); }
.action-button:disabled { opacity: .42; cursor: default; }
.selected-cell { margin-top: var(--world-game-space-2); padding: var(--world-game-space-3) var(--world-game-space-4); border-radius: var(--world-game-radius-sm); background: var(--world-game-panel); color: var(--ink); border: 1px solid var(--world-game-line); font-size: 13px; }
.game-side { min-width: 0; display: grid; grid-template-rows: minmax(176px, auto) minmax(300px, 1fr); gap: var(--world-game-space-3); color: var(--ink); }
.mission-card, .chat-card { overflow: hidden; }
.mission-card, .chat-card { border-width: 1px; border-color: var(--world-game-line); border-radius: var(--world-game-radius-md); background: var(--world-game-panel); box-shadow: none; }
.side-title { display: flex; justify-content: space-between; padding: var(--world-game-space-3) var(--world-game-space-4); border-bottom: 1px solid rgba(16,47,53,.18); }
.mission-item { padding: var(--world-game-space-2) var(--world-game-space-4); border-bottom: 1px solid rgba(16,47,53,.12); }
.mission-item:last-child { border-bottom: 0; }
.mission-item b { display: block; font-size: 13px; }
.mission-item span { display: block; margin-top: 4px; color: #748286; font-size: 11px; }
.mission-progress { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 3px; background: #e3e8e6; }
.mission-progress i { display: block; height: 100%; background: var(--orange); }
.chat-card { display: grid; grid-template-rows: auto minmax(140px, 1fr) auto auto; min-height: 300px; }
.chat-tabs { display: flex; align-items: center; gap: 4px; padding: var(--world-game-space-2); border-bottom: 1px solid rgba(16,47,53,.18); }
.chat-tabs button { border: 0; border-radius: var(--world-game-radius-sm); padding: 7px var(--world-game-space-3); background: transparent; color: var(--ink); font-weight: 850; font-size: 12px; }
.chat-tabs button.active { background: var(--ink); color: #fff; }
.chat-tabs .chat-lock { margin-left: auto; }
.chat-messages { overflow-y: auto; padding: var(--world-game-space-3); background: #fff; }
.chat-message { margin-bottom: 8px; font-size: 12px; line-height: 1.42; }
.chat-message b { margin-right: 5px; color: #254c55; }
.chat-message.mine { text-align: right; }
.chat-message.team b { color: #167d71; }
.quick-replies { display: flex; gap: 5px; overflow-x: auto; padding: 7px 9px; border-top: 1px solid var(--line); }
.quick-replies button { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 99px; padding: 6px 9px; background: #fff; color: var(--ink); font-size: 11px; font-weight: 800; }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 7px; padding: 9px; border-top: 2px solid var(--line); background: #fff; }
.chat-form input { min-width: 0; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; }
.chat-form button { border: 0; border-radius: 10px; padding: 0 13px; background: var(--orange); color: #fff; font-weight: 900; }

.teacher-game-ad { min-height: 100px; margin: 28px auto 0; display: none; place-items: center; border: 1px solid rgba(16,47,53,.14); color: #9a9f9c; background: rgba(255,255,255,.5); }
.teacher-game-ad > span { font-size: 10px; }
.teacher-game-ad > div { min-height: 70px; display: grid; place-items: center; }
.result-dialog { width: min(520px, calc(100% - 24px)); border: 3px solid var(--ink); border-radius: 24px; padding: 28px; color: var(--ink); box-shadow: var(--shadow); }
.result-dialog::backdrop { background: rgba(4,23,31,.66); backdrop-filter: blur(4px); }
.result-dialog h2 { margin: 0 0 18px; font-size: 34px; }
.result-row { display: flex; justify-content: space-between; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.result-dialog .primary-button { margin-top: 22px; }

@media (max-width: 1000px) {
  .world-main { width: 100%; }
  .world-setup { grid-template-columns: 1fr; padding: 12px 4vw 50px; }
  .setup-art { min-height: 340px; }
  .setup-map-card { inset: 2% 8% 0; }
  .setup-panel { max-width: 680px; width: 100%; margin: auto; }
  .world-lobby { grid-template-columns: 1fr; padding: 15px 2vw 60px; }
  .lobby-chat { height: 350px; }
  .game-layout { grid-template-columns: 1fr; }
  .game-side { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .chat-card { min-height: 300px; }
}

@media (max-width: 700px) {
  .world-header { width: calc(100% - 20px); height: 64px; }
  .world-brand-mark { width: 37px; height: 37px; border-width: 2px; box-shadow: 0 3px 0 var(--ink); }
  .world-brand b { font-size: 16px; }
  .world-brand small { display: none; }
  .world-room-code { font-size: 10px; padding: 7px; }
  .world-room-code b { font-size: 14px; }
  .icon-button { min-height: 36px; padding: 7px 9px; font-size: 11px; }
  .world-main { width: 100%; max-width: 100%; overflow: hidden; }
  .world-screen { min-height: calc(100vh - 84px); }
  .world-setup { padding: 4px 6px 36px; }
  .setup-art { min-height: 220px; }
  .setup-map-card { inset: 0 3%; border-radius: 22px; border-width: 3px; }
  .setup-panel { padding: 26px 5px; }
  .setup-panel h1 { font-size: 38px; }
  .setup-panel .lead { margin-bottom: 20px; font-size: 14px; }
  .choice-grid { grid-template-columns: 1fr; gap: 9px; }
  .choice-card { min-height: 94px; padding: 15px 17px; box-shadow: 0 4px 0 var(--ink); }
  .choice-card .choice-icon { float: left; width: 42px; margin: 0 8px 12px 0; }
  .choice-card b { font-size: 18px; }
  .character-grid { grid-template-columns: repeat(2, 1fr); }
  .world-lobby { padding: 5px 0 40px; }
  .lobby-card { border-radius: 20px; padding: 23px 12px; }
  .invite-code { font-size: 48px; }
  .player-grid { grid-template-columns: repeat(2, 1fr); }
  .game-topbar { grid-template-columns: 1fr; gap: 6px; }
  .turn-summary { min-height: 52px; grid-template-columns: auto 1fr; align-items: center; gap: 9px; }
  .player-strip { min-height: 92px; overflow: hidden; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, 1fr); }
  .player-pill { grid-template-columns: 28px minmax(0, 1fr); padding: 2px 6px; }
  .player-pill .character { width: 27px; }
  .player-pill b { font-size: 11px; }
  .player-pill small { font-size: 9px; }
  .board-stage { width: 100%; max-width: 100%; border-width: 2px; border-radius: 16px; }
  .board-map { border-radius: 12px; }
  .board-cell { border-width: 1px; border-radius: 6px; }
  .board-cell[data-cell-type="property"] .cell-plaque { display: none; }
  .cell-building { top: 48%; width: 52%; }
  .building-stage-2 { width: 58%; }
  .building-stage-3 { width: 64%; }
  .board-controls { grid-template-columns: 150px minmax(0, 1fr); min-height: 60px; }
  .board-center { grid-template-columns: 76px minmax(0, 1fr); gap: 7px; padding: 7px 9px; }
  .dice-result { grid-template-columns: auto 17px; gap: 4px; }
  .dice-pair { gap: 3px; }
  .die { width: 27px; height: 27px; gap: 1px; padding: 4px; border-radius: 6px; box-shadow: 0 2px 0 #9fb4bd, 0 4px 8px rgba(0,0,0,.2); }
  .die i { width: 4px; height: 4px; }
  .dice-total { min-width: 17px; font-size: 14px; }
  .dice-total::before { font-size: 7px; }
  .die--large { width: 56px; height: 56px; gap: 3px; padding: 9px; border-radius: 14px; box-shadow: 0 6px 0 #8ea7b2, 0 11px 20px rgba(0,0,0,.36); }
  .die--large i { width: 8px; height: 8px; }
  .dice-throw-pair { gap: 14px; }
  .dice-throw-total { min-width: 60px; padding: 6px 12px; font-size: 17px; }
  .event-copy { padding-left: 6px; }
  .event-copy b { font-size: 10px; }
  .event-copy span { font-size: 8px; }
  .action-bar { min-height: 62px; padding: 8px; }
  .action-button { flex: 1 1 42%; min-width: 0; min-height: 48px; }
  .game-layout, .game-topbar, .board-column, .board-stage, .board-controls, .action-bar, .game-side { width: 100%; min-width: 0; max-width: calc(100vw - 12px); }
  .game-layout { grid-template-columns: minmax(0, 1fr); overflow: hidden; }
  .game-side { grid-template-columns: minmax(0, 1fr); }
  .mission-card { box-shadow: 0 5px 0 var(--ink); }
  .chat-card { min-height: 360px; box-shadow: 0 5px 0 var(--ink); }
  .teacher-game-ad { margin-top: 20px; }
}

@media (max-width: 720px) {
  .world-ad-layout { width: min(100% - 12px, 1520px); grid-template-columns: minmax(0, 1fr); }
  .world-side-ad { display: none; }
  .teacher-game-ad { display: grid; }
}

@media (max-width: 430px) {
  .world-header-actions { min-width: 0; }
  .world-room-code { font-size: 0; white-space: nowrap; }
  .world-room-code b { margin-left: 0; font-size: 12px; letter-spacing: .08em; }
  .world-header .icon-button { display: none; }
}

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