* {
  box-sizing: border-box;
}

:root {
  --bg: #e6f4fe;
  --paper: #fbf8ec;
  --paper-deep: #f2ead4;
  --ink: #2c250f;
  --muted: #69737a;
  --blue: #0d344f;
  --blue2: #1e5872;
  --blue-soft: #d9eef7;
  --gold: #d4af37;
  --gold-dark: #9d7426;
  --line: rgba(157, 116, 38, 0.42);
  --shadow: rgba(14, 49, 70, 0.16);
  --red: #a44132;
  --green: #4a7b48;
  --purple: #7455a1;
  --teal: #317c8f;
  --brown: #9a732e;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background:
    linear-gradient(rgba(255,255,255,0.72), rgba(255,255,255,0.72)),
    radial-gradient(circle at 78% 10%, rgba(52, 103, 135, 0.14), transparent 24%),
    radial-gradient(circle at 8% 85%, rgba(212, 175, 55, 0.11), transparent 22%),
    linear-gradient(180deg, #e6f4fe 0%, #f8fbfd 50%, #edf7fb 100%);
  color: var(--ink);
  font-family: "Noto Serif TC", "Source Han Serif TC", "Microsoft JhengHei", "PMingLiU", serif;
  overflow: hidden;
}

button {
  font: inherit;
}

#app {
  width: 100%;
  height: 100%;
}

.rotate-warning {
  display: none;
  height: 100vh;
  padding: 28px;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--blue);
  background: var(--paper);
}

.game-shell {
  width: 100vw;
  height: 100vh;
  min-width: 980px;
  min-height: 560px;
  padding: 10px 12px 12px;
  display: grid;
  grid-template-rows: 64px 1fr;
  gap: 8px;
  position: relative;
}

.game-shell::before,
.start-screen::before,
.character-screen::before,
.result-screen::before,
.finished-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0%, transparent 84%, rgba(13, 52, 79, 0.08) 100%),
    radial-gradient(circle at 92% 9%, rgba(13, 52, 79, 0.09), transparent 18%);
}

.top-bar {
  height: 64px;
  display: grid;
  grid-template-columns: 310px 1fr 240px;
  gap: 10px;
  align-items: stretch;
}

.title-card,
.stats-card,
.action-card,
.panel {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.86), rgba(246, 250, 250, 0.78)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 7px 22px var(--shadow);
  position: relative;
}

.title-card::after,
.stats-card::after,
.action-card::after,
.panel::after,
.start-card::after,
.character-card::after,
.result-card::after,
.finished-card::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 7px;
}

.title-card {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-title {
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0.08em;
  color: var(--ink);
  font-weight: 900;
  margin: 0;
  white-space: nowrap;
}

.title-seal {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border-radius: 3px;
  padding: 3px 4px;
  font-size: 12px;
  writing-mode: vertical-rl;
  letter-spacing: 0.1em;
}

.sub-title {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}

.stats-card {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.tool-btn {
  border: 0;
  background: transparent;
  color: var(--blue);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  cursor: pointer;
  padding: 7px 2px;
}

.tool-icon {
  font-size: 22px;
}

.action-card {
  padding: 8px 12px;
  display: grid;
  place-items: center;
  text-align: center;
}

.date-card {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 700;
}

.main-layout {
  display: grid;
  grid-template-columns: 270px 1fr 290px;
  gap: 8px;
  min-height: 0;
}

.left-column,
.right-column {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr;
}

.profile-panel {
  padding: 12px;
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  text-align: center;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  margin: 2px 0 10px;
  letter-spacing: 0.08em;
}

.portrait-wrap {
  width: 142px;
  height: 142px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 2px solid rgba(212, 175, 55, 0.62);
  background: linear-gradient(180deg, #f8f3df, #d9eef7);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,0.7);
}

.portrait-symbol {
  width: 95px;
  height: 108px;
  border-radius: 45% 45% 16% 16%;
  background: linear-gradient(180deg, #27333d 0 18%, #b33a2f 18% 24%, #232323 24% 100%);
  position: relative;
}

.portrait-symbol::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 30px;
  width: 36px;
  height: 42px;
  background: #ead6b2;
  border-radius: 44% 44% 40% 40%;
}

.portrait-symbol::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 18px;
  width: 60px;
  height: 18px;
  background: #101820;
  border-radius: 4px;
}

.character-name {
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ink);
  margin: 4px 0;
}

.character-tag {
  width: fit-content;
  margin: 0 auto 14px;
  padding: 5px 14px;
  color: var(--muted);
  border: 1px solid rgba(157, 116, 38, 0.34);
  border-radius: 999px;
  background: rgba(251, 248, 236, 0.8);
  font-size: 13px;
}

.stat-list {
  display: grid;
  gap: 11px;
  padding: 4px 8px;
}

.stat-row {
  display: grid;
  grid-template-columns: 24px 68px 1fr 30px;
  align-items: center;
  gap: 6px;
}

.stat-badge {
  width: 21px;
  height: 21px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
}

.stat-row:nth-child(1) .stat-badge { background: var(--blue2); }
.stat-row:nth-child(2) .stat-badge { background: var(--green); }
.stat-row:nth-child(3) .stat-badge { background: var(--purple); }
.stat-row:nth-child(4) .stat-badge { background: var(--teal); }
.stat-row:nth-child(5) .stat-badge { background: var(--brown); }

.stat-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
}

.stat-value {
  font-size: 15px;
  color: var(--ink);
  text-align: right;
  font-weight: 800;
}

.stat-bar {
  height: 8px;
  background: rgba(44, 37, 15, 0.13);
  border-radius: 99px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.45s ease;
}

.stat-row:nth-child(1) .stat-fill { background: var(--blue2); }
.stat-row:nth-child(2) .stat-fill { background: var(--green); }
.stat-row:nth-child(3) .stat-fill { background: var(--purple); }
.stat-row:nth-child(4) .stat-fill { background: var(--teal); }
.stat-row:nth-child(5) .stat-fill { background: var(--brown); }

.detail-button {
  margin: 18px auto 0;
  width: 168px;
  border: 1px solid rgba(157, 116, 38, 0.34);
  background: rgba(251, 248, 236, 0.8);
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}

.content-panel {
  min-height: 0;
  padding: 12px 16px 12px;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.node-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.node-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 14px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.node-title-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.node-title-wrap::before,
.node-title-wrap::after {
  content: "";
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dark), transparent);
}

