﻿:root {
  --paper: #f7f0df;
  --ink: #1f2430;
  --muted: #5f6472;
  --line: rgba(31, 36, 48, 0.12);
  --card: rgba(255, 252, 244, 0.9);
  --accent-deep: #8a2f16;
  --boss: #405b8f;
  --win: #2e865f;
  --lose: #a73737;
  --draw: #7b6c48;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 197, 143, 0.42), transparent 28%),
    radial-gradient(circle at top right, rgba(112, 146, 214, 0.28), transparent 24%),
    linear-gradient(180deg, #ece4d1 0%, #d4c6ab 100%);
}
body { position: relative; overflow-x: hidden; }
button { font: inherit; }
img { display: block; }

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: linear-gradient(transparent 0 96%, rgba(0, 0, 0, 0.1) 96% 100%);
  background-size: 100% 7px;
}

.appShell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.heroCard,
.boardCard,
.resultPanel,
.logSection,
.playCard,
.logItem,
.scoreBox,
.statusBanner,
.infoCard,
.battleStageCard,
.playerActionSection,
.playerUsedCard {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 40px rgba(64, 43, 18, 0.12);
}

.heroCard,
.boardCard,
.logSection,
.battleStageCard,
.infoCard,
.playerActionSection,
.playerUsedCard {
  border-radius: 28px;
}

.heroCard { padding: 24px 26px; margin-bottom: 16px; }
.heroCard.is-collapsed { padding-bottom: 18px; }
.heroCard.is-collapsed .heroText,
.heroCard.is-collapsed .heroMeta { display: none; }
.boardCard { padding: 18px; }

.heroTopRow,
.boardTop,
.handHeader,
.controlsRow,
.scoreStrip,
.usedList,
.playerActionBody {
  display: flex;
  align-items: center;
}

.heroTopRow,
.boardTop,
.handHeader { justify-content: space-between; gap: 16px; }
.heroTopRow { align-items: flex-start; }
.scoreStrip { gap: 10px; }
.controlsRow { justify-content: center; }
.usedList { gap: 8px; flex-wrap: wrap; }
.playerActionBody { align-items: stretch; gap: 16px; margin-top: 16px; }

.heroEyebrow,
.sectionTag,
.deckNote,
.fighterLabel,
.heroMeta span,
.usedToken,
.hudName,
.movePanel small {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heroEyebrow,
.sectionTag {
  font-size: 12px;
  color: var(--accent-deep);
  font-weight: 800;
}

.heroCard h1,
.boardTop h2,
.handHeader h3 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
}

.heroCard h1 { font-size: clamp(34px, 6vw, 58px); }
.boardTop h2 { font-size: clamp(24px, 4vw, 36px); }
.handHeader h3 { font-size: clamp(20px, 3vw, 30px); }

.heroText {
  margin: 14px 0 0;
  font-size: 16px;
  line-height: 1.8;
  max-width: 780px;
  color: var(--muted);
}

.heroMeta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.heroMeta span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

#modeBadge {
  background: rgba(138, 47, 22, 0.12);
  color: var(--accent-deep);
}

#presenceBadge {
  background: rgba(64, 91, 143, 0.12);
  color: var(--boss);
}

#streakBadge {
  background: rgba(46, 134, 95, 0.14);
  color: var(--win);
}

.scoreBox {
  min-width: 112px;
  padding: 12px 14px;
  border-radius: 20px;
  text-align: center;
}

.scoreBox small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.scoreBox strong {
  display: block;
  font-size: 28px;
  margin-top: 6px;
}

.scoreBox.player strong { color: var(--accent-deep); }
.scoreBox.boss strong { color: var(--boss); }
.scoreVs { font-weight: 900; color: var(--muted); }

.battleStageCard {
  position: relative;
  margin-top: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 26, 54, 0.95), rgba(34, 56, 78, 0.9));
  min-height: 520px;
}

.battleViewport { position: absolute; inset: 0; }
.battleViewport canvas { width: 100%; height: 100%; display: block; }

.resultOverlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
}

.resultOverlay.is-hidden {
  display: none;
}

