:root {
  color-scheme: dark;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  background: #131716;
  color: #f0ecdf;
}

* { box-sizing: border-box; }

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 50% 16%, #758b7530, transparent 48%),
    radial-gradient(ellipse at 82% 72%, #b99a5720, transparent 38%),
    #131716;
}

.game-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #d7b875;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
}

h1 {
  margin: 0;
  font-family: "Noto Serif TC", "Microsoft JhengHei", serif;
  font-size: 34px;
}

.lobby-link {
  color: #e3c77f;
  font-weight: 700;
  text-decoration: none;
}

.lobby-link:hover { text-decoration: underline; }

[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible {
  outline: 2px solid #e3c77f;
  outline-offset: 3px;
}

.roster-section {
  margin-bottom: 12px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.section-heading h2 {
  margin: 0;
  font-size: 17px;
}

.section-heading p {
  margin: 0;
  color: #aeb4a8;
  font-size: 12px;
}

.character-roster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.roster-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px dashed #aeb9ad55;
  border-radius: 10px;
  color: #b5b8af;
  text-align: center;
}

.roster-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #42483f;
  border-radius: 10px;
  background: linear-gradient(145deg, #232923, #191e1b);
  color: #f0ecdf;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.roster-card:hover {
  transform: translateY(-2px);
  border-color: #9a8254;
}

.roster-card[aria-pressed="true"] {
  border-color: #d7b875;
  background: linear-gradient(145deg, #38372c, #232923);
  box-shadow: inset 0 0 0 1px #d7b87530;
}

.roster-card:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.roster-player {
  color: #e3c77f;
  font-size: 10px;
  font-weight: 700;
}

.setup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.setup-footer p {
  margin: 0;
  color: #b5b8af;
  font-size: 13px;
}

.action-button {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid #d7b875;
  border-radius: 999px;
  background: linear-gradient(145deg, #d7b875, #b99755);
  color: #171a18;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter .16s ease, transform .16s ease, opacity .16s ease;
}

.action-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.action-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.match-screen { display: grid; }

.turn-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid #aeb9ad38;
  border-radius: 12px;
  background: #d7e5d408;
}

.turn-panel h2 {
  margin: 0;
  font-size: 20px;
}

.move-status {
  margin: 5px 0 0;
  color: #b5b8af;
  font-size: 13px;
  line-height: 1.5;
}

.combatant-status {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.combatant-card {
  padding: 10px 12px;
  border: 1px solid #aeb9ad38;
  border-radius: 10px;
  background: #d7e5d408;
}

.combatant-card.active {
  border-color: #d7b875a0;
  box-shadow: inset 0 0 0 1px #d7b87530;
}

.combatant-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.combatant-heading span:last-child {
  color: #c4c8bd;
  font-variant-numeric: tabular-nums;
}

.health-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #ffffff19;
}

.health-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #bd6258, #e38b72);
  transition: width .25s ease;
}

.combatant-modifiers {
  margin: 7px 0 0;
  color: #aeb4a8;
  font-size: 11px;
}

.combatant-card.active .health-fill {
  background: linear-gradient(90deg, #8cae77, #c0d98a);
}

.dice-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dice-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 6px;
}

.dice-result {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 72px;
  padding: 7px 9px;
  border: 1px solid #e3c77f99;
  border-radius: 10px;
  background: linear-gradient(145deg, #f0ecdf, #d5c9a8);
  color: #252923;
  box-shadow: 0 5px 14px #0005, inset 0 1px 2px #fff9;
}

.dice-result span {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.dice-result strong {
  font-size: 24px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.dice-results.rolling .dice-result {
  animation: dice-roll .16s ease-in-out infinite alternate;
}

@keyframes dice-roll {
  from { transform: rotate(-12deg) translateY(-2px); }
  to { transform: rotate(12deg) translateY(2px); }
}

.match-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 10px;
}

.movement-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid #d4e6df;
  border-radius: 12px;
  background: #ffffffd9;
  box-shadow: 0 5px 16px #477f6b0d;
}

.movement-help {
  display: grid;
  gap: 3px;
}

.movement-help strong {
  color: #23413b;
  font-size: 14px;
}

.movement-help span {
  color: #70877f;
  font-size: 12px;
}

.direction-pad {
  display: grid;
  grid-template-columns: repeat(3, 42px);
  grid-template-rows: repeat(3, 36px);
  gap: 3px;
  justify-items: center;
  align-items: center;
}

.direction-button {
  width: 42px;
  height: 36px;
  border: 1px solid #55ab9580;
  border-radius: 9px;
  background: #ffffff55;
  color: #238b7b;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}

.direction-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #55ab95;
  background: #d9f3e8b8;
  box-shadow: 0 2px 8px #238b7b22;
}

.direction-button:active:not(:disabled) {
  transform: translateY(1px) scale(.94);
  border-color: #238b7b;
  background: #a9dec9b8;
  box-shadow: inset 0 2px 5px #1c75632e;
}

.direction-button:disabled {
  cursor: not-allowed;
  border-color: #afd3c766;
  background: #ffffff30;
  color: #71877e;
  opacity: .58;
}

.direction-center {
  color: #82988e;
  font-size: 10px;
  font-weight: 700;
}

.direction-spacer {
  width: 42px;
  height: 36px;
}

.turn-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.special-skill-choice {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #d7b87599;
  border-radius: 999px;
  background: #232923;
  color: #f0ecdf;
  font: inherit;
}

.text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: #d7b875;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.text-button:hover { text-decoration: underline; }

.roster-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #d7b87577;
  border-radius: 50%;
  background: #d7b87514;
  font-size: 19px;
}

.roster-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.roster-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-trait {
  overflow: hidden;
  color: #b5b8af;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-panel {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #d7b87555;
  border-radius: 12px;
  background: #232923;
}

.character-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.character-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid #d7b875;
  border-radius: 50%;
  color: #e3c77f;
  background: #d7b87518;
  font-weight: 700;
}

