:root {
  --paper: #f8fbf8;
  --mist: #e8f7f2;
  --sky: #d7eef8;
  --ink: #183143;
  --muted: #667986;
  --line: rgba(28, 73, 96, 0.16);
  --blue: #1b9bd1;
  --green: #3ab98a;
  --gold: #f2b84b;
  --red: #e96f5f;
  --violet: #7a77d9;
  --panel: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 42px rgba(32, 86, 110, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background:
    linear-gradient(120deg, rgba(216, 245, 235, 0.88), rgba(214, 235, 248, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.32) 0 1px, transparent 1px 30px);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.danger-soft {
  color: #9e382c;
  background: #fff0ec;
  border: 1px solid rgba(233, 111, 95, 0.38);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.setup-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.setup-card {
  width: min(1120px, 100%);
  display: grid;
  gap: 24px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.room-landing { width: min(1120px, 100%); }
.room-card { width: 100%; }
.room-entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.room-entry-grid .setup-form, .room-members, .room-wait { display: grid; gap: 12px; padding: 20px; background: rgba(246, 251, 253, .8); border: 1px solid var(--line); }
.room-members ul, .day-event-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.room-members li, .day-event-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px; background: white; border: 1px solid var(--line); }
.room-members li span { color: var(--muted); font-size: .8rem; }
.day-event-list li span { color: var(--muted); }
.game-shell { display: block; }
.game-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px clamp(16px, 4vw, 48px); background: rgba(255,255,255,.86); border-bottom: 1px solid var(--line); }
.game-brand { color: var(--ink); font-weight: 900; text-decoration: none; letter-spacing: .08em; }
.game-header-menu { position: relative; }
.game-header-menu summary { padding: 6px 10px; list-style: none; cursor: pointer; color: var(--ink); background: white; border: 1px solid var(--line); font-size: 1.2rem; }
.game-header-menu summary::-webkit-details-marker { display: none; }
.game-header-menu > div { position: absolute; right: 0; z-index: 100; display: grid; min-width: 150px; padding: 8px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.game-header-menu button { padding: 9px 10px; text-align: left; color: var(--ink); background: transparent; border: 0; }
.game-header-menu button:hover { background: var(--mist); }
@media (max-width: 680px) { .room-entry-grid { grid-template-columns: 1fr; } .room-members li, .day-event-list li { align-items: flex-start; flex-direction: column; } }

.setup-title h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
}

.eyebrow,
.setup-title p,
.turn-strip p {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

.setup-form,
.setup-options {
  display: grid;
  gap: 16px;
}

.setup-options {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.check-line {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.setup-footer {
  display: grid;
  grid-template-columns: minmax(180px, 300px) auto;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(250, 254, 252, 0.9);
}

.sidebar.collapsed {
  width: 84px;
}

.sidebar.collapsed .brand-row div,
.sidebar.collapsed .side-panel,
.sidebar.collapsed .side-actions button {
  display: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row h1 {
  font-size: 1.32rem;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: white;
}

.side-actions {
  display: grid;
  gap: 8px;
}

.side-actions button,
.battle-actions button,
.inventory button,
.primary,
.secondary,
.action-card,
.game-card button {
  min-height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.primary {
  border-color: transparent;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

.secondary {
  background: #eef5f7;
}

.side-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.feed {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}

.feed p {
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
}

.play-area {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  padding: 20px;
}

.top-summary,
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.top-summary {
  display: grid;
  gap: 16px;
  padding: 16px;
}

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

.turn-strip>div {
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
}

.turn-strip strong {
  display: block;
  font-size: 1.35rem;
}

.turn-strip span {
  color: var(--muted);
  font-size: 0.9rem;
}

.player-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.player-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: white;
}

.player-card.active {
  animation: activePulse 1.25s ease-in-out infinite;
}

.player-head {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
}

.player-head img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--mist);
}

.player-head h3 {
  font-size: 1rem;
}

.player-head p,
.mini-line,
.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.rank {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 34px;
  padding: 5px 8px;
  color: white;
  background: var(--blue);
  text-align: center;
  font-weight: 900;
}

.rank-a,
.rank-s {
  background: linear-gradient(135deg, var(--gold), #fff0a3);
  color: #6d4700;
  box-shadow: 0 0 22px rgba(242, 184, 75, 0.45);
}

.stage {
  min-height: 560px;
  padding: 20px;
}

.hero-band,
.spotlight,
.view-title,
.equipment-bar,
.inventory,
.material-board,
.result-panel,
.final-panel {
  margin-bottom: 18px;
}

.hero-band {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 18px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.hero-band img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
}

.hero-band h2,
.view-title h2,
.result-panel h2,
.final-panel h2 {
  font-size: clamp(1.7rem, 4vw, 3rem);
}

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

.hub-forge-preview {
  display: grid;
  gap: 12px;
  margin-top: 36px;
  padding: 18px;
  border: 1px solid rgba(27, 155, 209, 0.2);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(234, 248, 255, 0.88));
  box-shadow: 0 14px 28px rgba(43, 104, 132, 0.09);
}

.hub-forge-preview-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.hub-forge-preview-title h3,
.hub-forge-preview-title p {
  margin: 0;
}

.hub-forge-preview-title h3 {
  font-size: 1.12rem;
}

.hub-forge-preview-title > span {
  color: var(--muted);
  font-size: 0.8rem;
}

.hub-forge-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hub-forge-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(27, 155, 209, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.hub-forge-list li.with-image {
  justify-content: start;
}

.hub-forge-list li.with-image > img {
  width: 38px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--mist);
}

.hub-forge-list li.with-image .hub-forge-materials {
  margin-left: auto;
}

.hub-forge-list .detail-token > small {
  display: none;
}

.hub-forge-list .detail-token {
  min-width: 0;
  background: white;
}

.hub-forge-materials {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 4px;
}

.hub-forge-materials .material-chip {
  min-height: 25px;
  padding: 3px 5px;
  font-size: 0.7rem;
}

.hub-forge-materials .material-chip span {
  display: none;
}

.hub-forge-materials .material-chip b {
  width: 20px;
  height: 20px;
  font-size: 0.76rem;
}

.campaign-ribbon {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 14px;
  color: #704600;
  background: linear-gradient(135deg, #fff3b7, #dffcff);
  border: 1px solid rgba(240, 186, 64, 0.42);
  box-shadow: 0 10px 22px rgba(234, 177, 52, 0.16);
  animation: campaignPulse 1.8s ease-in-out infinite;
}

.campaign-ribbon b {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.campaign-ribbon span {
  font-size: 0.75rem;
}

.action-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 250px;
  padding: 16px;
  text-align: left;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.action-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.action-card img {
  width: 100%;
  aspect-ratio: 1.25;
  object-fit: contain;
  background: var(--mist);
  border: 1px solid var(--line);
}

.action-card span {
  font-size: 1.25rem;
}

.action-card small {
  color: var(--muted);
  line-height: 1.5;
}

.spotlight {
  padding: 14px;
  border-left: 5px solid var(--gold);
  background: rgba(255, 255, 255, 0.78);
}

.forge-spotlight {
  margin-top: 22px;
}

.quest-forge-spotlight>h3,
.quest-forge-spotlight>p {
  display: none;
}

.spotlight-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.spotlight-head h3,
.spotlight-head p {
  margin: 0;
}

.secondary.compact {
  min-width: 120px;
  padding: 8px 12px;
  font-size: 0.86rem;
}

.split {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(280px, 1fr);
  gap: 18px;
}

.feature-panel,
.list-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.deck-stack {
  position: relative;
  height: 170px;
}

.deck-stack span {
  position: absolute;
  display: grid;
  place-items: center;
  width: 120px;
  height: 160px;
  color: white;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border: 4px solid white;
  box-shadow: var(--shadow);
}

.deck-stack span:nth-child(2) {
  left: 28px;
  transform: rotate(5deg);
}

.deck-stack span:nth-child(3) {
  left: 56px;
  transform: rotate(10deg);
}

.mini-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  background: white;
}

.mini-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.quest-grid,
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.quest-card,
.game-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  background: white;
}

.shop-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.shop-note strong {
  color: var(--ink);
}

.shop-card.can-buy {
  border-color: rgba(58, 185, 138, 0.5);
  background:
    radial-gradient(circle at 88% 8%, rgba(58, 185, 138, 0.16), transparent 28%),
    white;
  box-shadow: 0 14px 30px rgba(58, 185, 138, 0.12);
}

.shop-card.open-equipment-slot {
  border-color: rgba(45, 134, 214, 0.82);
  box-shadow:
    0 0 0 3px rgba(45, 134, 214, 0.14),
    0 14px 30px rgba(45, 134, 214, 0.16);
}

.shop-open-slot-note,
.shop-stat-delta {
  margin: -4px 0 0;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.shop-open-slot-note {
  width: fit-content;
  color: #1f5f9a;
  background: rgba(222, 241, 255, 0.92);
  border: 1px solid rgba(45, 134, 214, 0.28);
}

.shop-stat-delta {
  color: #166949;
  background: rgba(225, 249, 238, 0.92);
  border: 1px solid rgba(58, 185, 138, 0.28);
}

.shop-card.cannot-buy {
  filter: saturate(0.72);
}

.quest-card img,
.game-card>img {
  width: 100%;
  aspect-ratio: 1.6;
  object-fit: cover;
  background: var(--mist);
  border: 1px solid var(--line);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.05);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.quest-card h3,
.game-card h3 {
  font-size: 1.15rem;
}

.quest-rank-badge {
  display: inline-grid;
  place-items: center;
  min-width: 74px;
  padding: 4px 9px;
  border-radius: 999px;
  color: white;
  background: #8fa3b3;
  box-shadow: 0 8px 18px rgba(32, 86, 110, 0.12);
}

.quest-rank-badge.rank-f {
  background: #8fa3b3;
}

.quest-rank-badge.rank-e {
  background: #4aa6c8;
}

.quest-rank-badge.rank-d {
  background: #3ab98a;
}

.quest-rank-badge.rank-c {
  background: #d99b32;
}

.quest-rank-badge.rank-b {
  background: #e97857;
}

.quest-rank-badge.rank-a,
.quest-rank-badge.rank-s {
  color: #653d00;
  background: linear-gradient(135deg, #fff6b8, #ffc94b, #fff4a3);
  box-shadow: 0 0 18px rgba(255, 204, 68, 0.45);
  animation: badgeGlow 1.8s ease-in-out infinite;
}

.quest-card.higher-rank {
  border-color: rgba(242, 184, 75, 0.58);
  background:
    radial-gradient(circle at 88% 8%, rgba(242, 184, 75, 0.18), transparent 28%),
    white;
  box-shadow: 0 18px 42px rgba(196, 137, 23, 0.13);
}

.quest-rank-note {
  padding: 8px 10px;
  border: 1px solid rgba(73, 155, 203, 0.15);
  border-radius: 14px;
  background: rgba(232, 247, 242, 0.64);
  color: var(--muted);
  font-size: 0.88rem;
}

.quest-rank-note b {
  color: #a65f00;
}

.quest-card p,
.game-card li,
.result-lines,
.final-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.game-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.rarity-rare {
  border-top: 5px solid var(--blue);
  box-shadow: 0 4px 12px rgba(27, 155, 209, 0.1);
}

.rarity-legend {
  border-top: 5px solid var(--green);
  box-shadow: 0 4px 12px rgba(58, 185, 138, 0.15);
}

.rarity-legendary {
  border-top: 5px solid var(--gold);
  box-shadow: 0 0 20px rgba(242, 184, 75, 0.2);
  background: linear-gradient(to bottom, #fff, #fff9f0);
}

.rarity-novice {
  border-top: 5px solid var(--green);
}

.rarity-advanced {
  border-top: 5px solid var(--blue);
}

.rarity-expert {
  border-top: 5px solid var(--red);
}

.reward-list,
.recipe,
.material-board {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gold,
.drop,
.material-chip,
.equipment-bar span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 9px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.gold {
  background: #fff3cf;
  color: #765300;
}

.material-chip b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1rem;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.material-chip.ok b {
  background: var(--green);
}

.material-chip.lack b {
  background: var(--red);
}

.material-chip em,
.drop em {
  color: var(--muted);
  font-style: normal;
}

.equipment-bar {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.equipment-bar div,
.inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.inventory article {
  display: grid;
  gap: 8px;
  min-width: 210px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
}

.inventory article div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.battle-scene {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(260px, 1fr) minmax(170px, 0.8fr);
  gap: 16px;
  align-items: stretch;
}

.combatant,
.battle-center {
  min-width: 0;
  overflow: hidden;
}

.battle-center h2 {
  overflow-wrap: anywhere;
}

.dice-row {
  max-width: 100%;
  overflow: hidden;
}

.battle-log {
  max-width: 100%;
  overflow: hidden;
}

.battle-log p {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.battle-log-line {
  min-width: 0;
}

.battle-log-line>span,
.battle-log-line strong {
  min-width: 0;
}

.battle-log-target,
.battle-log-dice,
.battle-log-hp {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .battle-log-line {
    grid-template-columns: 1fr 1fr;
  }

  .battle-log-line strong {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .battle-log-line {
    grid-template-columns: 1fr;
  }
}

.combatant,
.battle-center {
  display: grid;
  gap: 12px;
  align-content: center;
  padding: 16px;
  background: white;
  border: 1px solid var(--line);
}

.combatant-art {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--mist);
}

.combatant img {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
}

.enemy .combatant-art {
  background: #eef6fb;
}

.damage-pop {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  max-width: calc(100% - 20px);
  padding: 5px 11px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  color: white;
  text-shadow: 0 3px 0 rgba(18, 57, 82, 0.34), 0 0 14px rgba(255, 255, 255, 0.7);
  transform: translateX(-50%);
  pointer-events: none;
  animation: damagePop 0.72s cubic-bezier(0.18, 0.88, 0.28, 1.14) both;
  box-shadow: 0 10px 22px rgba(31, 128, 190, 0.24);
}

.damage-pop em,
.damage-pop span,
.damage-pop small {
  display: none;
}

.damage-pop strong {
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  line-height: 0.95;
  letter-spacing: 0.03em;
}

.damage-pop.outgoing {
  background: linear-gradient(135deg, rgba(48, 159, 214, 0.96), rgba(72, 197, 170, 0.96));
}

.damage-pop.incoming {
  background: linear-gradient(135deg, rgba(48, 159, 214, 0.96), rgba(72, 197, 170, 0.96));
}

.damage-pop.critical {
  border-color: rgba(255, 244, 174, 0.98);
  background: radial-gradient(circle at 35% 25%, #fff9b1, #ff9f2f 42%, #ef4b36 100%);
  box-shadow: 0 0 0 6px rgba(255, 213, 75, 0.18), 0 18px 42px rgba(215, 100, 22, 0.34);
  animation-name: criticalDamagePop;
}

.hit-shake .combatant-art {
  animation: hitShake 0.42s ease-out both;
}

.battle-review-scene {
  position: relative;
}

.battle-review-banner {
  padding: 11px 14px;
  border: 1px solid rgba(242, 184, 75, 0.48);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 248, 209, 0.96), rgba(232, 249, 255, 0.94));
  color: #705012;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(242, 184, 75, 0.15);
}

.hp {
  display: grid;
  gap: 6px;
}

.hp div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hp {
  position: relative;
}

.hp::after {
  content: "";
  display: block;
  height: 10px;
  background: #e4eef1;
  border: 1px solid var(--line);
}

.hp i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 10px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.dice-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px 0;
}

.die {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--line);
  background: white;
  box-shadow: 0 8px 0 rgba(28, 73, 96, 0.08);
  font-size: 1.55rem;
  font-weight: 900;
}

.die.rolling {
  animation: roll 0.18s linear infinite;
}

.battle-log {
  display: grid;
  gap: 8px;
  min-height: 86px;
}

.battle-log p {
  padding: 9px;
  background: var(--paper);
  color: var(--muted);
}

.battle-log>p:not(.battle-log-line) {
  display: none;
}

.battle-log-line {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) minmax(100px, 1fr) minmax(110px, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 8px;
  border-left: 4px solid var(--sky);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(73, 155, 203, 0.12);
}

.battle-log-line.incoming {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(255, 239, 236, 0.96), var(--paper));
}

.battle-log-line.outgoing {
  border-left-color: var(--blue);
  background: linear-gradient(90deg, rgba(231, 247, 255, 0.96), var(--paper));
}

.battle-log-line strong {
  color: #b53b2f;
  font-size: 1.05rem;
  white-space: nowrap;
}

.battle-log-target {
  color: var(--ink);
  font-weight: 900;
}

.battle-log-dice,
.battle-log-hp {
  color: var(--muted);
  font-size: 0.9rem;
}

.battle-log-line>span,
.battle-log-line strong {
  min-width: 0;
}

.battle-log-target,
.battle-log-dice,
.battle-log-hp {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .battle-log-line {
    grid-template-columns: 1fr 1fr;
  }

  .battle-log-line strong {
    justify-self: start;
  }
}

@media (max-width: 760px) {
  .battle-log-line {
    grid-template-columns: 1fr;
  }
}

.battle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.combat-condition-lane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(27, 155, 209, 0.25);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(235, 249, 255, 0.94), rgba(255, 250, 235, 0.94));
}

.combat-condition-lane > div {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
  align-items: center;
  font-size: 0.78rem;
}

.combat-condition-lane > div:last-child {
  justify-content: end;
  text-align: right;
}

.combat-condition-lane strong {
  padding: 5px 8px;
  border-radius: 999px;
  color: #765000;
  background: #fff2ba;
  font-size: 0.74rem;
  white-space: nowrap;
}

.combat-condition-lane em {
  color: var(--muted);
  font-style: normal;
}

.rules-panel {
  display: grid;
  gap: 16px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.rules-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
}

.rules-grid h3,
.rules-grid p {
  margin: 0;
}

.rules-grid p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.battle-actions button {
  min-width: 130px;
}

.battle-review-next {
  min-width: min(360px, 100%);
  margin-inline: auto;
  padding-block: 14px;
  font-size: 1.05rem;
  box-shadow: 0 18px 36px rgba(27, 155, 209, 0.2);
}

.battle-skill-button {
  position: relative;
  overflow: visible;
  display: grid;
  gap: 2px;
  text-align: left;
}

.battle-skill-name {
  font-weight: 900;
}

.battle-skill-use {
  color: inherit;
  font-size: 0.72rem;
  opacity: 0.78;
}

.battle-skill-button em {
  max-width: 210px;
  overflow: hidden;
  color: inherit;
  font-size: 0.72rem;
  font-style: normal;
  opacity: 0.8;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-skill-button .detail-token {
  background: transparent;
  border-color: transparent;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.battle-skill-button .detail-token small {
  display: none;
}

.battle-skill-button .detail-popover {
  text-align: left;
}

.battle-actions button[data-battle-action="flee"] {
  border-color: rgba(233, 111, 95, 0.55);
  color: #9d2d22;
  background: linear-gradient(180deg, #fff1ef, #ffd9d3);
  box-shadow: 0 10px 22px rgba(233, 111, 95, 0.18);
}

.battle-actions button[data-battle-action="flee"] {
  font-size: 0;
}

.battle-actions button[data-battle-action="flee"]::after {
  content: "逃走";
  font-size: 1rem;
  font-weight: 900;
}

.battle-actions button[data-battle-action="flee"]:hover {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(233, 111, 95, 0.16);
}

.battle-actions.final-boss-actions button[data-battle-action="flee"] {
  display: none;
}

.result-panel,
.final-panel {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.final-panel pre {
  overflow: auto;
  max-height: 320px;
  padding: 12px;
  background: #102333;
  color: #dff8ef;
}

.ending-panel {
  position: relative;
  display: grid;
  gap: 24px;
  width: min(1120px, 100%);
  overflow: hidden;
  padding: clamp(22px, 4vw, 44px);
  border: 1px solid rgba(242, 184, 75, 0.42);
  border-radius: 34px;
  background:
    radial-gradient(circle at 20% 8%, rgba(255, 246, 185, 0.95), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(139, 221, 255, 0.58), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(232, 249, 255, 0.9) 45%, rgba(255, 241, 196, 0.92));
  box-shadow: 0 34px 90px rgba(56, 112, 152, 0.24);
}

.demon-clear::before {
  content: "";
  position: absolute;
  inset: -28% -12% auto;
  height: 360px;
  background: conic-gradient(from 180deg, rgba(255, 210, 88, 0.32), rgba(85, 190, 224, 0.18), rgba(255, 255, 255, 0), rgba(255, 210, 88, 0.32));
  filter: blur(8px);
  animation: slowSpin 14s linear infinite;
}

.demon-clear {
  background:
    radial-gradient(circle at 50% 2%, rgba(255, 255, 225, 0.98), transparent 24%),
    radial-gradient(circle at 20% 8%, rgba(255, 246, 185, 0.95), transparent 28%),
    radial-gradient(circle at 86% 10%, rgba(139, 221, 255, 0.62), transparent 26%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(226, 250, 255, 0.9) 45%, rgba(255, 242, 195, 0.94));
}

.world-clear-sigil {
  position: absolute;
  inset: 16px 0 auto;
  z-index: 0;
  display: grid;
  place-items: center;
  height: 240px;
  pointer-events: none;
}

.world-clear-sigil span {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(242, 184, 75, 0.42);
  box-shadow: 0 0 36px rgba(255, 213, 77, 0.22);
  animation: slowSpin 18s linear infinite;
}

.world-clear-sigil span:nth-child(1) {
  width: 180px;
  height: 180px;
}

.world-clear-sigil span:nth-child(2) {
  width: 250px;
  height: 86px;
  animation-duration: 13s;
}

.world-clear-sigil span:nth-child(3) {
  width: 310px;
  height: 112px;
  border-color: rgba(73, 155, 209, 0.28);
  animation-direction: reverse;
}

.clear-epilogue {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 6px;
  justify-self: center;
  width: min(720px, 100%);
  padding: 18px 22px;
  border: 1px solid rgba(242, 184, 75, 0.34);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  color: #5d6e76;
  text-align: center;
  box-shadow: 0 18px 42px rgba(242, 184, 75, 0.16);
}

.clear-epilogue b {
  color: #a65f00;
  font-size: 1.15rem;
}

.ending-hero,
.ending-score,
.ending-party,
.ending-timeline,
.ending-roll,
.ending-panel>button {
  position: relative;
  z-index: 1;
}

.ending-hero {
  display: grid;
  gap: 10px;
  text-align: center;
}

.ending-hero h2 {
  font-size: clamp(2.2rem, 7vw, 5.4rem);
  letter-spacing: 0.08em;
  color: #b56c00;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.86), 0 18px 32px rgba(197, 119, 0, 0.2);
}

.ending-hero p {
  max-width: 780px;
  margin: 0 auto;
  color: #486473;
  font-size: 1.05rem;
  line-height: 1.85;
}

.ending-score {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
}

.ending-score span,
.ending-stat-grid span {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(73, 155, 203, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}

.ending-score b,
.ending-stat-grid b {
  color: var(--ink);
  font-size: 1.1rem;
}

.ending-party {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 16px;
}

.ending-adventurer {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(73, 155, 203, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 18px 40px rgba(52, 103, 139, 0.13);
}

.ending-adventurer-head {
  display: flex;
  align-items: center;
  gap: 13px;
}

.ending-adventurer-head img {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  background: linear-gradient(145deg, #e6fbff, #fff1bc);
  box-shadow: inset 0 0 0 1px rgba(73, 155, 203, 0.18);
}

.rank-badge {
  display: inline-grid;
  min-width: 32px;
  place-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  color: white;
  background: #8fa3b3;
  font-weight: 900;
}

.rank-badge.rank-a,
.rank-badge.rank-s {
  color: #653d00;
  background: linear-gradient(135deg, #fff6b8, #ffc94b, #fff4a3);
  box-shadow: 0 0 18px rgba(255, 204, 68, 0.65);
  animation: badgeGlow 1.8s ease-in-out infinite;
}

.ending-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ending-loadout {
  display: grid;
  gap: 6px;
}

.ending-loadout p {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ending-record {
  color: var(--muted);
  font-weight: 800;
}

.ending-timeline {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 24px;
  background: rgba(16, 35, 51, 0.86);
  color: #ecfbff;
  box-shadow: 0 22px 45px rgba(16, 35, 51, 0.18);
}

.ending-timeline h3 {
  font-size: 1.45rem;
}

.ending-timeline p {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.ending-timeline span {
  color: #c9eaf3;
  text-align: right;
}

.ending-roll {
  display: grid;
  gap: 8px;
  min-height: 170px;
  place-items: center;
  overflow: hidden;
  color: #5b7180;
  text-align: center;
}

.ending-roll p {
  margin-top: 14px;
  color: #a65f00;
  font-weight: 1000;
  letter-spacing: 0.22em;
}

.ending-roll span {
  animation: creditRise 7s ease-in-out infinite alternate;
}

.defeat-panel {
  border-color: rgba(60, 73, 88, 0.25);
  background: linear-gradient(145deg, #f8fbff, #e9eef6);
}

.demon-arrival {
  position: relative;
  display: grid;
  gap: 24px;
  place-items: center;
  min-height: 680px;
  overflow: hidden;
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid rgba(70, 35, 80, 0.38);
  border-radius: 34px;
  color: #f6fbff;
  text-align: center;
  background:
    radial-gradient(circle at 50% 12%, rgba(220, 77, 255, 0.32), transparent 26%),
    radial-gradient(circle at 50% 52%, rgba(255, 84, 84, 0.22), transparent 32%),
    linear-gradient(145deg, #111927, #1c1d35 48%, #32182f);
  box-shadow: 0 36px 90px rgba(24, 20, 39, 0.42);
}

.demon-arrival::before,
.demon-arrival::after {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
}

.demon-arrival::before {
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 28px);
  animation: stormDrift 7s linear infinite;
}

.demon-arrival::after {
  background: radial-gradient(circle at 50% 50%, transparent 0 38%, rgba(0, 0, 0, 0.48) 72%);
}

.demon-rift,
.demon-arrival-copy,
.demon-party-line,
.demon-auto-start,
.demon-arrival>button {
  position: relative;
  z-index: 1;
}

.demon-rift {
  width: min(420px, 80vw);
  height: 260px;
}

.rift-core,
.rift-ring,
.demon-silhouette {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.rift-core {
  width: 112px;
  height: 248px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff4c2, #ff4f6b 42%, #53205f);
  filter: blur(0.4px);
  box-shadow: 0 0 38px rgba(255, 94, 108, 0.8), 0 0 110px rgba(166, 61, 255, 0.62);
  animation: riftPulse 1.6s ease-in-out infinite;
}

.rift-ring {
  border: 2px solid rgba(255, 210, 112, 0.62);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(255, 116, 116, 0.32);
}

.ring-a {
  width: 250px;
  height: 88px;
  animation: slowSpin 10s linear infinite;
}

.ring-b {
  width: 310px;
  height: 112px;
  border-color: rgba(151, 222, 255, 0.36);
  animation: slowSpin 14s linear reverse infinite;
}

.demon-silhouette {
  top: 60%;
  width: 142px;
  height: 168px;
  border-radius: 64px 64px 22px 22px;
  background: linear-gradient(180deg, #05060b, #16101f);
  clip-path: polygon(14% 18%, 33% 30%, 39% 0, 50% 22%, 61% 0, 67% 30%, 86% 18%, 75% 50%, 82% 100%, 18% 100%, 25% 50%);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.58);
  animation: demonRise 2.4s ease both;
}

.demon-arrival-copy {
  display: grid;
  gap: 12px;
  max-width: 820px;
}

.demon-arrival-copy .eyebrow {
  color: #ffd977;
}

.demon-arrival-copy h2 {
  font-size: clamp(3rem, 9vw, 7rem);
  letter-spacing: 0.16em;
  color: #fff1b8;
  text-shadow: 0 0 20px rgba(255, 80, 96, 0.72), 0 10px 34px rgba(0, 0, 0, 0.65);
}

.demon-arrival-copy p {
  color: #dbe8f0;
  line-height: 1.85;
}

.demon-party-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.demon-party-line span {
  display: grid;
  grid-template-columns: 52px auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  text-align: left;
}

.demon-party-line img {
  grid-row: 1 / span 2;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.16);
}

.demon-party-line small {
  color: #bdd0dc;
}

.demon-auto-start {
  display: grid;
  gap: 8px;
  width: min(420px, 88vw);
  color: #ffdfa1;
  font-weight: 900;
}

.demon-auto-start i {
  display: block;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.demon-auto-start i::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffdf75, #ff6678, #b765ff);
  animation: autoStartBar 3.6s linear both;
}

.demon-defeat {
  border-color: rgba(56, 64, 86, 0.44);
  background:
    radial-gradient(circle at 50% 0%, rgba(112, 78, 170, 0.32), transparent 34%),
    linear-gradient(145deg, #eef3fa, #dce3ed 46%, #cfd6e2);
}

.demon-defeat::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, transparent 0 44%, rgba(54, 63, 79, 0.12) 44% 45%, transparent 45%),
    linear-gradient(68deg, transparent 0 58%, rgba(54, 63, 79, 0.14) 58% 59%, transparent 59%);
  pointer-events: none;
}

.defeat-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.72;
}

.defeat-sky span {
  position: absolute;
  width: 2px;
  height: 180px;
  background: linear-gradient(180deg, transparent, rgba(73, 84, 105, 0.72), transparent);
  animation: ashFall 3.4s linear infinite;
}

.defeat-sky span:nth-child(1) {
  left: 18%;
}

.defeat-sky span:nth-child(2) {
  left: 52%;
  animation-delay: 0.8s;
}

.defeat-sky span:nth-child(3) {
  left: 82%;
  animation-delay: 1.6s;
}

.defeat-hero h2 {
  color: #3e485b;
  text-shadow: 0 5px 0 rgba(255, 255, 255, 0.54), 0 18px 36px rgba(37, 44, 60, 0.24);
}

.defeat-score span {
  border-color: rgba(72, 83, 104, 0.2);
  background: rgba(255, 255, 255, 0.56);
}

.defeat-score b {
  color: #3e485b;
}

.defeat-party .ending-adventurer {
  filter: saturate(0.78);
}

.defeat-timeline {
  background: rgba(34, 40, 54, 0.9);
}

.daybreak-panel {
  display: grid;
  gap: 22px;
  place-items: center;
  min-height: 560px;
  padding: clamp(22px, 5vw, 56px);
  overflow: hidden;
  text-align: center;
  border: 1px solid rgba(242, 184, 75, 0.35);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 240, 163, 0.95), transparent 28%),
    linear-gradient(180deg, #e1f5ff 0%, #f8fbf8 58%, #e7f6ef 100%);
  box-shadow: var(--shadow);
}

.paper-scene {
  position: relative;
  width: min(620px, 100%);
  height: 260px;
  filter: drop-shadow(0 18px 28px rgba(32, 86, 110, 0.14));
  animation: paperSlideIn 780ms cubic-bezier(.2, .8, .2, 1) both;
}

.paper-scene span {
  position: absolute;
  display: block;
}

.paper-sun {
  top: 18px;
  left: 50%;
  width: 112px;
  height: 112px;
  border-radius: 999px;
  background: radial-gradient(circle, #fff6b8, #f2b84b);
  transform: translateX(-50%);
  box-shadow: 0 0 46px rgba(242, 184, 75, 0.38);
}

.paper-mountain {
  bottom: 42px;
  width: 58%;
  height: 138px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: linear-gradient(145deg, #83c9bf, #3ab98a);
}

.mountain-a {
  left: 2%;
}

.mountain-b {
  right: 0;
  height: 108px;
  background: linear-gradient(145deg, #9ed8e7, #1b9bd1);
}

.paper-hero {
  right: 14%;
  bottom: 36px;
  width: 64px;
  height: 96px;
  border-radius: 28px 28px 10px 10px;
  background: linear-gradient(180deg, #ffffff, #7a77d9);
  animation: heroStep 1.4s ease-in-out infinite alternate;
}

.paper-hero::before {
  content: "";
  position: absolute;
  top: -34px;
  left: 16px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #ffd7ae;
}

.daybreak-copy {
  display: grid;
  gap: 10px;
  max-width: 720px;
  animation: fadeUp 700ms ease 180ms both;
}

.daybreak-copy h2 {
  font-size: clamp(2rem, 6vw, 4.2rem);
}

.daybreak-next {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: center;
  width: min(560px, 100%);
  padding: 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  animation: fadeUp 700ms ease 320ms both;
}

.daybreak-next img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  background: var(--mist);
  border: 1px solid var(--line);
}

.daybreak-next span,
.daybreak-next small {
  display: block;
  color: var(--muted);
}

.daybreak-next strong {
  display: block;
  font-size: 1.35rem;
}

.daybreak-next b {
  color: #a65f00;
  font-size: 1.25rem;
}

.reincarnation-panel {
  position: relative;
  display: grid;
  gap: 28px;
  place-items: center;
  min-height: 650px;
  overflow: hidden;
  padding: clamp(24px, 5vw, 56px);
  border: 1px solid rgba(73, 155, 203, 0.22);
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 249, 184, 0.92), transparent 24%),
    radial-gradient(circle at 12% 18%, rgba(150, 226, 255, 0.52), transparent 28%),
    radial-gradient(circle at 86% 24%, rgba(255, 211, 128, 0.45), transparent 25%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(230, 249, 255, 0.92));
  box-shadow: 0 34px 90px rgba(56, 112, 152, 0.18);
}

.reincarnation-aura {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.reincarnation-aura span {
  position: absolute;
  left: 50%;
  top: 24%;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(242, 184, 75, 0.32);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: blessingSpin 18s linear infinite;
}

.reincarnation-aura span:nth-child(2) {
  width: 420px;
  height: 120px;
  border-color: rgba(27, 155, 209, 0.24);
  animation-duration: 13s;
}

.reincarnation-aura span:nth-child(3) {
  width: 520px;
  height: 160px;
  border-color: rgba(122, 119, 217, 0.2);
  animation-direction: reverse;
}

.reincarnation-story,
.reincarnation-title,
.reincarnation-grid,
.reincarnation-start {
  position: relative;
  z-index: 1;
}

.reincarnation-story {
  display: grid;
  gap: 10px;
  max-width: 860px;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(73, 155, 203, 0.18);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  box-shadow: 0 18px 42px rgba(32, 86, 110, 0.12);
}

.reincarnation-story h2 {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  color: #24516a;
}

.reincarnation-story p:not(.eyebrow) {
  color: #486473;
  line-height: 1.85;
}

.reincarnation-title {
  display: grid;
  gap: 10px;
  max-width: 760px;
  text-align: center;
}

.reincarnation-title h2 {
  font-size: clamp(2.2rem, 7vw, 5.2rem);
  color: #b56c00;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.82), 0 18px 32px rgba(197, 119, 0, 0.17);
}

.reincarnation-title p:last-child {
  color: #486473;
  line-height: 1.8;
}

.reincarnation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  width: 100%;
}

.reincarnation-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(73, 155, 203, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 42px rgba(32, 86, 110, 0.13);
  animation: blessingCardIn 700ms cubic-bezier(0.2, 0.86, 0.22, 1.18) both;
  animation-delay: var(--delay);
}

.reincarnation-owner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.reincarnation-owner img {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--mist);
  box-shadow: inset 0 0 0 1px rgba(73, 155, 203, 0.18);
}

.reincarnation-owner b,
.reincarnation-owner small {
  display: block;
}

.reincarnation-owner small {
  color: var(--muted);
}

.reincarnation-skill-card {
  position: relative;
  display: grid;
  gap: 9px;
  min-height: 250px;
  overflow: hidden;
  padding: 18px;
  border: 1px solid rgba(242, 184, 75, 0.4);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 245, 177, 0.94), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 251, 255, 0.9));
}

.skill-orb {
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 25%, #fff, #ffe28a 38%, #6bcaf0 72%, #7a77d9);
  box-shadow: 0 0 32px rgba(242, 184, 75, 0.45);
  animation: orbFloat 2.3s ease-in-out infinite alternate;
}

.reincarnation-skill-card p {
  color: var(--blue);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-align: center;
}

.reincarnation-skill-card h3 {
  color: var(--ink);
  font-size: 1.45rem;
  text-align: center;
}

.reincarnation-skill-card em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.55;
}

.reincarnation-skill-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.reincarnation-start {
  min-width: min(320px, 100%);
  min-height: 52px;
  font-size: 1.08rem;
}

.job-upgrade-panel {
  position: relative;
  display: grid;
  gap: 18px;
  overflow: hidden;
  padding: 28px;
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.92), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(171, 232, 255, 0.58), transparent 30%),
    linear-gradient(135deg, #f7fcff, #edf8f3 58%, #fff8e8);
  border: 1px solid rgba(72, 173, 190, 0.25);
  box-shadow: var(--shadow);
}

.upgrade-constellation {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.upgrade-constellation span {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 217, 104, 0.32), transparent 68%);
  animation: auraFloat 4.8s ease-in-out infinite;
}

.upgrade-constellation span:nth-child(1) {
  top: -42px;
  left: 8%;
}

.upgrade-constellation span:nth-child(2) {
  right: 12%;
  top: 10%;
  animation-delay: 0.8s;
}

.upgrade-constellation span:nth-child(3) {
  right: 38%;
  bottom: -64px;
  animation-delay: 1.4s;
}

.upgrade-copy,
.upgrade-current,
.upgrade-grid {
  position: relative;
  z-index: 1;
}

.upgrade-copy h2 {
  margin: 4px 0 8px;
  color: var(--ink);
  font-size: clamp(1.6rem, 4vw, 2.7rem);
}

.upgrade-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.upgrade-current img {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
}

.upgrade-current span,
.upgrade-current small {
  display: block;
  color: var(--muted);
}

.upgrade-current strong {
  display: block;
  color: var(--ink);
  font-size: 1.3rem;
}

.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.upgrade-card {
  position: relative;
  display: grid;
  gap: 9px;
  min-height: 230px;
  padding: 18px;
  text-align: left;
  border-radius: 24px;
  border: 1px solid rgba(72, 173, 190, 0.24);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 250, 255, 0.9));
  box-shadow: 0 18px 34px rgba(61, 111, 136, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.upgrade-card:hover,
.upgrade-card:focus-visible {
  transform: translateY(-5px);
  border-color: rgba(46, 154, 196, 0.54);
  box-shadow: 0 24px 42px rgba(61, 111, 136, 0.2);
}

.upgrade-card.stay {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(245, 247, 250, 0.9));
}

.upgrade-badge {
  justify-self: start;
  padding: 5px 10px;
  border-radius: 999px;
  color: #28606d;
  background: #e8fbff;
  border: 1px solid rgba(46, 154, 196, 0.22);
  font-size: 0.78rem;
  font-weight: 800;
}

.upgrade-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
}

.upgrade-card p,
.upgrade-card li {
  margin: 0;
  color: var(--muted);
}

.upgrade-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
}

.trial-campaign-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 238, 158, 0.54), transparent 28%),
    linear-gradient(135deg, rgba(246, 253, 255, 0.96), rgba(238, 249, 242, 0.96));
  border: 1px solid rgba(72, 173, 190, 0.24);
  box-shadow: var(--shadow);
}

.trial-campaign-head h2 {
  margin: 4px 0 8px;
  color: var(--ink);
}

.trial-campaign-head p {
  margin: 0;
  color: var(--muted);
}

.trial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.trial-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff, #f1fbff);
  border: 1px solid rgba(41, 160, 199, 0.24);
  box-shadow: 0 14px 26px rgba(47, 117, 139, 0.12);
}

