:root {
  color-scheme: dark;
  --bg: #08090d;
  --panel: rgba(19, 20, 27, .94);
  --panel-2: #20222c;
  --line: #333744;
  --text: #f5f1e8;
  --muted: #b9b4aa;
  --human: #74c7ff;
  --wolf: #ff6d8c;
  --gold: #f3c969;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

button {
  border: 1px solid var(--line);
  background: #232633;
  color: var(--text);
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

button:disabled {
  opacity: .42;
}

.archive-menu,
.log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.archive-menu button,
.log-actions button {
  border-color: rgba(116, 199, 255, .32);
  background: rgba(16, 22, 35, .82);
  color: #dbefff;
}

.bgm-toggle {
  min-width: 78px;
}

.bgm-toggle.active {
  border-color: rgba(243, 201, 105, .75);
  background: rgba(57, 44, 22, .92);
  color: var(--gold);
  box-shadow: inset 0 0 12px rgba(243, 201, 105, .12);
}

.app {
  position: relative;
  width: min(100vw, 1040px);
  height: 100vh;
  min-height: 720px;
  margin: 0 auto;
  padding: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 9, 13, .32), var(--bg) 185px),
    url("data/image/main.jpg") top center / min(100%, 720px) auto no-repeat,
    var(--bg);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(500px, 540px) minmax(320px, 1fr);
  gap: 12px;
  height: calc(100vh - 24px);
  min-height: 696px;
  align-items: stretch;
}

.play-column {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 14px;
}

.setup {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: start center;
  gap: 14px;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(5, 6, 9, .32), rgba(5, 6, 9, .9) 62%, rgba(5, 6, 9, .96)),
    url("data/image/main.jpg") center / cover no-repeat;
  text-align: center;
  overflow: auto;
}

.setup h1,
.hud h2,
.panel h3,
.setup p {
  margin: 0;
}

.setup h1 {
  font-size: 28px;
}

.setup p {
  color: var(--muted);
}

