:root {
  color-scheme: light;
  --ink: #18352d;
  --muted: #697d72;
  --line: #dce7df;
  --forest: #194737;
  --forest-deep: #12362e;
  --paper: #f5f8f5;
  --surface: #ffffff;
  --red: #e56e5a;
  --blue: #4d9a9e;
  --accent: #ee816b;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 86% 6%, #e3f2eb 0, transparent 28%), radial-gradient(circle at 5% 85%, #ffefe7 0, transparent 32%), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
button:focus-visible, input:focus-visible { outline: 3px solid #f0a65a; outline-offset: 3px; }
#app { min-height: 100dvh; }
main { max-width: 1440px; margin: auto; }
.topbar { height: 76px; padding: 0 max(32px, env(safe-area-inset-right)) 0 max(32px, env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #ffffffdb; border-bottom: 1px solid #e4ede6; backdrop-filter: blur(18px); position: relative; z-index: 2; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; white-space: nowrap; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--forest); color: #f9e4b0; font-family: Georgia, 'Noto Serif SC', serif; font-size: 26px; box-shadow: 0 8px 18px #19473727; }
.brand strong { display: block; font-size: 17px; line-height: 1.1; letter-spacing: .05em; }
.brand small { display: block; margin-top: 4px; color: #84958a; font-size: 9px; font-weight: 800; letter-spacing: .17em; }
.top-actions { display: flex; align-items: center; gap: 15px; }
.text-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 7px 11px; border: 0; border-radius: 13px; background: transparent; color: var(--forest); font-size: 13px; font-weight: 700; white-space: nowrap; }
.text-button:hover { background: #e7f1e9; }
.help-mark { width: 21px; height: 21px; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; font-weight: 800; }
.connection-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 100px; background: #e9f3ed; color: #3e755a; font-size: 11px; font-weight: 800; white-space: nowrap; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #b9c3be; }
.status-dot.connected { background: #47bd75; box-shadow: 0 0 0 3px #47bd7526; }
.status-dot.disconnected { background: #e9a36a; }
.eyebrow, .card-kicker { color: #658e77; font-size: 11px; font-weight: 800; letter-spacing: .13em; margin: 0 0 13px; }
.eyebrow { display: flex; align-items: center; gap: 9px; }
.eyebrow-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #ef9176; box-shadow: 0 0 0 4px #ef917622; }
.primary-button, .secondary-button, .ghost-button, .danger-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 50px; padding: 13px 19px; border: 1px solid transparent; border-radius: 14px; font-weight: 800; transition: transform .18s, box-shadow .18s, background .18s; }
.primary-button { background: var(--forest); color: #fff; box-shadow: 0 10px 22px #19473728; }
.primary-button:hover:not(:disabled) { background: #245d47; transform: translateY(-2px); box-shadow: 0 13px 24px #19473730; }
.primary-button span { font-size: 19px; font-weight: 400; }
.secondary-button { background: #dff1e8; color: #205b42; }
.ghost-button { border-color: var(--line); background: #fff; color: var(--forest); }
.danger-button { background: #c9534c; color: #fff; }

.home { min-height: calc(100dvh - 76px); display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); align-items: center; gap: clamp(28px, 5vw, 82px); padding: 54px clamp(34px, 6.2vw, 95px) 72px; }
.home-copy { grid-column: 1; grid-row: 1; max-width: 630px; }
.home h1 { margin: 0 0 22px; color: var(--forest-deep); font-size: clamp(45px, 4.9vw, 74px); font-weight: 850; line-height: 1.18; letter-spacing: -.065em; }
.home h1 em { color: var(--accent); font-style: normal; }
.lead { max-width: 520px; margin: 0 0 20px; color: #62786c; font-size: 16px; line-height: 1.85; }
.variant-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-width: 530px; margin-bottom: 22px; }
.variant-option { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px; border: 1px solid #dbe7dc; border-radius: 14px; background: #fff; text-align: left; color: var(--forest); box-shadow: 0 4px 14px #12362e08; }
.variant-option.active { border-color: #5caa7b; background: linear-gradient(135deg, #eaf7ed, #f8fcf6); box-shadow: inset 0 0 0 1px #7dc397; }
.variant-option strong { font-size: 13px; }
.variant-option small { color: #6c8876; font-size: 11px; line-height: 1.4; }
.home-controls { display: flex; align-items: start; gap: 16px; }
.home-controls > .primary-button { flex: none; min-width: 160px; }
.join-form { flex: 1; min-width: 220px; max-width: 292px; }
.join-form label { display: block; margin: 0 0 7px; color: #63786c; font-size: 12px; font-weight: 700; }
.join-row { display: flex; height: 50px; overflow: hidden; border: 1px solid #ccddd1; border-radius: 13px; background: #fff; box-shadow: 0 5px 18px #12362e0b; }
.join-row input { width: 100%; min-width: 0; flex: 1; padding: 0 13px; border: 0; outline: 0; color: var(--ink); background: transparent; letter-spacing: .1em; text-transform: uppercase; }
.join-row button { flex: none; min-width: 60px; border: 0; background: #e5f2e9; color: var(--forest); font-size: 13px; font-weight: 800; }
.form-error { min-height: 16px; margin: 7px 0 0; color: #bd594f; font-size: 12px; }
.home-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 11px; margin-top: 29px; color: #6c7d73; font-size: 13px; }
.home-guide button { display: inline-flex; gap: 7px; align-items: center; min-height: 38px; padding: 8px 13px; border: 1px solid #d1e4d8; border-radius: 11px; background: #fff; color: #237451; font-size: 13px; font-weight: 800; }
.home-guide button:hover { background: #e8f5ea; }
.effect-demo-link { display: inline-flex; gap: 7px; align-items: center; min-height: 38px; padding: 8px 13px; border: 1px solid #efd4c6; border-radius: 11px; background: #fff7f2; color: #b4634d; font-size: 13px; font-weight: 800; text-decoration: none; }
.effect-demo-link:hover { background: #ffede4; }
.home-guide-note { color: #a1afa5; font-size: 11px; }
.feature-row { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 37px; color: #6f8b79; font-size: 12px; font-weight: 700; }
.feature-row span { padding: 7px 10px; border: 1px solid #dcebe0; border-radius: 100px; background: #ffffffb3; }
.hero-art { grid-column: 2; grid-row: 1; position: relative; width: min(100%, 545px); aspect-ratio: 1/1; justify-self: center; display: flex; flex-direction: column; justify-content: space-between; padding: 28px; overflow: hidden; border: 1px solid #d7e7d9; border-radius: 38px; background: radial-gradient(circle at 65% 30%, #f9e9d5 0 22%, transparent 22.5%), radial-gradient(circle at 8% 89%, #c7e3d1 0 21%, transparent 21.5%), linear-gradient(135deg, #edf6e9, #dcefe2 63%, #f6e9d9); box-shadow: 0 28px 56px #315b4620; }
.hero-art::before, .hero-art::after { content: ''; position: absolute; border: 1px dashed #78a38955; border-radius: 50%; pointer-events: none; }
.hero-art::before { width: 110%; height: 110%; top: -5%; left: -5%; }
.hero-art::after { width: 70%; height: 70%; top: 15%; left: 15%; }
.hero-art-top, .hero-art-bottom { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 8px; color: #47745b; font-size: 11px; font-weight: 900; letter-spacing: .05em; }
.hero-art-top span:first-child { padding: 5px 9px; border-radius: 100px; background: #ffffffb8; }
.hero-art-bottom { justify-content: center; padding: 8px; border-radius: 100px; background: #ffffffa8; }
.hero-animals { position: relative; z-index: 1; width: 84%; aspect-ratio: 1/1; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); align-self: center; gap: 13px; transform: rotate(-7deg); }
.hero-animal { display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; border: 1px solid #ffffffdf; border-radius: 26px; background: #ffffffd9; box-shadow: 0 10px 24px #264e4125; }
.hero-animal:nth-child(2), .hero-animal:nth-child(4) { transform: translateY(11px); }
.hero-animal img { width: 76%; height: 74%; object-fit: contain; }
.hero-animal small { color: #426b54; font-size: clamp(10px, 1.3vw, 14px); font-weight: 900; }

.room-shell { padding: 32px clamp(20px, 4vw, 58px) 60px; }
.room-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.room-heading h1 { margin: 0; color: var(--forest-deep); font-size: clamp(28px, 3vw, 41px); line-height: 1.2; letter-spacing: -.04em; }
.room-pill { display: inline-flex; align-items: center; gap: 10px; padding: 9px 9px 9px 16px; border: 1px solid #dbe8de; border-radius: 13px; background: #fff; box-shadow: 0 5px 20px #315b460a; color: #849489; font-size: 12px; white-space: nowrap; }
.room-pill strong { color: var(--forest-deep); font-size: 15px; letter-spacing: .14em; }
.room-pill button { min-height: 32px; padding: 6px 10px; border: 0; border-radius: 9px; background: #e8f4ea; color: #286948; font-size: 11px; font-weight: 800; }
.game-layout { display: grid; grid-template-columns: minmax(0, 540px) minmax(260px, 340px); align-items: start; justify-content: center; gap: 31px; }
.board-column { min-width: 0; }
.player-card { display: flex; align-items: center; gap: 10px; min-height: 58px; margin: 11px 0; padding: 8px 14px; border: 1px solid #e0ebe2; border-radius: 14px; background: #fff; box-shadow: 0 6px 18px #315b4609; }
.player-card.active { border-color: #a7d4b5; box-shadow: 0 7px 22px #7daf8e24; }
.player-avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--red); color: #fff; font-size: 17px; font-weight: 900; }
.player-card.blue .player-avatar { background: var(--blue); }
.player-text { display: flex; flex-direction: column; gap: 3px; }
.player-text strong { font-size: 14px; }
.player-text strong small { margin-left: 5px; color: #8a9b90; font-size: 11px; font-weight: 600; }
.player-text > small { color: #7d8e83; font-size: 11px; }
.turn-badge { margin-left: auto; padding: 6px 10px; border-radius: 100px; background: #e8f5e8; color: #3b8a54; font-size: 11px; font-weight: 800; }
.board-frame { padding: 7px; border: 1px solid #d4e0d0; border-radius: 19px; background: #fff; box-shadow: 0 17px 40px #315b461f; }
.board { width: 100%; aspect-ratio: 7/9; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(9, minmax(0, 1fr)); overflow: hidden; border: 1px solid #c4d4bd; border-radius: 12px; background: #ecedcf; }
.square { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 0; border: 1px solid #c9d7bd; border-radius: 0; background: #f2f0d8; color: #64806a; touch-action: manipulation; }
.square:nth-child(even) { background: #ebeccf; }
.square.water { border-color: #91c7c9; background: repeating-linear-gradient(155deg, #c6e8e8 0 7px, #b7dfdf 7px 14px); }
.square.red-trap, .square.blue-trap { background: #f8dfc9; box-shadow: inset 0 0 0 3px #f4b58c8c; }
.square.red-den, .square.blue-den { background: #f1c9a5; box-shadow: inset 0 0 0 4px #dd9e72a6; }
.square:hover { filter: brightness(1.035); }
.square.last::before { content: ''; position: absolute; z-index: 1; inset: 3px; border: 2px solid #eab565; border-radius: 7px; pointer-events: none; }
.square.selected::after, .square.target::after { content: ''; position: absolute; z-index: 3; inset: 2px; border: 3px solid #f5a94b; border-radius: 9px; pointer-events: none; }
.square.capture-spot { box-shadow: inset 0 0 0 4px #ec8068; }
.square.jump-path { box-shadow: inset 0 0 0 3px #f5bf63; }
.move-dot { width: 15px; height: 15px; border-radius: 50%; background: #3c8b6599; box-shadow: 0 0 0 4px #ffffff79; }
.terrain-glyph { color: #986b53; font-size: clamp(14px, 2vw, 22px); font-weight: 800; opacity: .65; }
.jump-star { position: absolute; z-index: 4; top: 1px; right: 3px; color: #fffbdd; font-size: 16px; text-shadow: 0 1px 3px #14584b; }
.piece-shell { position: relative; z-index: 2; width: 86%; height: 86%; display: block; transform-style: preserve-3d; pointer-events: none; }
.piece-shell.covered { transform: rotateY(180deg); }
.piece-shell.just-flipped { animation: piece-reveal .75s cubic-bezier(.25,.75,.26,1) both; }
@keyframes piece-reveal { from { transform: rotateY(180deg) scale(.91); } 52% { transform: rotateY(86deg) scale(1.12); } to { transform: rotateY(0) scale(1); } }
.piece { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border: 2.5px solid var(--red); border-radius: 50%; background: linear-gradient(150deg, #fff, #fff7e8); box-shadow: 0 3px 6px #714f3b4d, inset 0 0 0 2px #ffffff; backface-visibility: hidden; pointer-events: none; }
.piece.blue { border-color: var(--blue); }
.piece-back { display: grid; place-items: center; transform: rotateY(180deg); overflow: hidden; border-color: #aa4b3e; background: radial-gradient(circle at 30% 22%, #faad8a, transparent 37%), linear-gradient(145deg, #df7568, #a84240); box-shadow: 0 3px 7px #714f3b63, inset 0 0 0 3px #ffd6b775, inset 0 0 0 6px #9e3d4380; color: #ffe8c3; }
.piece-back.blue { border-color: #286f82; background: radial-gradient(circle at 30% 22%, #9cd7d4, transparent 37%), linear-gradient(145deg, #67acb1, #287688); box-shadow: 0 3px 7px #31576960, inset 0 0 0 3px #d2f1e775, inset 0 0 0 6px #286f827d; color: #e9f8de; }
.back-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 67%; height: 67%; border: 1px solid currentColor; border-radius: 50%; font-family: Georgia, 'Noto Serif SC', serif; font-size: clamp(15px, 2.9vw, 27px); font-weight: 800; line-height: 1; text-shadow: 0 1px 2px #672a3070; }
.back-spark { position: absolute; top: 2px; right: 7px; font-size: clamp(7px, 1.1vw, 11px); }
.piece-animal { position: absolute; width: 78%; height: 78%; top: 0; left: 11%; object-fit: contain; }
.piece-rank { position: absolute; top: -5px; right: -5px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 2px; border-radius: 50%; background: var(--red); color: white; font-size: 9px; font-weight: 900; line-height: 1; }
.piece.blue .piece-rank { background: var(--blue); }
.piece-name { position: absolute; bottom: -2px; left: 50%; transform: translateX(-50%); min-width: 14px; padding: 1px 3px; border-radius: 5px; background: #fffdf5; color: #294d3d; font-size: clamp(8px, 1vw, 11px); font-weight: 900; line-height: 1.05; box-shadow: 0 1px 2px #42604a20; }
.capture-scene { position: fixed; z-index: 8; width: 170px; height: 170px; pointer-events: none; transform: translate(-50%, -50%); isolation: isolate; }
.capture-halo { position: absolute; top: 50%; left: 50%; width: 82px; height: 82px; border: 4px solid var(--attack-color); border-radius: 50%; background: radial-gradient(circle, #ffffffd9, transparent 68%); box-shadow: 0 0 20px var(--defender-color); animation: capture-halo var(--combo-duration) ease-out both; }
.capture-victim, .capture-attacker { position: absolute; top: 50%; left: 50%; width: 58px; height: 58px; display: grid; place-items: center; border: 3px solid var(--defender-color); border-radius: 50%; background: #fffdf5; box-shadow: 0 5px 16px #18352d45; }
.capture-victim img, .capture-attacker img { width: 88%; height: 88%; object-fit: contain; }
.capture-victim { animation: capture-victim-exit var(--combo-duration) cubic-bezier(.2,.7,.3,1) both; }
.capture-attacker { border-color: var(--attack-color); animation: capture-lunge var(--combo-duration) cubic-bezier(.2,.7,.3,1) both; }
.capture-mark { position: absolute; top: 50%; left: 50%; width: 68px; height: 68px; display: grid; place-items: center; color: var(--attack-color); font-family: Georgia, 'Noto Serif SC', serif; font-size: 42px; font-weight: 900; text-shadow: 0 2px 9px #ffffff, 0 0 15px var(--defender-color); animation: capture-mark var(--combo-duration) ease-out both; }
.capture-shard { position: absolute; top: calc(50% - 8px); left: calc(50% - 3px); width: 6px; height: 16px; border-radius: 6px; background: var(--defender-color); box-shadow: 0 0 6px #ffffff; animation: capture-shard var(--combo-duration) ease-out both; }
.capture-shard:nth-of-type(even) { background: var(--attack-color); }
.capture-caption { position: absolute; z-index: 2; top: calc(50% + 47px); left: 50%; min-width: 112px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 13px; border: 1px solid var(--attack-color); border-radius: 12px; background: #fffdf2f2; box-shadow: 0 7px 18px #18352d38; color: #23493a; white-space: nowrap; animation: capture-caption var(--combo-duration) ease both; }
.capture-caption strong { font-size: 13px; letter-spacing: .08em; }
.capture-caption small { color: #627c6d; font-size: 10px; font-weight: 800; }
@keyframes capture-halo { 0%, 15% { opacity: 0; transform: translate(-50%, -50%) scale(.15); } 45% { opacity: .9; transform: translate(-50%, -50%) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2); } }
@keyframes capture-victim-exit { 0%, 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 43% { opacity: 1; transform: translate(-50%, -50%) scale(1.16); } 100% { opacity: 0; transform: translate(calc(-50% + var(--exit-x)), calc(-50% + var(--exit-y))) rotate(var(--combo-angle)) scale(.16); } }
@keyframes capture-lunge { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.55); } 33% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); } 65% { opacity: 1; transform: translate(-50%, -50%) scale(.92); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.72); } }
@keyframes capture-mark { 0%, 23% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-40deg); } 48% { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(var(--combo-angle)); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.8) rotate(var(--combo-angle)); } }
@keyframes capture-shard { 0%, 25% { opacity: 0; transform: rotate(var(--shard-angle)) translateY(0) scale(.2); } 43% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--shard-angle)) translateY(var(--shard-distance)) scale(.55); } }
@keyframes capture-caption { 0%, 20% { opacity: 0; transform: translate(-50%, 9px) scale(.88); } 38%, 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -8px) scale(.96); } }
@keyframes capture-stomp { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% - 70px)) scale(1.4); } 41% { opacity: 1; transform: translate(-50%, -50%) scale(1.5); } 53% { transform: translate(-50%, -50%) scale(.78); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } }
@keyframes capture-roar { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.5) rotate(-18deg); } 45% { opacity: 1; transform: translate(-50%, -50%) scale(1.5) rotate(8deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.8) rotate(0); } }
@keyframes capture-claw { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.7) rotate(-35deg); } 36% { opacity: 1; transform: translate(-50%, -50%) scale(1.2) rotate(16deg); } 57% { transform: translate(-50%, -50%) scale(.94) rotate(-9deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.72); } }
@keyframes capture-dash { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.4) skewX(-18deg); } 32% { opacity: 1; transform: translate(-50%, -50%) scale(1.4) skewX(13deg); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.65) skewX(0); } }
@keyframes capture-orbit { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) rotate(-100deg) scale(.5); } 45% { opacity: 1; transform: translate(-50%, -50%) rotate(30deg) scale(1.35); } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(100deg) scale(.7); } }
@keyframes capture-bounce { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.7); } 30% { opacity: 1; transform: translate(-50%, calc(-50% - 24px)) scale(1.1); } 54% { transform: translate(-50%, -50%) scale(1.35, .78); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.8); } }
@keyframes capture-swipe { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) rotate(-40deg) scale(.5); } 34% { opacity: 1; transform: translate(calc(-50% + 12px), calc(-50% - 12px)) rotate(20deg) scale(1.15); } 58% { transform: translate(calc(-50% - 9px), -50%) rotate(-12deg) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } }
@keyframes capture-zigzag { 0% { opacity: 0; transform: translate(calc(-50% + var(--entry-x)), calc(-50% + var(--entry-y))) scale(.55); } 28% { opacity: 1; transform: translate(calc(-50% + 15px), calc(-50% - 16px)) scale(1); } 46% { transform: translate(calc(-50% - 12px), calc(-50% + 8px)) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(.7); } }
.capture-elephant .capture-attacker { animation-name: capture-stomp; }
.capture-lion .capture-attacker { animation-name: capture-roar; }
.capture-tiger .capture-attacker { animation-name: capture-claw; }
.capture-leopard .capture-attacker { animation-name: capture-dash; }
.capture-wolf .capture-attacker { animation-name: capture-orbit; }
.capture-dog .capture-attacker { animation-name: capture-bounce; }
.capture-cat .capture-attacker { animation-name: capture-swipe; }
.capture-rat .capture-attacker { animation-name: capture-zigzag; }
.side-panel { display: flex; flex-direction: column; gap: 13px; padding-top: 9px; }
.mobile-action-bar { display: none; }
.panel-card { padding: 22px 23px; border: 1px solid #e0eae0; border-radius: 18px; background: #fff; box-shadow: 0 6px 22px #315b460a; }
.panel-card h2 { margin: 0 0 8px; color: var(--forest-deep); font-size: 23px; letter-spacing: -.035em; }
.panel-card p:not(.card-kicker) { margin: 0; color: #708277; font-size: 13px; line-height: 1.68; }
.state-card { border-color: #cfe6d7; background: linear-gradient(135deg, #e9f6e9, #f7fbf4); }
.deadline { display: flex; justify-content: space-between; margin-top: 15px; padding-top: 13px; border-top: 1px solid #cbddcf; color: #637c6c; font-size: 13px; }
.deadline strong { color: #ca675b; font-size: 16px; font-variant-numeric: tabular-nums; }
.invite-actions, .move-actions, .dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.invite-actions button, .move-actions button { flex: 1; padding: 11px; font-size: 12px; white-space: nowrap; }
.result-card .primary-button { width: 100%; margin-top: 18px; }
.facts { display: grid; grid-template-columns: 1fr auto; gap: 9px; color: #819084; font-size: 12px; }
.facts strong { color: #3e6451; text-align: right; }
.captured-list { display: flex; flex-direction: column; gap: 7px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #e6eee7; color: #819084; font-size: 12px; }
.captured-list strong { margin-left: 8px; color: #3e6451; }
.minor-actions { display: flex; flex-wrap: wrap; gap: 13px; padding: 2px 5px; }
.minor-actions button { min-height: 36px; padding: 6px 2px; border: 0; background: transparent; color: #6b8174; font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: #142c25b8; backdrop-filter: blur(7px); }
.modal { position: relative; width: min(100%, 530px); max-height: min(90dvh, 900px); overflow: auto; padding: 28px; border: 1px solid #ffffff8c; border-radius: 23px; background: #fff; box-shadow: 0 28px 90px #0a291e68; }
.modal h2 { margin: 0 0 12px; color: var(--forest-deep); font-size: 30px; letter-spacing: -.04em; }
.modal p { color: #63786b; font-size: 14px; line-height: 1.7; }
.rules-modal { width: min(100%, 780px); }
.close-button { position: absolute; z-index: 1; top: 16px; right: 17px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 11px; background: #ffffffd9; color: #456b54; font-size: 25px; }
.rules-hero { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -6px -6px 21px; padding: 22px 28px; border-radius: 18px; background: linear-gradient(120deg, #e9f5e6, #fff0e6); }
.rules-hero p { max-width: 470px; margin: 0; }
.rules-hero p strong { color: #d56650; }
.rules-hero img { width: 123px; height: 123px; flex: none; object-fit: contain; }
.rules-steps { display: flex; align-items: stretch; gap: 7px; margin-bottom: 30px; }
.rules-steps > div { display: flex; flex: 1; flex-direction: column; gap: 3px; min-width: 0; padding: 13px 16px; border: 1px solid #deebe0; border-radius: 13px; background: #f8fbf8; }
.rules-steps b { color: #e6816b; font-size: 11px; }
.rules-steps strong { color: var(--forest); font-size: 14px; }
.rules-steps span { color: #839488; font-size: 11px; }
.rules-steps i { align-self: center; color: #9eb9a6; font-style: normal; }
.flip-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 25px; }
.guide-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border: 1px solid #deebe0; border-radius: 14px; background: #f8fbf8; }
.guide-card strong { color: var(--forest); font-size: 13px; }
.guide-card p { margin: 0; color: #708277; font-size: 11px; line-height: 1.55; }
.guide-back, .guide-arrow, .guide-paw { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; font-family: Georgia, 'Noto Serif SC', serif; font-size: 20px; font-weight: 800; }
.guide-back { background: #c75650; color: #ffe6c6; box-shadow: inset 0 0 0 3px #f7cfac; }
.guide-arrow { background: #e1f0e5; color: #337853; }
.guide-paw { background: #f6e9d6; color: #bf8653; }
.rules-section { margin-top: 25px; padding-top: 23px; border-top: 1px solid #e9efe8; }
.rules-section-title { display: flex; align-items: start; gap: 12px; }
.rules-section-title > span { width: 29px; height: 29px; flex: none; display: grid; place-items: center; border-radius: 9px; background: #e8f4e8; color: #2a7954; font-size: 11px; font-weight: 900; }
.rules-section h3 { margin: 0; color: var(--forest-deep); font-size: 18px; }
.rules-section-title p { margin: 3px 0 0; font-size: 12px; }
.animal-ladder { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 7px; margin-top: 19px; }
.ladder-animal { display: flex; align-items: center; flex-direction: column; padding: 8px 2px; border: 1px solid #e5ebe2; border-radius: 12px; background: #fbfcf9; }
.ladder-animal img { width: 55px; height: 55px; max-width: 100%; object-fit: contain; }
.ladder-animal strong { margin-top: 1px; color: var(--forest); font-size: 12px; }
.ladder-animal small { color: #87978a; font-size: 10px; }
.rule-tip { display: flex; align-items: center; gap: 12px; margin-top: 13px; padding: 10px 15px; border: 1px solid #f2dfb2; border-radius: 13px; background: #fff7e7; }
.rule-tip img { width: 44px; height: 44px; flex: none; object-fit: contain; }
.rule-tip p { margin: 0; font-size: 12px; }
.rule-tip strong { color: #af6840; }
.terrain-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.terrain-guide > div { display: flex; align-items: start; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid #e4ebe1; border-radius: 13px; background: #fbfcfa; }
.terrain-guide strong { color: var(--forest); font-size: 13px; }
.terrain-guide p { margin: 0; font-size: 11px; }
.terrain-demo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; font-size: 21px; font-weight: 800; }
.water-demo { background: repeating-linear-gradient(155deg, #c6e8e8 0 7px, #b7dfdf 7px 14px); color: #3a8792; }
.trap-demo { background: #f8dfc9; color: #c18464; }
.den-demo { background: #f1c9a5; color: #a56c4b; }
.rules-ending > p { margin: 14px 0 0 41px; padding: 12px 14px; border-radius: 11px; background: #f4f8f4; font-size: 12px; }
.full { width: 100%; margin-top: 25px; }
.small-modal { max-width: 390px; }
.dialog-actions button { flex: 1; white-space: nowrap; }
#toast { position: fixed; z-index: 20; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); max-width: calc(100vw - 30px); overflow: hidden; padding: 12px 20px; border-radius: 100px; background: #1d4435; box-shadow: 0 10px 28px #15382954; color: #fff; font-size: 13px; opacity: 0; pointer-events: none; text-overflow: ellipsis; transform: translate(-50%, 18px); transition: opacity .2s, transform .2s; white-space: nowrap; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .home { gap: 24px; padding-inline: 5vw; }
  .home-controls { flex-direction: column; }
  .hero-art { padding: 20px; }
  .game-layout { grid-template-columns: minmax(0, 560px) minmax(220px, 280px); gap: 18px; }
  .panel-card { padding: 17px; }
}
@media (max-width: 700px) {
  .topbar { height: 68px; padding-inline: 16px; }
  .brand-mark { width: 38px; height: 38px; font-size: 23px; }
  .brand strong { font-size: 15px; }
  .connection-label { display: none; }
  .connection-chip { padding: 9px; }
  .home { min-height: calc(100dvh - 68px); display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 29px 22px 45px; }
  .home-copy { order: 2; align-self: stretch; }
  .hero-art { order: 1; width: min(53vw, 245px); padding: 12px; border-radius: 25px; }
  .hero-art-top, .hero-art-bottom { font-size: 8px; }
  .hero-animals { gap: 6px; }
  .hero-animal { border-radius: 12px; }
  .hero-animal small { font-size: 9px; }
  .home h1 { margin-bottom: 13px; font-size: clamp(35px, 9vw, 53px); }
  .lead { margin-bottom: 23px; font-size: 14px; line-height: 1.7; }
  .variant-picker { margin-bottom: 18px; }
  .home-controls { flex-direction: row; gap: 12px; }
  .home-controls > .primary-button { flex: 1; min-width: 0; white-space: nowrap; font-size: 13px; }
  .join-form { min-width: 0; }
  .feature-row { gap: 7px; margin-top: 22px; font-size: 10px; }
  .room-shell { padding: 20px 16px 46px; }
  .room-heading { align-items: center; margin-bottom: 15px; }
  .room-heading h1 { font-size: 26px; }
  .room-pill { gap: 6px; padding: 7px 8px; }
  .room-pill > span { display: none; }
  .room-pill strong { font-size: 12px; }
  .room-pill button { font-size: 10px; }
  .game-layout { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .board-column { width: 100%; }
  .side-panel { width: 100%; display: flex; }
  .action-card .move-actions { display: none; }
  .mobile-action-bar { position: fixed; z-index: 7; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 76px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #cfe2d4; background: #fffffff0; box-shadow: 0 -10px 30px #1d443523; backdrop-filter: blur(16px); }
  .mobile-action-summary { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--forest-deep); }
  .mobile-action-summary small { color: #759180; font-size: 10px; font-weight: 800; }
  .mobile-action-summary strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bar-actions { display: flex; flex: none; gap: 7px; }
  .mobile-bar-actions button { min-height: 43px; padding: 8px 11px; border-radius: 11px; font-size: 12px; white-space: nowrap; }
}
@media (max-width: 480px) {
  .home { justify-content: flex-start; }
  .home-controls { flex-direction: column; }
  .home-controls > .primary-button, .join-form { width: 100%; max-width: none; }
  .hero-art { width: min(52vw, 205px); }
  .home-guide { margin-top: 17px; }
  .home-guide-note { display: none; }
  .room-shell { padding-inline: 0; }
  .room-heading { padding-inline: 14px; }
  .board-frame { padding: 0; border-inline: 0; border-radius: 0; }
  .board { border-radius: 0; }
  .player-card { margin: 8px 12px; }
  .side-panel { padding-inline: 13px; }
  .square { border-width: .5px; }
  .piece { border-width: 2px; }
  .piece-rank { min-width: 15px; height: 15px; font-size: 8px; }
  .back-mark { font-size: 18px; }
  .modal-backdrop { padding: 10px; }
  .modal { padding: 20px; border-radius: 18px; }
  .rules-hero { margin: -3px -3px 14px; padding: 17px; }
  .rules-hero h2 { font-size: 23px; }
  .rules-hero img { width: 70px; height: 70px; }
  .rules-steps { display: grid; gap: 7px; }
  .rules-steps > div { display: grid; grid-template-columns: 29px 62px 1fr; align-items: center; min-height: 44px; gap: 6px; padding: 8px 10px; }
  .rules-steps i { display: none; }
  .rules-steps span { font-size: 11px; }
  .flip-guide { grid-template-columns: 1fr; gap: 7px; }
  .guide-card { display: grid; grid-template-columns: 37px 1fr; align-items: center; padding: 9px 11px; column-gap: 10px; }
  .guide-card > span { grid-row: span 2; }
  .guide-card p { font-size: 11px; }
  .animal-ladder { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .terrain-guide { grid-template-columns: 1fr; }
  .terrain-guide > div { display: grid; grid-template-columns: 42px 1fr; column-gap: 10px; padding: 10px; }
  .terrain-guide .terrain-demo { grid-row: span 2; }
}
@media (max-width: 380px) {
  .room-heading h1 { font-size: 23px; }
  .room-pill button { display: none; }
  .home h1 { font-size: 34px; }
  .top-actions { gap: 2px; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .room-shell { padding-top: 10px; }
  .room-heading { margin-bottom: 5px; }
  .board-column { width: min(45vw, calc((100dvh - 125px) * 7 / 9)); }
  .game-layout { display: flex; flex-direction: row; align-items: start; justify-content: center; }
  .side-panel { display: flex; width: min(42vw, 330px); }
  .compact-card { display: none; }
  .player-card { min-height: 35px; margin: 4px 0; padding: 2px 8px; }
  .player-avatar { width: 28px; height: 28px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
  .capture-halo, .capture-victim, .capture-attacker, .capture-mark, .capture-shard { display: none; }
  .capture-caption { animation: none !important; opacity: 1; transform: translate(-50%, 0); }
}