.node-title {
  margin: 0;
  text-align: center;
  font-size: 31px;
  letter-spacing: 0.16em;
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.node-place {
  justify-content: flex-end;
}

.scene-area {
  min-height: 0;
  display: grid;
  grid-template-rows: 47% 1fr;
  gap: 10px;
}

.scene-visual {
  min-height: 190px;
  border: 1px solid rgba(157, 116, 38, 0.25);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background:
    linear-gradient(90deg, rgba(251,248,236,0.05) 0 49%, rgba(251,248,236,0) 49% 51%, rgba(251,248,236,0.05) 51% 100%),
    linear-gradient(135deg, #795f3e, #d7c09c 48%, #72828d 49%, #2d3030);
}

.scene-visual::before {
  content: "A";
  position: absolute;
  top: 8px;
  left: 10px;
  background: var(--blue2);
  color: #fff;
  width: 34px;
  height: 40px;
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}

.scene-visual::after {
  content: "B";
  position: absolute;
  top: 8px;
  left: calc(50% + 10px);
  background: var(--blue2);
  color: #fff;
  width: 34px;
  height: 40px;
  clip-path: polygon(0 0, 100% 0, 100% 82%, 50% 100%, 0 82%);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}

.split-crack {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 49.4%;
  width: 32px;
  transform: translateX(-50%);
  background:
    linear-gradient(135deg, transparent 0 18%, var(--paper) 18% 26%, transparent 26% 42%, var(--paper) 42% 54%, transparent 54% 70%, var(--paper) 70% 82%, transparent 82%);
  filter: drop-shadow(0 0 2px rgba(44, 37, 15, 0.25));
}

.scene-label-left,
.scene-label-right {
  position: absolute;
  bottom: 12px;
  width: 42%;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,0.55);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
}

.scene-label-left { left: 4%; }
.scene-label-right { right: 4%; }

.story-text {
  min-height: 0;
  overflow: auto;
  padding: 0 18px;
  text-align: center;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.85;
}

.story-text .intro {
  color: var(--ink);
}

.monologue {
  margin: 8px auto 0;
  width: min(760px, 100%);
  padding: 8px 14px;
  color: #3e3522;
  background: rgba(217, 238, 247, 0.42);
  border-left: 4px solid var(--blue2);
  border-radius: 5px;
  text-align: left;
}

.choices-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.choice-btn {
  min-height: 104px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.82), rgba(250, 244, 226, 0.96));
  border: 1px solid rgba(157, 116, 38, 0.42);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  padding: 13px 16px 12px 58px;
  text-align: left;
  position: relative;
  box-shadow: 0 8px 20px rgba(14, 49, 70, 0.1);
  transition: transform 0.16s ease, filter 0.16s ease;
}

.choice-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.choice-index {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 31px;
  height: 31px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, #d7b45f, #9d7426);
  font-weight: 900;
  border: 2px solid rgba(255,255,255,0.75);
}

.choice-title {
  font-size: 19px;
  line-height: 1.35;
  font-weight: 900;
}

.choice-desc {
  color: #5c533e;
  font-size: 14px;
  line-height: 1.55;
  margin-top: 5px;
}

.right-panel {
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  background:
    linear-gradient(180deg, rgba(217, 238, 247, 0.72), rgba(251, 248, 236, 0.85));
}

.side-button {
  border: 1px solid rgba(157, 116, 38, 0.34);
  border-radius: 8px;
  background: rgba(251, 248, 236, 0.88);
  padding: 13px 14px;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.ai-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(157, 116, 38, 0.28);
  border-radius: 8px;
  background: rgba(255,255,255,0.45);
  padding: 12px;
}

.ai-header {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.ai-face {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid rgba(157, 116, 38, 0.45);
  background: linear-gradient(180deg, #f8f3df, #d9eef7);
  position: relative;
}

.ai-face::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 16px;
  width: 22px;
  height: 24px;
  background: #ead6b2;
  border-radius: 44%;
}

.ai-face::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 8px;
  width: 34px;
  height: 12px;
  background: #1b242b;
  border-radius: 2px;
}

.ai-title {
  font-size: 23px;
  font-weight: 900;
  color: var(--ink);
}

.ai-subtitle {
  color: #5c6f78;
  line-height: 1.45;
  font-size: 13px;
}

.chat-bubble {
  background: rgba(251, 248, 236, 0.92);
  border: 1px solid rgba(157, 116, 38, 0.28);
  border-radius: 10px;
  padding: 9px 11px;
  line-height: 1.55;
  font-size: 14px;
  margin: 8px 0;
  color: #3e3522;
}

.history-box {
  min-height: 0;
  overflow: auto;
  color: #3e3522;
  line-height: 1.65;
  font-size: 14px;
  padding-right: 4px;
}

.history-box h3 {
  margin: 2px 0 8px;
  color: var(--blue);
  font-size: 18px;
}

.small-btn {
  border: 1px solid rgba(157, 116, 38, 0.32);
  color: var(--blue);
  background: rgba(251, 248, 236, 0.82);
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
}

.start-screen,
.character-screen,
.result-screen,
.finished-screen {
  height: 100vh;
  padding: 18px;
  display: grid;
  place-items: center;
}

.start-card,
.character-card,
.result-card,
.finished-card {
  width: min(1180px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.84), rgba(246, 250, 250, 0.82)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 42px var(--shadow);
  position: relative;
}

.start-title {
  font-size: 46px;
  color: var(--ink);
  margin: 0 0 12px;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.start-card p,
.finished-card p {
  color: #3e3522;
  font-size: 20px;
  line-height: 1.75;
}

.primary-btn {
  border: 0;
  background: linear-gradient(180deg, #d9b75d, #a77928);
  color: #fff;
  font-weight: 900;
  border-radius: 9px;
  padding: 13px 22px;
  font-size: 19px;
  cursor: pointer;
  box-shadow: 0 9px 20px rgba(14, 49, 70, 0.16);
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 22px;
}

.character-option {
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(157, 116, 38, 0.35);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  color: var(--ink);
  min-height: 245px;
}

.character-option:hover {
  background: rgba(217, 238, 247, 0.5);
}

.character-option h3 {
  color: var(--ink);
  font-size: 30px;
  margin: 8px 0;
}

.character-option p {
  color: #3e3522;
  line-height: 1.7;
  font-size: 17px;
}

.result-card h2,
.finished-card h2 {
  color: var(--ink);
  font-size: 34px;
  margin: 12px 0;
}

.effect-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 12px 0;
}

.effect-pill {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(217, 238, 247, 0.48);
  border: 1px solid rgba(157, 116, 38, 0.24);
  color: var(--ink);
  font-weight: 800;
}

.effect-pill.positive {
  color: #2e6b38;
}

.effect-pill.negative {
  color: #a44132;
}

.result-text {
  line-height: 1.85;
  font-size: 19px;
  color: var(--ink);
}

.original-effect {
  color: var(--gold-dark);
  font-weight: 900;
}

.footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-warning {
    display: flex;
  }

  .game-shell,
  .start-screen,
  .character-screen,
  .result-screen,
  .finished-screen {
    display: none;
  }
}