.trial-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trial-card-top span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #755100;
  background: #fff0b5;
  font-size: 0.72rem;
  font-weight: 800;
}

.trial-card-top b {
  color: #236070;
}

.trial-card h3 {
  margin: 0;
  color: var(--ink);
}

.trial-card p,
.trial-card li {
  margin: 0;
  color: var(--muted);
}

.trial-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

@keyframes campaignPulse {
  0%,
  100% {
    transform: translateY(0);
    filter: brightness(1);
  }
  50% {
    transform: translateY(-2px);
    filter: brightness(1.05);
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  color: white;
  background: #183143;
  box-shadow: var(--shadow);
}

.busy button {
  pointer-events: none;
}

@keyframes activePulse {

  0%,
  100% {
    border-color: var(--line);
    box-shadow: none;
  }

  50% {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(27, 155, 209, 0.14);
  }
}

@keyframes roll {
  0% {
    transform: rotate(0deg) translateY(0);
  }

  50% {
    transform: rotate(8deg) translateY(-4px);
  }

  100% {
    transform: rotate(0deg) translateY(0);
  }
}

@keyframes damagePop {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.72) rotate(-4deg);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -3px) scale(1.08) rotate(2deg);
  }

  72% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(0);
  }

  100% {
    opacity: 0.92;
    transform: translate(-50%, 0) scale(0.98);
  }
}