.resultOverlayCard {
  width: min(360px, calc(100% - 32px));
  padding: 28px 28px 22px;
  border-radius: 28px;
  background: rgba(255, 252, 244, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: 0 22px 50px rgba(16, 18, 28, 0.34);
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
  pointer-events: auto;
}

.resultOverlayCard strong {
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.08;
  font-family: Georgia, "Times New Roman", serif;
}

.resultOverlayCard span {
  font-size: 19px;
  line-height: 1.7;
  color: var(--muted);
}

.resultOverlayNextBtn {
  width: 66px;
  height: 66px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #2f3548, #131722);
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 24px rgba(15, 17, 24, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.resultOverlayNextBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 30px rgba(15, 17, 24, 0.32);
  filter: brightness(1.06);
}

.resultOverlayNextBtn:active {
  transform: translateY(0);
}

.resultOverlayCard.result-win strong { color: var(--win); }
.resultOverlayCard.result-lose strong { color: var(--lose); }
.resultOverlayCard.result-draw strong { color: var(--draw); }

.challengeOverlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 14, 24, 0.24);
}

.challengeOverlay.is-hidden {
  display: none;
}

.challengeCard {
  width: min(460px, calc(100% - 32px));
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 252, 244, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 20px 44px rgba(10, 14, 24, 0.28);
  display: grid;
  gap: 14px;
}

.challengeCard strong {
  font-size: 28px;
  font-family: Georgia, "Times New Roman", serif;
  text-align: center;
}

.challengeCard span {
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.challengeList {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
}

.challengePlayerBtn {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 36, 48, 0.12);
  background: rgba(255, 255, 255, 0.84);
  text-align: left;
  cursor: pointer;
}

.challengePlayerBtn strong {
  display: block;
  font-size: 20px;
  font-family: "Microsoft JhengHei", "PingFang TC", sans-serif;
  text-align: left;
}

.challengePlayerBtn span {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  text-align: left;
}

.challengeActions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pickTimer {
  justify-self: start;
  min-width: 60px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 248, 231, 0.92);
  color: #1f2430;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.pickTimer.is-hidden {
  display: none;
}

.battleHud {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 3;
  pointer-events: none;
}

.battleHudTop {
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  padding: 16px 16px 0;
  align-items: start;
}

.battleHudBottom {
  bottom: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: end;
  padding: 0 16px 16px;
}

.hudSide { display: grid; gap: 8px; }
.hudSide.player { justify-items: start; }
.hudSide.boss { justify-items: end; }