@media (max-width: 1150px) {
  .game-shell {
    min-width: 900px;
    padding: 8px;
    grid-template-rows: 58px 1fr;
  }

  .top-bar {
    height: 58px;
    grid-template-columns: 250px 1fr 170px;
  }

  .game-title {
    font-size: 24px;
  }

  .toolbar {
    gap: 12px;
  }

  .tool-icon {
    font-size: 18px;
  }

  .main-layout {
    grid-template-columns: 205px 1fr 220px;
  }

  .portrait-wrap {
    width: 82px;
    height: 82px;
  }

  .portrait-symbol {
    transform: scale(0.58);
  }

  .character-name {
    font-size: 21px;
  }

  .stat-row {
    grid-template-columns: 20px 56px 1fr 26px;
    gap: 4px;
  }

  .stat-label {
    font-size: 12px;
  }

  .scene-area {
    grid-template-rows: 42% 1fr;
  }

  .node-title {
    font-size: 24px;
  }

  .node-title-wrap::before,
  .node-title-wrap::after {
    width: 36px;
  }

  .story-text {
    font-size: 16px;
    line-height: 1.65;
    padding: 0 8px;
  }

  .choice-btn {
    min-height: 90px;
    padding: 10px 10px 10px 46px;
  }

  .choice-index {
    left: 10px;
    top: 12px;
  }

  .choice-title {
    font-size: 16px;
  }

  .choice-desc {
    font-size: 13px;
  }

  .side-button {
    font-size: 18px;
    padding: 10px;
  }

  .ai-title {
    font-size: 19px;
  }

  .ai-header {
    grid-template-columns: 54px 1fr;
  }

  .ai-face {
    width: 52px;
    height: 52px;
  }
}


/* v0.9 外部 AI API 智囊對話系統 */
.advisor-fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #d9b75d, #a77928);
  color: #fff;
  font-weight: 900;
  padding: 14px 20px;
  box-shadow: 0 12px 30px rgba(14, 49, 70, 0.24);
  cursor: pointer;
  letter-spacing: 0.08em;
}

.advisor-fab:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.advisor-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background:
    linear-gradient(rgba(10, 31, 48, 0.38), rgba(10, 31, 48, 0.38)),
    radial-gradient(circle at 80% 10%, rgba(212, 175, 55, 0.18), transparent 28%);
  display: grid;
  place-items: center;
  padding: 18px;
}

.advisor-window {
  width: min(1180px, calc(100vw - 36px));
  height: min(780px, calc(100vh - 36px));
  background:
    linear-gradient(180deg, rgba(255,255,255,0.94), rgba(246,250,250,0.96)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(14, 49, 70, 0.34);
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
  position: relative;
}

.advisor-window::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 9px;
  pointer-events: none;
}

.advisor-left {
  padding: 18px;
  border-right: 1px solid rgba(157, 116, 38, 0.26);
  background: linear-gradient(180deg, rgba(217, 238, 247, 0.72), rgba(251, 248, 236, 0.82));
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  min-height: 0;
}

.advisor-portrait {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  margin: 6px auto;
  border: 2px solid rgba(212, 175, 55, 0.7);
  background: linear-gradient(180deg, #f8f3df, #d9eef7);
  position: relative;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,0.7);
}

.advisor-portrait::before {
  content: "";
  position: absolute;
  left: 45px;
  top: 33px;
  width: 42px;
  height: 46px;
  background: #ead6b2;
  border-radius: 44%;
}

.advisor-portrait::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 20px;
  width: 70px;
  height: 20px;
  background: #1b242b;
  border-radius: 3px;
}

.advisor-name {
  text-align: center;
  font-size: 27px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: 0.08em;
}

.advisor-role {
  text-align: center;
  color: #5c6f78;
  line-height: 1.55;
  font-size: 14px;
}

.advisor-quick {
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: auto;
}

.advisor-quick button,
.advisor-close,
.advisor-speak,
.advisor-send {
  border: 1px solid rgba(157, 116, 38, 0.32);
  color: var(--blue);
  background: rgba(251, 248, 236, 0.9);
  border-radius: 9px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
}

.advisor-quick button:hover,
.advisor-close:hover,
.advisor-speak:hover,
.advisor-send:hover {
  background: rgba(217, 238, 247, 0.78);
}

.advisor-main {
  min-height: 0;
  padding: 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.advisor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(157, 116, 38, 0.25);
  padding-bottom: 10px;
}

.advisor-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0.08em;
}

.advisor-subtitle {
  color: #5c6f78;
  font-size: 14px;
  margin-top: 4px;
}

.advisor-messages {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 8px 4px 2px;
}

.advisor-message {
  max-width: 88%;
  border: 1px solid rgba(157, 116, 38, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.65;
  white-space: pre-line;
  color: var(--ink);
  background: rgba(251, 248, 236, 0.9);
}

.advisor-message.user {
  align-self: flex-end;
  background: rgba(217, 238, 247, 0.82);
}

.advisor-message.assistant {
  align-self: flex-start;
}

.advisor-message.system {
  align-self: center;
  color: #5c6f78;
  background: rgba(255,255,255,0.52);
  font-size: 14px;
}

.advisor-message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.advisor-message-row.assistant {
  justify-content: flex-start;
}

.advisor-message-row.user {
  justify-content: flex-end;
}

.advisor-speak {
  padding: 8px 9px;
  font-size: 14px;
}

.advisor-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.advisor-input {
  width: 100%;
  resize: none;
  border: 1px solid rgba(157, 116, 38, 0.35);
  border-radius: 10px;
  padding: 12px;
  min-height: 58px;
  font: inherit;
  line-height: 1.5;
  color: var(--ink);
  background: rgba(255,255,255,0.72);
}

.advisor-send {
  min-width: 96px;
  background: linear-gradient(180deg, #d9b75d, #a77928);
  color: #fff;
  border: 0;
}

.advisor-disclaimer {
  color: #6f6a5d;
  font-size: 12px;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .advisor-window {
    grid-template-columns: 1fr;
    height: calc(100vh - 20px);
    width: calc(100vw - 20px);
  }

  .advisor-left {
    display: none;
  }

  .advisor-overlay {
    padding: 10px;
  }
}


/* v1.2 學校授權碼 */
.license-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  background: rgba(10, 31, 48, 0.42);
  padding: 20px;
}

.license-card {
  width: min(560px, calc(100vw - 40px));
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,250,250,0.96)),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(14, 49, 70, 0.32);
  padding: 24px;
  color: var(--ink);
}