@keyframes criticalDamagePop {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.68) rotate(-8deg);
    filter: brightness(1);
  }

  22% {
    opacity: 1;
    transform: translate(-50%, -5px) scale(1.16) rotate(4deg);
    filter: brightness(1.3);
  }

  70% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.04) rotate(-1deg);
  }

  100% {
    opacity: 0.95;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes hitShake {
  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-7px) rotate(-1deg);
  }

  45% {
    transform: translateX(7px) rotate(1deg);
  }

  70% {
    transform: translateX(-3px);
  }
}

@keyframes paperSlideIn {
  from {
    opacity: 0;
    transform: translateX(36px) rotate(1deg);
  }

  to {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes heroStep {
  from {
    transform: translateY(0) rotate(-1deg);
  }

  to {
    transform: translateY(-8px) rotate(1deg);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blessingSpin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes blessingCardIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.92) rotate(-1deg);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

@keyframes orbFloat {
  from {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }

  to {
    transform: translateY(-8px) scale(1.04);
    filter: brightness(1.16);
  }
}

@keyframes statusGlow {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.08);
  }
}

@keyframes stormDrift {
  from {
    transform: translateX(-5%) translateY(-3%);
  }

  to {
    transform: translateX(5%) translateY(3%);
  }
}

@keyframes riftPulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scaleX(0.88);
    filter: brightness(1) blur(0.4px);
  }

  50% {
    transform: translate(-50%, -50%) scaleX(1.08);
    filter: brightness(1.25) blur(0);
  }
}