.village-lottery,
.god-setup {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.god-setup.hidden,
.village-lottery.hidden {
  display: none;
}

.lottery-status {
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.lottery-slot {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  align-items: center;
  min-width: min(86vw, 520px);
  padding: 18px 24px;
  border: 1px solid rgba(243, 201, 105, .42);
  border-radius: 8px;
  background: rgba(19, 20, 27, .92);
  color: var(--text);
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}

.lottery-slot span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.lottery-slot b {
  text-align: left;
}

.lottery-slot.rolling {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(243, 201, 105, .45);
}

.lottery-result,
.current-village {
  width: min(980px, 94vw);
}

.current-village {
  max-height: 230px;
  overflow: auto;
  padding: 2px 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.current-village .village-trait-list {
  display: flex;
  width: 100%;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scroll-snap-type: x proximity;
}

.current-village .village-trait-list-title {
  flex: 0 0 auto;
  display: grid;
  align-items: center;
  min-width: 76px;
  text-align: left;
}

.current-village .village-trait-card {
  flex: 0 0 min(300px, 84vw);
  scroll-snap-align: start;
  padding: 10px;
  gap: 7px;
  text-align: left;
}

.current-village .village-trait-card strong {
  font-size: 18px;
}

.current-village .village-trait-card p {
  font-size: 12px;
  line-height: 1.35;
}

.current-village .setup-affinity {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.current-village .setup-affinity span {
  padding: 5px;
  font-size: 11px;
}

.current-village .village-winrate-reference {
  justify-self: stretch;
  grid-template-columns: 1fr auto;
  padding: 7px 9px;
}

.current-village .village-winrate-reference span {
  font-size: 17px;
}

.village-trait-card {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px solid rgba(243, 201, 105, .44);
  border-radius: 8px;
  background: rgba(8, 9, 13, .82);
  text-align: center;
}

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

.village-trait-list-title {
  grid-column: 1 / -1;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.village-trait-list .village-trait-card {
  padding: 12px;
}

.village-trait-list .village-trait-card strong {
  font-size: 22px;
}

.village-trait-list .setup-affinity {
  grid-template-columns: 1fr 1fr;
}

.village-trait-list .village-winrate-reference {
  width: 100%;
  min-width: 0;
  grid-template-columns: 1fr auto;
}

.village-trait-list .village-winrate-reference span {
  font-size: 18px;
}

.village-trait-card > span,
.village-trait-card small {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.village-trait-card strong {
  font-size: 32px;
  line-height: 1.1;
}

.village-trait-card p {
  color: var(--muted);
}

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

.setup-affinity span {
  padding: 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .06);
  color: #d8d0c1;
  font-size: 12px;
  font-weight: 800;
}

.setup-affinity b {
  display: block;
  color: var(--gold);
}

.village-winrate-reference {
  justify-self: center;
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  align-items: center;
  min-width: min(320px, 88vw);
  padding: 9px 12px;
  border: 1px solid rgba(116, 199, 255, .28);
  border-radius: 8px;
  background: rgba(116, 199, 255, .08);
}

.village-winrate-reference b {
  color: var(--human);
  font-size: 12px;
}

.village-winrate-reference span {
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.village-winrate-reference small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

.lottery-log {
  display: grid;
  gap: 5px;
  width: min(520px, 86vw);
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  text-align: left;
  font-size: 13px;
}

.side-select,
.difficulty-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.difficulty-select {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 10px;
}

.admin-toggle {
  width: min(420px, 100%);
  border-color: rgba(255, 109, 140, .42);
  background: rgba(35, 16, 28, .82);
  color: #ffd7e0;
  box-shadow: inset 0 0 14px rgba(255, 109, 140, .08);
}

.admin-toggle.active {
  border-color: var(--gold);
  background:
    repeating-linear-gradient(90deg, rgba(243, 201, 105, .08) 0 4px, transparent 4px 10px),
    rgba(57, 44, 22, .92);
  color: var(--gold);
  text-shadow: 0 0 12px rgba(243, 201, 105, .5);
}

.side-select button.selected,
.difficulty-select button.selected,
.god-choice.selected,
.start-game {
  border-color: var(--gold);
  background: #382f1d;
}

.god-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px));
  gap: 12px;
  max-width: 760px;
}

.god-choice {
  display: grid;
  gap: 7px;
  min-height: 440px;
  padding: 12px;
  text-align: left;
  align-content: start;
  background: rgba(19, 20, 27, .96);
}

.god-choice.locked {
  border-color: rgba(255, 109, 140, .28);
  background:
    repeating-linear-gradient(135deg, rgba(255, 109, 140, .07) 0 2px, transparent 2px 8px),
    rgba(13, 14, 20, .96);
  filter: saturate(.75);
}

.god-choice.locked .god-portrait {
  opacity: .48;
}

.god-choice.locked .god-title,
.god-choice.locked strong {
  color: var(--wolf);
}

.god-choice strong {
  font-size: 18px;
}

.god-choice small {
  color: var(--muted);
  line-height: 1.45;
}

.god-portrait {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11131a;
}

.god-title,
.god-stars,
.god-specialties b,
.god-spell-tier b {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.god-stars {
  letter-spacing: 0;
}

.god-stars small {
  color: var(--muted);
  font-size: 10px;
}

.god-copy {
  min-height: 38px;
}

.god-specialties,
.god-spells,
.god-spell-tier {
  display: grid;
  gap: 4px;
}

.god-specialties {
  grid-template-columns: auto 1fr;
  align-items: start;
  color: var(--muted);
  font-size: 12px;
}

.god-specialties span {
  display: block;
}

.god-specialties.weakness b {
  color: var(--wolf);
}

.god-playstyle,
.god-thought {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.god-thought {
  color: var(--gold);
  font-weight: 800;
}

.god-spells {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.god-spell-tier {
  grid-template-columns: 46px 1fr 1fr;
  align-items: center;
  color: var(--muted);
}

.start-game {
  justify-self: center;
  min-width: 180px;
  padding: 11px 18px;
}

.setup.hidden {
  display: none;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  min-height: 74px;
}

.label {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.god-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hud h2 {
  font-size: 24px;
  line-height: 1;
  text-shadow: 0 2px 8px #000;
}

.mp {
  display: grid;
  gap: 5px;
  min-width: 106px;
  font-size: 12px;
}

.mp span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 7px;
  background: rgba(8, 9, 13, .76);
}

.turn-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.turn-strip span {
  min-height: 34px;
  display: grid;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.turn-buttons {
  display: flex;
  gap: 6px;
}

.turn-buttons button {
  min-width: 72px;
}

#debugToggle.active,
#tutorialToggle.active {
  border-color: var(--gold);
  background: #392c16;
  color: var(--gold);
}

.villages {
  display: grid;
  gap: 7px;
}

.village {
  min-height: 98px;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: left;
}

.village.selected {
  outline: 2px solid var(--gold);
}

.village.done-human {
  border-left: 5px solid var(--human);
}

.village.done-wolf {
  border-left: 5px solid var(--wolf);
}

.village-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.village h3 {
  margin: 0;
  font-size: 16px;
}

.lean,
#targetHint {
  color: var(--muted);
  font-size: 11px;
}

.situation {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 7px;
  margin-top: 7px;
}

.alive {
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
}

.alive small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.status-lines {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.affinity-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  color: #d8d0c1;
  font-size: 10px;
  line-height: 1.1;
}

.affinity-strip span {
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(243, 201, 105, .1);
  border: 1px solid rgba(243, 201, 105, .18);
}

.village .badges,
.village .affinity-strip,
.village .status-lines span:nth-child(1),
.village .status-lines span:nth-child(2) {
  display: none;
}

.debug-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, .55);
}

.debug-modal {
  width: min(980px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(243, 201, 105, .42);
  border-radius: 8px;
  background: rgba(8, 9, 13, .96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .55);
}

.debug-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
}

.debug-panel-head button {
  padding: 7px 10px;
  font-size: 12px;
}

.debug-section {
  margin-top: 10px;
}

.debug-section h4 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
}

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

.debug-village-card {
  min-width: 0;
  padding: 6px;
  border-left: 4px solid var(--line);
  background: rgba(32, 34, 44, .78);
  border-radius: 6px;
}

.debug-village-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 11px;
}

.debug-village-card h5 {
  margin: 8px 0 4px;
  color: var(--gold);
  font-size: 10px;
  line-height: 1.2;
}

.debug-rate {
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.debug-desc {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.debug-village-card.village-a {
  border-left-color: #ff6b6b;
}

.debug-village-card.village-b {
  border-left-color: #f3c969;
}

.debug-village-card.village-c {
  border-left-color: #74c7ff;
}

.debug-village {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 5px;
  color: #d8d0c1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  line-height: 1.25;
}

.debug-village span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.debug-log-list {
  display: grid;
  gap: 5px;
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding-left: 22px;
  color: #d8d0c1;
  font-size: 11px;
  line-height: 1.35;
}

.debug-empty {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.debug-village b {
  display: inline-block;
  min-width: 38px;
  margin-right: 3px;
  color: var(--gold);
}

.debug-village small {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

.debug-formula {
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  background: rgba(8, 9, 13, .45);
  color: #d8d0c1;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  line-height: 1.25;
}

.debug-formula p {
  margin: 0;
  overflow-wrap: anywhere;
}

.debug-impact-list {
  display: grid;
  gap: 5px;
}

.debug-impact-list div {
  display: grid;
  gap: 2px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  background: rgba(8, 9, 13, .35);
  color: #d8d0c1;
  font-size: 10px;
}

.badge {
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
}

.badge.human {
  color: var(--human);
}

.badge.wolf {
  color: var(--wolf);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  min-height: 0;
  padding-bottom: 12px;
}

.panel,
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.panel h3,
.log-panel h3 {
  font-size: 14px;
}

.spells,
.cards {
  display: grid;
  gap: 6px;
  margin-top: 7px;
  max-height: 190px;
  overflow: auto;
}

.spell-notice {
  padding: 9px 10px;
  border: 1px dashed rgba(243, 201, 105, .45);
  border-radius: 7px;
  background: rgba(57, 44, 22, .46);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.spell,
.card {
  min-height: 42px;
  padding: 7px;
  display: grid;
  align-content: center;
  gap: 2px;
  text-align: left;
}

.card {
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
}

.spell small,
.card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}

.spell-tier {
  color: var(--gold);
  font-size: 11px;
}

.spell-effect {
  display: block;
  color: #d8d0c1 !important;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.debug-spell {
  display: block;
  max-height: 28px;
  overflow: hidden;
  padding-top: 3px;
  border-top: 1px dashed rgba(243, 201, 105, .3);
  color: #d8d0c1 !important;
  font-family: Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
}

.spell-preview {
  margin-top: 8px;
  max-height: 230px;
  overflow: auto;
}

.spell-preview.hidden {
  display: none;
}

.prediction-card {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(243, 201, 105, .36);
  border-radius: 8px;
  background: rgba(8, 9, 13, .78);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

.prediction-card h4 {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
}

.prediction-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.prediction-grid span {
  min-width: 0;
  padding: 5px;
  border-radius: 6px;
  background: rgba(32, 34, 44, .72);
  color: #d8d0c1;
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.prediction-grid b {
  display: block;
  color: var(--gold);
  font-size: 10px;
}

.prediction-card p {
  margin: 0;
  color: var(--text);
  font-size: 11px;
  line-height: 1.4;
}

.prediction-card small {
  color: var(--muted);
  font-size: 10px;
}

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

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.card-actions.single {
  grid-template-columns: 1fr;
}

.card-actions button {
  min-height: 28px;
  padding: 5px 7px;
  font-size: 11px;
}

.discard-notice {
  padding: 8px;
  border: 1px solid rgba(243, 201, 105, .55);
  border-radius: 8px;
  color: var(--gold);
  background: rgba(243, 201, 105, .08);
  font-size: 12px;
  font-weight: 700;
}

.discard-pick {
  border-color: rgba(255, 109, 140, .55);
}

.spell.human {
  border-color: rgba(116, 199, 255, .55);
}

.spell.wolf {
  border-color: rgba(255, 109, 140, .55);
}

.log-panel {
  margin-top: 0;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

#log {
  height: auto;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

#log li:first-child {
  color: var(--text);
}

.log-entry {
  padding: 6px 8px;
  border-left: 4px solid transparent;
  border-radius: 6px;
  background: rgba(32, 34, 44, .45);
}

.log-entry.village-a {
  border-left-color: #ff5a67;
}

.log-entry.village-b {
  border-left-color: #f3c969;
}

.log-entry.village-c {
  border-left-color: #69a7ff;
}

.log-commentary {
  color: #f0dfb2;
}

.log-day,
.log-result {
  color: var(--text);
  background: rgba(243, 201, 105, .12);
}

.log-execution-wolf {
  color: #dfffee;
  background: linear-gradient(90deg, rgba(88, 255, 166, .18), rgba(32, 34, 44, .5));
  border-left-color: #58ffa6;
  font-weight: 900;
}

.log-execution-human {
  color: #ffe1e6;
  background: linear-gradient(90deg, rgba(255, 90, 103, .2), rgba(32, 34, 44, .5));
  border-left-color: #ff5a67;
  font-weight: 900;
}

.log-lastword {
  color: #f6e6bd;
  background:
    repeating-linear-gradient(90deg, rgba(243, 201, 105, .08) 0 3px, transparent 3px 9px),
    rgba(32, 34, 44, .58);
  border-left-color: var(--gold);
  font-style: italic;
}

.result {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, .76);
}

.result-box {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #171920;
  text-align: center;
}

.result-villages {
  display: grid;
  gap: 8px;
  text-align: left;
}

.result-village {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(32, 34, 44, .78);
}

.result-village strong {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
}

.result-village span,
.result-village small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.result-village.human {
  border-left: 5px solid var(--human);
}

.result-village.wolf {
  border-left: 5px solid var(--wolf);
}

.archive-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 4px),
    rgba(0, 0, 0, .68);
}

.archive-panel.hidden {
  display: none;
}

.archive-modal {
  width: min(1040px, 96vw);
  max-height: 90vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(116, 199, 255, .5);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0%, rgba(116, 199, 255, .14), transparent 34%),
    radial-gradient(circle at 80% 8%, rgba(255, 109, 140, .12), transparent 28%),
    rgba(7, 8, 13, .97);
  box-shadow: 0 0 40px rgba(116, 199, 255, .18), 0 24px 80px rgba(0, 0, 0, .7);
}

.archive-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.archive-head span {
  display: block;
  color: var(--human);
  font-size: 12px;
  font-weight: 900;
}

.archive-head strong {
  color: var(--gold);
  font-size: 24px;
}

.archive-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.archive-tabs button.active {
  border-color: var(--gold);
  background: rgba(243, 201, 105, .18);
  color: var(--gold);
}

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

.archive-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-left: 4px solid var(--human);
  border-radius: 8px;
  background: rgba(20, 22, 31, .78);
  text-align: left;
}

.archive-card.locked {
  border-left-color: var(--wolf);
  background:
    repeating-linear-gradient(135deg, rgba(255, 109, 140, .06) 0 2px, transparent 2px 8px),
    rgba(17, 18, 24, .82);
}

.archive-card > span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
}

.archive-card strong {
  color: var(--text);
  font-size: 18px;
}

.archive-god-portrait {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(244, 201, 104, .28);
  border-radius: 6px;
  object-fit: cover;
  object-position: center 22%;
  background: #10121a;
}

.archive-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.archive-stats,
.archive-spells {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.archive-stats b,
.archive-spells div {
  padding: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .06);
  color: #d8d0c1;
  font-size: 11px;
}

.archive-spells {
  grid-template-columns: 1fr;
}

.archive-spells b {
  display: block;
  color: var(--gold);
}

.archive-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.archive-summary div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(116, 199, 255, .09);
  border: 1px solid rgba(116, 199, 255, .2);
}