.license-card h2 {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 28px;
}

.license-card p {
  line-height: 1.7;
  color: #3e3522;
}

.license-input {
  width: 100%;
  border: 1px solid rgba(157, 116, 38, 0.4);
  border-radius: 10px;
  padding: 13px 14px;
  font: inherit;
  font-size: 18px;
  margin: 10px 0 14px;
  background: rgba(255,255,255,0.85);
}

.license-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.license-note {
  font-size: 13px;
  color: #6f6a5d !important;
}


/* v1.3 遊戲封面：圖片三 */
.start-screen,
.home-screen,
.title-screen,
.character-screen,
.menu-screen,
.landing-screen {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.06), rgba(12, 35, 52, 0.26)),
    url("./assets/cover_xining_fengyun_choice3_4x3.jpg") center center / cover no-repeat !important;
  position: relative;
}

.start-screen::before,
.home-screen::before,
.title-screen::before,
.character-screen::before,
.menu-screen::before,
.landing-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 246, 207, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(8, 28, 42, 0.24));
  z-index: 0;
}

.start-screen > *,
.home-screen > *,
.title-screen > *,
.character-screen > *,
.menu-screen > *,
.landing-screen > * {
  position: relative;
  z-index: 1;
}

.start-card,
.character-select-card,
.start-panel,
.menu-panel,
.landing-panel {
  background: rgba(251, 248, 236, 0.88) !important;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(212, 175, 55, 0.5) !important;
  box-shadow: 0 18px 50px rgba(12, 35, 52, 0.22);
}

.game-title,
.title-logo,
.start-screen h1,
.home-screen h1,
.title-screen h1,
.character-screen h1 {
  color: #f7d36a !important;
  text-shadow:
    0 3px 8px rgba(0,0,0,0.45),
    0 0 18px rgba(212,175,55,0.40);
}

.cover-choice-3 {
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.06), rgba(12, 35, 52, 0.26)),
    url("./assets/cover_xining_fengyun_choice3_4x3.jpg") center center / cover no-repeat !important;
}


/* v1.4 封面頁修正：移除說明卡，讓封面圖合理縮放 */
.cover-start-screen {
  width: 100vw;
  height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.02), rgba(12, 35, 52, 0.12)),
    url("./assets/cover_xining_fengyun_choice3_banner.jpg") center center / cover no-repeat !important;
}

/* 不再以 4:3 圖作 full-screen cover，避免桌面橫屏過度放大 */
.cover-start-screen.cover-choice-3 {
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.02), rgba(12, 35, 52, 0.12)),
    url("./assets/cover_xining_fengyun_choice3_banner.jpg") center center / cover no-repeat !important;
}

.cover-start-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 248, 218, 0.10), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.08));
  z-index: 0;
}

/* 把真正可點擊的開始遊戲放在封面圖底部「開始遊戲」位置 */
.cover-start-button {
  position: fixed;
  left: 26.5%;
  bottom: 3.1%;
  transform: translateX(-50%);
  z-index: 5;
  width: clamp(116px, 10vw, 190px);
  height: clamp(34px, 4.8vh, 58px);
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 8px;
  background: rgba(58, 38, 18, 0.32);
  color: #fff3bf;
  font-weight: 900;
  font-size: clamp(16px, 1.45vw, 24px);
  letter-spacing: 0.08em;
  cursor: pointer;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}

.cover-start-button:hover {
  background: rgba(157, 116, 38, 0.46);
  filter: brightness(1.08);
}

.cover-load-button {
  position: fixed;
  left: 41.5%;
  bottom: 3.1%;
  transform: translateX(-50%);
  z-index: 5;
  width: clamp(116px, 10vw, 190px);
  height: clamp(34px, 4.8vh, 58px);
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 8px;
  background: rgba(58, 38, 18, 0.20);
  color: #fff3bf;
  font-weight: 800;
  font-size: clamp(15px, 1.25vw, 22px);
  letter-spacing: 0.08em;
  cursor: pointer;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
}

.cover-load-button:hover {
  background: rgba(157, 116, 38, 0.38);
}

/* 封面頁不顯示舊的卡片樣式 */
.cover-start-screen .start-card {
  display: none !important;
}

@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen,
  .cover-start-screen.cover-choice-3 {
    background:
      linear-gradient(180deg, rgba(12, 35, 52, 0.02), rgba(12, 35, 52, 0.12)),
      url("./assets/cover_xining_fengyun_choice3_4x3.jpg") center center / cover no-repeat !important;
  }

  .cover-start-button {
    left: 30%;
    bottom: 4%;
  }

  .cover-load-button {
    left: 47%;
    bottom: 4%;
  }
}


/* v1.5：以 banner 圖調整成 4:3 作正式封面頁 */
.cover-start-screen,
.cover-start-screen.cover-choice-3,
.start-screen.cover-choice-3,
.home-screen.cover-choice-3,
.title-screen.cover-choice-3,
.character-screen.cover-choice-3,
.menu-screen.cover-choice-3,
.landing-screen.cover-choice-3 {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.01), rgba(12, 35, 52, 0.08)),
    url("./assets/cover_page_banner_4x3.jpg") center center / contain no-repeat,
    #0d344f !important;
}

/* 保證封面不會過度放大；寬屏時保留完整 4:3 封面 */
.cover-start-screen::before {
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 248, 218, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.04)) !important;
}

/* 依新 4:3 封面調整按鈕位置 */
.cover-start-button {
  left: 50%;
  bottom: 22.5%;
  transform: translateX(-50%);
  width: clamp(190px, 18vw, 320px);
  height: clamp(54px, 7vh, 82px);
  font-size: clamp(24px, 2.4vw, 42px);
  border-radius: 12px;
  background: rgba(170, 113, 30, 0.22);
  border: 1px solid rgba(245, 211, 120, 0.55);
}