.hudName {
  color: #fff8e7;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.hudBar {
  width: min(300px, 100%);
  height: 16px;
  border-radius: 999px;
  padding: 2px;
  background: rgba(8, 12, 30, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.hudBar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

#playerMomentumBar { background: linear-gradient(90deg, #ffcc8c, #ff7f50); }
#bossMomentumBar { background: linear-gradient(90deg, #90c8ff, #4f78d2); }

.hudCenter {
  align-self: start;
  margin-top: 4px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(12, 16, 32, 0.55);
  color: #fff8e7;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.movePanel { display: grid; gap: 8px; }
.movePanel small {
  color: #fff8e7;
  opacity: 0.85;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.effectCenter { display: grid; place-items: center; min-height: 130px; }
.effectBurst {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 170px;
  padding: 14px 18px;
  border-radius: 28px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(255, 241, 204, 0.78));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.26);
  animation: burstPop 0.42s ease;
}
.effectBurst img { width: 74px; height: 74px; object-fit: contain; }
.effectBurst b { font-size: 24px; font-family: Georgia, "Times New Roman", serif; color: #35271b; }

@keyframes burstPop {
  0% { transform: scale(0.72); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.moveDisplay {
  min-height: 120px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(232, 221, 196, 0.9));
  border: 1px dashed rgba(255, 255, 255, 0.18);
  text-align: center;
  padding: 14px;
  gap: 10px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.moveArtWrap { display: grid; place-items: center; width: 100%; }
.moveArt { width: 84px; max-height: 84px; object-fit: contain; }
.moveName { font-size: 28px; font-weight: 900; font-family: Georgia, "Times New Roman", serif; }
.movePlaceholder { font-size: 24px; font-weight: 800; color: var(--muted); }

.statusBanner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 700;
}

.battleInfoGrid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(240px, 320px);
  gap: 14px;
  align-items: stretch;
}

.infoCard,
.resultPanel,
.playerUsedCard {
  min-width: 0;
  padding: 18px;
}

.infoCard { background: rgba(255, 252, 244, 0.8); }
.fighterLabel { font-size: 12px; font-weight: 800; color: var(--muted); }
.usedToken {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.07);
  font-size: 11px;
  font-weight: 700;
}

.resultPanel {
  border-radius: 24px;
  min-height: 150px;
  display: grid;
  align-content: center;
  text-align: center;
  gap: 10px;
}

.resultPanel strong { font-size: 28px; font-family: Georgia, "Times New Roman", serif; }
.resultPanel span { line-height: 1.7; color: var(--muted); }
.bossInfoCard { display: grid; align-content: start; }

.playerActionSection {
  margin-top: 18px;
  padding: 18px;
}

.playerActionHeader { margin-bottom: 0; }
.playerUsedCard {
  width: 230px;
  flex: 0 0 230px;
  background: rgba(255, 252, 244, 0.82);
}

.usedListStack {
  margin-top: 14px;
  align-content: flex-start;
  min-height: 110px;
}

.playerHandWrap {
  flex: 1 1 auto;
  min-width: 0;
}

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

.controlsRowMain { margin-top: 16px; }

.ghostBtn {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(31, 36, 48, 0.16);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.heroToggleBtn { white-space: nowrap; }

.logSection { margin-top: 18px; padding: 18px; }

.playCard {
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(31, 36, 48, 0.1);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.playCard:hover:not(:disabled) {
  transform: translateY(-4px);
  box-shadow: 0 16px 28px rgba(64, 43, 18, 0.12);
}

.playCard:disabled { opacity: 0.48; cursor: not-allowed; }
.playCard h4 { margin: 10px 0 8px; font-size: 28px; font-family: Georgia, "Times New Roman", serif; }
.playCard p { margin: 0; line-height: 1.7; color: var(--muted); }

.cardArtWrap {
  display: grid;
  place-items: center;
  min-height: 112px;
  margin-top: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(31, 36, 48, 0.08);
}

.cardArt { width: min(92px, 100%); max-height: 92px; object-fit: contain; }
.playCard .cardTag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 800;
}

.playCard[data-card='vacation'] {
  background: linear-gradient(180deg, rgba(255, 236, 220, 0.96), rgba(255, 223, 198, 0.92));
}
.playCard[data-card='overtime'] {
  background: linear-gradient(180deg, rgba(224, 233, 252, 0.96), rgba(201, 214, 247, 0.92));
}
.playCard[data-card='sick'] {
  background: linear-gradient(180deg, rgba(229, 244, 230, 0.96), rgba(202, 232, 207, 0.92));
}

.battleLog { margin-top: 16px; display: grid; gap: 10px; }
.logItem { border-radius: 18px; padding: 14px 16px; }
.logItem b { display: block; margin-bottom: 5px; }
.logItem small { color: var(--muted); }
.logItem.win { border-left: 5px solid var(--win); }
.logItem.lose { border-left: 5px solid var(--lose); }
.logItem.draw { border-left: 5px solid var(--draw); }
.result-win strong { color: var(--win); }
.result-lose strong { color: var(--lose); }
.result-draw strong { color: var(--draw); }

@media (max-width: 960px) {
  .battleInfoGrid { grid-template-columns: 1fr; }
  .playerActionBody { flex-direction: column; }
  .playerUsedCard { width: auto; flex-basis: auto; }
  .battleHudBottom { grid-template-columns: 1fr; padding-top: 120px; }
  .effectCenter { order: -1; }
}

@media (max-width: 720px) {
  .appShell { width: min(100% - 18px, 100%); padding-top: 14px; }
  .heroCard,
  .boardCard,
  .logSection,
  .battleStageCard,
  .infoCard,
  .playerActionSection,
  .playerUsedCard { border-radius: 22px; }
  .heroTopRow,
  .boardTop,
  .handHeader { display: block; }
  .scoreStrip { margin-top: 12px; }
  .handGrid { grid-template-columns: 1fr; }
  .battleStageCard { min-height: 620px; }
  .battleHudTop { grid-template-columns: 1fr; }
  .hudSide.boss,
  .hudSide.player { justify-items: stretch; }
  .heroToggleBtn { margin-top: 14px; }
}

.boardTopCompact { justify-content: flex-end; }
.battleStageCard { min-height: 560px; }
.battleHudBottom { grid-template-columns: 180px minmax(0, 1fr) 180px; }
.battleHudSpacer { min-height: 1px; }
.sideHandPanel {
  position: absolute;
  right: 16px;
  top: 118px;
  bottom: 18px;
  width: 220px;
  z-index: 4;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border-radius: 24px;
  background: rgba(248, 241, 226, 0.88);
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: 0 18px 40px rgba(20,22,34,.18);
}
.sideHandHead small {
  display: block;
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.sideHandGrid {
  display: grid;
  gap: 12px;
}
.sideHandGrid .playCard {
  padding: 12px;
  border-radius: 20px;
}
.sideHandGrid .playCard h4 {
  margin: 8px 0 4px;
  font-size: 22px;
}
.sideHandGrid .playCard p {
  display: none;
}
.sideHandGrid .cardArtWrap {
  min-height: 86px;
  margin-top: 8px;
}
.sideHandGrid .cardArt {
  width: min(72px, 100%);
  max-height: 72px;
}
.effectCenter,
.effectBurst { display: none !important; }
.battleInfoGridWide {
  grid-template-columns: minmax(250px, 1.15fr) minmax(220px, 280px) minmax(220px, 320px);
}
.onlineInfoCard {
  display: grid;
  align-content: start;
}
.onlineInfoBody {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.onlineInfoBody strong {
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
}
.onlineInfoBody p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.ruleInfoCard {
  display: grid;
  align-content: start;
}
.ruleText {
  margin-top: 14px;
  font-size: 28px;
  font-weight: 900;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
}
.playerActionBody {
  margin-top: 10px;
}
.playerActionSection {
  margin-top: 16px;
}
.playerActionSection .playerHandWrap,
.playerActionSection .handGrid,
.playerActionSection .sideHandGrid { min-width: 0; }
@media (max-width: 1100px) {
  .sideHandPanel {
    position: static;
    width: auto;
    margin-top: 16px;
  }
  .battleStageCard {
    padding-bottom: 0;
  }
  .battleInfoGridWide {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .sideHandPanel {
    padding: 12px;
  }
  .sideHandGrid {
    grid-template-columns: 1fr;
  }
  .ruleText {
    font-size: 22px;
  }
}

.boardTop,
.boardTopCompact,
.scoreStrip,
.scoreBox,
.scoreVs { display: none !important; }
.battleStageCard { min-height: 580px; }
.battleHudBottom {
  grid-template-columns: 280px minmax(0, 1fr) 180px;
  padding: 0 16px 16px;
}
.playerMovePanelWide {
  align-content: end;
}
.inlineHandGrid {
  display: grid;
  gap: 10px;
}
.inlineHandGrid .playCard {
  padding: 12px;
  border-radius: 20px;
}
.inlineHandGrid .playCard h4 {
  margin: 8px 0 4px;
  font-size: 20px;
}
.inlineHandGrid .playCard p {
  display: none;
}
.inlineHandGrid .cardArtWrap {
  min-height: 72px;
  margin-top: 6px;
}
.inlineHandGrid .cardArt {
  width: min(64px, 100%);
  max-height: 64px;
}
.moveDisplay.is-hidden,
.inlineHandGrid.is-hidden { display: none !important; }
.sideHandPanel { display: none !important; }
.effectCenter,
.effectBurst { display: none !important; }
.playerActionBody {
  margin-top: 10px;
}
@media (max-width: 900px) {
  .battleHudBottom {
    grid-template-columns: 1fr;
    padding-top: 140px;
  }
  .bossMovePanel {
    order: 2;
  }
}