.archive-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.archive-summary strong {
  color: var(--text);
  font-size: 24px;
}

.archive-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.archive-columns section {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .05);
}

.archive-columns h4 {
  margin: 0 0 8px;
  color: var(--gold);
}

.archive-columns p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 5px 0;
  color: var(--muted);
  font-size: 12px;
}

.archive-affinity .setup-affinity {
  grid-template-columns: 1fr 1fr;
}

.unlock-flash {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .08) 0 1px, transparent 1px 5px),
    rgba(0, 0, 0, .72);
  animation: flashNoise .18s steps(2) infinite;
}

.unlock-flash.hidden {
  display: none;
}

.unlock-box {
  display: grid;
  gap: 10px;
  min-width: min(560px, 86vw);
  padding: 32px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(8, 9, 13, .92);
  text-align: center;
  box-shadow: 0 0 26px rgba(243, 201, 105, .75), inset 0 0 22px rgba(116, 199, 255, .18);
  animation: unlockPulse .9s ease-in-out infinite alternate;
}

.unlock-box span {
  color: var(--human);
  font-size: 14px;
  font-weight: 900;
}

.unlock-box strong {
  color: var(--text);
  font-size: 38px;
  line-height: 1.1;
}

.unlock-box b {
  color: var(--gold);
  font-size: 24px;
}