.cover-load-button {
  left: 50%;
  bottom: 13.2%;
  transform: translateX(-50%);
  width: clamp(170px, 16vw, 280px);
  height: clamp(44px, 5.8vh, 68px);
  font-size: clamp(20px, 1.9vw, 34px);
  border-radius: 10px;
  background: rgba(245, 238, 220, 0.18);
  border: 1px solid rgba(245, 211, 120, 0.36);
}

@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen,
  .cover-start-screen.cover-choice-3,
  .start-screen.cover-choice-3,
  .home-screen.cover-choice-3,
  .title-screen.cover-choice-3,
  .character-screen.cover-choice-3,
  .menu-screen.cover-choice-3,
  .landing-screen.cover-choice-3 {
    background:
      linear-gradient(180deg, rgba(12, 35, 52, 0.01), rgba(12, 35, 52, 0.08)),
      url("./assets/cover_page_banner_4x3.jpg") center center / cover no-repeat !important;
  }

  .cover-start-button {
    bottom: 21%;
  }

  .cover-load-button {
    bottom: 11.5%;
  }
}


/* v1.6 角色選擇頁更新 */
.character-screen.role-select-screen,
.character-screen.cover-choice-3.role-select-screen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 18px !important;
  display: grid !important;
  place-items: center !important;
  overflow: auto !important;
  background:
    linear-gradient(180deg, rgba(12, 35, 52, 0.06), rgba(12, 35, 52, 0.24)),
    url("./assets/cover_page_banner_4x3.jpg") center center / cover no-repeat !important;
}

.role-select-card {
  width: min(1180px, calc(100vw - 56px)) !important;
  max-height: calc(100vh - 56px);
  overflow: auto;
  margin: 0 auto !important;
  padding: 28px 30px 30px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(246,250,250,0.84)),
    var(--paper) !important;
  border: 1px solid rgba(212, 175, 55, 0.55) !important;
  border-radius: 14px !important;
  box-shadow: 0 18px 52px rgba(12, 35, 52, 0.26) !important;
  text-align: center;
}

.role-select-card .start-title {
  margin-bottom: 8px;
}

.role-select-card > p {
  margin: 0 auto;
  max-width: 820px;
  color: #3e3522;
  line-height: 1.7;
  font-size: 18px;
}

.role-select-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 22px !important;
  align-items: stretch;
  margin-top: 22px !important;
}

.character-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 430px !important;
  padding: 18px 16px 20px !important;
  background: rgba(255,255,255,0.58) !important;
  border: 1px solid rgba(157, 116, 38, 0.36) !important;
  border-radius: 14px !important;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.character-option:hover {
  transform: translateY(-3px);
  background: rgba(217, 238, 247, 0.66) !important;
  box-shadow: 0 12px 30px rgba(12, 35, 52, 0.18);
}

.character-select-portrait {
  width: min(230px, 18vw);
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  border: 2px solid rgba(212, 175, 55, 0.68);
  background: rgba(251, 248, 236, 0.85);
  overflow: hidden;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,0.48), 0 8px 24px rgba(12, 35, 52, 0.16);
}

.character-select-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.character-option h3 {
  font-size: 30px !important;
  margin: 12px 0 8px !important;
  color: var(--ink) !important;
}

.character-option p {
  font-size: 16px !important;
  line-height: 1.62 !important;
  color: #3e3522 !important;
  text-align: left;
  margin: 0;
}

.character-option-wangAnshi {
  order: 1;
}

.character-option-songShenzong {
  order: 2;
}

.character-option-simaGuang {
  order: 3;
}

/* 遊戲內左側角色資訊亦使用正式立繪 */
.portrait-image-wrap {
  background: rgba(251, 248, 236, 0.9) !important;
}

.profile-portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

@media (max-width: 1150px) {
  .character-select-portrait {
    width: 145px;
  }

  .character-option {
    min-height: 330px !important;
    padding: 14px 12px !important;
  }

  .character-option h3 {
    font-size: 24px !important;
  }

  .character-option p {
    font-size: 13px !important;
    line-height: 1.5 !important;
  }
}


/* v1.7：4K封面頁、移除底部文字雜訊、底部並排細按鈕 */
.cover-start-screen-v17,
.cover-start-screen.cover-start-screen-v17,
.start-screen.cover-start-screen-v17,
.start-screen.cover-choice-3.cover-start-screen-v17 {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    url("./assets/cover_page_clean_4k_4x3.jpg") center center / contain no-repeat,
    #0d344f !important;
}

/* 寬螢幕以完整 4:3 圖置中顯示，避免裁走封面主體 */
@media (min-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_clean_4k_4x3.jpg") center center / contain no-repeat,
      #0d344f !important;
  }
}

/* 較窄螢幕可滿版，仍保持封面完整感 */
@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_clean_4k_4x3.jpg") center center / cover no-repeat,
      #0d344f !important;
  }
}

.cover-start-screen-v17::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 248, 218, 0.04), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.03));
  z-index: 0;
}

.cover-button-row {
  position: fixed;
  left: 50%;
  bottom: clamp(28px, 5.2vh, 72px);
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 1.5vw, 26px);
}

.cover-menu-button {
  width: clamp(128px, 9.6vw, 184px);
  height: clamp(38px, 4.6vh, 54px);
  border-radius: 999px;
  border: 1px solid rgba(245, 211, 120, 0.60);
  background: linear-gradient(180deg, rgba(190, 130, 36, 0.88), rgba(117, 72, 20, 0.86));
  color: #fff3bf;
  font-weight: 900;
  font-size: clamp(16px, 1.22vw, 22px);
  letter-spacing: 0.10em;
  cursor: pointer;
  text-shadow: 0 2px 5px rgba(0,0,0,0.58);
  box-shadow:
    0 8px 20px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.28);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.cover-menu-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow:
    0 12px 26px rgba(0,0,0,0.26),
    inset 0 1px 0 rgba(255,255,255,0.34);
}

.cover-load-save-button {
  background: linear-gradient(180deg, rgba(247, 241, 225, 0.86), rgba(202, 188, 151, 0.84));
  color: #183247;
  border-color: rgba(245, 211, 120, 0.42);
  text-shadow: none;
}

