/* Pokédex shell + handheld-era battle menus. Layout and battle animation live in style.css. */
:root {
  color-scheme: light;
  --bg: #f0ede3;
  --panel: #fffdf5;
  --line: #c4c7b7;
  --text: #293b46;
  --muted: #63777d;
  --accent: #286d87;
}
body {
  background-color: var(--bg);
  background-image: radial-gradient(#9aa99c35 1px, transparent 1px);
  background-size: 12px 12px;
  font-family: 'Malgun Gothic', 'DM Sans', sans-serif;
}
.shell {max-width: 1370px; padding: 0 38px;}
header {
  height: 82px;
  margin: 0 -38px;
  padding: 0 38px;
  background: #cf434b;
  border: 0;
  border-bottom: 6px solid #913a41;
  box-shadow: 0 4px 0 #fff7;
  position: relative;
}
header::after {content: ''; position: absolute; left: 39px; bottom: -10px; width: 70px; height: 4px; background: #42b6d0;}
.brand {color: #fff8e6; font-size: 26px; text-shadow: 1px 2px #823840; gap: 8px;}
.brand > span:last-child {color: #ffe89a;}
.ball-logo {width: 29px; height: 29px; border: 3px solid #3c3b43; background: linear-gradient(#f36d69 0 43%, #3c3b43 43% 57%, #fff7e5 57%); box-shadow: 0 1px 0 #f8948b;}
.ball-logo::after {width: 9px; height: 9px; left: 7px; top: 7px; background: #fff9e7; border-color: #3c3b43;}
.header-meta {color: #ffe8d7; font-weight: 600;}
.header-meta .live-dot {width: 14px; height: 14px; background: #78dcf6; border: 2px solid #fff2c7; box-shadow: 0 0 0 3px #a73542;}
.version {border-color: #f68e8f; color: white; border-radius: 3px;}
.intro {padding: 34px 0 28px; align-items: center;}
.eyebrow {letter-spacing: .7px; color: #637c7d; font-size: 10px; margin-bottom: 12px;}
.intro-badge {display: inline-block; padding: 5px 8px; margin-right: 9px; background: #2d6c83; color: #fff7df; font: 700 9px 'Space Grotesk', monospace; letter-spacing: 1px; border-radius: 2px;}
h1 {font-size: 32px; color: #d34a49; letter-spacing: -1.5px; text-shadow: 1px 2px 0 white;}
h1 span {color: #314b5a;}
.subtitle {color: #667c80; font-size: 11px; margin-top: 11px;}
.match-settings {background: #e3e6dc; padding: 13px 15px 11px; border: 1px solid #c5cebf; border-radius: 5px; box-shadow: inset 0 2px #fff7;}
.match-settings > label {font-size: 11px; font-weight: 700; color: #3b5c65; margin-bottom: 8px;}
.settings-row select {background: #fffdf5; border: 2px solid #788e92; border-radius: 4px; padding-top: 10px; padding-bottom: 10px; color: #2b4c57;}
.primary {background: #d95150; border: 2px solid #ad3e43; border-radius: 4px; color: #fff9eb; box-shadow: inset 0 2px #fb9280, 0 3px 0 #993b40; padding: 10px 14px;}
.primary:hover:not(:disabled) {background: #e76459;}
.primary:active:not(:disabled) {transform: translateY(2px); box-shadow: inset 0 2px #fb9280, 0 1px 0 #993b40;}
.primary span {font-size: 11px;}
.match-settings p {font-size: 9px; color: #627575;}
.workspace {gap: 20px; grid-template-columns: minmax(0, 1fr) 304px;}
.battle-panel, .team-panel, .log-panel {border: 2px solid #3d606b; border-radius: 7px; box-shadow: 0 4px 0 #80958e33;}
.panel-top {height: 42px; background: #3d606b; color: #fffbe6; padding: 0 17px; font-size: 11px; font-weight: 700; letter-spacing: .3px;}
.panel-top small {font: 8px 'Space Grotesk', monospace; color: #b8d8da; margin-left: 7px; letter-spacing: 1px;}
.panel-top .live-dot {background: #f8d47f; box-shadow: 0 0 0 2px #294c55;}
.panel-top > span:last-child {background: #244b56; padding: 5px 9px; color: #fff0af; border-radius: 3px; font-size: 9px;}
.arena {height: 365px; background: linear-gradient(#c4e1d5 0%, #e6edd0 46%, #bdce98 47%, #8cae75 100%); border: 6px solid #f4efd6; border-bottom-width: 5px;}
.sky-lines {opacity: .2;}
.sun {background: #fff4bd90;}
.hill-back {background: #9abb91; opacity: .9;}
.hill-front {background: #acc695;}
.field-label {color: #426b5c; font-size: 8px; opacity: .8;}
.platform {background: #d2dda6; border: 5px solid #82a163; box-shadow: 0 5px 0 #50734c50, inset 0 3px #e8ecbd;}
.pokemon-card {border: 3px solid #445a51; background: #fffde9; border-radius: 3px 10px 3px 10px; box-shadow: 4px 4px 0 #53715a40, inset 0 0 0 2px #e3e4c9; color: #2f4541; padding: 9px 12px;}
.card-title {font-size: 13px;}
.hp-line > span {font: 700 10px 'Space Grotesk', monospace; color: #976b1f;}
.hp-track {height: 9px; border: 1px solid #60715e; background: #d9dfc6; border-radius: 3px; padding: 1px;}
.hp-fill {border-radius: 1px; background: #65ae74;}
.hp-numbers {font-size: 11px; color: #3c514c;}
.card-meta {font-size: 9px;}
.welcome {background: repeating-linear-gradient(0deg, #e3ebd9e8 0 3px, #eaf0dfe8 3px 6px); color: #35594e;}
.welcome-tag {font: 700 9px 'Space Grotesk', monospace; letter-spacing: 2px; color: #6a8776; margin-bottom: 24px;}
.welcome-ball {display: block; width: 64px; height: 64px; position: relative; border: 4px solid #3f5551; border-radius: 50%; background: linear-gradient(#e5675c 0 44%, #3f5551 44% 56%, #fff8dd 56%); box-shadow: 5px 5px 0 #8aab8b55;}
.welcome-ball::after {content: ''; width: 18px; height: 18px; border: 4px solid #3f5551; background: #fffbe7; border-radius: 50%; position: absolute; left: 15px; top: 15px;}
.welcome h2 {font-size: 22px; margin: 22px 0 10px; letter-spacing: -1px;}
.welcome p {font-size: 11px; opacity: 1; color: #6b8476;}
.welcome-dots {color: #d8705e; font-size: 12px; letter-spacing: 5px; margin-top: 15px;}
.motion-label {color: #647a7a;}
.fx-settings {display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px; margin-left: auto;}
.fx-settings .volume {width: 84px; accent-color: #d64545;}
.fx-settings .sound-state {flex-basis: 100%; text-align: right; color: #b0533f;}
.bgm-settings {display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 12px;}
.bgm-settings select {max-width: 190px;}
.bgm-settings .volume {width: 84px; accent-color: #d64545;}
.bgm-settings .sound-state {flex-basis: 100%; color: #b0533f;}
.bgm-source-note {flex-basis: 100%; font-size: 10px; line-height: 1.5; color: #647a7a;}
.match-settings {min-width: 0;}
.intro > div:first-child {min-width: 220px;}
@media (min-width: 521px) and (max-width: 1100px) {
  .intro {display: block;}
  .match-settings {margin-top: 18px;}
  .settings-row {flex-direction: row; flex-wrap: wrap;}
  .settings-row select {min-width: 0; flex: 1;}
}
.controls {background: #e9ede5; padding: 14px 16px 17px;}
.control-head {font-weight: 700; color: #375563;}
.control-head small {color: #708b8e;}
.control-head label {color: #8d4f87;}
.moves {gap: 9px; min-height: 133px;}
.move {border: 2px solid #74888c; border-radius: 4px; background: #fffdf1; box-shadow: inset 0 -3px #d9dfd5; padding: 11px 12px; color: #2c444d;}
.move::before {left: 0; top: 0; bottom: 0; width: 5px; border-radius: 0; background: var(--move-color); border-right: 1px solid #324e4033;}
.move strong {font-size: 12px;}
.move small, .move-right {color: #657b7f;}
.move:hover:not(:disabled) {background: #fffff9; border-color: #cf5352; box-shadow: inset 0 -3px #e8d0bb, 0 0 0 1px #cf5352;}
.move:disabled {opacity: .48; background: #e0e3da;}
.type-pill {border-radius: 3px; padding: 3px 6px; margin-bottom: 5px; background: var(--move-color); color: #293d49; font-size: 9px; font-weight: 700; border: 1px solid #0002;}
.empty-moves {background: #f5f7ed; border: 2px dashed #b6c4b4; color: #6c857b; font-size: 11px;}
.team-panel {padding: 0 13px 14px; background: #e7f0ec;}
.section-heading {min-height: 43px; border-bottom: 1px solid #b8cfc9;}
.section-heading h2 {color: #315865; font-size: 12px;}
.section-heading small {color: #576e6b;}
.section-heading > span {background: #457d87; color: #fffbe6; padding: 4px 8px; border-radius: 3px; font-size: 10px;}
.section-hint {margin-top: 11px; font-size: 10px; color: var(--muted);}
.team {gap: 7px;}
.team-member {background: #fffdf1; border: 1px solid #a1b9b4; border-radius: 4px; min-height: 55px; padding: 7px 8px; color: #2f5159; box-shadow: 0 2px #bbcdc755;}
.team-member.is-active {background: #fff1c2; border: 2px solid #c59741; padding: 6px 7px; box-shadow: inset 3px 0 #e2b650;}
.team-member:hover:not(:disabled) {background: #fff6d5; border-color: #ca6356;}
.team-info small {color: #748a80;}
.team-index {color: #78958a;}
.team-member.is-active .team-index {color: #a8752c; font-weight: 700;}
.mini-track {background: #d6dfcc; height: 4px; border: 1px solid #92a88e;}
.mini-track > div {background: #6ba66e;}
.empty-team {padding: 77px 0; color: #5b6e68;}
.log-panel {padding: 0 13px 12px; background: #f9f6e9; border-color: #7a8783;}
.log-panel .section-heading {border-bottom-color: #d6d6c4;}
.log {height: 169px; scrollbar-color: #9eb2a3 transparent;}
.log p {color: #5f746c; line-height: 1.9;}
.log .log-turn {color: #c75447; border-top: 1px dashed #c8ccbb; font-weight: 700;}
.log .log-muted {color: #66726b;}
.text-button {color: #4a7e88;}
.result {background: #e7eedbea; color: #37534f;}
.result strong {color: #c65547; text-shadow: 2px 3px #fff8d0;}
.result-actions {display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 12px;}
/* 대전 방식 탭과 트레이너 도전 패널. 트레이너 카드는 그림 없이 테마 색 띠와 머리글자 엠블럼만 쓰는 자체 디자인. */
.mode-tabs {display: flex; gap: 6px; margin: 12px 0 0;}
.mode-tabs button {flex: 1; background: #e3e6dc; border: 2px solid #c5cebf; border-radius: 4px 4px 0 0; padding: 9px; color: #4f6764; font-weight: 700;}
.mode-tabs button[aria-selected="true"] {background: #fffce9; border-color: #607b81; color: #c65547;}
.trainer-panel {display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; background: #fffce9; border: 4px solid #607b81; border-radius: 0 0 4px 4px; padding: 14px;}
.trainer-panel[hidden] {display: none;}
.trainer-panel h2 {font-size: 14px; margin: 0 0 10px; color: #344c53;}
.trainer-panel h2 small {font-size: 9px; color: #74827b; margin-left: 4px;}
.trainer-list {display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;}
.trainer-card {display: flex; align-items: center; gap: 8px; text-align: left; background: linear-gradient(100deg, var(--trainer-a) 0 44px, #fff 44px); border: 2px solid #c5cebf; border-radius: 4px; padding: 8px; min-height: 58px;}
.trainer-card:hover {border-color: var(--trainer-b);}
.trainer-card.is-selected {border-color: var(--trainer-b); box-shadow: 0 0 0 2px var(--trainer-b);}
.trainer-emblem {flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--trainer-b); color: var(--trainer-ink, var(--trainer-a)); font-weight: 800; border: 2px solid #fff;}
.trainer-text {display: grid; min-width: 0;}
.trainer-text strong {font-size: 13px; color: #273c40;}
.trainer-text small {font-size: 9px; color: var(--muted);}
.trainer-detail {margin-top: 10px; border-left: 6px solid var(--trainer-b); background: #f3f5ec; padding: 10px 12px;}
.trainer-name {font-size: 13px; color: var(--trainer-a);}
.trainer-intro {margin: 6px 0 4px; font-size: 12px; color: #344c53;}
.trainer-meta {font-size: 10px; color: var(--muted);}
.trainer-team {display: flex; flex-direction: column; gap: 8px;}
.trainer-team textarea {width: 100%; box-sizing: border-box; font: 11px/1.5 ui-monospace, Consolas, monospace; border: 2px solid #c5cebf; border-radius: 4px; padding: 8px; resize: vertical;}
.team-check {font-size: 11px; border-radius: 4px; padding: 8px 10px; max-height: 140px; overflow: auto;}
.team-check p {margin: 0 0 4px;}
.team-check.ok {background: #e3f1dc; color: #2f5a35;}
.team-check.bad {background: #f8e1dc; color: #8a3a2c;}
@media (max-width: 760px) {
  .trainer-panel {grid-template-columns: 1fr;}
  .trainer-list {grid-template-columns: repeat(2, minmax(0, 1fr));}
}
.error {background: #fff0df; color: #a33b32; border: 2px solid #c96e5b;}
.missing-art {background: #dbe6c6;}
.fx-caption {background: #fffbe9; border: 3px solid #45646a; color: #30494f; box-shadow: 3px 3px #254b3040;}
footer {margin-top: 24px; border-top: 2px solid #c7cfc0; color: #7c8a80;}
footer > span {font: 600 9px 'Space Grotesk','Malgun Gothic',sans-serif; letter-spacing: .5px;}
footer b {color: #cf5d53; margin: 0 6px;}
details a {color: #1f6070;}
@media(min-width:1300px) {.arena {height: 390px;}}
@media(max-width:1100px) {
  .shell {padding: 0 24px;}
  header {margin: 0 -24px; padding: 0 24px;}
  .workspace {grid-template-columns: minmax(0,1fr) 275px; gap: 14px;}
  h1 {font-size: 28px;}
  .eyebrow {font-size: 9px;}
  .intro-badge {font-size: 8px; display: table; margin-bottom: 8px;}
  .match-settings {min-width: 245px;}
  .arena {height: 365px;}
  .pokemon-card {padding: 8px 10px;}
}
@media(max-width:800px) {
  .workspace {grid-template-columns: 1fr;}
  .intro {gap: 18px;}
  h1 {font-size: 25px;}
  .subtitle {font-size: 10px; max-width: 230px; line-height: 1.8;}
  .arena {height: 380px;}
  .team-panel {padding: 0 13px 14px;}
  .log {height: 355px;}
}
@media(max-width:520px) {
  .shell {padding: 0 12px;}
  header {height: 66px; margin: 0 -12px; padding: 0 15px;}
  .brand {font-size: 23px;}
  .header-meta {gap: 6px;}
  .header-meta .live-dot {height: 10px; width: 10px;}
  .intro {padding: 24px 0 20px;}
  .intro-badge {display: inline-block; margin-bottom: 0;}
  h1 {font-size: 28px;}
  .subtitle {max-width: none; margin-top: 8px;}
  .match-settings {margin-top: 18px; padding: 10px;}
  .primary {font-size: 10px; padding: 10px 8px;}
  .arena {height: 335px; border-width: 4px;}
  .panel-top {padding: 0 11px; font-size: 10px;}
  .panel-top small {display: none;}
  .pokemon-card {width: 157px; padding: 7px 8px; border-width: 2px;}
  .card-title {font-size: 11px;}
  .card-meta {font-size: 8px;}
  .hp-numbers {font-size: 10px;}
  .welcome h2 {font-size: 20px;}
  .welcome-tag {font-size: 8px; letter-spacing: 1px;}
  .motion-label {font-size: 9px;}
  .controls {padding: 12px;}
  .move {padding: 10px 9px 10px 12px;}
  .move strong {font-size: 11px;}
  .move small {font-size: 8px;}
  .move-right {font-size: 8px;}
  .type-pill {font-size: 8px; padding: 2px 4px;}
  .log {height: 180px;}
  .team-member.is-active {padding: 6px 4px;}
}
/* 내 파티 편집기 */
.party-panel {display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 14px; background: #fffce9; border: 4px solid #607b81; border-radius: 0 0 4px 4px; padding: 14px; margin-bottom: 14px; color: #273c40;}
.party-panel h2 {font-size: 14px; margin: 0 0 10px; color: #344c53;}
.party-panel h2 small {font-size: 9px; color: #74827b; margin-left: 4px;}
.party-panel select, .party-panel input[type="search"], .party-panel input[type="number"], .party-panel input:not([type]) {background: #fff; color: #273c40; border: 2px solid #c5cebf; border-radius: 4px; padding: 6px 8px; font-size: 12px; min-width: 0;}
.party-panel textarea {width: 100%; box-sizing: border-box; font: 11px/1.5 ui-monospace, Consolas, monospace; border: 2px solid #c5cebf; border-radius: 4px; padding: 8px; resize: vertical; background: #fff; color: #273c40;}
.party-saved {display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow: auto;}
.party-saved-item {display: grid; text-align: left; gap: 2px; background: #fff; border: 2px solid #c5cebf; border-radius: 4px; padding: 7px 9px; color: #273c40;}
.party-saved-item strong {font-size: 12px;}
.party-saved-item small {font-size: 9px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.party-saved-item.is-selected {border-color: #c65547; box-shadow: 0 0 0 2px #f2c8bd;}
.party-side-actions {margin: 10px 0 0;}
.party-side-actions .primary {width: 100%; justify-content: space-between;}
.party-import {text-align: left; margin-top: 10px; font-size: 11px; color: #4f6764;}
.party-import textarea {margin: 6px 0;}
.party-editor {display: flex; flex-direction: column; gap: 10px; min-width: 0;}
.party-empty {display: grid; place-items: center; color: var(--muted); font-size: 12px; border: 2px dashed #c5cebf; border-radius: 4px; min-height: 180px;}
.party-head {display: flex; flex-wrap: wrap; align-items: center; gap: 8px;}
.party-head #party-name {flex: 1 1 160px; font-weight: 700; font-size: 14px;}
.party-rule {font-size: 10px; color: var(--muted);}
.party-members {display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;}
.party-slot {display: flex; align-items: stretch; background: #fff; border: 2px solid #c5cebf; border-radius: 4px; min-height: 56px; min-width: 0;}
.party-slot.is-selected {border-color: #c65547; box-shadow: 0 0 0 2px #f2c8bd;}
.party-slot.is-empty {display: grid; place-items: center; font-size: 10px; color: #66716c; border-style: dashed; background: #f6f7ef;}
.party-slot-main {flex: 1; display: flex; align-items: center; gap: 6px; background: none; border: 0; text-align: left; padding: 4px 6px; min-width: 0; color: #273c40;}
.party-art-wrap {flex: none; width: 44px; height: 44px; display: grid; place-items: center;}
.party-art, .result-art {width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated;}
.party-art.missing-art, .result-art.missing-art, .member-art.missing-art {width: 40px; height: 40px; font-size: 10px; border-radius: 8px;}
.party-slot-text {display: grid; min-width: 0;}
.party-slot-text strong {font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.party-slot-text small {font-size: 9px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.party-slot-tools {display: flex; flex-direction: column; justify-content: center; padding: 0 4px; border-left: 1px solid #e3e6dc;}
.party-slot-tools .text-button {font-size: 10px; padding: 1px 3px; color: #4a7e88;}
.party-add {position: relative;}
.party-add input {width: 100%; box-sizing: border-box;}
.party-results {display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; margin-top: 4px; max-height: 220px; overflow: auto;}
.party-result {display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 6px; align-items: center; text-align: left; background: #fff; border: 2px solid #c5cebf; border-radius: 4px; padding: 3px 6px; color: #273c40;}
.party-result:hover, .party-result:focus-visible {border-color: #607b81;}
.party-result .result-art, .party-result .missing-art {grid-row: span 2;}
.party-result span {font-size: 12px; font-weight: 700;}
.party-result small {font-size: 9px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.member-detail {background: #f3f5ec; border-left: 6px solid #c65547; padding: 10px 12px; display: flex; flex-direction: column; gap: 10px;}
.member-head {display: flex; align-items: center; gap: 10px;}
.member-art {width: 64px; height: 64px; object-fit: contain; image-rendering: pixelated;}
.member-head strong {font-size: 15px;}
.member-head small {font-size: 10px; color: var(--muted);}
.member-base {display: block;}
.member-grid {display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 10px;}
.member-field {display: grid; gap: 2px; font-size: 10px; color: #4f6764; min-width: 0;}
.member-field select {width: 100%;}
.member-stats {border: 2px solid #dfe3d6; border-radius: 4px; padding: 6px 8px; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 10px; color: #4f6764;}
.member-stats legend, .member-stats summary {font-size: 10px; font-weight: 700; color: #344c53; padding: 0 4px;}
.member-ivs {display: block; text-align: left; max-width: none;}
.member-ivs[open] {display: flex;}
.member-ivs summary {width: 100%; cursor: pointer;}
.stat-input {display: grid; gap: 2px; text-align: center;}
.stat-input input {width: 58px; box-sizing: border-box;}
.member-total {width: 100%; color: #4f6764;}
.member-total.bad {color: #a33b32; font-weight: 700;}
.member-actions {display: flex; gap: 10px; align-items: center;}
.party-actions {display: flex; flex-wrap: wrap; gap: 12px; align-items: center;}
.party-actions .text-button {font-size: 11px;}
.party-actions .danger {color: #a33b32;}
.party-actions .sound-state {color: #4f6764; font-size: 10px;}
.party-export-text {min-height: 120px;}
@media (max-width: 900px) {
  .party-panel {grid-template-columns: 1fr;}
  .party-saved {max-height: 180px;}
}
@media (max-width: 520px) {
  .party-panel {padding: 10px;}
  .party-members {grid-template-columns: repeat(2, minmax(0, 1fr));}
  .member-grid {grid-template-columns: 1fr;}
  .stat-input input {width: 52px;}
}
.trainer-variant {display: block; width: 100%; margin: 6px 0 2px; background: #fff; color: #273c40; border: 2px solid #c5cebf; border-radius: 4px; padding: 6px 8px; font-size: 12px;}
.trainer-meta a {color: #1f6070;}
/* 날씨·필드·진영 효과 (장면 모델이 data-weather / data-terrain / pN-screen 을 바꾼다) */
.weather-layer {position: absolute; inset: 0; z-index: 7; pointer-events: none; opacity: 0; transition: opacity calc(.9s / var(--battle-speed,1));}
.arena[data-weather="raindance"] .weather-layer, .arena[data-weather="primordialsea"] .weather-layer {opacity: .75; background: repeating-linear-gradient(105deg, transparent 0 14px, #4f7fb8cc 14px 16px, transparent 16px 31px); background-size: 120px 120px; animation: rainFall .45s linear infinite;}
.arena[data-weather="sunnyday"] .weather-layer, .arena[data-weather="desolateland"] .weather-layer {opacity: 1; background: radial-gradient(circle at 48% 8%, #fff3b0cc 0, #ffd56a55 22%, transparent 55%);}
.arena[data-weather="sandstorm"] .weather-layer {opacity: .6; background: repeating-linear-gradient(80deg, #c9a46a33 0 3px, transparent 3px 9px), linear-gradient(#d8b98066, #b8935a55); background-size: 90px 90px, auto; animation: sandBlow .7s linear infinite;}
.arena[data-weather="hail"] .weather-layer, .arena[data-weather="snow"] .weather-layer, .arena[data-weather="snowscape"] .weather-layer {opacity: .8; background: radial-gradient(#ffffffee 1.5px, transparent 2px), radial-gradient(#ffffffaa 1px, transparent 1.5px); background-size: 38px 38px, 23px 23px; background-position: 0 0, 11px 17px; animation: snowFall 2.4s linear infinite;}
.arena[data-weather="deltastream"] .weather-layer {opacity: .5; background: repeating-linear-gradient(170deg, transparent 0 20px, #bfe6e2aa 20px 22px); animation: sandBlow 1s linear infinite;}
.arena[data-terrain="electricterrain"] .hill-front, .arena[data-terrain="electricterrain"] .hill-back {background: #c9c46a;}
.arena[data-terrain="grassyterrain"] .hill-front, .arena[data-terrain="grassyterrain"] .hill-back {background: #6fae5c;}
.arena[data-terrain="mistyterrain"] .hill-front, .arena[data-terrain="mistyterrain"] .hill-back {background: #d7a9c9;}
.arena[data-terrain="psychicterrain"] .hill-front, .arena[data-terrain="psychicterrain"] .hill-back {background: #b08cc9;}
.arena.p1-screen .player-platform, .arena.p2-screen .opponent-platform {box-shadow: 0 0 0 4px #a8d8ffaa, 0 0 26px 6px #8fc8ffcc;}
.field-conditions {position: absolute; top: 34px; left: 22px; z-index: 9; display: flex; flex-wrap: wrap; gap: 4px; max-width: 60%;}
.side-conditions {position: absolute; z-index: 9; display: flex; flex-wrap: wrap; gap: 3px; max-width: 46%; pointer-events: none;}
.opponent-conditions {right: 18px; top: 16px; justify-content: flex-end;}
.player-conditions {left: 18px; bottom: 8px;}
.condition {font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; background: #fffbe9e6; color: #344c53; border: 1px solid #8aa0a0; white-space: nowrap;}
.condition-stealthrock {background: #e6d2b0; border-color: #8a6a3a; color: #5a4120;}
.condition-spikes {background: #dcdcd6; border-color: #6e6e66;}
.condition-toxicspikes {background: #e1cfee; border-color: #7d4f9c; color: #4f2a6a;}
.condition-stickyweb {background: #f3efc8; border-color: #9a9256;}
.condition-reflect, .condition-auroraveil {background: #d9ecff; border-color: #4f86c0; color: #24507e;}
.condition-lightscreen {background: #fde3ef; border-color: #c06a93; color: #7e2d55;}
.condition-tailwind {background: #d6f2ec; border-color: #3e9b8a; color: #1f5c51;}
.condition-weather {background: #e3f0ff; border-color: #5e86b0;}
.condition-terrain {background: #e9f5dc; border-color: #6f9a4f;}
.condition-pseudo {background: #efe3ff; border-color: #7b5aa8; color: #4a2f75;}
.card-meta .boost {padding: 1px 4px; border-radius: 3px; color: #fff;}
.card-meta .boost.up {background: #c65547;}
.card-meta .boost.down {background: #4a7e88;}
.battle-art.is-shiny {filter: drop-shadow(0 0 6px #ffe68a) drop-shadow(0 8px 3px #254b3040);}
@keyframes rainFall {to {background-position: -30px 120px;}}
@keyframes sandBlow {to {background-position: 90px 10px, 0 0;}}
@keyframes snowFall {to {background-position: 0 38px, 11px 40px;}}
@media (max-width: 520px) {
  .opponent-conditions {top: 12px; right: 8px;}
  .field-conditions {left: 12px; top: 30px;}
  .condition {font-size: 8px; padding: 1px 4px;}
}
/* 연승 도전·전적 */
.streak-button {display: grid; gap: 2px; text-align: left; background: #fff3d6; color: #8a4b12; border: 2px solid #d9a24a; border-radius: 4px; padding: 8px 10px; font-weight: 800; font-size: 12px;}
.streak-button small {font-weight: 500; font-size: 9px; color: #9a6a2c;}
.streak-button:hover {background: #ffe9b8;}
.records {border-top: 2px dashed #c5cebf; padding-top: 8px; font-size: 10px; color: #4f6764;}
.records strong {display: block; font-size: 10px; letter-spacing: .5px; color: #344c53; margin-bottom: 4px;}
.records p {margin: 2px 0;}
.records .records-warning {color: #a33b32;}
.result .result-note {font-weight: 700; color: #9a5714;}
/* 리플레이 */
.replay-panel {background: #fffce9; border: 4px solid #607b81; border-radius: 0 0 4px 4px; padding: 14px; margin-bottom: 14px; color: #273c40;}
.replay-panel h2 {font-size: 14px; margin: 0 0 6px; color: #344c53;}
.replay-panel h2 small {font-size: 9px; color: #74827b; margin-left: 4px;}
.replay-list {display: flex; flex-direction: column; gap: 6px;}
.replay-item {display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #c5cebf; border-radius: 4px; padding: 6px 10px;}
.replay-text {flex: 1; display: grid; min-width: 0;}
.replay-text strong {font-size: 12px;}
.replay-text small {font-size: 9px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.replay-item .primary {padding: 7px 12px; gap: 6px;}
.replay-item .danger {color: #a33b32;}
.replay-file {margin-top: 10px; display: flex; gap: 10px; align-items: center;}
.replay-file label {cursor: pointer; font-size: 11px;}
.replay-bar {display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px; background: #f3f5ec; border-bottom: 2px solid #c5cebf; color: #273c40;}
.replay-bar strong {font-size: 12px; flex: 1 1 100%;}
.replay-pos {font: 600 11px 'Space Grotesk', 'Malgun Gothic', sans-serif; color: #4f6764; min-width: 72px;}
.replay-bar .text-button {font-size: 11px; color: #2f6f7a;}
.replay-bar .replay-play {padding: 8px 14px; gap: 6px;}
.replay-bar select {background: #fff; color: #273c40; border: 2px solid #c5cebf; border-radius: 4px; padding: 4px 6px; font-size: 11px;}
@media (max-width: 520px) {
  .replay-item {flex-wrap: wrap;}
  .replay-text {flex-basis: 100%;}
  .replay-bar {padding: 10px 12px;}
}
/* 파티 추천 세트 */
.member-recs {display: grid; gap: 4px; font-size: 11px; color: #344c53;}
.member-recs > small {font-size: 9px; color: var(--muted);}
.rec-list {display: flex; flex-wrap: wrap; gap: 6px;}
.rec-chip {display: grid; gap: 2px; text-align: left; background: #fff; border: 2px solid #c5cebf; border-radius: 4px; padding: 5px 8px; max-width: 100%; color: #273c40;}
.rec-chip strong {font-size: 11px; color: #c65547;}
.rec-chip small {font-size: 9px; color: #4f6764; white-space: normal;}
.rec-chip:hover {border-color: #c65547;}
/* 등장 연출: 트레이너 · 몬스터볼 */
.trainer-sprite {position: absolute; right: 60px; top: 28px; width: 150px; height: 170px; z-index: 6; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; opacity: 0;}
.trainer-sprite .trainer-art {width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 8px 3px #254b3040);}
.trainer-sprite.enter {animation: trainerIn .5s ease-out forwards;}
.trainer-sprite.exit {animation: trainerOut .38s ease-in forwards;}
.trainer-missing {display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: #dbe6c6; color: #365438; font-weight: 800;}
.intro-caption {position: absolute; left: 12%; right: 12%; bottom: 14px; z-index: 12; background: #fffbe9; border: 3px solid #45646a; color: #30494f; padding: 10px 14px; font-size: 13px; font-weight: 700; border-radius: 5px; box-shadow: 3px 3px #254b3040; text-align: center;}
.intro-hidden {visibility: hidden;}
.pokeball {position: absolute; z-index: 11; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #2b2b2b; background: linear-gradient(#e0473b 0 44%, #2b2b2b 44% 56%, #fafafa 56%); box-shadow: inset 0 0 0 4px transparent;}
.pokeball::after {content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -5px 0 0 -5px; border-radius: 50%; background: #fafafa; border: 2px solid #2b2b2b;}
.pokeball.throw-opponent {animation: throwOpponent .43s cubic-bezier(.3,.6,.5,1) forwards;}
.pokeball.throw-player {animation: throwPlayer .43s cubic-bezier(.3,.6,.5,1) forwards;}
.ball-flash {position: absolute; z-index: 10; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(#fffbe0, #fff1a8aa 45%, transparent 70%); animation: ballFlash .33s ease-out forwards; pointer-events: none;}
.ball-flash.flash-opponent {right: 120px; top: 95px;}
.ball-flash.flash-player {left: 115px; bottom: 90px;}
.sprite-slot.pop-in {animation: popIn .33s ease-out;}
.result .result-trainer {display: block; width: 96px; height: 96px; margin: -40px auto 6px; object-fit: contain; image-rendering: pixelated;}
@keyframes trainerIn {from {opacity: 0; transform: translateX(80px);} to {opacity: 1; transform: none;}}
@keyframes trainerOut {from {opacity: 1; transform: none;} to {opacity: 0; transform: translateX(110px);}}
@keyframes throwOpponent {from {right: 40%; top: 70%; transform: rotate(0);} 60% {top: 22%;} to {right: 150px; top: 120px; transform: rotate(540deg);}}
@keyframes throwPlayer {from {left: -20px; bottom: 30%; transform: rotate(0);} 60% {bottom: 48%;} to {left: 150px; bottom: 110px; transform: rotate(-540deg);}}
@keyframes ballFlash {from {transform: scale(.2); opacity: 1;} to {transform: scale(1.4); opacity: 0;}}
@keyframes popIn {from {transform: scale(.15); filter: brightness(3);} to {transform: none; filter: none;}}
@media (max-width: 520px) {
  .trainer-sprite {right: 20px; top: 24px; width: 110px; height: 130px;}
  .ball-flash.flash-opponent {right: 50px; top: 80px;}
  .ball-flash.flash-player {left: 50px; bottom: 80px;}
}
/* 메가진화·Z기술·다이맥스 */
.control-head .gimmick {font-size: 10px; color: #8a4b12; margin-right: 10px;}
.zmoves {display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px;}
.zmove-label {font: 800 10px 'Space Grotesk', 'Malgun Gothic', sans-serif; color: #b07a12;}
.zmove {background: linear-gradient(90deg, #fff3c4, #ffd76a); border: 2px solid #c9961c; border-radius: 4px; padding: 5px 10px; font-size: 11px; font-weight: 700; color: #6b4a06;}

/* BW풍: 정보창은 화면 가장자리에, 포켓몬은 중앙의 대각선에 배치한다. */
.arena .pokemon-card {width: 224px; padding: 7px 12px 6px; border: 2px solid #374b48; border-radius: 0 0 14px 0; background: linear-gradient(#fffef2, #e5e9d6); box-shadow: 0 3px 0 #344d4545;}
.arena .opponent-card {top: 40px; left: -2px;}
.arena .player-card {right: -2px; bottom: 30px; border-radius: 14px 0 0 0;}
.arena .card-title {font-size: 12px; line-height: 1.2;}
.arena .card-title > span {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.arena .hp-line {margin-top: 5px; gap: 5px;}
.arena .hp-track {height: 8px; border-radius: 5px;}
.arena .hp-numbers {font-size: 10px; margin-top: 2px; line-height: 1.1;}
.arena .opponent-card .hp-numbers {display: none;}
/* BW 원작 대조(2026-10-25): 정보창 안쪽 끝이 화살촉 모양 — 상대는 오른쪽, 나는 왼쪽으로 뾰족하다.
   clip-path는 테두리·그림자도 잘라 내므로 테두리(::before)와 바탕(::after)을 같은 모양으로 겹쳐 그리고, 그림자는 filter로 준다. */
.arena .pokemon-card {border: 0; border-radius: 0; background: none; box-shadow: none; isolation: isolate; filter: drop-shadow(0 3px 0 #344d4545);}
.arena .pokemon-card::before, .arena .pokemon-card::after {content: ''; position: absolute; z-index: -1; clip-path: var(--hud-shape);}
.arena .pokemon-card::before {inset: 0; background: #374b48;}
.arena .pokemon-card::after {inset: 2px; background: linear-gradient(#fffef2, #e5e9d6);}
.arena .pokemon-card.opponent-card {--hud-shape: polygon(0 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 0 100%); padding-right: 24px;}
.arena .pokemon-card.player-card {--hud-shape: polygon(18px 0, 100% 0, 100% 100%, 18px 100%, 0 50%); padding-left: 24px;}
.arena .card-meta {font-size: 8px; margin-top: 3px; gap: 3px; flex-wrap: wrap; line-height: 1.25;}
.field-settings {display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; padding: 8px 14px; background: #f4f3e5; color: #526e69; font-size: 10px; border-bottom: 1px solid #b5c7b9;}
.field-settings select {max-width: 180px; border: 1px solid #91aaa1; background: #fffef3; color: #344e4b; padding: 4px 9px; font-size: 11px;}
.field-settings small {color: #996048;}
.arena.has-background {background-image: var(--battle-background); background-size: cover; background-position: center;}
.has-background > .sun, .has-background > .hill, .has-background > .sky-lines {display: none;}
.has-background .field-label {background: #fffce7df; padding: 3px 6px; border-radius: 3px; opacity: 1;}
.control-head {flex-wrap: wrap; justify-content: flex-start; gap: 8px;}
.control-head > span {margin-right: auto;}
.control-head .gimmick {position: relative; cursor: pointer; font-size: 11px; color: #354e56;}
.gimmick input {position: absolute; opacity: 0; width: 1px; height: 1px;}
.gimmick-face {display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 2px solid var(--gimmick-color); border-radius: 7px; background: #fffdf2; box-shadow: 0 2px 0 #30475430; transition: background .15s, box-shadow .15s;}
.gimmick-tera {--gimmick-color: #348c9a; --gimmick-light: #d4f8f5;}
.gimmick-mega {--gimmick-color: #8860ad; --gimmick-light: #eee0ff;}
.gimmick-dmax {--gimmick-color: #cc4569; --gimmick-light: #ffe0e8;}
.gimmick-icon {display: grid; place-items: center; width: 25px; height: 25px; color: var(--gimmick-color); font-size: 23px; background: var(--gimmick-light); border-radius: 50%;}
.gimmick-face small {font-size: 9px; color: #677c77; margin-left: 3px; letter-spacing: 0;}
.gimmick input:checked + .gimmick-face {background: var(--gimmick-light); box-shadow: 0 0 0 2px var(--gimmick-color), inset 0 -3px #ffffff70;}
.gimmick input:focus-visible + .gimmick-face {outline: 3px solid #244c63; outline-offset: 4px;}
.gimmick input:disabled + .gimmick-face {opacity: .5; cursor: wait;}
.controls[data-gimmick="tera"] .move:not(:disabled) {background: linear-gradient(120deg, #dbf8f5, #fff4e3, #e3ecff); border-color: #348c9a;}
.controls[data-gimmick="mega"] .move:not(:disabled) {background: linear-gradient(120deg, #f2e6ff, #ffedf3); border-color: #8860ad;}
.controls[data-gimmick="dmax"] .move:not(:disabled) {background: linear-gradient(120deg, #ffe1e7, #fff3ed); border-color: #cc4569;}
.zmoves .zmove {padding: 9px 13px; border-radius: 7px; box-shadow: 0 2px 0 #9b731e40;}
.zmoves .zmove:focus-visible {outline: 3px solid #79580b; outline-offset: 3px;}
.zmove-label {font-size: 10px; color: #846116;}
@media (max-width: 520px) {
  .arena .pokemon-card {width: 166px; padding: 6px 8px 5px;}
  .arena .opponent-card {top: 34px;}
  .arena .player-card {bottom: 22px;}
  .arena .card-title {font-size: 11px;}
  .arena .card-meta {font-size: 7px;}
  .arena .opponent-sprite {top: 88px; right: 15px; width: 115px; height: 115px;}
  .arena .opponent-platform {top: 186px; right: 0; width: 145px; height: 35px;}
  .arena .player-sprite {left: 0; bottom: 55px; width: 143px; height: 143px;}
  .arena .player-platform {left: -28px; bottom: 41px; width: 190px; height: 44px;}
  .control-head > span {flex-basis: 100%;}
  .gimmick-face {padding: 6px 8px;}
  .fx-settings {justify-content: flex-start; margin-left: 0;}
}
.sprite-slot.dynamaxed img {transform: scale(1.35); transform-origin: bottom center; filter: drop-shadow(0 0 10px #ff3b5c) drop-shadow(0 0 22px #ff3b5caa);}
.sprite-slot.gmax img {filter: drop-shadow(0 0 10px #ff2a2a) drop-shadow(0 0 26px #b51cff);}
.player-sprite.dynamaxed img {transform: scale(1.05);}
.opponent-sprite.dynamaxed img {transform: scale(1.15);}
@media (max-width: 520px) {.player-sprite.dynamaxed img {transform: scale(1.15);}}

/* BW풍 대사창(2026-10-25): 대사창을 경기장 아래쪽에 겹친다. 경기장 높이(각 화면 폭의 height 값)는 무대 높이로 그대로 두고,
   아래에 대사창 몫(--dialog-h - --dialog-overlap)만큼 늘린다. 무대(.stage)가 예전 경기장과 같은 크기라 포켓몬·정보창·효과 배치는 그대로다. */
.arena {--dialog-h: 64px; --dialog-overlap: 24px; box-sizing: content-box; padding-bottom: calc(var(--dialog-h) - var(--dialog-overlap));}
.stage {position: absolute; left: 0; right: 0; top: 0; bottom: calc(var(--dialog-h) - var(--dialog-overlap));}
.arena .stage .player-card {bottom: calc(var(--dialog-overlap) + 8px);}
.stage .player-conditions {bottom: calc(var(--dialog-overlap) + 6px);}
.battle-dialog, .intro-caption, .stage .fx-caption {position: absolute; left: 6px; right: 6px; bottom: 6px; top: auto; height: calc(var(--dialog-h) - 8px); box-sizing: border-box;
  display: flex; flex-direction: column; justify-content: center; padding: 8px 34px 8px 16px; text-align: left;
  background: linear-gradient(#3a5154f5, #273a3df5); color: #fffde9; border: 3px solid #f2eed6; border-radius: 7px; box-shadow: 0 0 0 2px #26383b, inset 0 0 0 1px #6d8e88;}
.battle-dialog {z-index: 10;}   /* 시작 화면(9) 위, 기술 안내(11)·등장 대사(12)·결과(15) 아래 */
.battle-dialog strong {font-size: 14px; line-height: 1.3;}
.battle-dialog small {display: block; margin-top: 3px; font-size: 10px; color: #c3d3c6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.dialog-cursor {position: absolute; right: 13px; bottom: 8px; font-size: 10px; color: #f0c45a; animation: dialogBlink 1s steps(2, start) infinite;}
@keyframes dialogBlink {to {visibility: hidden;}}
/* 등장 대사·기술 이름 안내도 원작처럼 대사창 자리에 띄운다(대사창 위에 겹쳐 그림). */
.intro-caption {z-index: 12; font-size: 14px; font-weight: 700;}
.stage .fx-caption {bottom: calc(6px - (var(--dialog-h) - var(--dialog-overlap))); font-size: 14px; font-weight: 700; border-radius: 7px;}
.field-settings .fx-settings .motion-label {font-size: 10px;}
@media (max-width: 520px) {
  .arena {--dialog-h: 58px; --dialog-overlap: 22px;}
  .battle-dialog, .intro-caption, .stage .fx-caption {left: 4px; right: 4px; bottom: 4px; padding: 6px 28px 6px 12px;}
  .stage .fx-caption {bottom: calc(4px - (var(--dialog-h) - var(--dialog-overlap)));}
  .battle-dialog strong, .intro-caption, .stage .fx-caption {font-size: 12px;}
  .battle-dialog small {font-size: 9px;}
}
@media (prefers-reduced-motion: reduce) {.dialog-cursor {animation: none;}}

/* 특수 행동을 선택한 뒤 기술을 누르는 순서와 배경 재시도 안내. */
.gimmick-help {margin: 0 0 10px; padding: 8px 11px; border-left: 3px solid #718f8b; background: #fffdf2; color: #405d5b; font-size: 11px; line-height: 1.6;}
.controls[data-gimmick="tera"] .gimmick-help {border-color: #348c9a; background: #e2f6f3;}
.controls[data-gimmick="mega"] .gimmick-help {border-color: #8860ad; background: #f1e9fa;}
.controls[data-gimmick="dmax"] .gimmick-help {border-color: #cc4569; background: #fce6ec;}
.gimmick-face {min-height: 44px; box-sizing: border-box;}
.field-settings select {min-height: 36px;}
#background-retry {min-height: 36px; padding: 5px 8px; color: #874b30; border: 1px solid #bda58d; border-radius: 4px; background: #fff8e9;}
#background-retry:focus-visible {outline: 3px solid #244c63; outline-offset: 2px;}
@media (max-width: 520px) {.field-settings select, #background-retry {min-height: 44px;}.gimmick-help {font-size: 10px;}}
.selection-panel {margin:16px 0;padding:20px;background:#f8faf1;border:2px solid #456b70;border-radius:8px;}
.selection-panel[hidden] {display:none;}
.preview-grid {display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;margin:12px 0 20px;}
.preview-card {display:flex;flex-direction:column;align-items:center;gap:5px;min-width:0;padding:10px 5px;background:#fff;border:2px solid #c3d1c8;border-radius:6px;color:#233e42;font:inherit;overflow-wrap:anywhere;}
.preview-card img {width:64px;height:64px;object-fit:contain;image-rendering:pixelated;}
.preview-card small {font-size:11px;}
.preview-card.selected {border-color:#bb3e46;background:#fff2d2;box-shadow:0 0 0 1px #bb3e46;}
@media(max-width:720px) {.preview-grid {grid-template-columns:repeat(3,minmax(0,1fr));}.settings-row {flex-wrap:wrap;}}
.battle-feedback-panel {padding:12px 16px;background:#f5f7ed;border-top:2px solid #41666c;color:#203c41;}
#battle-feedback {display:block;padding:10px 12px;border-left:5px solid #467b8a;background:#e4eff0;font-size:16px;min-height:42px;}
#battle-feedback[data-tone="status"],#battle-feedback[data-tone="debuff"] {border-color:#9250b2;background:#f1e4f8;}
#battle-feedback[data-tone="fail"] {border-color:#b35434;background:#fff0dc;}
#battle-feedback[data-tone="super"],#battle-feedback[data-tone="damage"] {border-color:#bd3541;background:#ffe8e8;}
#battle-feedback[data-tone="heal"],#battle-feedback[data-tone="boost"] {border-color:#44855b;background:#e6f5e9;}
.turn-events {display:flex;flex-wrap:wrap;gap:5px;margin-top:8px;max-height:160px;overflow:auto;}
.turn-events p {margin:0;padding:5px 8px;background:#fff;border:1px solid #aebfb6;border-radius:4px;font-size:12px;}
.sprite-status {position:absolute;bottom:2px;left:50%;transform:translateX(-50%);padding:4px 12px;border:2px solid #fff;border-radius:6px;background:#675179;color:#fff;font-weight:800;font-size:14px;z-index:14;white-space:nowrap;}
.sprite-status.status-par {background:#b58000;}.sprite-status.status-brn {background:#bb421e;}.sprite-status.status-frz {background:#25759d;}.sprite-status.status-slp {background:#58667b;}
.battle-float {position:absolute;left:50%;top:-12px;transform:translateX(-50%);width:max-content;max-width:220px;padding:7px 10px;background:#fff9e8;color:#173a42;border:2px solid #4f7880;border-radius:7px;font-size:14px;font-weight:bold;z-index:20;pointer-events:none;text-align:center;box-shadow:0 2px 6px #0003;}
.battle-float.tone-status {background:#f3ddff;border-color:#965eb0;}.battle-float.tone-fail {background:#fff0cf;border-color:#a77827;}.battle-float.tone-super {background:#ffe0dd;border-color:#bc4139;}.battle-float.tone-heal {background:#def4dd;border-color:#548851;}
.feedback-status img {animation:statusPulse calc(.65s / var(--battle-speed,1)) ease;}.status-cast {animation:statusPulse calc(.55s / var(--battle-speed,1)) ease;}
@keyframes statusPulse {50%{filter:drop-shadow(0 0 12px #b764ff) brightness(1.2);}}
.fx-projectile {animation-duration:calc(.45s / var(--battle-speed,1));}.hit {animation-duration:calc(.35s / var(--battle-speed,1));}.heal-glow {animation-duration:calc(.6s / var(--battle-speed,1));}
.lunge-player,.lunge-opponent {animation-duration:calc(.28s / var(--battle-speed,1));}.fx-caption {animation-duration:calc(.8s / var(--battle-speed,1));}
.trainer-sprite.enter {animation-duration:calc(.5s / var(--battle-speed,1));}.trainer-sprite.exit {animation-duration:calc(.38s / var(--battle-speed,1));}
.pokeball.throw-player,.pokeball.throw-opponent {animation-duration:calc(.43s / var(--battle-speed,1));}.ball-flash,.sprite-slot.pop-in {animation-duration:calc(.33s / var(--battle-speed,1));}
.hp-fill {transition-duration:calc(.75s / var(--battle-speed,1));}
@media(max-width:520px){#battle-feedback {font-size:13px;}.battle-float {max-width:155px;font-size:11px;}.sprite-status {font-size:11px;}.field-settings {flex-wrap:wrap;}}

/* 좁은 화면: 세대 선택칸이 잘리지 않게 한 줄을 통째로 쓴다. */
@media (max-width: 520px) {
  .settings-row {flex-wrap: wrap;}
  .settings-row #generation {flex-basis: 100%;}
}
/* 아주 좁은 화면: "트레이너 도전" 탭이 두 줄로 나뉘지 않게 "도전"을 줄인다(탭 내용으로 뜻이 이어짐). */
@media (max-width: 480px) {
  .mode-tabs button {padding: 9px 4px; white-space: nowrap;}
  .tab-extra {display: none;}
}
.result .result-summary {font-size: 11px; color: #5d7671; margin: 2px 0 0;}

/* ===== 2026-10-28 전체 UI 개편: 원작 게임(블랙/화이트) 메뉴 느낌 =====
   장식용 영문 라벨·홍보 문구·배지 대신, 굵은 테두리의 메뉴창·둥근 게임 버튼·도트 글꼴(Galmuri11, OFL)로 통일한다.
   위쪽 규칙은 그대로 두고 여기서 덮어쓴다(되돌릴 때 이 절만 지우면 된다). */
@font-face {font-family: 'Galmuri11'; src: url('/fonts/Galmuri11.woff2') format('woff2'); font-weight: 400; font-display: swap;}
@font-face {font-family: 'Galmuri11'; src: url('/fonts/Galmuri11-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap;}
:root {
  --ink: #2c3440;          /* 창 테두리·진한 글자 */
  --paper: #fbfbf7;        /* 창 바탕 */
  --paper-2: #eef1ec;      /* 창 안쪽 칸 */
  --muted: #55636a;        /* 보조 글자(바탕 위 명암비 4.5 이상) */
  --game: 'Galmuri11', 'Malgun Gothic', sans-serif;
  --win-shadow: inset 0 0 0 2px #fff, 0 3px 0 #2c344033;
  --stellar: #7fb7d9;      /* 테라버스트 스텔라 타입 */
}
body {background: #dfe5e3 repeating-linear-gradient(0deg, transparent 0 3px, #ffffff40 3px 4px); color: var(--ink);}
/* 머리줄: 앱 이름만. */
header {height: 52px; background: #c9403f; border-bottom: 4px solid var(--ink); box-shadow: none;}
header::after {display: none;}
.brand {font-family: var(--game); font-weight: 700; font-size: 20px; letter-spacing: 0; color: #fff; text-shadow: 2px 2px 0 #7d2528;}
.ball-logo {width: 24px; height: 24px; border-width: 3px; border-color: var(--ink); box-shadow: none;}
.ball-logo::after {width: 7px; height: 7px; left: 5px; top: 5px; border-color: var(--ink);}
.intro {display: block; padding: 14px 0 10px;}
/* 메뉴창 공통 */
.match-settings, .trainer-panel, .party-panel, .replay-panel, .battle-panel, .team-panel, .log-panel {
  background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; box-shadow: var(--win-shadow);}
.match-settings {padding: 12px 14px 10px;}
.match-settings > label, .trainer-panel h2, .party-panel h2, .replay-panel h2, .section-heading h2 {font-family: var(--game); font-weight: 700; font-size: 13px; color: var(--ink); letter-spacing: 0;}
.match-settings p, .bgm-source-note, .motion-label, .section-hint, .trainer-text small, .trainer-meta, .party-rule, .party-saved-item small, .party-slot-text small, .party-result small, .replay-text small, .member-head small, .member-recs > small, .streak-button small, .records, .team-info small, .move small, .move-right, .gimmick-face small {color: var(--muted);}
.settings-row select, .field-settings select, .party-panel select, .party-panel input, .party-panel textarea, .trainer-team textarea, .trainer-variant, .replay-bar select, #my-team, .bgm-settings select {
  background: #fff; color: var(--ink); border: 2px solid #6d7a80; border-radius: 6px;}
/* 게임 버튼 */
.primary {font-family: var(--game); font-weight: 700; font-size: 12px; background: #d64a45; color: #fff; border: 3px solid var(--ink); border-radius: 8px; box-shadow: inset 0 -3px 0 #a3302e, 0 2px 0 #2c344033;}
.primary:hover:not(:disabled) {background: #e2584f;}
.primary:active:not(:disabled) {transform: translateY(1px); box-shadow: inset 0 -1px 0 #a3302e;}
.text-button {color: #2d6577;}
/* 대전 방식 탭: 메뉴 버튼 줄 */
.mode-tabs {gap: 6px; margin: 4px 0 10px;}
.mode-tabs button {font-family: var(--game); font-weight: 700; font-size: 13px; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 8px; padding: 9px 6px; box-shadow: inset 0 -3px 0 #cfd6d3;}
.mode-tabs button[aria-selected="true"] {background: #2f6f9a; color: #fff; box-shadow: inset 0 -3px 0 #1f4e6e;}
.trainer-panel, .party-panel, .replay-panel {margin-bottom: 12px;}
/* 배틀 창 */
.panel-top {height: 36px; background: var(--ink); color: #fff; font-family: var(--game); font-size: 12px; font-weight: 700; padding: 0 14px; border-radius: 6px 6px 0 0;}
.panel-top > span:last-child {background: none; color: #ffe17a; padding: 0; font-size: 12px;}
.field-settings {background: var(--paper-2); color: var(--muted); border-bottom: 2px solid #cfd6d3;}
.arena {border: 0; border-bottom: 3px solid var(--ink);}
.field-label {font-family: var(--game); font-size: 11px; letter-spacing: 0; color: #2f4a43; opacity: .85;}
.card-title, .hp-numbers {font-family: var(--game);}
.battle-dialog strong, .intro-caption, .stage .fx-caption {font-family: var(--game); font-weight: 700;}
.battle-dialog {background: #fbfbf7; color: var(--ink); border: 3px solid var(--ink); border-radius: 8px; box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px #fbfbf7;}
.battle-dialog small {color: var(--muted);}
.dialog-cursor {color: #d64a45;}
.intro-caption, .stage .fx-caption {background: #fbfbf7; color: var(--ink); border: 3px solid var(--ink); box-shadow: inset 0 0 0 2px #fff;}
/* 시작 화면: 몬스터볼과 짧은 안내만 */
.welcome {background: #eef2eecc; color: var(--ink);}
.welcome h2 {font-family: var(--game); font-weight: 700; font-size: 22px; letter-spacing: 0; margin: 16px 0 8px;}
.welcome p {color: var(--muted); font-size: 12px;}
.welcome-ball {border-color: var(--ink); box-shadow: none;}
.welcome-ball::after {border-color: var(--ink);}
/* 결과 */
.result {background: #fbfbf7e8; color: var(--ink);}
.result strong {font-family: var(--game); font-weight: 700; letter-spacing: 1px; color: #c9403f; text-shadow: 2px 2px 0 #fff;}
/* 기술 버튼: 타입 색 바탕의 둥근 버튼(원작 기술 선택처럼) */
.controls {background: var(--paper-2); border-radius: 0 0 7px 7px;}
.control-head {font-family: var(--game); font-weight: 700; color: var(--ink); font-size: 12px;}
.move {border: 3px solid color-mix(in srgb, var(--move-color) 55%, #1d232b); border-radius: 10px; background: color-mix(in srgb, var(--move-color) 18%, #fff); box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--move-color) 35%, #fff); color: var(--ink);}
.move::before {display: none;}
.move strong {font-family: var(--game); font-weight: 700; font-size: 13px;}
.move:hover:not(:disabled) {background: color-mix(in srgb, var(--move-color) 30%, #fff); border-color: var(--ink); box-shadow: inset 0 -4px 0 color-mix(in srgb, var(--move-color) 45%, #fff);}
.type-pill {background: color-mix(in srgb, var(--move-color) 80%, #fff); color: #1d232b; border: 0; border-radius: 4px;}
.empty-moves {background: #fff; border: 2px dashed #9aa7a3; color: var(--muted); border-radius: 10px;}
/* 내 포켓몬(교체): 원작 파티 화면 같은 둥근 칸 */
.team-panel {background: var(--paper); padding: 0 12px 12px;}
.section-heading {border-bottom: 2px solid #cfd6d3;}
.section-heading > span {background: var(--ink); color: #fff; font-family: var(--game); border-radius: 6px;}
.team-member {background: #fff; border: 2px solid #8d9aa0; border-radius: 10px; box-shadow: inset 0 -3px 0 #e3e8e6; color: var(--ink);}
.team-member.is-active {background: #fff4c9; border: 3px solid #c98d1e; box-shadow: inset 0 -3px 0 #f0d98a; padding: 6px 7px;}
.team-member:hover:not(:disabled) {background: #f1f8fb; border-color: #2f6f9a;}
.team-info strong {font-family: var(--game); font-weight: 700; font-size: 12px;}
.team-index {color: var(--muted);}
.mini-track {border-color: #6d7a80; background: #e3e8e6;}
.log-panel {background: var(--paper);}
.log p {color: #3f4c52;}
.log .log-turn {font-family: var(--game); color: #c9403f; border-top-color: #cfd6d3;}
/* 트레이너 카드: 색 띠 대신 엠블럼만, 게임 메뉴 칸처럼 */
.trainer-card {background: #fff; border: 3px solid #8d9aa0; border-radius: 10px; box-shadow: inset 0 -3px 0 #e3e8e6;}
.trainer-card:hover {border-color: var(--ink);}
.trainer-card.is-selected {border-color: var(--ink); background: #fff4c9; box-shadow: inset 0 -3px 0 #f0d98a;}
.trainer-emblem {border: 3px solid var(--ink); font-family: var(--game);}
.trainer-text strong {font-family: var(--game); font-weight: 700; font-size: 13px; color: var(--ink);}
.trainer-detail {background: var(--paper-2); border-left: 0; border: 2px solid #cfd6d3; border-radius: 8px;}
.streak-button {font-family: var(--game); border: 3px solid var(--ink); border-radius: 8px; background: #fff4c9; color: #6e4610; box-shadow: inset 0 -3px 0 #f0d98a;}
/* 파티·리플레이 목록 칸 */
.party-saved-item, .party-slot, .party-result, .replay-item, .rec-chip {border: 2px solid #8d9aa0; border-radius: 8px; background: #fff;}
.party-saved-item.is-selected, .party-slot.is-selected {border-color: var(--ink); background: #fff4c9; box-shadow: none;}
.party-saved-item strong, .party-slot-text strong, .party-result span, .replay-text strong, .member-head strong {font-family: var(--game); font-weight: 700;}
.member-detail {background: var(--paper-2); border-left: 0; border: 2px solid #cfd6d3; border-radius: 8px;}
.replay-bar {background: var(--paper-2); border-bottom: 2px solid #cfd6d3;}
/* 꼬리말 */
footer {border-top: 2px solid #b9c3c0; color: var(--muted);}
footer > span {font-family: var(--game); font-size: 11px; letter-spacing: 0;}
@media (max-width: 520px) {
  header {height: 48px;}
  .brand {font-size: 17px;}
  .mode-tabs button {font-size: 12px;}
  .move strong {font-size: 12px;}
}
/* 개편 명암 보정: 흰 글자 버튼은 바탕을 한 단계 진하게(명암비 4.79), 누를 때도 밝아지지 않게. */
.primary {background: #c94440;}
.primary:hover:not(:disabled) {background: #b83c38;}
.team-member.is-active .team-index {color: #8a5e1f;}
.party-slot-tools .text-button {color: #2d6577;}
.rec-chip strong {color: #b2453a;}
.fx-settings .sound-state, .bgm-settings .sound-state {color: #a24a37;}

/* ===== 2026-10-28 기술 효과 모양(app.js animateMove의 shape) =====
   기술마다 따로 그리지 않고 엔진 분류로 나눈 모양: 돌진·펀치·킥·물기·베기·광선·소리·바람·지진·탄환·투사체,
   변화 기술(상대에게 거는 기술·설치기·필드·자기 강화·회복), 능력치 화살표·회복 반짝임. 색은 기술 타입 색(--fx-color). */
#effects {position: absolute; inset: 0; pointer-events: none; z-index: 10;}
.fx {position: absolute; left: var(--x); top: var(--y); pointer-events: none; z-index: 10; transform: translate(-50%, -50%); animation-delay: var(--d, 0ms); animation-fill-mode: both;}
.fx-burst {width: 74px; height: 74px; background: radial-gradient(circle, #fff 0 16%, var(--fx-color) 17% 52%, transparent 54%);
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 34%); filter: drop-shadow(0 0 6px var(--fx-color)); animation: fxBurst .42s ease-out both;}
.fx-burst-big {width: 104px; height: 104px;}
.fx-kick {clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);}
.fx-fang {width: 84px; height: 30px; background: #fff; border: 3px solid var(--fx-color); box-sizing: border-box;
  clip-path: polygon(0 0, 100% 0, 100% 40%, 88% 100%, 76% 40%, 64% 100%, 52% 40%, 40% 100%, 28% 40%, 16% 100%, 4% 40%, 0 40%); filter: drop-shadow(0 0 4px var(--fx-color));}
.fx-fang.top {animation: fxFangTop .36s ease-in both;}
.fx-fang.bottom {transform-origin: center; animation: fxFangBottom .36s ease-in both;}
.fx-slash {width: 120px; height: 90px; background: linear-gradient(transparent 0 26%, #fff 26% 31%, transparent 31% 46%, var(--fx-color) 46% 53%, transparent 53% 68%, #fff 68% 73%, transparent 73%);
  filter: drop-shadow(0 0 5px var(--fx-color)); animation: fxSlash .36s ease-out both;}
.fx-beam {width: var(--len); height: 20px; transform-origin: 0 50%; border-radius: 10px;
  background: linear-gradient(transparent, var(--fx-color) 25%, #fff 50%, var(--fx-color) 75%, transparent); box-shadow: 0 0 14px var(--fx-color); animation: fxBeam .6s ease-out both;}
.fx-wave, .fx-ring-out {width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--fx-color); box-shadow: 0 0 0 2px #2c344055, inset 0 0 0 2px #2c344055, 0 0 10px var(--fx-color); animation: fxWave .6s ease-out both;}
.fx-ring-out {animation-duration: .7s;}
.fx-gust {width: 170px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--fx-color) 25%, #fff 50%, var(--fx-color) 75%, transparent); box-shadow: 0 0 6px var(--fx-color); animation: fxGust .55s ease-out both;}
.fx-dust {width: 200px; height: 70px; border-radius: 50%; background: radial-gradient(ellipse, #a07a3ef2 0 30%, #c9a36ad9 31% 48%, var(--fx-color) 49% 58%, transparent 72%); animation: fxDust .65s ease-out both;}
.fx-shake {animation: fxShake .5s linear;}
.fx-orb-small {width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, #fff 0 25%, var(--fx-color) 30%); box-shadow: 0 0 10px var(--fx-color); animation: fxFly .38s ease-in both;}
.fx-spiral {width: 76px; height: 76px; border-radius: 50%; border: 5px dashed var(--fx-color); box-shadow: 0 0 0 2px #2c344055, inset 0 0 0 2px #2c344055, inset 0 0 14px var(--fx-color), 0 0 10px var(--fx-color); animation: fxSpiral .75s ease-out both;}
.fx-drop {width: 22px; height: 22px; background: var(--fx-color); clip-path: polygon(50% 0, 100% 100%, 0 100%); filter: drop-shadow(0 0 3px #0006); animation: fxDrop .55s ease-in both;}
.fx-flash {left: 0; top: 0; width: 100%; height: 100%; transform: none; background: var(--fx-color); animation: fxFlash .65s ease-out both;}
.fx-sparkle {width: 16px; height: 16px; background: var(--fx-color); clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%); animation: fxRise .8s ease-out both;}
.fx-arrow {width: 16px; height: 22px; background: var(--fx-color); clip-path: polygon(50% 0, 100% 45%, 68% 45%, 68% 100%, 32% 100%, 32% 45%, 0 45%); filter: drop-shadow(0 0 3px #fff);}
.fx-arrow.up {animation: fxRise .8s ease-out both;}
.fx-arrow.down {animation: fxFall .8s ease-out both;}
@keyframes fxBurst {from {transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(.3); opacity: 1;} 60% {opacity: 1;} to {transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.3); opacity: 0;}}
@keyframes fxFangTop {from {transform: translate(-50%, -190%); opacity: 0;} 30% {opacity: 1;} 80% {transform: translate(-50%, -85%);} to {transform: translate(-50%, -85%); opacity: 0;}}
@keyframes fxFangBottom {from {transform: translate(-50%, 90%) scaleY(-1); opacity: 0;} 30% {opacity: 1;} 80% {transform: translate(-50%, -15%) scaleY(-1);} to {transform: translate(-50%, -15%) scaleY(-1); opacity: 0;}}
@keyframes fxSlash {from {transform: translate(-50%, -50%) rotate(var(--rot, -35deg)); clip-path: inset(0 100% 0 0);} 55% {clip-path: inset(0 0 0 0); opacity: 1;} to {transform: translate(-50%, -50%) rotate(var(--rot, -35deg)); clip-path: inset(0 0 0 100%); opacity: .2;}}
@keyframes fxBeam {from {transform: translateY(-50%) rotate(var(--ang)) scaleX(0); opacity: 1;} 55% {transform: translateY(-50%) rotate(var(--ang)) scaleX(1); opacity: 1;} to {transform: translateY(-50%) rotate(var(--ang)) scaleX(1); opacity: 0;}}
@keyframes fxWave {from {transform: translate(-50%, -50%) scale(.4); opacity: 1;} to {transform: translate(-50%, -50%) scale(3); opacity: 0;}}
@keyframes fxGust {from {transform: translate(-110%, -50%); opacity: 0;} 30% {opacity: 1;} to {transform: translate(10%, -50%); opacity: 0;}}
@keyframes fxDust {from {transform: translate(-50%, -30%) scale(.5); opacity: .9;} to {transform: translate(-50%, -80%) scale(1.3); opacity: 0;}}
@keyframes fxShake {0%, 100% {transform: none;} 15% {transform: translate(-6px, 2px);} 30% {transform: translate(6px, -2px);} 45% {transform: translate(-5px, 1px);} 60% {transform: translate(5px, -1px);} 80% {transform: translate(-2px, 0);}}
@keyframes fxFly {from {transform: translate(-50%, -50%);} to {transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty)));}}
@keyframes fxSpiral {from {transform: translate(-50%, -50%) rotate(0) scale(.4); opacity: 0;} 25% {opacity: 1;} to {transform: translate(-50%, -50%) rotate(300deg) scale(1.1); opacity: 0;}}
@keyframes fxDrop {from {transform: translate(-50%, -260%); opacity: 0;} 40% {opacity: 1;} 85% {transform: translate(-50%, -50%);} to {transform: translate(-50%, -50%); opacity: 0;}}
@keyframes fxFlash {from {opacity: 0;} 30% {opacity: .45;} to {opacity: 0;}}
@keyframes fxRise {from {transform: translate(-50%, -20%); opacity: 0;} 25% {opacity: 1;} to {transform: translate(-50%, -260%); opacity: 0;}}
@keyframes fxFall {from {transform: translate(-50%, -160%) rotate(180deg); opacity: 0;} 25% {opacity: 1;} to {transform: translate(-50%, 60%) rotate(180deg); opacity: 0;}}

/* ===== 2026-10-28 합치기: 10-25 Codex 화면 요소(선출·결과 표시·규칙 안내)를 위 개편 모양에 맞춘다 ===== */
.selection-panel {background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; box-shadow: var(--win-shadow); color: var(--ink);}
.selection-panel h2, .selection-panel h3 {font-family: var(--game); font-weight: 700; color: var(--ink); letter-spacing: 0;}
.selection-panel h2 {font-size: 15px;} .selection-panel h3 {font-size: 13px;}
.selection-panel p {color: var(--muted);}
.preview-card {font-family: var(--game); background: #fff; border: 3px solid var(--ink); border-radius: 8px; box-shadow: inset 0 -3px 0 #cfd6d3; color: var(--ink);}
.preview-card small {color: var(--muted);}
.preview-card.selected {border-color: #c9403f; background: #fff2d2; box-shadow: inset 0 -3px 0 #e9c98d, 0 0 0 2px #c9403f;}
.battle-feedback-panel {background: var(--paper-2); border-top: 3px solid var(--ink);}
#battle-feedback {font-family: var(--game); font-weight: 700; color: var(--ink); border: 3px solid var(--ink); border-left-width: 8px; border-radius: 8px; box-shadow: inset 0 0 0 2px #fff;}
.battle-feedback-panel summary {font-family: var(--game); font-size: 12px; color: var(--ink);}
.turn-events p {font-family: var(--game); color: var(--ink); border: 2px solid #aab5b0;}
.battle-float, .sprite-status {font-family: var(--game);}
.battle-float {color: var(--ink); border-width: 3px; border-color: var(--ink);}
.battle-rule-note summary {font-family: var(--game); font-size: 12px; color: var(--ink); cursor: pointer;}
.battle-rule-note p {color: var(--muted);}

/* 날씨·필드 남은 턴 표시: 효과 이름 옆에 남은 턴(이번 턴 포함)을 붙이고, 날씨·필드마다 색을 나눠 한눈에 보이게 한다. */
.field-conditions {top: 30px; gap: 5px;}
.field-conditions .condition {font-size: 12px; padding: 3px 8px; border-width: 2px; border-radius: 4px; box-shadow: 0 2px 0 #0000002e;}
.side-conditions .condition {font-size: 10px; pointer-events: auto;}
.condition {display: inline-flex; align-items: center; gap: 5px; cursor: help;}
.condition .turns {font-weight: 700; font-size: .92em; padding: 0 5px; border-radius: 3px; background: #2c3440; color: #fff;}
.weather-raindance, .weather-primordialsea {background: #d6e6fb; border-color: #3f6fae; color: #1f4170;}
.weather-sunnyday, .weather-desolateland {background: #ffe7b8; border-color: #d27a1c; color: #74400a;}
.weather-sandstorm {background: #ecdcb8; border-color: #9b7638; color: #5a4120;}
.weather-hail, .weather-snow, .weather-snowscape {background: #eef7fb; border-color: #6aa7c4; color: #22526a;}
.weather-deltastream {background: #dff2ef; border-color: #4f9a8f; color: #1f5c51;}
.terrain-electricterrain {background: #fbf3b8; border-color: #b59d12; color: #5e5000;}
.terrain-grassyterrain {background: #dcf0cf; border-color: #4f8f36; color: #2c5a1c;}
.terrain-mistyterrain {background: #fbe1f0; border-color: #c06a9e; color: #74224f;}
.terrain-psychicterrain {background: #f1defb; border-color: #8c55b5; color: #4f2373;}
@media (max-width: 520px) {
  .field-conditions .condition {font-size: 10px; padding: 2px 5px;}
  .side-conditions .condition {font-size: 9px;}
}
/* 왼쪽 위는 상대 체력 칸이 있어 겹친다 — 날씨·필드는 경기장 위쪽 가운데에 둔다. */
.stage .field-conditions, .field-conditions {top: 8px; left: 50%; right: auto; transform: translateX(-50%); justify-content: center; max-width: 46%;}
/* 휴대폰 폭은 위쪽 가운데에 세대·규칙 글자가 걸쳐 있어 오른쪽 위에 두고, 상대 진영 효과는 그 아래로 내린다(app.js가 top을 맞춤). */
@media (max-width: 520px) {.stage .field-conditions, .field-conditions {top: 6px; left: auto; right: 8px; transform: none; justify-content: flex-end; max-width: 46%;}}

/* 내 포켓몬 상세 창(pokemon-info.js) */
.team-slot, .preview-slot {position: relative; display: grid; min-width: 0;}
.team-slot > .team-member, .preview-slot > .preview-card {width: 100%;}
.info-button {position: absolute; top: 4px; right: 4px; min-height: 24px; padding: 2px 7px; background: #fff; border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); font-family: var(--game); font-size: 11px; line-height: 1.2; cursor: pointer;}
.info-button:hover {background: #f1f8fb;}
.info-button:focus-visible {outline: 2px solid #2f6f9a; outline-offset: 1px;}
.team-slot .team-index {align-self: flex-end;}
.pokemon-info {width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px; background: var(--paper); border: 3px solid var(--ink); border-radius: 10px; color: var(--ink); font-family: var(--game);}
.pokemon-info::backdrop {background: rgba(20, 30, 34, .55);}
.info-head {display: flex; align-items: center; gap: 10px;}
.info-title {flex: 1; min-width: 0;}
.info-title h2 {margin: 0; font-size: 16px;}
.info-title small {color: var(--muted);}
.info-close {min-height: 32px; padding: 4px 12px; background: #fff; border: 2px solid var(--ink); border-radius: 6px; color: var(--ink); font-family: inherit; cursor: pointer;}
.info-fields {display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 12px 0;}
.info-field {min-width: 0;}
.info-field span {display: block; color: var(--muted); font-size: 11px;}
.info-field strong {display: block; font-size: 13px; font-weight: 700; overflow-wrap: anywhere;}
.info-stats {width: 100%; border-collapse: collapse; font-size: 13px;}
.info-stats th, .info-stats td {padding: 4px 6px; border-bottom: 1px solid #c9d2d0; text-align: right; font-weight: 400;}
.info-stats tr > th:first-child {text-align: left; font-weight: 700;}
.info-stats tr:first-child th {color: var(--muted); font-size: 11px; font-weight: 400;}
.info-stats .nature-up td:last-child {color: #b3261e; font-weight: 700;}
.info-stats .nature-down td:last-child {color: #1f5f99; font-weight: 700;}
.pokemon-info h3 {margin: 14px 0 6px; font-size: 13px;}
.info-moves {display: grid; gap: 6px; margin: 0; padding: 0; list-style: none;}
.info-moves li {padding: 6px 8px; background: #fff; border: 1px solid #c9d2d0; border-radius: 6px;}
.info-move-title {display: flex; align-items: center; justify-content: space-between; gap: 8px;}
.info-moves small {color: var(--muted);}
.info-move-desc {margin: 4px 0 0; font-size: 13px; line-height: 1.45;}
.info-move-desc:empty {display: none;}
.info-matchup {margin: 4px 0 0; font-size: 13px; font-weight: 700;}
.info-matchup.super {color: #b3261e;}
.info-matchup.resisted {color: #5a6670;}
.info-matchup.immune {color: #4a4a8a;}
.move-info-button {margin-left: auto;}
.info-moves .type-pill {font-size: 12px; padding: 2px 8px; color: var(--ink); background: #e8eeec; border-radius: 6px; white-space: nowrap;}
.team-slot .team-info strong {padding-right: 40px; overflow-wrap: anywhere;}
.team-slot, .preview-slot {grid-template-columns: minmax(0, 1fr);}
.team-slot > .team-member {min-width: 0; overflow: hidden;}

/* 테라스탈 연출: 결정이 감싸고 조각이 흩어진다. 테라 중인 포켓몬은 테라 타입 색으로 계속 은은하게 빛난다. */
.fx-tera-crystal {width: 170px; height: 200px; background: linear-gradient(135deg, #ffffffcc, var(--fx-color) 45%, #ffffff99 60%, var(--fx-color)); clip-path: polygon(50% 0, 88% 22%, 100% 62%, 70% 100%, 30% 100%, 0 62%, 12% 22%); opacity: .85; mix-blend-mode: screen; animation: fxTeraCrystal 1.1s ease-out both;}
.fx-tera-shard {width: 16px; height: 30px; background: linear-gradient(#fff, var(--fx-color)); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); animation: fxTeraShard .8s ease-out both;}
.fx-tera-ring {width: 60px; height: 60px; border-radius: 50%; border: 5px solid var(--fx-color); box-shadow: 0 0 14px #fff, inset 0 0 10px #fff; animation: fxTeraRing 1s ease-out both;}
.fx-tera-banner {left: 0; width: 100%; transform: translateY(-50%); display: grid; justify-items: center; gap: 2px; padding: 10px 16px; z-index: 12;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fx-color) 85%, #000) 18%, var(--fx-color) 50%, color-mix(in srgb, var(--fx-color) 85%, #000) 82%, transparent);
  color: #fff; text-shadow: 0 2px 0 #0008, 0 0 8px #000a; border-block: 2px solid #ffffffcc; animation: fxTeraBanner 1.7s ease-in-out both;}
.fx-tera-banner.from-right {animation-name: fxTeraBannerRight;}
.fx-tera-banner strong {font-size: clamp(22px, 5vw, 34px); letter-spacing: .08em;}
.fx-tera-banner small {font-size: clamp(12px, 2.6vw, 15px);}
.sprite-slot.tera-flash img {animation: teraFlash 1.2s ease-in-out;}
.sprite-slot.terastal img {filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 9px var(--tera-color)) drop-shadow(0 8px 3px #254b3040);}
@keyframes fxTeraCrystal {0% {transform: translate(-50%, -50%) scale(.2) rotate(-8deg); opacity: 0;} 25% {opacity: .9;} 55% {transform: translate(-50%, -50%) scale(1) rotate(0); opacity: .85;} 100% {transform: translate(-50%, -50%) scale(1.3); opacity: 0;}}
@keyframes fxTeraShard {from {transform: translate(-50%, -50%) rotate(var(--rot)) translateY(0); opacity: 1;} to {transform: translate(-50%, -50%) rotate(var(--rot)) translateY(-130px); opacity: 0;}}
@keyframes fxTeraRing {from {transform: translate(-50%, -50%) scale(.3); opacity: 1;} to {transform: translate(-50%, -50%) scale(4); opacity: 0;}}
@keyframes fxTeraBanner {0% {transform: translate(-100%, -50%); opacity: 0;} 18%, 78% {transform: translate(0, -50%); opacity: 1;} 100% {transform: translate(40%, -50%); opacity: 0;}}
@keyframes fxTeraBannerRight {0% {transform: translate(100%, -50%); opacity: 0;} 18%, 78% {transform: translate(0, -50%); opacity: 1;} 100% {transform: translate(-40%, -50%); opacity: 0;}}
@keyframes teraFlash {0%, 100% {filter: none;} 45% {filter: brightness(2.2) saturate(.3) drop-shadow(0 0 14px #fff);}}

/* 교체 확인창 */
.confirm-dialog {border: 3px solid #2c3440; border-radius: 14px; padding: 18px 20px; background: #fffdf3; color: #1f2a30; box-shadow: 0 6px 0 #2c344055; width: min(360px, calc(100vw - 32px));}
.confirm-dialog::backdrop {background: #10201c88;}
.confirm-body {display: flex; align-items: center; gap: 12px;}
.confirm-body .team-art {width: 56px; height: 56px;}
.confirm-text strong {display: block; font-size: 15px; line-height: 1.4;}
.confirm-text small {display: block; margin-top: 4px; font-size: 12px; color: #55636a;}
.confirm-actions {display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;}
.confirm-actions button {min-width: 84px; padding: 10px 14px; border-radius: 8px; font-weight: 700; font-size: 13px; border: 2px solid #2c3440;}
.confirm-cancel {background: #eef1ee; color: #2c3440;}
.confirm-ok {background: #d9473c; color: #fff;}
.confirm-ok:hover {background: #c23a30;}

/* 턴 요약(2026-11-15): 턴마다 "누가 → 무엇을 → 결과" 행. 내 쪽은 파랑, 상대는 빨강 줄로 구분한다. */
.battle-feedback-panel details {text-align: left; max-width: none;}
.turn-events {display: block; max-height: 300px; overflow: auto; margin-top: 8px;}
.turn-events .turn-empty {margin: 0; padding: 8px 2px; font-size: 12px; color: #5d6b70; border: 0; background: none;}
.turn-block {margin: 0 0 8px;}
.turn-number {margin: 0 0 6px; font: 700 12px var(--game, inherit); color: var(--ink, #203c41); letter-spacing: .5px;}
.turn-list {list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px;}
.turn-row {padding: 7px 10px; background: #fff; border: 2px solid #c7d1cc; border-left-width: 6px; border-radius: 8px;}
.turn-row.side-p1 {border-left-color: #3f7fc4;}
.turn-row.side-p2 {border-left-color: #cf4b42;}
.turn-row.kind-tera {background: linear-gradient(100deg, #fff, #eafbff 60%, #fff6e6);}
.turn-row.kind-cant {background: #fff6ea;}
.turn-head {display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13px; color: var(--ink, #203c41);}
.turn-side {font-size: 10px; font-weight: 700; color: #fff; padding: 1px 6px; border-radius: 10px; background: #6b7a80;}
.side-p1 .turn-side {background: #3f7fc4;}
.side-p2 .turn-side {background: #cf4b42;}
.turn-title {color: #34474d;}
.kind-switch .turn-title, .kind-cant .turn-title {color: #6a5a2e;}
.turn-chips, .turn-end {display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px;}
.turn-chip {font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #eef2ef; color: #2c3a3e; border: 1px solid #cfd8d3;}
.turn-chip.tone-damage {background: #fdecea; border-color: #f0b9b3;}
.turn-chip.tone-super {background: #ffe2c2; border-color: #f2a65a; font-weight: 700;}
.turn-chip.tone-resisted {background: #eef1f6;}
.turn-chip.tone-fail {background: #f4efe2; border-color: #d9c9a0;}
.turn-chip.tone-status, .turn-chip.tone-debuff {background: #f1e4f8; border-color: #c9a5dd;}
.turn-chip.tone-heal, .turn-chip.tone-boost {background: #e3f4e6; border-color: #a8d4b1;}
.turn-chip.tone-faint {background: #3a3f45; color: #fff; border-color: #3a3f45; font-weight: 700;}
.turn-end {align-items: center; padding: 6px 8px; border: 2px dashed #c7d1cc; border-radius: 8px; background: #f8faf6;}
.turn-end-label {font-size: 10px; font-weight: 700; color: #5d6b70; margin-right: 2px;}
.turn-history {margin-top: 6px; text-align: left; max-width: none;}
.turn-history > summary {font-size: 12px; color: #4a5b60; padding: 4px 0;}
.turn-history .turn-block {opacity: .85;}

header > h1 {display: contents; margin: 0; font-size: inherit;}
@media (pointer: coarse) {
  .text-button, .party-slot-tools .text-button, .info-button {min-height: 36px; min-width: 36px;}
}

.rating-form {display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 8px 0; font-size: 12px;}
.rating-form input[type=text] {flex: 1 1 200px; min-width: 0;}

/* 계정(클라우드 서버) */
header {display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;}
.account-bar {display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: #fff; text-shadow: 0 1px 0 #0006;}
.account-bar span {max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
.account-bar .text-button {background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 6px; padding: 2px 8px; text-shadow: none;}
.account-dialog {border: 3px solid #2c3440; border-radius: 14px; padding: 20px; background: #fffdf3; color: #1f2a30; width: min(380px, calc(100vw - 32px));}
.account-dialog::backdrop {background: #1f2a30cc;}
.account-dialog h2 {margin: 0 0 6px;}
.account-form {display: grid; gap: 10px; margin-top: 12px;}
.account-field {display: grid; gap: 4px; font-size: 14px;}
.account-field input {font: inherit; padding: 8px 10px; border: 2px solid #74888c; border-radius: 8px; background: #fff;}
.account-notice {margin: 0; font-size: 13px; color: #5a3b00; background: #fff3cf; border-radius: 8px; padding: 8px 10px;}
.account-error {margin: 0; min-height: 1em; color: #b3261e; font-size: 14px;}
.account-error:empty {display: none;}