@keyframes flashNoise {
  from { filter: contrast(1.05) brightness(1); }
  to { filter: contrast(1.35) brightness(1.18); }
}

@keyframes unlockPulse {
  from { transform: scale(.985); }
  to { transform: scale(1.015); }
}

.card-reveal {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-content: center;
  gap: 14px;
  padding: 20px;
  background: radial-gradient(circle at center, rgba(243, 201, 105, .18), rgba(0, 0, 0, .72) 54%);
  perspective: 1200px;
  text-align: center;
}

.card-reveal.hidden {
  display: none;
}

.day-resolution {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 14%, rgba(243, 201, 105, .16), transparent 32%),
    rgba(0, 0, 0, .78);
  backdrop-filter: blur(4px);
}

.day-resolution.hidden {
  display: none;
}

.day-resolution-box {
  width: min(620px, 94vw);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(243, 201, 105, .5);
  border-radius: 10px;
  background:
    repeating-linear-gradient(135deg, rgba(243, 201, 105, .045) 0 2px, transparent 2px 9px),
    rgba(12, 13, 18, .96);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .58), inset 0 0 24px rgba(243, 201, 105, .08);
  text-align: center;
}

.day-resolution-kicker {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.day-resolution h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.day-resolution-result {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
}

.day-resolution-result span,
.day-resolution-result small,
.day-resolution-details small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.day-resolution-result strong {
  font-size: 34px;
  line-height: 1;
}

.day-resolution.counting .day-resolution-result {
  border-color: rgba(243, 201, 105, .34);
  background:
    repeating-linear-gradient(90deg, rgba(243, 201, 105, .08) 0 8px, transparent 8px 16px),
    rgba(255, 255, 255, .035);
}

.day-resolution.counting .day-resolution-result strong {
  color: var(--gold);
  animation: voteCountingPulse .8s steps(2, end) infinite;
}

@keyframes voteCountingPulse {
  50% {
    opacity: .35;
    text-shadow: 0 0 18px rgba(243, 201, 105, .5);
  }
}

.day-resolution.wolf-executed .day-resolution-result strong {
  color: #58ffa6;
  text-shadow: 0 0 18px rgba(88, 255, 166, .38);
}

.day-resolution.human-executed .day-resolution-result strong {
  color: var(--wolf);
  text-shadow: 0 0 18px rgba(255, 109, 140, .35);
}

.day-resolution blockquote {
  margin: 0;
  padding: 16px;
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  background: rgba(243, 201, 105, .08);
  color: #fff0c9;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.55;
  text-align: left;
}

.day-resolution-details {
  display: grid;
  gap: 8px;
}

.day-resolution-details div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.day-resolution-details span {
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #e8e0d2;
  font-size: 12px;
  font-weight: 900;
}

.day-resolution button {
  justify-self: center;
  min-width: 170px;
  border-color: var(--gold);
  background: #3b301b;
  color: var(--gold);
}

.card-reveal-inner {
  position: relative;
  width: min(320px, 68vw);
  aspect-ratio: 2 / 3;
  animation: cardDrawIn .34s cubic-bezier(.18, .88, .24, 1.12) both;
}

.card-face {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 28px 72px rgba(0, 0, 0, .62), 0 0 0 1px rgba(243, 201, 105, .32);
}

.card-back {
  z-index: 1;
  opacity: 1;
  transform: scale(1);
  transition: opacity .14s ease, transform .42s cubic-bezier(.2, .74, .2, 1), filter .25s ease;
}

.card-front {
  z-index: 2;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .16s ease, transform .42s cubic-bezier(.18, .88, .24, 1.08), filter .24s ease;
  pointer-events: none;
}

.card-reveal-inner.flipped .card-back {
  opacity: 0;
  transform: scale(.86);
  filter: brightness(1.45) saturate(.72);
}

.card-reveal-inner.flipped .card-front {
  opacity: 1;
  transform: scale(1);
  filter: drop-shadow(0 0 24px rgba(243, 201, 105, .7));
}

.card-reveal p {
  min-height: 24px;
  margin: 0;
  color: var(--gold);
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 2px 8px #000;
}

@keyframes cardDrawIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(.82) rotateZ(-3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1) rotateZ(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-reveal-inner,
  .card-face {
    animation: none;
    transition-duration: .01ms;
  }
}

.hidden {
  display: none;
}

@media (max-height: 780px) {
  .app {
    padding: 8px;
  }

  .hud {
    min-height: 62px;
  }

  .village {
    min-height: 88px;
    padding: 8px;
  }

  .spell,
  .card {
    min-height: 36px;
  }

  .debug-village-grid {
    max-height: none;
  }

  .spells,
  .cards {
    max-height: 150px;
  }

  #log {
    font-size: 12px;
    gap: 6px;
  }
}