/* 停用 v1.4/v1.5 舊的絕對定位按鈕設定 */
.cover-start-screen-v17 .cover-start-button,
.cover-start-screen-v17 .cover-load-button {
  position: static !important;
  transform: none !important;
}

/* 封面頁不再顯示任何舊卡片／舊文字 */
.cover-start-screen-v17 .start-card,
.cover-start-screen-v17 .start-panel,
.cover-start-screen-v17 .landing-panel,
.cover-start-screen-v17 .menu-panel {
  display: none !important;
}


/* v1.8：中心橫額變成 full page 封面 */
.cover-start-screen-v17,
.cover-start-screen.cover-start-screen-v17,
.start-screen.cover-start-screen-v17,
.start-screen.cover-choice-3.cover-start-screen-v17 {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    url("./assets/cover_page_full_4k_4x3.jpg") center center / cover no-repeat,
    #0d344f !important;
}

/* 覆蓋 v1.7 的 contain 設定：封面必須鋪滿整頁 */
@media (min-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_full_4k_4x3.jpg") center center / cover no-repeat,
      #0d344f !important;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_full_4k_4x3.jpg") center center / cover no-repeat,
      #0d344f !important;
  }
}

/* 保持封面乾淨，不加上下模糊帶 */
.cover-start-screen-v17::before {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.05)) !important;
}

/* 按鈕維持底部並排，稍微上移避免貼邊 */
.cover-button-row {
  bottom: clamp(30px, 5.8vh, 76px) !important;
}


/* v1.9：重新修改尺寸後的真正 4:3 封面圖 */
.cover-start-screen-v17,
.cover-start-screen.cover-start-screen-v17,
.start-screen.cover-start-screen-v17,
.start-screen.cover-choice-3.cover-start-screen-v17 {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    url("./assets/cover_page_resized_true_4k_4x3.jpg") center center / cover no-repeat,
    #0d344f !important;
}

/* 覆蓋舊版 cover / contain 設定 */
@media (min-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_resized_true_4k_4x3.jpg") center center / cover no-repeat,
      #0d344f !important;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_resized_true_4k_4x3.jpg") center center / cover no-repeat,
      #0d344f !important;
  }
}

/* 新封面不再使用舊的橫額補底／模糊邊 */
.cover-start-screen-v17::before {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.04)) !important;
}

/* 按鈕維持底部並排，但移至新封面留白區 */
.cover-button-row {
  bottom: clamp(34px, 5.4vh, 78px) !important;
  gap: clamp(14px, 1.5vw, 24px) !important;
}

.cover-menu-button {
  width: clamp(128px, 9.4vw, 178px) !important;
  height: clamp(38px, 4.4vh, 52px) !important;
  font-size: clamp(16px, 1.16vw, 21px) !important;
}


/* v2.0：正式封面頁更新，使用使用者上傳的新遊戲封面 */
.cover-start-screen-v17,
.cover-start-screen.cover-start-screen-v17,
.start-screen.cover-start-screen-v17,
.start-screen.cover-choice-3.cover-start-screen-v17 {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  padding: 0 !important;
  display: block !important;
  overflow: hidden;
  background:
    url("./assets/cover_page_final_4k.png") center center / cover no-repeat,
    #0d344f !important;
}

@media (min-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_final_4k.png") center center / cover no-repeat,
      #0d344f !important;
  }
}

@media (max-aspect-ratio: 4 / 3) {
  .cover-start-screen-v17,
  .cover-start-screen.cover-start-screen-v17,
  .start-screen.cover-start-screen-v17,
  .start-screen.cover-choice-3.cover-start-screen-v17 {
    background:
      url("./assets/cover_page_final_4k.png") center center / cover no-repeat,
      #0d344f !important;
  }
}

.cover-start-screen-v17::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.00), rgba(8, 28, 42, 0.04)) !important;
}

/* 封面按鈕：只保留進入遊戲、讀取存檔，底部並排，不過大 */
.cover-button-row {
  position: fixed !important;
  left: 50% !important;
  bottom: clamp(30px, 5.2vh, 76px) !important;
  transform: translateX(-50%) !important;
  z-index: 5 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: clamp(14px, 1.5vw, 24px) !important;
}

.cover-menu-button {
  width: clamp(128px, 9.4vw, 178px) !important;
  height: clamp(38px, 4.4vh, 52px) !important;
  border-radius: 999px !important;
  font-size: clamp(16px, 1.16vw, 21px) !important;
  letter-spacing: 0.10em !important;
}


/* v2.1 節點轉場動畫 */
.transition-screen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 44px);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 244, 203, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(5, 28, 44, 0.34), rgba(5, 28, 44, 0.68)),
    url("./assets/cover_page_final_4k.png") center center / cover no-repeat,
    #0d344f;
  position: relative;
}

.transition-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 52, 79, 0.55), rgba(255,255,255,0.02), rgba(13, 52, 79, 0.55));
  pointer-events: none;
}

.transition-bg-mist {
  position: absolute;
  inset: -12%;
  background:
    radial-gradient(circle at 18% 78%, rgba(226, 242, 246, 0.22), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(245, 211, 120, 0.16), transparent 32%),
    linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.15) 45%, transparent 62%);
  animation: transitionMistDrift 9s ease-in-out infinite alternate;
  pointer-events: none;
}

.transition-card {
  position: relative;
  z-index: 2;
  width: min(900px, 88vw);
  min-height: min(560px, 72vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(34px, 5vw, 72px);
  border-radius: 18px;
  border: 1px solid rgba(245, 211, 120, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 252, 239, 0.90), rgba(239, 247, 249, 0.82)),
    rgba(251, 248, 236, 0.82);
  box-shadow:
    0 22px 80px rgba(0,0,0,0.32),
    inset 0 0 0 6px rgba(255,255,255,0.26);
  backdrop-filter: blur(8px);
  animation: transitionCardIn 780ms cubic-bezier(.2,.8,.2,1) both;
}

.transition-chapter {
  color: var(--blue);
  font-size: clamp(30px, 4.2vw, 58px);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-shadow: 0 2px 0 rgba(255,255,255,0.55);
  animation: transitionTextRise 650ms 160ms both;
}

.transition-period,
.transition-node-period {
  color: #5c6f78;
  font-size: clamp(15px, 1.35vw, 20px);
  margin-top: 8px;
  letter-spacing: 0.08em;
  animation: transitionTextRise 650ms 260ms both;
}