@keyframes demonRise {
  from {
    opacity: 0;
    transform: translate(-50%, -28%) scale(0.78);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes autoStartBar {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes ashFall {
  from {
    transform: translateY(-220px) rotate(8deg);
    opacity: 0;
  }

  25% {
    opacity: 1;
  }

  to {
    transform: translateY(820px) rotate(-8deg);
    opacity: 0;
  }
}

@media (max-width: 1100px) {
  .game-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .setup-options,
  .action-grid,
  .battle-scene,
  .ending-score,
  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {

  .setup-screen,
  .play-area,
  .stage {
    padding: 12px;
  }

  .setup-card {
    padding: 18px;
  }

  .setup-footer,
  .turn-strip,
  .hero-band,
  .daybreak-next {
    grid-template-columns: 1fr;
  }

  .hero-band img {
    width: 86px;
    height: 86px;
  }

  .die {
    width: 48px;
    height: 48px;
  }

  .battle-log-line {
    grid-template-columns: 1fr;
  }

  .ending-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .ending-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ending-timeline p {
    display: grid;
  }

  .ending-timeline span {
    text-align: left;
  }
}

.forge-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.forge-preview-card {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(27, 155, 209, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 20px rgba(43, 104, 132, 0.08);
}

.forge-preview-card>img {
  width: 58px;
  height: 76px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--mist);
}

.forge-preview-card>div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.forge-preview strong {
  font-size: 0.84rem;
}

.forge-preview span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.forge-preview .material-chip {
  min-height: 26px;
  padding: 4px 6px;
  font-size: 0.72rem;
}

.forge-preview .material-chip span {
  display: none;
}

.forge-preview .material-chip b {
  width: 22px;
  height: 22px;
  font-size: 0.86rem;
}

.forge-preview .detail-token {
  justify-self: start;
  max-width: 100%;
  background: white;
}

.forge-preview .detail-token>small {
  display: none;
}

.forge-preview .detail-popover {
  text-align: left;
}

.material-board-rich {
  padding: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.material-beast_fang {
  background: #fff7df;
  border-color: rgba(199, 139, 42, 0.38);
}

.material-beast_fang b {
  background: linear-gradient(135deg, #d79838, #fff1b7);
}

.material-flame_stone {
  background: #fff0ec;
  border-color: rgba(221, 91, 65, 0.42);
}

.material-flame_stone b {
  background: linear-gradient(135deg, #ff5c38, #ffc05a);
}

.material-dragon_scale {
  background: #eef6ff;
  border-color: rgba(43, 111, 196, 0.4);
}

.material-dragon_scale b {
  background: linear-gradient(135deg, #3579d4, #9ee7ff);
}

.material-shadow_ink {
  background: #f1efff;
  border-color: rgba(100, 83, 175, 0.38);
}

.material-shadow_ink b {
  background: linear-gradient(135deg, #30295f, #8c7bff);
}

.material-star_fragment {
  background: #fff9d7;
  border-color: rgba(224, 174, 37, 0.5);
}

.material-star_fragment b {
  background: linear-gradient(135deg, #e8af25, #fff6a8);
}

.material-chip.lack {
  filter: saturate(0.72);
}

.material-chip.lack b {
  box-shadow: inset 0 0 0 999px rgba(20, 25, 35, 0.24);
}

.view-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.action-view-title {
  padding: 14px;
  border: 1px solid rgba(27, 155, 209, 0.18);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(241, 251, 255, 0.92), rgba(255, 255, 255, 0.78));
}

.action-title-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.action-back-button {
  min-width: 170px;
  padding: 11px 16px;
  border: 1px solid rgba(27, 155, 209, 0.44);
  border-radius: 999px;
  color: #155f78;
  background: linear-gradient(180deg, #f4fcff, #dff6ff);
  box-shadow: 0 12px 26px rgba(27, 155, 209, 0.16);
  font-weight: 900;
}

.action-back-button::before {
  content: "竊・";
}

.action-back-button:hover,
.action-back-button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(27, 155, 209, 0.14), 0 16px 30px rgba(27, 155, 209, 0.18);
  transform: translateY(-1px);
}

.victory-result {
  position: relative;
  overflow: hidden;
  border-color: rgba(242, 184, 75, 0.58);
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 248, 189, 0.95), transparent 28%),
    radial-gradient(circle at 85% 22%, rgba(175, 235, 255, 0.8), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 246, 214, 0.86));
  box-shadow: 0 26px 70px rgba(193, 132, 22, 0.22);
}

.victory-result h2 {
  color: #a65f00;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8);
}

.victory-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.victory-burst span {
  position: absolute;
  width: 14px;
  height: 34px;
  border-radius: 999px;
  background: var(--gold);
  animation: confettiFall 1800ms ease-out infinite;
}

.victory-burst span:nth-child(1) {
  left: 12%;
  top: -12px;
  background: var(--blue);
}

.victory-burst span:nth-child(2) {
  left: 31%;
  top: -28px;
  background: var(--green);
  animation-delay: 220ms;
}

.victory-burst span:nth-child(3) {
  left: 52%;
  top: -8px;
  background: var(--gold);
  animation-delay: 90ms;
}

.victory-burst span:nth-child(4) {
  left: 72%;
  top: -34px;
  background: var(--red);
  animation-delay: 340ms;
}

.victory-burst span:nth-child(5) {
  left: 88%;
  top: -18px;
  background: var(--violet);
  animation-delay: 520ms;
}

.victory-copy,
.victory-rewards {
  position: relative;
  z-index: 1;
}

.victory-copy {
  display: grid;
  gap: 8px;
}

.victory-copy h3 {
  font-size: clamp(1.4rem, 3vw, 2.25rem);
}

.victory-copy p {
  color: var(--muted);
  line-height: 1.65;
}

.victory-rewards {
  display: grid;
  gap: 14px;
}

.reward-gold {
  display: inline-grid;
  width: max-content;
  min-width: 180px;
  gap: 3px;
  padding: 16px 20px;
  color: #7a4a00;
  background: linear-gradient(135deg, #fff4c7, #ffd56c);
  border: 1px solid rgba(194, 126, 0, 0.24);
  box-shadow: 0 12px 26px rgba(198, 130, 16, 0.18);
}

.reward-gold span {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.reward-gold strong {
  font-size: 2rem;
}

.reward-materials,
.reward-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reward-card {
  display: grid;
  grid-template-columns: 74px minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(32, 86, 110, 0.12);
}

.reward-card img {
  width: 74px;
  height: 74px;
  object-fit: contain;
  background: var(--mist);
}

.reward-card div {
  display: grid;
  gap: 4px;
}

.reward-card span {
  color: var(--muted);
}

.reward-card-frame {
  display: grid;
  place-items: center;
  width: min(280px, 100%);
  margin: 0 auto;
}

.reward-trading-card {
  display: grid;
  grid-template-rows: auto 150px auto minmax(42px, auto) 1fr;
  gap: 10px;
  width: 260px;
  min-height: 390px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 250, 0.95)),
    var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(32, 86, 110, 0.18);
}

.reward-trading-card>img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  background: var(--sky);
  border: 1px solid var(--line);
}

.reward-trading-card h3 {
  font-size: 1.12rem;
  line-height: 1.25;
}

.reward-trading-card p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.reward-trading-card ul {
  display: grid;
  align-content: start;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.35;
}

.reward-trading-card.rarity-legendary {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 244, 176, 0.9), transparent 32%),
    linear-gradient(180deg, #fffdf3, #fff5d7);
  box-shadow: 0 22px 54px rgba(196, 137, 23, 0.26);
}

.reward-trading-card.rarity-legend {
  background:
    radial-gradient(circle at 18% 0%, rgba(210, 245, 235, 0.95), transparent 34%),
    linear-gradient(180deg, #fbfffd, #eaf9f5);
}

.reward-trading-card.rarity-rare {
  background:
    radial-gradient(circle at 18% 0%, rgba(218, 241, 255, 0.95), transparent 34%),
    linear-gradient(180deg, #fbfdff, #eef8ff);
}

.result-panel>.reward-card-frame {
  justify-self: center;
}

.reward-cards .reward-card-frame {
  margin: 0;
}

.profile-loadout {
  display: grid;
  gap: 7px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.76rem;
}

.profile-stats>span {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 999px;
  color: #315468;
  background: rgba(236, 248, 255, 0.84);
  border: 1px solid rgba(85, 180, 220, 0.24);
}

.stat-value {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

.stat-value b {
  color: var(--ink);
  font-size: 0.86rem;
}

.stat-value em {
  color: #14875f;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
}

.stat-token.magic {
  color: #594097;
  background: linear-gradient(135deg, #f4efff, #e9fbff);
  border-color: rgba(128, 106, 217, 0.28);
  cursor: help;
}

.stat-token.attack,
.stat-token.defense {
  cursor: help;
}

.stat-token.attack {
  color: #8a4a15;
  background: linear-gradient(135deg, #fff7ea, #fff1db);
  border-color: rgba(210, 145, 64, 0.28);
}

.stat-token.defense {
  color: #23597a;
  background: linear-gradient(135deg, #edf8ff, #e3f1fb);
  border-color: rgba(63, 149, 196, 0.28);
}

.stat-token:hover .detail-popover,
.stat-token:focus-visible .detail-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-8px, -100%) translateY(-8px) scale(1);
}

.profile-loadout>div {
  display: grid;
  gap: 5px;
}

.profile-equipment {
  --token-bg: #eef9ff;
  --token-border: rgba(27, 155, 209, 0.34);
  --token-color: #24516a;
}

.profile-skills {
  --token-bg: #fff7df;
  --token-border: rgba(242, 184, 75, 0.46);
  --token-color: #7a4a00;
}

.profile-reincarnation {
  --token-bg: #f4efff;
  --token-border: rgba(128, 106, 217, 0.36);
  --token-color: #594097;
}

.profile-battle-skills {
  --token-bg: #fff7df;
  --token-border: rgba(242, 184, 75, 0.46);
  --token-color: #7a4a00;
}

.profile-relics {
  --token-bg: #fff1f8;
  --token-border: rgba(219, 88, 148, 0.42);
  --token-color: #8a275f;
}

.profile-loadout b {
  color: var(--ink);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.profile-loadout>div>span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.profile-loadout em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.78rem;
}

.profile-statuses {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(58, 185, 138, 0.18);
  background: rgba(238, 249, 244, 0.7);
}

.profile-statuses>b {
  color: var(--ink);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.profile-statuses>span,
.battle-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-materials {
  display: grid;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.profile-materials b {
  color: var(--ink);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.profile-materials>span {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.profile-materials .material-chip {
  min-height: 28px;
  padding: 4px 6px;
  font-size: 0.72rem;
}

.profile-materials .material-chip b {
  width: 22px;
  height: 22px;
  font-size: 0.86rem;
  letter-spacing: 0;
}

.profile-materials .material-chip em {
  font-size: 0.72rem;
}

.detail-token {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 7px;
  color: var(--token-color, #24516a);
  background: var(--token-bg, #eef9ff);
  border: 1px solid var(--token-border, rgba(27, 155, 209, 0.28));
  font-size: 0.75rem;
  font-weight: 800;
  outline: none;
}

.detail-token.item-token {
  --token-bg: #eef9ff;
  --token-border: rgba(27, 155, 209, 0.34);
  --token-color: #24516a;
}

.detail-token.skill-token {
  --token-bg: #fff7df;
  --token-border: rgba(242, 184, 75, 0.46);
  --token-color: #7a4a00;
}

.profile-relics .detail-token.item-token {
  --token-bg: #fff1f8;
  --token-border: rgba(219, 88, 148, 0.42);
  --token-color: #8a275f;
}

.job-token {
  position: relative;
  display: inline-flex;
  color: #285575;
  font-weight: 900;
  cursor: help;
  outline: none;
}

.job-token:hover .detail-popover,
.job-token:focus-visible .detail-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-8px, -100%) translateY(-8px) scale(1);
}

.job-popover {
  color: var(--ink);
}

.status-token {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(58, 185, 138, 0.38);
  border-radius: 999px;
  color: #126240;
  background: linear-gradient(180deg, #effff8, #dff8ec);
  font-size: 0.75rem;
  font-weight: 900;
  box-shadow: 0 0 0 3px rgba(58, 185, 138, 0.08);
  outline: none;
  animation: statusGlow 1.9s ease-in-out infinite;
}

.status-token.debuff {
  color: #8d2d25;
  border-color: rgba(233, 111, 95, 0.42);
  background: linear-gradient(180deg, #fff1ef, #ffdcd7);
  box-shadow: 0 0 0 3px rgba(233, 111, 95, 0.08);
}

.status-token small {
  color: inherit;
  opacity: 0.72;
  font-size: 0.66rem;
}

.status-token:hover,
.status-token:focus-visible {
  z-index: 60;
  box-shadow: 0 0 0 4px rgba(58, 185, 138, 0.16);
}

.status-token.debuff:hover,
.status-token.debuff:focus-visible {
  box-shadow: 0 0 0 4px rgba(233, 111, 95, 0.16);
}

.status-token:hover .detail-popover,
.status-token:focus-visible .detail-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.status-popover {
  grid-template-columns: minmax(180px, 260px);
}

.battle-status-row {
  justify-content: center;
}

.detail-token small {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
}

.detail-token:hover,
.detail-token:focus-visible {
  z-index: 50;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(27, 155, 209, 0.12);
}

.detail-popover {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 60;
  display: grid;
  grid-template-columns: 70px minmax(180px, 240px);
  gap: 8px 10px;
  width: max-content;
  max-width: min(330px, 86vw);
  padding: 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  box-shadow: 0 18px 42px rgba(32, 86, 110, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(5px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
  pointer-events: none;
}

.detail-token:hover .detail-popover,
.detail-token:focus-visible .detail-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.detail-popover img {
  grid-row: 1 / span 4;
  width: 70px;
  height: 92px;
  object-fit: contain;
  background: var(--mist);
  border: 1px solid var(--line);
}

.detail-popover strong {
  font-size: 0.95rem;
}

.detail-popover em {
  color: var(--muted);
  font-size: 0.75rem;
  font-style: normal;
}

.detail-popover p {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.detail-popover .popover-copy {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.detail-popover .popover-list {
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
}

.detail-popover .popover-list > span {
  display: block;
}

.loot-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 35, 48, 0.62);
  backdrop-filter: blur(5px);
}

.loot-dialog {
  width: min(620px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  color: var(--ink);
  background: linear-gradient(145deg, #fffdf5, #eef9ff);
  border: 2px solid rgba(242, 184, 75, 0.7);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.loot-dialog h2 { font-size: clamp(1.35rem, 4vw, 2rem); }

.loot-dialog-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.loot-dialog-item img { width: 78px; height: 78px; object-fit: contain; }
.loot-dialog-item div { display: grid; gap: 5px; }
.loot-dialog-item strong { font-size: 1.05rem; }
.loot-dialog-item span, .loot-dialog > p { color: var(--muted); line-height: 1.55; }

.loot-slot-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 9px; }

.loot-slot-choice {
  display: grid;
  gap: 4px;
  padding: 12px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.loot-slot-choice:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(27, 155, 209, 0.12); }
.loot-slot-choice span { color: var(--muted); font-size: 0.74rem; }
.loot-slot-choice em { color: #16734f; font-size: 0.78rem; font-style: normal; font-weight: 900; }

.rulebook { display: grid; gap: 18px; }

.rulebook-cover {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: clamp(20px, 4vw, 38px);
  color: #fff;
  background: linear-gradient(125deg, #1d4f6e, #39749a 58%, #3a9275);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: var(--shadow);
}

.rulebook-cover h3 { margin: 4px 0 8px; font-size: clamp(1.45rem, 4vw, 2.4rem); }
.rulebook-cover p:last-child { max-width: 760px; line-height: 1.65; opacity: 0.92; }

.rulebook-seal {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  color: #66450a;
  background: radial-gradient(circle at 35% 30%, #fff8ca, #e4a92f);
  border: 4px double rgba(105, 71, 7, 0.7);
  border-radius: 50%;
  font-size: 1.8rem;
  font-weight: 900;
}

.rulebook-section { display: grid; gap: 15px; padding: clamp(18px, 3vw, 28px); background: rgba(255, 255, 255, 0.72); border: 1px solid var(--line); }
.rulebook-heading { display: flex; gap: 12px; align-items: center; }
.rulebook-heading > b { display: grid; width: 34px; height: 34px; place-items: center; color: white; background: var(--blue); border-radius: 50%; }
.rulebook-heading h3 { margin-top: 2px; font-size: 1.3rem; }

.rule-steps { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.rule-steps li { display: grid; gap: 6px; padding: 14px; background: #f6fbfd; border-left: 3px solid var(--green); }
.rule-steps b { color: #1c5877; }
.rule-steps span, .rulebook-final p { color: var(--muted); font-size: 0.88rem; line-height: 1.55; }

.battle-formula { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; justify-content: center; padding: 16px; color: #164e6b; background: linear-gradient(90deg, #e8f7f2, #eef7ff); border: 1px dashed rgba(27, 155, 209, 0.45); font-weight: 900; }
.battle-formula span, .battle-formula strong { padding: 7px 10px; background: white; border: 1px solid var(--line); }
.battle-formula strong { color: #a15d00; background: #fff7df; }

.rulebook-final { border-left: 5px solid var(--gold); }

@media (max-width: 760px) {
  .rule-steps { grid-template-columns: 1fr; }
  .rulebook-cover { grid-template-columns: 1fr; }
}

.detail-popover ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-40px) rotate(0deg);
    opacity: 0;
  }

  15% {
    opacity: 1;
  }

  100% {
    transform: translateY(560px) rotate(420deg);
    opacity: 0;
  }
}

@keyframes slowSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes badgeGlow {

  0%,
  100% {
    filter: brightness(1);
    transform: translateY(0);
  }

  50% {
    filter: brightness(1.18);
    transform: translateY(-1px);
  }
}

@keyframes creditRise {
  from {
    transform: translateY(10px);
  }

  to {
    transform: translateY(-12px);
  }
}