@media (max-width: 880px) {
  .app {
    width: min(100vw, 540px);
    overflow: auto;
  }

  .game-layout {
    display: block;
    height: auto;
    min-height: 0;
  }

  .play-column {
    height: auto;
    overflow: visible;
  }

  .log-panel {
    height: 180px;
    margin-top: 8px;
  }

  .god-choices,
  .side-select,
  .difficulty-select,
  .setup-affinity,
  .village-trait-list,
  .archive-grid,
  .archive-summary,
  .archive-columns {
    grid-template-columns: 1fr;
  }

  .debug-village-grid {
    grid-template-columns: 1fr;
  }
}

/* Divine Board: a visual adapter for the three villages, never the game state owner. */
.app {
  width: min(100vw, 1180px);
}

.game-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
}

.divine-board-panel {
  display: grid;
  gap: 8px;
  margin: 9px 0;
  padding: 9px;
  border: 1px solid rgba(201, 174, 113, .38);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(99, 74, 42, .26), transparent 42%),
    repeating-linear-gradient(90deg, rgba(245, 223, 164, .035) 0 1px, transparent 1px 10px),
    rgba(15, 15, 19, .92);
  box-shadow: inset 0 0 32px rgba(242, 193, 99, .06), 0 16px 28px rgba(0, 0, 0, .2);
}

.divine-board-head,
.divine-board-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.divine-board-head p {
  color: #d9b96f;
  font-size: 10px;
  font-weight: 900;
}

.divine-board-head h3 {
  color: #fff5dc;
  font-size: 16px;
}

.board-camera-controls {
  display: flex;
  gap: 5px;
}

.board-camera-controls button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border-color: rgba(236, 204, 128, .46);
  color: #f8df9c;
  font-size: 18px;
  line-height: 1;
}

.divine-board {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  border: 1px solid rgba(255, 246, 216, .12);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 25%, rgba(92, 95, 128, .28), transparent 42%),
    radial-gradient(ellipse at 50% 76%, rgba(156, 105, 57, .16), transparent 54%),
    #101117;
  transition: box-shadow .55s ease;
}

.divine-board::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .018) 0 1px, transparent 1px 4px);
  content: "";
  pointer-events: none;
}

.divine-board canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.board-village-labels {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.board-village-label {
  position: absolute;
  min-width: 96px;
  max-width: 150px;
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  border: 1px solid rgba(242, 214, 151, .3);
  border-radius: 5px;
  background: rgba(10, 11, 16, .78);
  color: #fff4d8;
  box-shadow: 0 5px 14px rgba(0, 0, 0, .22);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  text-align: center;
}

.board-village-label:hover,
.board-village-label.selected {
  border-color: rgba(250, 214, 123, .88);
  background: rgba(45, 36, 20, .9);
  box-shadow: 0 0 0 1px rgba(250, 214, 123, .18), 0 0 18px rgba(245, 191, 74, .2);
}

.board-village-label span {
  color: #d9b96f;
  font-size: 9px;
  font-weight: 900;
}

.board-village-label strong {
  overflow: hidden;
  color: #fff8e7;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-village-label small {
  color: #c3bdad;
  font-size: 9px;
}

.board-village-label.resolved-human {
  border-color: rgba(153, 221, 180, .7);
}

.board-village-label.resolved-wolf {
  border-color: rgba(190, 108, 168, .72);
}

.board-village-label.is-behind {
  opacity: .44;
  pointer-events: none;
}

.divine-board-fallback {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 12px;
  left: 14px;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(243, 201, 105, .35);
  border-radius: 5px;
  background: rgba(18, 16, 13, .92);
  color: #f1d697;
  font-size: 12px;
  text-align: center;
}

.divine-board--fallback canvas,
.divine-board--fallback .board-village-labels {
  opacity: .13;
}

.divine-board--night {
  box-shadow: inset 0 0 70px rgba(7, 3, 13, .78);
}

.divine-board-foot {
  color: #bcb3a1;
  font-size: 10px;
}

.divine-board-foot span:first-child {
  color: #eee0bc;
  font-weight: 800;
}

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

.village {
  min-height: 88px;
}

.village h3 {
  font-size: 13px;
}

.situation {
  grid-template-columns: 46px 1fr;
}

.alive {
  font-size: 16px;
}

@media (max-width: 880px) {
  .app {
    width: min(100vw, 680px);
  }

  .game-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .play-column {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .divine-board {
    min-height: 330px;
  }

  .villages {
    grid-template-columns: 1fr;
  }

  .village h3 {
    font-size: 15px;
  }

  .situation {
    grid-template-columns: 64px 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .divine-board,
  .board-village-label,
  .divine-board-panel {
    scroll-behavior: auto;
    transition: none;
  }
}

/* Hand-card activation is separate from the draw reveal so both moments keep their own rhythm. */
.card-activation {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  pointer-events: none;
  isolation: isolate;
}

.card-activation.hidden {
  display: none;
}

.card-activation-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, .58);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .16s ease;
}

.card-activation-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: min(480px, 92vw);
  height: min(620px, 88vh);
  perspective: 1200px;
}

.card-activation-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(286px, 68vw);
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid rgba(244, 201, 104, .3);
  border-radius: 8px;
  background: #0c0d14;
  box-shadow: 0 18px 56px rgba(0, 0, 0, .55);
  opacity: 0;
  transform: translateY(34px) scale(.9) rotateX(8deg);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .16s ease, filter .12s ease;
}

.card-activation-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-activation-copy {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 3px;
  padding: 38px 14px 14px;
  background: linear-gradient(transparent, rgba(4, 5, 10, .96) 54%);
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .88);
}

.card-activation-copy span {
  color: #ffe49a;
  font-size: 11px;
  font-weight: 900;
}