.transition-divider {
  width: min(520px, 64vw);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
  margin: clamp(22px, 3vh, 34px) 0 clamp(16px, 2.4vh, 26px);
  color: #a77928;
  animation: transitionTextRise 650ms 340ms both;
}

.transition-divider span {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 121, 40, 0.72), transparent);
}

.transition-divider b {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(167, 121, 40, 0.45);
  border-radius: 50%;
  background: rgba(255,255,255,0.48);
}

.transition-node-title {
  margin: 0;
  color: #2c250e;
  font-size: clamp(28px, 3vw, 46px);
  letter-spacing: 0.08em;
  animation: transitionTextRise 650ms 420ms both;
}

.transition-body {
  margin: clamp(20px, 3vh, 32px) auto 0;
  max-width: 760px;
  color: #2f3027;
  font-size: clamp(18px, 1.7vw, 26px);
  line-height: 1.85;
  text-align: left;
  animation: transitionTextRise 720ms 520ms both;
}

.transition-actions {
  margin-top: clamp(24px, 4vh, 44px);
  animation: transitionTextRise 720ms 680ms both;
}

.transition-enter-btn {
  border: 1px solid rgba(245, 211, 120, 0.72);
  border-radius: 999px;
  padding: 12px 28px;
  min-width: 156px;
  background: linear-gradient(180deg, rgba(190, 130, 36, 0.94), rgba(117, 72, 20, 0.92));
  color: #fff6cc;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.32);
}

.transition-enter-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

@keyframes transitionCardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes transitionTextRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes transitionMistDrift {
  from {
    transform: translate3d(-1.5%, 0, 0) scale(1);
    opacity: 0.72;
  }
  to {
    transform: translate3d(1.5%, -1%, 0) scale(1.03);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .transition-card {
    width: 94vw;
    min-height: 68vh;
    padding: 26px;
  }

  .transition-body {
    font-size: 17px;
    line-height: 1.7;
  }
}


/* v2.2 歷史背景按鈕與彈窗 */
.history-button-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  text-align: center;
}

.inline-history-button-wrap {
  margin: 12px 0 8px;
  display: flex;
  justify-content: flex-start;
}

.history-background-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(157, 116, 38, 0.42);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 252, 239, 0.94), rgba(232, 244, 248, 0.88));
  color: var(--blue);
  padding: 10px 16px;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(12, 35, 52, 0.10);
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease;
}

.history-background-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 12px 26px rgba(12, 35, 52, 0.16);
}

.history-background-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.22);
  color: #8b5f18;
  font-size: 13px;
  font-weight: 900;
}

.history-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  background:
    radial-gradient(circle at 50% 30%, rgba(245, 211, 120, 0.16), transparent 34%),
    rgba(5, 24, 38, 0.56);
  backdrop-filter: blur(5px);
  animation: historyModalFadeIn 180ms ease-out both;
}

.history-modal-panel {
  width: min(920px, 92vw);
  max-height: min(760px, 86vh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(212, 175, 55, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 252, 239, 0.96), rgba(239, 247, 249, 0.94)),
    var(--paper);
  box-shadow:
    0 28px 90px rgba(0,0,0,0.36),
    inset 0 0 0 6px rgba(255,255,255,0.24);
  animation: historyModalSlideIn 240ms cubic-bezier(.2,.8,.2,1) both;
}

.history-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(157, 116, 38, 0.24);
}

.history-modal-header h2 {
  margin: 0;
  color: var(--blue);
  font-size: clamp(24px, 2.6vw, 38px);
  letter-spacing: 0.08em;
}

.history-modal-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(157, 116, 38, 0.35);
  border-radius: 50%;
  background: rgba(255,255,255,0.64);
  color: #7a5217;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.history-modal-content {
  overflow: auto;
  padding: 22px 28px;
  color: #2e3028;
  font-size: clamp(17px, 1.55vw, 22px);
  line-height: 1.9;
  white-space: pre-line;
  text-align: left;
}

.history-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(157, 116, 38, 0.20);
}