.character-role {
  margin: 0 0 2px;
  color: #d7b875;
  font-size: 12px;
  font-weight: 700;
}

.character-title h2 {
  margin: 0;
  font-size: 18px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.stats div {
  flex: 1 1 64px;
  min-width: 68px;
  padding: 8px 10px;
  border: 1px solid #42483f;
  border-radius: 8px;
  text-align: center;
}

.stats dt {
  color: #aeb4a8;
  font-size: 11px;
}

.stats dd {
  margin: 3px 0 0;
  color: #f0ecdf;
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.coordinate-status {
  grid-column: 1 / -1;
  margin: 0;
  color: #b5b8af;
  font-size: 13px;
}

.selected-description {
  grid-column: 1 / -1;
  margin: 0;
  color: #d3d4ca;
  font-size: 13px;
}

.board-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: clamp(22px, 3vw, 28px);
  border: 1px solid #aeb9ad38;
  border-radius: 18px;
  background: #d7e5d408;
  box-shadow: 0 18px 50px #0006, inset 0 1px 0 #ffffff12;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  gap: 2px;
  padding: 2px;
  background: transparent;
  border: 1px solid #b9c9bd38;
  border-radius: 10px;
  overflow: hidden;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid #b9c9bd26;
  border-radius: 3px;
  background: #dce8df08;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.cell:disabled {
  cursor: default;
  opacity: 1;
}

.cell:hover {
  border-color: #e3c77f9c;
  background: #e3c77f16;
  box-shadow: inset 0 0 14px #e3c77f0d;
  z-index: 2;
}

.axis-label {
  position: absolute;
  z-index: 3;
  color: #d7b875;
  font-size: clamp(9px, 1.3vw, 12px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  text-align: center;
  user-select: none;
}

.axis-x {
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
}

.axis-y {
  left: -20px;
  top: 50%;
  transform: translate(-50%, -50%);
}

.cell.in-range {
  border-color: #d7b87580;
  background:
    radial-gradient(circle at center, #d7b87535 0 20%, transparent 21%),
    #d7b87512;
}

.cell.move-option {
  border-color: #7bc5c2;
  background:
    radial-gradient(circle at center, #7bc5c244 0 20%, transparent 21%),
    #4eaaa51c;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #7bc5c244;
}

.cell.move-option:hover {
  border-color: #a4ffef;
  background: #72d6cc44;
  box-shadow: inset 0 0 0 2px #a4ffef66, 0 0 12px #72d6cc33;
}

.cell.attack-option {
  border-color: #f07d68;
  background: radial-gradient(circle at center, #f07d6866, #f07d6822);
  box-shadow: inset 0 0 0 2px #f07d6844, 0 0 14px #f07d6844;
  cursor: crosshair;
  animation: attack-pulse .8s ease-in-out infinite alternate;
}

.cell.attack-option:hover {
  border-color: #ffb09c;
  background: #f07d6877;
  box-shadow: inset 0 0 0 2px #ffb09c88, 0 0 18px #f07d6866;
}

@keyframes attack-pulse {
  from { box-shadow: inset 0 0 0 1px #f07d6833, 0 0 5px #f07d6822; }
  to { box-shadow: inset 0 0 0 2px #f07d6877, 0 0 14px #f07d6844; }
}

.cell.character-cell {
  border-color: #dfc1848c;
  background:
    radial-gradient(circle at center, #d7b87525, transparent 68%),
    #ffffff08;
}

.cell.selected-character-cell {
  border-color: #f0d99f;
  box-shadow: inset 0 0 0 2px #d7b87566, 0 0 14px #d7b87555;
  z-index: 1;
}

.character {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 72%;
  display: grid;
  place-items: center;
  border: 2px solid #f0ecdf;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 32% 28%, #626f68, #26312d 55%, #151a18);
  color: #f0ecdf;
  font-size: clamp(10px, 2vw, 18px);
  font-weight: 700;
  box-shadow: 0 4px 10px #0007;
  z-index: 2;
}

@media (max-width: 720px) {
  .game-shell {
    width: calc(100% - 20px);
    padding: 14px 0;
  }

  .character-panel {
    grid-template-columns: 1fr;
  }

  .section-heading {
    display: block;
  }

  .section-heading p {
    margin-top: 4px;
  }

  .character-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .turn-panel {
    align-items: flex-start;
  }

  .dice-area {
    flex-direction: column;
    align-items: stretch;
  }

  .dice-results {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dice-result {
    min-width: 0;
    padding: 7px 4px;
  }

  .dice-result span {
    font-size: 10px;
  }

  .stats {
    width: 100%;
  }

  .stats div {
    flex-basis: 60px;
  }

  h1 { font-size: 28px; }
}

:root {
  color-scheme: light;
  background: #f2faf7;
  color: #23413b;
}

body {
  background:
    radial-gradient(ellipse at 12% 8%, #c9eee466, transparent 38%),
    radial-gradient(ellipse at 92% 18%, #d7edff77, transparent 34%),
    #f2faf7;
}

h1,
.section-heading h2,
.turn-panel h2,
.character-title h2 {
  color: #23413b;
}

.eyebrow,
.character-role {
  color: #278778;
}

.lobby-link,
.text-button {
  color: #248374;
}

.section-heading p,
.setup-footer p,
.move-status,
.combatant-modifiers,
.roster-trait,
.coordinate-status {
  color: #70877f;
}

.roster-empty {
  border-color: #b7d8cc;
  color: #668078;
}

.roster-card {
  border-color: #d3e6df;
  background: linear-gradient(145deg, #ffffff, #f3faf7);
  color: #294941;
  box-shadow: 0 3px 12px #477f6b12;
}

.roster-card:hover {
  border-color: #80c4b1;
}

.roster-card[aria-pressed="true"] {
  border-color: #48a994;
  background: linear-gradient(145deg, #e8f8f2, #dff3ed);
  box-shadow: inset 0 0 0 1px #48a99424;
}

.roster-player {
  color: #278778;
}

.action-button {
  border-color: #238b7b;
  background: linear-gradient(145deg, #45b39d, #278b7c);
  color: #ffffff;
  box-shadow: 0 4px 10px #258a781f;
}

.action-button:hover:not(:disabled) {
  filter: brightness(1.04);
}

.turn-panel,
.combatant-card,
.character-panel,
.board-frame {
  border-color: #d4e6df;
  background: #ffffffd9;
  box-shadow: 0 8px 24px #477f6b12;
}

.combatant-card.active {
  border-color: #78c4ad;
  box-shadow: inset 0 0 0 1px #78c4ad33;
}

.combatant-heading span:last-child {
  color: #536e65;
}

.health-track {
  background: #e4eee9;
}

.health-fill {
  background: linear-gradient(90deg, #e98578, #f3aa89);
}

.combatant-card.active .health-fill {
  background: linear-gradient(90deg, #43ae91, #8bd1a5);
}

.dice-result {
  border-color: #b7d8ca;
  background: linear-gradient(145deg, #ffffff, #e9f5ef);
  color: #294941;
  box-shadow: 0 4px 12px #477f6b1a, inset 0 1px 2px #ffffff;
}

.special-skill-choice {
  border-color: #afd3c7;
  background: #ffffff;
  color: #294941;
}

.roster-icon,
.character-avatar {
  border-color: #90cdbb;
  background: #e5f6ef;
  color: #238b7b;
}

.character-panel {
  border-color: #c9e2d7;
}

.stats div {
  border-color: #e0ece6;
  background: #f7fbf9;
}

.stats dt {
  color: #71877e;
}

.stats dd {
  color: #294941;
}

.selected-description {
  color: #60796f;
}

.board-frame {
  border-radius: 20px;
  box-shadow: 0 14px 34px #477f6b18;
}

.board {
  border-color: #bfdbcf;
  background: #dcece3;
}

.cell {
  border-color: #c8ded2;
  background: #f8fcf9;
}

.cell:hover {
  border-color: #76bda9;
  background: #e5f6ef;
  box-shadow: inset 0 0 12px #6ab69d1c;
}

.axis-label {
  color: #318b7b;
}

.cell.in-range {
  border-color: #9dc986;
  background:
    radial-gradient(circle at center, #a5cf8144 0 20%, transparent 21%),
    #e8f4dc;
}

.cell.move-option {
  border-color: #56ae9d;
  background:
    radial-gradient(circle at center, #65c3ad55 0 20%, transparent 21%),
    #dcf4eb;
  box-shadow: inset 0 0 0 1px #65c3ad44;
}

.cell.move-option:hover {
  border-color: #269b88;
  background: #c8eee1;
  box-shadow: inset 0 0 0 2px #269b8844, 0 0 10px #269b8822;
}

.cell.attack-option {
  border-color: #e68172;
  background: radial-gradient(circle at center, #ef9b8a77, #fbe5df);
  box-shadow: inset 0 0 0 2px #e6817244, 0 0 12px #e6817222;
}

.cell.attack-option:hover {
  border-color: #d96155;
  background: #f7c7ba;
  box-shadow: inset 0 0 0 2px #d9615544, 0 0 14px #d9615522;
}

.cell.character-cell {
  border-color: #82bca6;
  background:
    radial-gradient(circle at center, #71b89b33, transparent 68%),
    #edf7f1;
}

.cell.selected-character-cell {
  border-color: #238b7b;
  box-shadow: inset 0 0 0 2px #238b7b55, 0 0 12px #238b7b33;
}

.character {
  border-color: #ffffff;
  background: radial-gradient(circle at 32% 28%, #8bd1b3, #318b78 58%, #23685e);
  color: #ffffff;
  box-shadow: 0 3px 8px #315f5040;
}

button:focus-visible,
a:focus-visible {
  outline-color: #238b7b;
}

.character-panel {
  align-items: start;
}

.skill-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 13px 15px;
  border: 1px solid #c5e3d6;
  border-radius: 12px;
  background: linear-gradient(120deg, #f1faf5, #f6fbff);
}

.skill-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.skill-eyebrow {
  margin: 0 0 2px;
  color: #63877a;
  font-size: 11px;
  font-weight: 700;
}

.skill-heading h3 {
  margin: 0;
  color: #23413b;
  font-size: 17px;
}

.skill-cooldown {
  flex: 0 0 auto;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid #b9ddce;
  border-radius: 999px;
  background: #ffffffb8;
  color: #278778;
  font-size: 12px;
  font-weight: 700;
}

.skill-rule,
.skill-description {
  margin: 0;
  color: #5f786e;
  font-size: 13px;
  line-height: 1.6;
}

.skill-description {
  padding: 9px 11px;
  border-radius: 8px;
  background: #ffffffb8;
  color: #38594e;
}

.skill-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-select-label {
  color: #60796f;
  font-size: 12px;
  font-weight: 700;
}

.special-skill-choice {
  min-height: 38px;
  padding: 7px 34px 7px 10px;
  border-radius: 9px;
}

.skill-use-button {
  min-height: 38px;
  padding: 7px 15px;
  border-radius: 9px;
}

.skill-use-button:disabled {
  background: #e6efeb;
  border-color: #d3e2dc;
  color: #74877f;
  opacity: 1;
}

.passive-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #e0ece6;
  border-radius: 9px;
  background: #f8fbf9;
  color: #60796f;
  font-size: 12px;
  line-height: 1.55;
}

.passive-summary strong {
  color: #278778;
}

.selected-description,
.coordinate-status {
  grid-column: 1 / -1;
}

.turn-actions {
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .skill-heading {
    align-items: flex-start;
  }

  .skill-cooldown {
    white-space: nowrap;
  }

  .movement-panel {
    gap: 8px;
    padding: 9px 10px;
  }
}

@media (max-width: 420px) {
  .skill-heading {
    flex-direction: column;
    gap: 6px;
  }

  .passive-summary {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .movement-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .direction-pad {
    align-self: center;
  }
}


/* 勝利結算動畫 */
.victory-overlay {
  position: fixed; z-index: 1000; inset: 0; display: grid; place-items: center;
  overflow: hidden; padding: 20px; background: #080d0be8; backdrop-filter: blur(8px);
}
.victory-card {
  position: relative; z-index: 2; display: grid; justify-items: center;
  width: min(420px, 100%); padding: 32px 24px 26px;
  border: 1px solid #e3c77f; border-radius: 24px;
  background: radial-gradient(circle at 50% 0, #74613b 0, #292d25 48%, #1b211e 100%);
  box-shadow: 0 0 0 6px #e3c77f18, 0 22px 80px #000b, 0 0 48px #e3c77f38;
  text-align: center; opacity: 0; transform: translateY(28px) scale(.82);
}
.victory-celebrate .victory-card { animation: victory-card-enter .65s cubic-bezier(.16, 1, .3, 1) forwards; }
.victory-kicker { margin: 0; color: #e3c77f; font-size: 11px; font-weight: 800; letter-spacing: .28em; }
.victory-cup { margin: 12px 0 4px; font-size: 68px; filter: drop-shadow(0 0 18px #f5d77a99); animation: victory-cup-bounce .9s ease-in-out infinite alternate; }
.victory-card h2 { margin: 4px 0 10px; color: #ffe6a6; font-family: Georgia, "Microsoft JhengHei", serif; font-size: clamp(28px, 8vw, 42px); text-shadow: 0 0 20px #f2cb6a88; }
.victory-caption { margin: 8px 0 4px; color: #c7cabb; font-size: 13px; }
.victory-character { margin-bottom: 22px; color: #fff4d2; font-size: 24px; }
.victory-replay-btn { min-width: 180px; }
.victory-home-link { margin-top: 16px; color: #d7b875; font-size: 13px; text-decoration: none; }
.victory-home-link:hover { text-decoration: underline; }
.victory-sparkles { position: absolute; inset: 0; pointer-events: none; }
.victory-sparkles span { position: absolute; top: -12%; color: #f5d77a; font-size: clamp(18px, 4vw, 32px); opacity: 0; }
.victory-sparkles span:nth-child(1) { left: 8%; }
.victory-sparkles span:nth-child(2) { left: 21%; color: #b8e8d0; }
.victory-sparkles span:nth-child(3) { left: 35%; }
.victory-sparkles span:nth-child(4) { left: 55%; color: #f3a58c; }
.victory-sparkles span:nth-child(5) { left: 69%; }
.victory-sparkles span:nth-child(6) { left: 82%; color: #b8e8d0; }
.victory-sparkles span:nth-child(7) { left: 92%; color: #f3a58c; }
.victory-sparkles span:nth-child(8) { left: 45%; color: #b8e8d0; }
.victory-celebrate .victory-sparkles span { animation: victory-sparkle-fall 2.1s ease-in infinite; }
.victory-celebrate .victory-sparkles span:nth-child(2n) { animation-delay: .25s; }
.victory-celebrate .victory-sparkles span:nth-child(3n) { animation-delay: .55s; }
@keyframes victory-card-enter {
  0% { opacity: 0; transform: translateY(28px) scale(.82); }
  70% { opacity: 1; transform: translateY(-5px) scale(1.035); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes victory-cup-bounce { from { transform: translateY(0) rotate(-5deg); } to { transform: translateY(-8px) rotate(5deg); } }
@keyframes victory-sparkle-fall {
  0% { transform: translateY(-5vh) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translateY(115vh) rotate(300deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .victory-celebrate .victory-card, .victory-cup, .victory-celebrate .victory-sparkles span { animation: none; }
  .victory-card { opacity: 1; transform: none; }
}

/* 場景障礙物 */
.cell.obstacle-cell{font-size:clamp(10px,2vw,18px);font-weight:800}
.cell.obstacle-wall{background:#aeb8b5;border-color:#71827d;color:#334640;box-shadow:inset 0 0 0 2px #71827d55}
.cell.obstacle-glass{background:#d8f3f7;border-color:#69b8c3;color:#287987;box-shadow:inset 0 0 0 1px #69b8c388}
.cell.obstacle-spike{background:#ffe8e3;border-color:#df8b7d;color:#a94e43}
.cell.obstacle-grass{background:#e3f5df;border-color:#86bd78;color:#397a3a}
.cell.obstacle-cell.attack-option{cursor:pointer;outline:2px solid #df8b45;outline-offset:-2px}

.cell{position:relative}
.facing-indicator{position:absolute;right:1px;bottom:0;z-index:2;padding:0 2px;border-radius:4px;background:#ffffffdf;color:#176b5e;font-size:10px;font-weight:900;line-height:1.1}

.cell{position:relative}
.facing-indicator{position:absolute;right:1px;bottom:0;z-index:2;padding:0 2px;border-radius:4px;background:#ffffffdf;color:#176b5e;font-size:10px;font-weight:900;line-height:1.1}