.card-activation-copy strong {
  color: #fff9e8;
  font-size: 25px;
  line-height: 1.1;
}

.card-activation-copy b {
  color: #ffe49a;
  font-size: 13px;
}

.card-activation-sigil,
.card-activation-ripple,
.card-activation-particles {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
}

.card-activation-sigil {
  z-index: 1;
  width: min(400px, 84vw);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 222, 131, .08);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.62) rotate(-18deg);
  transition: opacity .18s ease, transform .44s cubic-bezier(.2, .75, .15, 1);
}

.card-activation-sigil::before,
.card-activation-sigil::after,
.card-activation-sigil i {
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(255, 222, 131, .42);
  border-radius: 50%;
  content: "";
}

.card-activation-sigil::after {
  inset: 20%;
  border-style: dashed;
  opacity: .72;
}

.card-activation-sigil i:nth-child(1) {
  inset: 4%;
  border-color: rgba(255, 205, 87, .2);
  clip-path: polygon(49% 0, 51% 0, 100% 49%, 100% 51%, 51% 100%, 49% 100%, 0 51%, 0 49%);
}

.card-activation-sigil i:nth-child(2) {
  inset: 32%;
  border-color: rgba(255, 238, 181, .62);
  transform: rotate(45deg);
}

.card-activation-sigil i:nth-child(3) {
  inset: 42%;
  border-color: rgba(255, 211, 92, .74);
}

.card-activation-ripple {
  z-index: 0;
  width: 42px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 218, 119, .9);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.2);
}

.card-activation-ripple--two {
  border-color: rgba(255, 244, 205, .56);
}

.card-activation-particles {
  z-index: 3;
  width: 1px;
  height: 1px;
}

.card-activation-particles i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffe8a4;
  box-shadow: 0 0 10px rgba(255, 217, 114, .92);
  opacity: 0;
  transform: rotate(var(--particle-angle)) translateY(12px) scale(.25);
}

.card-activation.is-entering .card-activation-backdrop {
  opacity: 1;
}

.card-activation.is-entering .card-activation-card {
  opacity: 1;
  transform: translateY(0) scale(1) rotateX(0);
}

.card-activation.is-entering .card-activation-sigil {
  opacity: .56;
  transform: translate(-50%, -50%) scale(1) rotate(0);
}

.card-activation.is-impact .card-activation-card {
  border-color: rgba(255, 237, 173, .96);
  box-shadow: 0 0 0 2px rgba(255, 216, 104, .48), 0 0 46px rgba(255, 207, 83, .62), 0 22px 58px rgba(0, 0, 0, .58);
  filter: brightness(1.2) saturate(1.12);
  animation: card-activation-hit .1s ease-out both;
}

.card-activation.is-impact .card-activation-sigil {
  opacity: .94;
  animation: card-activation-sigil .5s ease-out both;
}

.card-activation.is-impact .card-activation-ripple--one {
  animation: card-activation-ripple .48s ease-out both;
}

.card-activation.is-impact .card-activation-ripple--two {
  animation: card-activation-ripple .52s .05s ease-out both;
}

.card-activation.is-impact .card-activation-particles i {
  animation: card-activation-particle .42s ease-out both;
}

.card-activation.is-resolved .card-activation-card {
  opacity: .18;
  transform: translateY(-8px) scale(.97);
}

.card--activation-selected {
  position: relative;
  z-index: 2;
  border-color: rgba(255, 217, 112, .9) !important;
  box-shadow: 0 0 0 1px rgba(255, 217, 112, .36), 0 0 20px rgba(255, 195, 74, .26);
  transform: translateY(-4px) scale(1.04);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

.cards--activation-pending .card:not(.card--activation-selected) {
  opacity: .46;
  filter: saturate(.7);
  transition: opacity .12s ease, filter .12s ease;
}

.app--card-impact {
  animation: card-activation-shake .18s linear both;
}

.magic-panel--boosted {
  border-color: rgba(255, 213, 104, .64) !important;
  box-shadow: 0 0 0 1px rgba(255, 213, 104, .12), 0 0 24px rgba(255, 196, 74, .13), 0 12px 26px rgba(0, 0, 0, .16);
}

.spell-power-boost-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 219, 125, .48);
  border-radius: 5px;
  background: rgba(92, 66, 17, .34);
  color: #fff0bd;
  font-size: 11px;
  box-shadow: inset 0 0 14px rgba(255, 215, 105, .08);
}

.spell-power-boost-status span {
  color: #ffe196;
  font-weight: 900;
}

.spell-power-boost-status b {
  color: #fff9e9;
  font-size: 12px;
}

.magic-panel--activation-pulse {
  animation: magic-panel-activation .76s ease-out both;
}

@keyframes card-activation-hit {
  0% { transform: translateY(0) scale(1); }
  45% { transform: translateY(0) scale(1.055); }
  100% { transform: translateY(0) scale(1.015); }
}

@keyframes card-activation-sigil {
  0% { transform: translate(-50%, -50%) scale(.82) rotate(0); }
  100% { transform: translate(-50%, -50%) scale(1.12) rotate(28deg); }
}

@keyframes card-activation-ripple {
  0% { opacity: .95; transform: translate(-50%, -50%) scale(.18); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(7.2); }
}

@keyframes card-activation-particle {
  0% { opacity: 0; transform: rotate(var(--particle-angle)) translateY(12px) scale(.25); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--particle-angle)) translateY(var(--particle-distance)) scale(1); }
}

@keyframes card-activation-shake {
  0%, 100% { transform: translateX(0); }
  35% { transform: translateX(-2px); }
  70% { transform: translateX(2px); }
}