.history-modal-ok {
  border: 1px solid rgba(245, 211, 120, 0.66);
  border-radius: 999px;
  padding: 10px 22px;
  background: linear-gradient(180deg, rgba(190, 130, 36, 0.94), rgba(117, 72, 20, 0.92));
  color: #fff6cc;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}

@keyframes historyModalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes historyModalSlideIn { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }


/* v2.3 文字標籤清理 */
.monologue::before,
.monologue-label,
.inner-monologue-label {
  content: none !important;
  display: none !important;
}


/* v2.4 歷史迴響：五角雷達圖顯示指標變化 */
.result-screen-radar {
  min-height: 100vh;
  padding: 18px;
  background:
    radial-gradient(circle at 50% 18%, rgba(245, 211, 120, 0.12), transparent 30%),
    linear-gradient(180deg, #eef7fa, #f8fbfb);
}

.result-card-radar {
  width: min(1320px, calc(100vw - 48px));
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
}

.result-card-radar > h2 {
  margin: 22px 0 10px;
  color: var(--ink);
  font-size: clamp(32px, 3vw, 46px);
  letter-spacing: 0.06em;
}

.result-radar-layout {
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.result-explanation-panel {
  width: min(980px, 92%);
  margin: 0 auto;
  padding: 14px 20px;
  border-left: 5px solid var(--blue);
  border-radius: 10px;
  background: rgba(231, 245, 250, 0.78);
  color: #2e3028;
  font-size: clamp(18px, 1.55vw, 25px);
  line-height: 1.75;
  text-align: left;
}

.result-explanation-panel p,
.result-history-note p {
  margin: 0;
}

.result-radar-wrap {
  position: relative;
  width: min(620px, 56vh, 80vw);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.result-radar-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 16px 30px rgba(12, 35, 52, 0.10));
}

.result-radar-svg {
  position: absolute;
  inset: 9.5%;
  width: 81%;
  height: 81%;
  overflow: visible;
}

.radar-before-polygon {
  fill: rgba(44, 82, 101, 0.10);
  stroke: rgba(44, 82, 101, 0.54);
  stroke-width: 3;
  stroke-dasharray: 7 7;
}

.radar-after-polygon {
  fill: rgba(196, 138, 34, 0.26);
  stroke: rgba(177, 111, 20, 0.92);
  stroke-width: 5;
  filter: drop-shadow(0 4px 7px rgba(177, 111, 20, 0.28));
}

.radar-after-dot {
  fill: #b16f14;
  stroke: #fff6cc;
  stroke-width: 2;
}

.radar-axis-label {
  font-size: 24px;
  font-weight: 900;
  fill: #0d344f;
  paint-order: stroke;
  stroke: rgba(255, 252, 239, 0.92);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.radar-legend {
  position: absolute;
  left: 50%;
  bottom: 7.8%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 252, 239, 0.78);
  border: 1px solid rgba(157, 116, 38, 0.22);
  color: #2e3028;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.radar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.radar-legend i {
  width: 18px;
  height: 10px;
  display: inline-block;
  border-radius: 999px;
}

.legend-before {
  background: rgba(44, 82, 101, 0.22);
  border: 1px dashed rgba(44, 82, 101, 0.70);
}

.legend-after {
  background: rgba(196, 138, 34, 0.36);
  border: 1px solid rgba(177, 111, 20, 0.80);
}

.result-history-note {
  width: min(980px, 92%);
  margin: 0 auto;
  padding: 12px 18px;
  border-radius: 10px;
  background: rgba(255, 252, 239, 0.70);
  color: #2e3028;
  font-size: clamp(16px, 1.25vw, 21px);
  line-height: 1.7;
  text-align: left;
}

.result-footer-actions {
  margin-top: 16px;
}

@media (max-width: 980px) {
  .result-card-radar {
    width: calc(100vw - 24px);
    padding: 18px;
  }

  .result-radar-wrap {
    width: min(520px, 54vh, 86vw);
  }

  .radar-axis-label {
    font-size: 20px;
  }

  .radar-legend {
    font-size: 12px;
    bottom: 6%;
  }
}


/* v2.5 按鈕修正 */
.inline-history-button-wrap {
  display: none !important;
}

/* 選擇頁不顯示歷史迴響按鈕；歷史迴響只在完成選擇後進入 */
.history-echo-button,
.echo-button,
.history-echo-panel,
.side-history-echo {
  display: none !important;
}


/* v2.6 右側按鈕精準清理 */
.ai-panel .history-box.history-button-box {
  display: none !important;
}

button.side-button:not([onclick]) {
  display: none !important;
}


/* V2.8 蝴蝶效應命運揭示版 */
.butterfly-shell-v28 {
  background:
    radial-gradient(circle at 50% 16%, rgba(245, 211, 120, 0.12), transparent 34%),
    linear-gradient(180deg, #eef7fa, #f8fbfb);
}

.butterfly-layout-v28 {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 330px;
  gap: 14px;
  min-height: calc(100vh - 122px);
}

.butterfly-content-panel {
  padding: 24px;
  overflow: auto;
}

.butterfly-reveal-header {
  text-align: center;
  max-width: 920px;
  margin: 0 auto 18px;
}

.butterfly-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  border: 1px solid rgba(157, 116, 38, 0.35);
  border-radius: 999px;
  background: rgba(255, 252, 239, 0.80);
  color: #8b5f18;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.butterfly-reveal-header h2 {
  margin: 12px 0 10px;
  color: var(--ink);
  font-size: clamp(30px, 3vw, 48px);
  letter-spacing: 0.05em;
}

.butterfly-reveal-header p {
  margin: 6px auto;
  color: #2e3028;
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.7;
  max-width: 880px;
}

.butterfly-reveal-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.butterfly-reveal-card {
  min-height: 310px;
  padding: 18px;
  border: 1px solid rgba(212, 175, 55, 0.46);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 252, 239, 0.94), rgba(239, 247, 249, 0.86));
  box-shadow: 0 16px 34px rgba(12, 35, 52, 0.12);
  animation: butterflyCardIn 620ms cubic-bezier(.2,.8,.2,1) both;
  animation-delay: var(--delay);
}

.butterfly-card-alive {
  border-color: rgba(75, 132, 79, 0.42);
}

.butterfly-card-history {
  border-color: rgba(157, 116, 38, 0.54);
  background:
    linear-gradient(180deg, rgba(255, 248, 231, 0.96), rgba(244, 238, 224, 0.88));
}

.butterfly-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.butterfly-person-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.18);
  border: 1px solid rgba(157, 116, 38, 0.32);
  font-size: 25px;
}

.butterfly-person-name {
  color: var(--blue);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.butterfly-status-pill {
  display: inline-flex;
  margin-top: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(13, 52, 79, 0.08);
  color: #6f5321;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.butterfly-reveal-card h3 {
  margin: 8px 0 10px;
  color: #2c250e;
  font-size: 24px;
  line-height: 1.35;
}

.butterfly-reveal-card p {
  margin: 0;
  color: #2e3028;
  font-size: 17px;
  line-height: 1.75;
  white-space: pre-line;
}

.butterfly-summary-card {
  width: min(900px, 94%);
  margin: 12px auto 0;
  padding: 16px 20px;
  border-left: 5px solid var(--blue);
  border-radius: 12px;
  background: rgba(231, 245, 250, 0.78);
  color: #2e3028;
  font-size: 19px;
  line-height: 1.8;
  white-space: pre-line;
}

.butterfly-summary-card p {
  margin: 0;
}

.butterfly-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.butterfly-profile-note {
  margin: 16px 0 0;
  color: #3e3522;
  font-size: 16px;
  line-height: 1.65;
  text-align: center;
}

.butterfly-profile-panel .stat-list,
.butterfly-profile-panel .detail-button {
  display: none !important;
}

@keyframes butterflyCardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.985);
    filter: blur(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@media (max-width: 1250px) {
  .butterfly-layout-v28 {
    grid-template-columns: 250px minmax(0, 1fr) 280px;
  }

  .butterfly-reveal-cards {
    gap: 10px;
  }

  .butterfly-reveal-card {
    padding: 14px;
  }

  .butterfly-reveal-card h3 {
    font-size: 20px;
  }

  .butterfly-reveal-card p {
    font-size: 15px;
    line-height: 1.65;
  }
}


/* V2.9 蝴蝶效應：只顯示當前角色命運卡 */
.single-butterfly-reveal {
  grid-template-columns: minmax(360px, 720px) !important;
  justify-content: center;
}

.single-butterfly-card {
  min-height: 330px;
  width: min(720px, 100%);
}

.single-butterfly-card .butterfly-reveal-card p,
.single-butterfly-card p {
  white-space: pre-line;
}

.butterfly-summary-card p {
  white-space: pre-line;
}