@keyframes magic-panel-activation {
  0% { box-shadow: 0 0 0 1px rgba(255, 213, 104, .12), 0 0 0 rgba(255, 196, 74, 0), 0 12px 26px rgba(0, 0, 0, .16); }
  35% { box-shadow: 0 0 0 2px rgba(255, 229, 152, .62), 0 0 34px rgba(255, 201, 84, .44), 0 12px 26px rgba(0, 0, 0, .16); }
  100% { box-shadow: 0 0 0 1px rgba(255, 213, 104, .12), 0 0 24px rgba(255, 196, 74, .13), 0 12px 26px rgba(0, 0, 0, .16); }
}

@media (prefers-reduced-motion: reduce) {
  .card-activation-backdrop,
  .card-activation-card,
  .card-activation-sigil {
    transition-duration: .01ms;
  }

  .card-activation-sigil,
  .card-activation-ripple,
  .card-activation-particles,
  .app--card-impact {
    animation: none !important;
  }

  .card-activation-particles,
  .card-activation-ripple {
    display: none;
  }

  .card-activation.is-impact .card-activation-card {
    transform: translateY(0) scale(1.015);
  }
}

/* Mythic visual refresh: the selection screen is the game's front door. */
:root {
  --ink: #06070b;
  --surface: rgba(13, 15, 23, .92);
  --surface-raised: rgba(27, 31, 44, .96);
  --human-bright: #64caff;
  --wolf-bright: #ff627f;
  --signal: #f4c968;
}

body {
  background:
    linear-gradient(rgba(5, 6, 10, .88), rgba(5, 6, 10, .96)),
    #07080d;
}

button {
  position: relative;
  border-color: rgba(224, 232, 255, .18);
  background: rgba(26, 30, 43, .94);
  box-shadow: inset 0 1px rgba(255, 255, 255, .05);
  transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: rgba(244, 201, 104, .68);
  background: rgba(47, 43, 35, .96);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .23), inset 0 1px rgba(255, 255, 255, .08);
}

button:focus-visible {
  outline: 2px solid var(--human-bright);
  outline-offset: 2px;
}

.app {
  width: min(100vw, 1120px);
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(5, 6, 10, .42), var(--ink) 230px),
    url("data/image/main.jpg") top center / min(100%, 760px) auto no-repeat,
    var(--ink);
}

.game-layout {
  grid-template-columns: minmax(520px, 590px) minmax(350px, 1fr);
  gap: 14px;
  height: calc(100vh - 32px);
}

.setup {
  align-content: start;
  gap: 18px;
  padding: 30px 24px 42px;
  background:
    linear-gradient(180deg, rgba(3, 5, 9, .18), rgba(4, 5, 9, .76) 48%, rgba(4, 5, 9, .98)),
    url("data/image/main.jpg") top center / cover no-repeat;
}

.setup-header {
  display: grid;
  gap: 7px;
  justify-items: center;
  padding-top: 4px;
}

.setup-kicker,
.god-select-kicker {
  color: var(--signal) !important;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-shadow: 0 0 16px rgba(244, 201, 104, .34);
}

.setup h1 {
  color: #f6f2e9;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
  text-shadow: 0 4px 20px #000, 0 0 24px rgba(100, 202, 255, .18);
}

.setup h1 span {
  color: var(--signal);
}

.setup-header #setupLead {
  max-width: 520px;
  color: rgba(242, 238, 229, .78);
  font-size: 14px;
}

.archive-menu {
  width: min(720px, 100%);
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(7, 8, 14, .62);
  backdrop-filter: blur(8px);
}

.archive-menu button,
.log-actions button {
  border-color: rgba(100, 202, 255, .25);
  background: rgba(14, 22, 35, .88);
}

.village-lottery,
.god-setup {
  width: min(1040px, 96vw);
}

.village-lottery {
  padding: 22px;
  border: 1px solid rgba(244, 201, 104, .28);
  border-radius: 8px;
  background: rgba(7, 9, 14, .82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3), inset 0 1px rgba(255, 255, 255, .05);
}

.lottery-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--signal);
  font-size: 12px;
  letter-spacing: .1em;
}

.lottery-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
  content: "";
}

.lottery-slot {
  width: min(100%, 760px);
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-color: rgba(244, 201, 104, .48);
  background: rgba(12, 14, 23, .92);
  font-size: 25px;
}

.lottery-slot span {
  grid-row: 1;
  color: rgba(238, 232, 221, .56);
  font-size: 11px;
  letter-spacing: .07em;
}

.lottery-slot b {
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  color: #fbf6eb;
  font-size: clamp(19px, 2.4vw, 27px);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lottery-result {
  width: 100%;
}

.god-setup {
  gap: 13px;
}

.god-select-kicker {
  margin: 0;
}

.current-village {
  width: 100%;
  max-height: 178px;
  padding: 8px;
  border: 1px solid rgba(100, 202, 255, .24);
  border-radius: 8px;
  background: rgba(6, 10, 16, .72);
}

.current-village .village-trait-list-title {
  color: var(--human-bright);
  font-size: 11px;
  letter-spacing: .06em;
}

.current-village .village-trait-card {
  flex-basis: min(316px, 84vw);
  border-color: rgba(244, 201, 104, .28);
  background: rgba(17, 20, 30, .94);
}

.current-village .village-trait-card strong {
  color: #fff9ec;
}

.side-select,
.difficulty-select {
  width: min(430px, 100%);
}

.side-select button,
.difficulty-select button {
  min-height: 37px;
}

.side-select button.selected {
  border-color: var(--signal);
  background: rgba(72, 54, 23, .96);
  color: #fff1c8;
  box-shadow: 0 0 22px rgba(244, 201, 104, .14);
}

.difficulty-select button.selected {
  border-color: var(--human-bright);
  background: rgba(18, 46, 67, .95);
  color: #e6f6ff;
}

.god-choices {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  max-width: none;
}

.god-choice {
  position: relative;
  min-height: 0;
  overflow: hidden;
  gap: 8px;
  padding: 10px;
  border-color: rgba(255, 255, 255, .15);
  border-radius: 8px;
  background: rgba(10, 12, 19, .94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .26), inset 0 1px rgba(255, 255, 255, .05);
}

.god-choice::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--human-bright);
  box-shadow: 0 0 18px var(--human-bright);
  content: "";
}

.god-choice.god-wolf::before {
  background: var(--wolf-bright);
  box-shadow: 0 0 18px var(--wolf-bright);
}

.god-choice:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: rgba(244, 201, 104, .55);
}

.god-choice.selected {
  border-color: var(--signal);
  background: rgba(24, 22, 23, .98);
  box-shadow: 0 0 0 1px rgba(244, 201, 104, .22), 0 16px 36px rgba(0, 0, 0, .42), 0 0 26px rgba(244, 201, 104, .12);
}

.god-choice.locked {
  min-height: 520px;
}

.god-portrait {
  aspect-ratio: 4 / 5;
  border-color: rgba(255, 255, 255, .2);
  border-radius: 6px;
  object-position: center top;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.god-human .god-portrait {
  border-color: rgba(100, 202, 255, .56);
}

.god-wolf .god-portrait {
  border-color: rgba(255, 98, 127, .56);
}

.god-title {
  margin-top: 1px;
  color: var(--signal);
  font-size: 11px;
  letter-spacing: .06em;
}

.god-choice strong {
  color: #fffaf0;
  font-size: 20px;
}

.god-stars {
  display: flex;
  justify-content: space-between;
  color: var(--signal);
}

.god-stars small {
  color: rgba(239, 234, 222, .56);
}

.god-copy {
  min-height: 35px;
  color: #e7dfd1 !important;
  font-size: 12px !important;
}

.god-specialties {
  grid-template-columns: 38px 1fr;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.god-specialties span {
  display: inline;
  margin-right: 8px;
  color: #d4d8e0;
}

.god-specialties span::before {
  margin-right: 3px;
  color: var(--human-bright);
  content: ">";
}

.god-specialties.weakness span::before {
  color: var(--wolf-bright);
}

.god-playstyle {
  min-height: 45px;
  color: rgba(238, 233, 223, .72) !important;
}

.god-thought {
  color: var(--signal) !important;
}

.god-spells {
  gap: 5px;
  padding-top: 9px;
}

.god-spell-tier {
  grid-template-columns: 45px repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.god-spell-tier span {
  min-width: 0;
  overflow: hidden;
  color: rgba(235, 231, 222, .72);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-game {
  min-width: 250px;
  border-color: var(--signal);
  background: #493719;
  color: #fff2c9;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .26), inset 0 1px rgba(255, 255, 255, .14);
}

.start-game::before {
  margin-right: 7px;
  color: var(--signal);
  content: "✦";
}

.hud,
.turn-strip,
.village,
.panel,
.log-panel {
  border-color: rgba(210, 220, 244, .14);
  background: rgba(12, 14, 22, .9);
}

.hud {
  padding: 12px;
  border: 1px solid rgba(210, 220, 244, .14);
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.hud h2 {
  font-size: 27px;
}

.mp span {
  border-color: rgba(255, 255, 255, .15);
  background: rgba(4, 6, 11, .72);
}

.mp b {
  color: var(--signal);
}

.turn-strip span {
  border-color: rgba(100, 202, 255, .22);
  background: rgba(11, 17, 27, .9);
}

.village {
  min-height: 102px;
  border-left: 3px solid rgba(255, 255, 255, .16);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .13);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.village:hover {
  transform: translateX(2px);
  border-color: rgba(244, 201, 104, .52);
  background: rgba(20, 23, 34, .96);
}

.village.selected {
  outline: 0;
  border-color: var(--signal);
  box-shadow: 0 0 0 1px rgba(244, 201, 104, .44), 0 0 22px rgba(244, 201, 104, .1);
}

.alive {
  background: rgba(26, 30, 43, .94);
  color: var(--signal);
}

.panel,
.log-panel {
  border-radius: 8px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, .16);
}

.panel-head {
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.panel h3,
.log-panel h3 {
  color: #fff8e9;
}

.spells,
.cards {
  max-height: 250px;
}

.spell,
.card {
  min-height: 50px;
  border-radius: 6px;
  background: rgba(24, 28, 40, .82);
}

.spell {
  border-left-width: 3px;
}

.spell.human:hover:not(:disabled) {
  background: rgba(17, 45, 65, .96);
}

.spell.wolf:hover:not(:disabled) {
  background: rgba(60, 21, 37, .96);
}

.card {
  border-color: rgba(255, 255, 255, .13);
}

.card-actions button:first-child {
  border-color: rgba(100, 202, 255, .28);
}

.card-actions button:last-child {
  border-color: rgba(244, 201, 104, .34);
}

.log-panel {
  background: rgba(8, 10, 16, .94);
}

.log-entry {
  border-radius: 5px;
  background: rgba(24, 28, 39, .52);
}

.day-resolution-box,
.result-box {
  border-radius: 8px;
  background: rgba(10, 12, 19, .98);
  box-shadow: 0 30px 96px rgba(0, 0, 0, .74), 0 0 45px rgba(244, 201, 104, .1);
}

.day-resolution h2,
.result-box #resultText {
  color: #fff9eb;
  text-shadow: 0 0 24px rgba(244, 201, 104, .16);
}

@media (max-width: 880px) {
  .app {
    width: min(100vw, 620px);
    padding: 10px;
  }

  .setup {
    padding: 20px 12px 32px;
  }

  .lottery-slot {
    padding: 12px 8px;
  }

  .god-choices {
    grid-template-columns: 1fr;
    width: min(440px, 100%);
  }

  .god-choice.locked {
    min-height: 0;
  }

  .god-portrait {
    max-height: 470px;
  }

  .current-village {
    max-height: 188px;
  }
}

/* Divine Board final layout overrides: keep the tabletop spacious without removing 2D controls. */
.app {
  width: min(100vw, 1180px);
}

.game-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
}

@media (max-width: 880px) {
  .app {
    width: min(100vw, 680px);
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .game-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .play-column {
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .divine-board {
    min-height: 330px;
  }

  .villages {
    grid-template-columns: 1fr;
  }
}
