:root {
  color-scheme: dark;
  --ink: #f3ead8;
  --muted: #b9ab93;
  --line: rgba(243, 234, 216, 0.16);
  --panel: rgba(25, 28, 31, 0.86);
  --panel-soft: rgba(40, 39, 34, 0.72);
  --gold: #d9b76f;
  --green: #8fbf7f;
  --red: #d66d62;
  --blue: #7fa6c9;
  --stone: #25282b;
  --topbar-height: 112px;
  --war-banner-height: 0px;
  --fixed-chrome-gap: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #151819;
  color: var(--ink);
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
}

body.war-mode {
  --ink: #f6e8d7;
  --muted: #c9aaa0;
  --line: rgba(229, 126, 102, 0.2);
  --panel: rgba(27, 22, 23, 0.9);
  --panel-soft: rgba(53, 32, 31, 0.74);
}

button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(15, 17, 17, 0.82);
  color: var(--ink);
  min-height: 42px;
  padding: 0 12px;
  font: inherit;
}

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(21, 24, 25, 0.18), rgba(21, 24, 25, 0.78) 24%, rgba(21, 24, 25, 0.82) 76%, rgba(21, 24, 25, 0.24)),
    linear-gradient(180deg, rgba(11, 13, 14, 0.18), #151819 82%),
    url("/assets/frederick-iii.jpg") right 4vw top 38px / auto min(76vh, 760px) no-repeat fixed,
    url("/assets/austrian-region-1450.jpg") left 3vw bottom 4vh / min(42vw, 560px) auto no-repeat fixed,
    url("/assets/austria-1444-heraldry.svg") center top / cover fixed,
    url("/assets/end.png") center top / cover fixed;
  position: relative;
  isolation: isolate;
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(105deg, transparent 0%, rgba(234, 216, 181, 0.09) 24%, transparent 48%, rgba(234, 216, 181, 0.06) 72%, transparent 100%),
    radial-gradient(circle at 83% 18%, rgba(217, 183, 111, 0.18), transparent 27%),
    radial-gradient(circle at 13% 77%, rgba(185, 45, 45, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0.48));
  mix-blend-mode: screen;
  opacity: 0.62;
  animation: ambient-fog 44s ease-in-out infinite alternate;
}

body.war-mode .app-shell::before {
  background:
    linear-gradient(105deg, transparent 0%, rgba(214, 109, 98, 0.12) 24%, transparent 48%, rgba(217, 183, 111, 0.06) 72%, transparent 100%),
    radial-gradient(circle at 78% 15%, rgba(214, 109, 98, 0.18), transparent 30%),
    radial-gradient(circle at 8% 72%, rgba(115, 31, 30, 0.28), transparent 31%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(18, 8, 8, 0.68));
  opacity: 0.86;
  animation: war-fog 18s ease-in-out infinite alternate;
}

body.war-mode .app-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border: 1px solid rgba(214, 109, 98, 0.18);
  box-shadow: inset 0 0 90px rgba(96, 24, 22, 0.42);
  animation: war-edge-pulse 3.4s ease-in-out infinite;
}

@keyframes ambient-fog {
  from {
    transform: translateX(-1.5%);
  }
  to {
    transform: translateX(1.5%);
  }
}

@keyframes war-fog {
  from {
    transform: translateX(-2%) translateY(0);
  }
  to {
    transform: translateX(2%) translateY(1%);
  }
}

@keyframes war-edge-pulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 0.92;
  }
}

.court {
  min-height: 100vh;
  padding: 24px;
  backdrop-filter: blur(1px);
}

.entry-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.entry-card,
.save-hall {
  width: min(980px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 31, 0.9);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  padding: 24px;
}

.entry-card {
  max-width: 460px;
}

.wide-button {
  width: 100%;
  margin-top: 16px;
}

.entry-copy,
.save-label {
  color: var(--muted);
  line-height: 1.6;
  margin: 10px 0 0;
}

.save-label {
  font-size: 13px;
}

.archive-status {
  display: inline-flex;
  width: fit-content;
  margin: 8px 0 0;
  border: 1px solid rgba(217, 183, 111, 0.22);
  border-radius: 999px;
  background: rgba(217, 183, 111, 0.08);
  color: rgba(238, 226, 198, 0.68);
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 10px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.archive-status.pulse {
  border-color: rgba(217, 183, 111, 0.76);
  background: rgba(217, 183, 111, 0.18);
  color: #f7e5bd;
  box-shadow: 0 0 22px rgba(217, 183, 111, 0.18);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 20px 0 14px;
}

.auth-tabs button,
.primary-button,
.scenario-card,
.save-card button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 22, 22, 0.82);
  color: var(--muted);
  min-height: 40px;
  padding: 0 12px;
  cursor: pointer;
}

.auth-tabs button.active,
.primary-button,
.scenario-card.active,
.save-card button:hover {
  border-color: var(--gold);
  background: var(--gold);
  color: #171715;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.save-name-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.form-message {
  min-height: 20px;
  color: var(--red);
  margin: 0;
  font-size: 13px;
}

.hall-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.hall-actions {
  display: flex;
  gap: 8px;
  justify-content: end;
  flex-wrap: wrap;
}

.hall-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.scenario-list,
.save-list {
  display: grid;
  gap: 10px;
}

.scenario-card {
  display: grid;
  gap: 6px;
  text-align: left;
  min-height: auto;
  padding: 13px;
}

.scenario-card strong,
.save-card strong {
  color: var(--ink);
}

.scenario-card.active strong {
  color: #171715;
}

.scenario-card span,
.scenario-card em,
.save-card span,
.empty-save {
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  font-style: normal;
}

.scenario-card.active span,
.scenario-card.active em {
  color: rgba(23, 23, 21, 0.78);
}

.save-name-field {
  margin-top: 14px;
}

.primary-button {
  width: 100%;
  margin-top: 12px;
}

.save-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.save-card div {
  display: grid;
  gap: 5px;
}

.save-card .save-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.save-card button.danger-button {
  border-color: rgba(214, 109, 98, 0.42);
  color: #f0b3aa;
}

.save-card button.danger-button:hover {
  border-color: var(--red);
  background: rgba(214, 109, 98, 0.18);
  color: #ffd9d2;
}

.library-view {
  min-height: 100vh;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.library-head,
.library-tools,
.library-grid {
  width: min(1240px, 100%);
  margin-inline: auto;
}

.library-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 28, 31, 0.9);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  padding: 22px;
}

.library-tools {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.library-tools input {
  min-height: 48px;
  background: rgba(15, 17, 17, 0.9);
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-filters button {
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 999px;
  background: rgba(20, 22, 22, 0.84);
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  cursor: pointer;
}

.category-filters button.active,
.category-filters button:hover {
  border-color: var(--gold);
  background: rgba(217, 183, 111, 0.18);
  color: var(--ink);
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.library-panel {
  min-height: 300px;
}

.scenario-knowledge,
.library-section-list,
.event-library-list {
  display: grid;
  gap: 10px;
}

.scenario-library-card {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(217, 183, 111, 0.28);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.1);
  padding: 13px;
}

.scenario-library-card strong,
.library-event-card strong {
  color: var(--ink);
}

.scenario-library-card span,
.scenario-library-card em,
.library-event-card p,
.library-choice span {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.58;
}

.library-event-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
}

.library-event-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.library-event-head div {
  display: grid;
  gap: 4px;
}

.library-event-head small {
  color: var(--gold);
  font-size: 12px;
}

.library-event-head span {
  border: 1px solid rgba(217, 183, 111, 0.28);
  border-radius: 999px;
  color: var(--gold);
  font-size: 12px;
  padding: 4px 8px;
  white-space: nowrap;
}

.truth-tag {
  width: fit-content;
  border: 1px solid rgba(117, 158, 198, 0.34);
  border-radius: 999px;
  background: rgba(48, 79, 106, 0.22);
  color: #cfe2ee;
  font-size: 12px;
  line-height: 1.4;
  padding: 4px 9px;
}

.library-choice-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.library-choice {
  display: grid;
  gap: 4px;
  border-left: 2px solid rgba(217, 183, 111, 0.5);
  padding-left: 9px;
}

.prototype-time {
  display: inline-flex;
  width: fit-content;
  margin: 0 8px 6px 0;
  border: 1px solid rgba(217, 183, 111, 0.28);
  border-radius: 999px;
  background: rgba(217, 183, 111, 0.12);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
}

.historical-date-note {
  display: block;
  margin: 8px 12px 12px;
  color: rgba(238, 226, 198, 0.52);
  font-size: 11px;
  line-height: 1.5;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: end;
}

.music-toggle.active {
  border-color: rgba(217, 183, 111, 0.58);
  background: rgba(217, 183, 111, 0.16);
  color: #f0d99d;
}

.music-status {
  color: rgba(238, 226, 198, 0.62);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(520px, 1.35fr) auto;
  gap: 16px;
  align-items: center;
  max-width: 1440px;
  margin: 0 auto 18px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(21, 24, 25, 0.94), rgba(25, 28, 31, 0.78)),
    url("/assets/austria-1444-heraldry.svg") center / cover;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.34);
  padding: 14px 16px;
  backdrop-filter: blur(12px);
}

body.war-mode .topbar {
  border-color: rgba(214, 109, 98, 0.34);
  background:
    linear-gradient(90deg, rgba(24, 15, 16, 0.96), rgba(40, 24, 24, 0.84)),
    url("/assets/austria-1444-heraldry.svg") center / cover;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(214, 109, 98, 0.06);
}

.war-banner {
  position: relative;
  grid-column: 1 / -1;
  z-index: 1;
  width: 100%;
  margin: 2px 0 0;
  display: grid;
  grid-template-columns: minmax(190px, 0.75fr) minmax(280px, 1.15fr) minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(214, 109, 98, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(66, 23, 23, 0.92), rgba(27, 22, 23, 0.9)),
    repeating-linear-gradient(135deg, rgba(243, 234, 216, 0.04) 0 1px, transparent 1px 12px);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), inset 0 0 34px rgba(214, 109, 98, 0.08);
  padding: 10px 12px;
  overflow: hidden;
}

body.war-mode .war-banner {
  backdrop-filter: blur(12px);
}

body.war-mode .game-grid {
  margin-top: 0;
}

.war-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(217, 183, 111, 0.08), transparent);
  transform: translateX(-100%);
  animation: war-scan 5.2s ease-in-out infinite;
}

.war-banner-title,
.war-banner-ledger {
  position: relative;
  z-index: 1;
}

.war-banner-title {
  display: grid;
  gap: 2px;
}

.war-banner-title span,
.war-banner-title em,
.war-banner-ledger span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.war-banner-title strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.25;
}

.war-banner-front {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.war-banner-front > span {
  color: rgba(246, 232, 215, 0.68);
  font-size: 12px;
  white-space: nowrap;
}

.war-front-track {
  position: relative;
  height: 12px;
  border: 1px solid rgba(243, 234, 216, 0.16);
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(214, 109, 98, 0.3), rgba(217, 183, 111, 0.16) 50%, rgba(117, 158, 116, 0.24)),
    rgba(10, 10, 10, 0.42);
  overflow: hidden;
}

.war-front-track i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(214, 109, 98, 0.75), rgba(217, 183, 111, 0.9));
  box-shadow: 0 0 18px rgba(217, 183, 111, 0.18);
  transition: width 520ms ease;
}

.war-front-track::after {
  content: "";
  position: absolute;
  top: -5px;
  left: calc(var(--value) - 5px);
  width: 10px;
  height: 20px;
  border-radius: 3px;
  background: #e6d0a1;
  box-shadow: 0 0 16px rgba(217, 183, 111, 0.6);
  transition: left 520ms ease;
}

.war-banner-ledger {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.war-banner-ledger span {
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  padding: 3px 8px;
  white-space: nowrap;
}

.war-peace-button,
.war-peace-wide {
  border: 1px solid rgba(217, 183, 111, 0.45);
  border-radius: 999px;
  background: rgba(217, 183, 111, 0.16);
  color: #f3dfad;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  min-height: 26px;
  padding: 4px 10px;
}

.war-peace-button:hover,
.war-peace-wide:hover {
  border-color: rgba(217, 183, 111, 0.78);
  background: rgba(217, 183, 111, 0.26);
}

.war-banner.danger {
  border-color: rgba(214, 109, 98, 0.68);
  animation: war-banner-danger 2.4s ease-in-out infinite;
}

.war-banner.good {
  border-color: rgba(217, 183, 111, 0.54);
}

@keyframes war-scan {
  0%,
  56% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(110%);
  }
}

@keyframes war-banner-danger {
  0%,
  100% {
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), inset 0 0 34px rgba(214, 109, 98, 0.08);
  }
  50% {
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.34), 0 0 24px rgba(214, 109, 98, 0.14), inset 0 0 42px rgba(214, 109, 98, 0.18);
  }
}

.topbar-title {
  min-width: 0;
}

.vital-hud {
  display: grid;
  grid-template-columns: minmax(300px, 1.35fr) minmax(230px, 0.9fr);
  gap: 10px;
  min-width: 0;
}

.vital-group {
  min-width: 0;
  border-radius: 8px;
  padding: 7px;
  border: 1px solid rgba(243, 234, 216, 0.1);
}

.vital-group.pillars {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(42, 67, 62, 0.12));
}

.vital-group.tools {
  border-color: rgba(217, 183, 111, 0.2);
  background:
    linear-gradient(135deg, rgba(217, 183, 111, 0.12), rgba(92, 61, 33, 0.16)),
    rgba(22, 18, 14, 0.3);
}

.vital-group-title {
  margin: 0 0 6px;
  color: rgba(243, 234, 216, 0.64);
  font-size: 10px;
  letter-spacing: 0;
}

.vital-group.tools .vital-group-title {
  color: rgba(239, 205, 135, 0.76);
}

.vital-group-grid {
  display: grid;
  gap: 7px;
}

.pillars-grid {
  grid-template-columns: repeat(4, minmax(58px, 1fr));
}

.tools-grid {
  grid-template-columns: repeat(3, minmax(58px, 1fr));
}

.vital-chip {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  padding: 7px 8px;
}

.vital-chip:focus-visible,
.metric-card:focus-visible {
  outline: 1px solid rgba(217, 183, 111, 0.72);
  outline-offset: 2px;
}

.vital-chip.resource {
  border-color: rgba(217, 183, 111, 0.26);
  background: rgba(217, 183, 111, 0.1);
  padding-left: 11px;
  box-shadow: inset 3px 0 0 rgba(217, 183, 111, 0.5);
}

.vital-chip.warning {
  border-color: rgba(217, 183, 111, 0.52);
}

.vital-chip.danger {
  border-color: rgba(214, 109, 98, 0.68);
  background: rgba(92, 26, 25, 0.28);
  animation: vitalWarning 1.8s ease-in-out infinite;
}

.vital-chip.pillar-signed.negative {
  border-color: rgba(214, 109, 98, 0.48);
  background: rgba(92, 26, 25, 0.18);
}

.vital-chip.pillar-signed.critical {
  border-color: rgba(214, 109, 98, 0.76);
  background: rgba(92, 26, 25, 0.32);
  box-shadow: 0 0 0 1px rgba(214, 109, 98, 0.16), inset 0 0 18px rgba(214, 109, 98, 0.08);
}

.vital-chip.pillar-signed.watching {
  border-color: rgba(217, 183, 111, 0.28);
}

.vital-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 5px;
  align-items: baseline;
  margin-bottom: 5px;
}

.vital-line span {
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vital-line strong {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.vital-line em {
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.vital-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.vital-bar span {
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
}

.signed-bar {
  position: relative;
}

.signed-bar::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(243, 234, 216, 0.48);
}

.signed-bar span {
  background: linear-gradient(90deg, #8f2f2d 0%, #b86145 44%, #d9b76f 50%, #7f9f72 74%, #5d9b79 100%);
}

.vital-chip.resource .vital-bar span {
  background: linear-gradient(90deg, #8f5f2d, var(--gold), #f1d48b);
}

.impact-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  z-index: 30;
  width: min(260px, 82vw);
  transform: translateX(-50%) translateY(-4px);
  border: 1px solid rgba(217, 183, 111, 0.34);
  border-radius: 8px;
  background: rgba(22, 20, 17, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
  color: var(--muted);
  display: grid;
  gap: 5px;
  opacity: 0;
  pointer-events: none;
  padding: 10px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.impact-popover,
.impact-note {
  display: none;
}

.impact-popover::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -5px;
  width: 9px;
  height: 9px;
  transform: translateX(-50%) rotate(45deg);
  border-left: 1px solid rgba(217, 183, 111, 0.34);
  border-top: 1px solid rgba(217, 183, 111, 0.34);
  background: rgba(22, 20, 17, 0.96);
}

.impact-popover strong,
.impact-note strong,
.global-impact-tooltip strong {
  color: var(--gold);
  font-size: 12px;
  line-height: 1.35;
}

.impact-popover span,
.impact-note span,
.global-impact-tooltip span {
  color: rgba(238, 226, 198, 0.76);
  font-size: 11px;
  line-height: 1.45;
}

.global-impact-tooltip {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 120;
  display: grid;
  width: min(300px, calc(100vw - 24px));
  gap: 5px;
  border: 1px solid rgba(217, 183, 111, 0.38);
  border-radius: 8px;
  background: rgba(22, 20, 17, 0.97);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.52);
  color: var(--muted);
  padding: 10px 11px;
  pointer-events: none;
}

@keyframes vitalWarning {
  0%,
  100% {
    box-shadow: inset 0 0 18px rgba(214, 109, 98, 0.06);
  }
  50% {
    box-shadow: inset 0 0 24px rgba(214, 109, 98, 0.22), 0 0 18px rgba(214, 109, 98, 0.1);
  }
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.clock {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.date-card {
  position: relative;
  display: grid;
  justify-items: end;
  min-width: 178px;
  border: 1px solid rgba(217, 183, 111, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(236, 218, 178, 0.13), rgba(47, 31, 23, 0.22)),
    rgba(14, 15, 15, 0.86);
  box-shadow: inset 0 0 34px rgba(217, 183, 111, 0.08);
  padding: 10px 12px;
  transform-origin: top center;
}

.date-card::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-top: 1px solid rgba(217, 183, 111, 0.22);
  pointer-events: none;
}

.date-kicker,
.date-sub {
  color: var(--gold);
  font-size: 11px;
  line-height: 1.2;
}

#dateLabel,
.date-main {
  color: var(--ink);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  margin: 4px 0;
}

.date-sub {
  color: var(--muted);
}

.date-card.date-flip {
  animation: calendar-flip 520ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.date-card.month-turn {
  animation: calendar-flip 520ms cubic-bezier(0.2, 0.72, 0.2, 1), month-seal 900ms ease-out;
}

.event-alert {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(217, 183, 111, 0.58);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.18);
  color: var(--ink);
  padding: 9px 12px;
  box-shadow: 0 10px 30px rgba(217, 183, 111, 0.14);
  max-width: 330px;
}

.event-alert strong {
  color: var(--gold);
  font-size: 14px;
}

.event-alert span {
  color: #dfd3bd;
  font-size: 12px;
  line-height: 1.45;
}

.speed-controls {
  display: flex;
  gap: 6px;
}

.speed-controls button,
.ghost-button {
  border: 1px solid var(--line);
  background: rgba(20, 22, 22, 0.82);
  color: var(--muted);
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

.speed-controls button.active,
.ghost-button:hover {
  color: #171715;
  background: var(--gold);
  border-color: var(--gold);
}

@keyframes calendar-flip {
  0% {
    transform: perspective(360px) rotateX(0deg) translateY(0);
  }
  42% {
    transform: perspective(360px) rotateX(-18deg) translateY(1px);
    box-shadow: inset 0 18px 34px rgba(0, 0, 0, 0.34);
  }
  100% {
    transform: perspective(360px) rotateX(0deg) translateY(0);
  }
}

@keyframes month-seal {
  0% {
    border-color: rgba(217, 183, 111, 0.32);
  }
  28% {
    border-color: rgba(217, 183, 111, 0.95);
    box-shadow: 0 0 0 5px rgba(217, 183, 111, 0.13), inset 0 0 38px rgba(217, 183, 111, 0.22);
  }
  100% {
    border-color: rgba(217, 183, 111, 0.32);
  }
}

.game-grid {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(520px, 1fr);
  gap: 16px;
  align-items: start;
}

.status-panel {
  position: sticky;
  top: 132px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 183, 111, 0.45) rgba(255, 255, 255, 0.06);
}

body.war-mode .status-panel {
  top: calc(var(--topbar-height) + var(--war-banner-height) + 28px);
  max-height: calc(100vh - var(--topbar-height) - var(--war-banner-height) - 44px);
}

.panel,
.event-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

body.war-mode .panel,
body.war-mode .event-card {
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34), inset 0 0 28px rgba(214, 109, 98, 0.04);
}

.panel {
  border-radius: 8px;
  padding: 16px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  color: var(--ink);
  font-size: 16px;
}

.sidebar-section {
  border-bottom: 1px solid rgba(243, 234, 216, 0.08);
  padding-bottom: 14px;
}

.sidebar-section + .sidebar-section {
  margin-top: 14px;
}

.sidebar-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sidebar-section > summary.panel-title {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}

.sidebar-section > summary.panel-title::-webkit-details-marker {
  display: none;
}

.sidebar-section > summary.panel-title::after {
  content: "▾";
  color: var(--gold);
  font-size: 12px;
  transform: rotate(-90deg);
  transition: transform 160ms ease;
}

.sidebar-section[open] > summary.panel-title {
  margin-bottom: 14px;
}

.sidebar-section[open] > summary.panel-title::after {
  transform: rotate(0deg);
}

.panel-title small {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.resources-title {
  margin-top: 24px;
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-card {
  border: 1px solid rgba(243, 234, 216, 0.12);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 8px;
  padding: 12px;
}

.metric-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 15px;
}

.metric-value {
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value);
  background: linear-gradient(90deg, var(--red), var(--gold), var(--green));
}

.signed-meter {
  position: relative;
}

.signed-meter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  background: rgba(243, 234, 216, 0.5);
}

.signed-meter span {
  background: linear-gradient(90deg, #8f2f2d 0%, #b86145 44%, #d9b76f 50%, #7f9f72 74%, #5d9b79 100%);
}

.metric-card.support-negative,
.metric-card.support-critical {
  border-color: rgba(214, 109, 98, 0.46);
  background:
    linear-gradient(180deg, rgba(92, 26, 25, 0.18), rgba(22, 18, 14, 0.28)),
    rgba(255, 255, 255, 0.03);
}

.metric-card.support-critical {
  border-color: rgba(214, 109, 98, 0.76);
  box-shadow: inset 0 0 22px rgba(214, 109, 98, 0.08);
}

.metric-card.support-watching {
  border-color: rgba(217, 183, 111, 0.24);
}

.trend {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.trend-detail {
  margin-top: 3px;
  color: rgba(243, 234, 216, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.impact-note {
  display: grid;
  gap: 5px;
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  border: 1px solid rgba(217, 183, 111, 0);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0);
  opacity: 0;
  padding: 0 10px;
  transition: max-height 180ms ease, margin-top 180ms ease, opacity 180ms ease, padding 180ms ease, border-color 180ms ease, background 180ms ease;
}

.metric-card:hover .impact-note,
.metric-card:focus-within .impact-note,
.metric-card:focus .impact-note {
  max-height: 210px;
  margin-top: 8px;
  border-color: rgba(217, 183, 111, 0.22);
  background: rgba(217, 183, 111, 0.07);
  opacity: 1;
  padding: 9px 10px;
}

.month-delta {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.submetrics {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.submetrics span {
  border: 1px solid rgba(243, 234, 216, 0.1);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 12px;
}

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

.resource {
  padding: 14px 12px;
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.11);
  border: 1px solid rgba(217, 183, 111, 0.22);
}

.resource-treasury {
  grid-column: 1 / -1;
  background:
    linear-gradient(135deg, rgba(217, 183, 111, 0.14), rgba(92, 61, 33, 0.12)),
    rgba(217, 183, 111, 0.09);
}

.resource strong {
  display: block;
  font-size: 24px;
  color: var(--gold);
  margin-top: 6px;
}

.resource em {
  display: block;
  margin-top: 5px;
  font-style: normal;
  font-size: 12px;
}

.finance-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.finance-lines span:first-child,
.finance-lines span:nth-child(2),
.finance-lines span:nth-child(3),
.finance-lines em {
  grid-column: 1 / -1;
}

.finance-efficiency-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.finance-impact-target,
.impact-target {
  position: relative;
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-bottom: 1px dotted rgba(217, 183, 111, 0.42);
  color: rgba(238, 226, 198, 0.84);
  cursor: help;
  font-style: normal;
}

.finance-impact-target:focus-visible,
.impact-target:focus-visible {
  outline: 1px solid rgba(217, 183, 111, 0.72);
  outline-offset: 2px;
}

.finance-impact-target .impact-popover,
.impact-target .impact-popover {
  left: 0;
  top: calc(100% + 8px);
  transform: translateY(-4px);
  width: min(280px, 78vw);
}

.finance-impact-target .impact-popover::before,
.impact-target .impact-popover::before {
  left: 18px;
  transform: rotate(45deg);
}

.impact-target.good {
  color: var(--green);
}

.impact-target.danger,
.impact-target.negative {
  color: var(--red);
}

.impact-target.positive {
  color: var(--green);
}

.finance-lines em {
  font-style: normal;
  color: rgba(243, 234, 216, 0.56);
}

.foreign-list {
  display: grid;
  gap: 8px;
}

.foreign-card {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.foreign-card.war-ready {
  border-color: rgba(214, 109, 98, 0.58);
  background: rgba(92, 26, 25, 0.34);
  box-shadow: inset 0 0 24px rgba(214, 109, 98, 0.08);
}

.mini-flag {
  width: 34px;
  height: 24px;
  border: 1px solid rgba(243, 234, 216, 0.28);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--flag-a) 0 33%, var(--flag-b) 33% 66%, var(--flag-c) 66% 100%);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.22);
}

.heraldry-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border: 1px solid rgba(243, 234, 216, 0.22);
  border-radius: 5px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.12), rgba(23, 20, 17, 0.55));
  padding: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.24);
}

.foreign-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

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

.foreign-head strong {
  font-size: 14px;
}

.foreign-head span,
.foreign-card em {
  font-variant-numeric: tabular-nums;
}

.foreign-head span.good {
  color: var(--green);
}

.foreign-head span.danger,
.foreign-card em.danger {
  color: var(--red);
}

.foreign-tags,
.foreign-detail,
.foreign-card em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.35;
}

.foreign-detail {
  flex-wrap: wrap;
}

.foreign-tags.muted {
  opacity: 0.72;
}

.war-panel,
.province-list {
  display: grid;
  gap: 8px;
}

.war-card,
.province-card {
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.war-card {
  display: grid;
  gap: 9px;
  border-color: rgba(214, 109, 98, 0.34);
  background: rgba(92, 26, 25, 0.25);
}

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

.war-head strong,
.province-card strong {
  font-size: 14px;
  line-height: 1.35;
}

.war-head span {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.war-head span.good {
  color: var(--green);
}

.war-head span.danger {
  color: var(--red);
}

.war-progress span {
  background: linear-gradient(90deg, var(--red), rgba(217, 183, 111, 0.9), var(--green));
}

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

.war-peace-wide {
  width: fit-content;
  border-radius: 6px;
}

body.war-mode .war-card {
  box-shadow: inset 0 0 24px rgba(214, 109, 98, 0.08);
}

.stance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stance-grid button {
  position: relative;
  display: grid;
  gap: 3px;
  align-content: center;
  min-height: 54px;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 6px;
  background: rgba(20, 22, 22, 0.74);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 8px;
  overflow: hidden;
  text-align: left;
}

.stance-grid button.active,
.stance-grid button:hover {
  border-color: var(--gold);
  background: rgba(217, 183, 111, 0.18);
  color: var(--ink);
}

.stance-grid button strong {
  color: inherit;
  font-size: 12px;
  line-height: 1.2;
}

.stance-grid button span {
  color: rgba(243, 234, 216, 0.62);
  font-size: 10px;
  line-height: 1.25;
}

.stance-grid button.active::after {
  content: "已盖印";
  position: absolute;
  right: -18px;
  top: 5px;
  border: 1px solid rgba(214, 109, 98, 0.54);
  color: rgba(255, 202, 181, 0.9);
  font-size: 10px;
  line-height: 1;
  padding: 3px 18px;
  transform: rotate(28deg);
}

.province-card {
  display: grid;
  gap: 6px;
}

.province-ledger-total {
  border: 1px solid rgba(217, 183, 111, 0.22);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.08);
  color: rgba(238, 226, 198, 0.86);
  font-size: 12px;
  line-height: 1.45;
  padding: 8px 10px;
}

.peace-council-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(6, 7, 8, 0.68);
  backdrop-filter: blur(7px);
  padding: 24px;
}

.peace-council {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid rgba(217, 183, 111, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 28, 24, 0.96), rgba(18, 17, 17, 0.97)),
    url("/assets/austria-1444-heraldry.svg") center / cover;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  padding: 20px;
}

.peace-council-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.peace-council-head small,
.peace-council p,
.peace-ledger span,
.peace-option span,
.peace-option small {
  color: var(--muted);
}

.peace-council h2 {
  margin: 8px 0;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.25;
}

.peace-council p {
  margin: 0 0 14px;
  line-height: 1.7;
}

.peace-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(243, 234, 216, 0.16);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.24);
  color: var(--ink);
  cursor: pointer;
  font-size: 20px;
}

.peace-ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.peace-ledger span {
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
  padding: 5px 9px;
}

.peace-options {
  display: grid;
  gap: 10px;
}

.peace-option {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(217, 183, 111, 0.24);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.08);
  color: var(--ink);
  cursor: pointer;
  padding: 12px;
  text-align: left;
}

.peace-option:hover:not(:disabled) {
  border-color: rgba(217, 183, 111, 0.66);
  background: rgba(217, 183, 111, 0.16);
}

.peace-option:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.peace-option strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.peace-option span,
.peace-option small {
  font-size: 12px;
  line-height: 1.45;
}

.policy-list {
  display: grid;
  gap: 10px;
}

.policy-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(217, 183, 111, 0.2);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.08);
  padding: 10px;
}

.policy-card div:last-child {
  display: grid;
  gap: 4px;
}

.policy-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}

.policy-card span,
.policy-card em,
.benefit-line {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
}

.policy-repeal-button {
  width: fit-content;
  border: 1px solid rgba(214, 109, 98, 0.42);
  border-radius: 6px;
  background: rgba(214, 109, 98, 0.1);
  color: #f0c0bb;
  cursor: pointer;
  font-size: 12px;
  min-height: 30px;
  padding: 0 10px;
}

.policy-repeal-button:hover:not(:disabled) {
  background: rgba(214, 109, 98, 0.22);
}

.policy-repeal-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.event-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(217, 183, 111, 0.38);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.14);
  color: var(--gold);
  font-weight: 800;
  font-size: 14px;
}

.event-mark.inline {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  margin-right: 6px;
  vertical-align: middle;
  font-size: 12px;
}

.policy-created {
  border: 1px solid rgba(143, 191, 127, 0.32);
  border-radius: 8px;
  background: rgba(143, 191, 127, 0.12);
  color: #d9f0dd;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  padding: 10px 12px;
}

.policy-created.danger {
  border-color: rgba(214, 109, 98, 0.38);
  background: rgba(214, 109, 98, 0.12);
  color: #f0c0bb;
}

.policy-created small {
  display: block;
  margin-top: 4px;
  color: rgba(231, 216, 188, 0.76);
  font-weight: 600;
  line-height: 1.45;
}

.draft-research-status {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 10px;
  border: 1px solid rgba(217, 183, 111, 0.22);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.07);
  color: rgba(238, 226, 198, 0.82);
  padding: 10px 12px;
}

.draft-research-status strong {
  color: var(--gold);
  font-size: 13px;
}

.draft-research-status p {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.draft-research-status.done,
.draft-research-status.warning {
  grid-template-columns: 1fr;
}

.draft-research-status.done strong {
  color: var(--green);
}

.draft-research-status.warning strong {
  color: #f0c0bb;
}

.loading-seal.small {
  width: 20px;
  height: 20px;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.neutral {
  color: var(--muted);
}

.main-stage {
  display: grid;
  gap: 16px;
}

.visual-band {
  min-height: 260px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(96, 14, 19, 0.28), transparent 36%),
    linear-gradient(180deg, #181513, #090909);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.58), 0 18px 60px rgba(0, 0, 0, 0.22);
}

.visual-band img {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.visual-court {
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
  object-position: center;
  opacity: 0.82;
  transform: scale(1.04);
  filter: sepia(0.18) saturate(0.86) contrast(1.08) brightness(0.66);
  animation: historical-breath 22s ease-in-out infinite alternate;
}

.visual-court-primary {
  opacity: 0.84;
}

.visual-court-secondary {
  opacity: 0;
  object-position: center 44%;
  animation: historical-breath 26s ease-in-out infinite alternate, court-crossfade 42s ease-in-out infinite;
}

.visual-band::before,
.visual-band::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.visual-band::before {
  background:
    linear-gradient(90deg, rgba(6, 7, 8, 0.7), rgba(6, 7, 8, 0.14) 36%, rgba(6, 7, 8, 0.56)),
    radial-gradient(circle at 24% 18%, rgba(217, 183, 111, 0.16), transparent 28%),
    radial-gradient(circle at 82% 74%, rgba(185, 45, 45, 0.14), transparent 34%);
  mix-blend-mode: multiply;
}

.visual-band::after {
  background:
    url("/assets/austria-1444-heraldry.svg") center / cover,
    linear-gradient(100deg, transparent 0%, rgba(234, 216, 181, 0.18) 28%, transparent 52%, rgba(234, 216, 181, 0.13) 75%, transparent 100%);
  opacity: 0.34;
  transform: translateX(-2%);
  animation: court-mist 32s linear infinite;
}

.visual-band.season-winter .visual-court {
  filter: saturate(0.66) contrast(1.08) brightness(0.72) hue-rotate(8deg);
}

.visual-band.season-spring .visual-court {
  filter: saturate(0.82) contrast(1.04) brightness(0.8);
}

.visual-band.season-summer .visual-court {
  filter: saturate(0.9) contrast(1.02) brightness(0.86) sepia(0.08);
}

.visual-band.season-autumn .visual-court {
  filter: saturate(0.78) contrast(1.08) brightness(0.76) sepia(0.22);
}

body.war-mode .visual-band {
  border-color: rgba(214, 109, 98, 0.34);
  box-shadow: inset 0 0 110px rgba(0, 0, 0, 0.68), 0 18px 60px rgba(0, 0, 0, 0.32);
}

body.war-mode .visual-court {
  filter: sepia(0.28) saturate(0.72) contrast(1.18) brightness(0.52) hue-rotate(-8deg);
}

body.war-mode .visual-band::before {
  background:
    linear-gradient(90deg, rgba(6, 7, 8, 0.78), rgba(49, 15, 15, 0.2) 38%, rgba(6, 7, 8, 0.64)),
    radial-gradient(circle at 24% 18%, rgba(217, 183, 111, 0.1), transparent 28%),
    radial-gradient(circle at 78% 70%, rgba(214, 109, 98, 0.28), transparent 34%);
}

body.war-mode .visual-band::after {
  opacity: 0.45;
  animation-duration: 18s;
}

.visual-band.empire-dusk {
  border-color: rgba(217, 183, 111, 0.34);
  background:
    linear-gradient(135deg, rgba(96, 14, 19, 0.38), transparent 38%),
    linear-gradient(180deg, #1b1512, #080808);
}

.visual-band.empire-dusk .visual-court {
  filter: sepia(0.34) saturate(0.74) contrast(1.14) brightness(0.58);
}

.visual-band.empire-dusk::before {
  background:
    linear-gradient(90deg, rgba(6, 7, 8, 0.76), rgba(27, 18, 12, 0.2) 38%, rgba(6, 7, 8, 0.68)),
    radial-gradient(circle at 36% 20%, rgba(217, 183, 111, 0.18), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(120, 28, 24, 0.22), transparent 34%);
}

.visual-copy {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  max-width: 620px;
  color: var(--ink);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  z-index: 2;
}

.visual-copy span {
  display: inline-flex;
  border-left: 2px solid var(--gold);
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0;
  margin-bottom: 8px;
  padding-left: 9px;
}

.visual-copy p {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
}

.war-dispatch {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(214, 109, 98, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(82, 28, 27, 0.64), rgba(25, 20, 20, 0.9)),
    repeating-linear-gradient(0deg, rgba(243, 234, 216, 0.025) 0 1px, transparent 1px 9px);
  box-shadow: inset 0 0 34px rgba(214, 109, 98, 0.07), 0 12px 36px rgba(0, 0, 0, 0.24);
  padding: 12px 14px;
}

.war-dispatch.danger {
  animation: dispatch-warning 2.2s ease-in-out infinite;
}

.war-dispatch.good {
  border-color: rgba(217, 183, 111, 0.4);
}

.dispatch-seal {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(214, 109, 98, 0.52);
  border-radius: 50%;
  background: rgba(90, 22, 22, 0.52);
  color: #ffd4c6;
  font-weight: 700;
  box-shadow: inset 0 0 18px rgba(214, 109, 98, 0.18);
}

.war-dispatch span {
  display: block;
  color: var(--gold);
  font-size: 12px;
  margin-bottom: 4px;
}

.war-dispatch p {
  margin: 0;
  color: #eadccb;
  font-size: 14px;
  line-height: 1.65;
}

@keyframes dispatch-warning {
  0%,
  100% {
    border-color: rgba(214, 109, 98, 0.36);
  }
  50% {
    border-color: rgba(214, 109, 98, 0.72);
    box-shadow: inset 0 0 38px rgba(214, 109, 98, 0.13), 0 0 20px rgba(214, 109, 98, 0.1);
  }
}

@keyframes court-mist {
  0% {
    opacity: 0.22;
    transform: translateX(-4%) scale(1.02);
  }
  50% {
    opacity: 0.42;
  }
  100% {
    opacity: 0.22;
    transform: translateX(4%) scale(1.04);
  }
}

@keyframes historical-breath {
  from {
    transform: scale(1.02);
  }
  to {
    transform: scale(1.055);
  }
}

@keyframes court-crossfade {
  0%,
  34% {
    opacity: 0;
  }
  48%,
  82% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
  }
}

.event-card {
  border-radius: 8px;
  padding: 22px;
  min-height: 340px;
}

.council-panel {
  display: grid;
  gap: 14px;
}

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

.council-message {
  display: grid;
  gap: 5px;
  border-left: 2px solid rgba(217, 183, 111, 0.48);
  background: rgba(255, 255, 255, 0.035);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}

.council-message.emperor {
  border-left-color: var(--gold);
  background: rgba(217, 183, 111, 0.1);
}

.council-message.scribe {
  border-left-color: var(--blue);
}

.council-message.loading {
  border-left-color: rgba(116, 161, 199, 0.86);
  background: rgba(116, 161, 199, 0.08);
}

.council-message strong {
  color: var(--gold);
  font-size: 13px;
}

.council-message span,
.council-draft p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.council-message span {
  white-space: pre-line;
}

.council-message.loading span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  white-space: normal;
}

.council-draft {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(217, 183, 111, 0.26);
  border-radius: 8px;
  background: rgba(217, 183, 111, 0.08);
  padding: 12px;
}

.council-loading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.council-loading strong {
  color: var(--gold);
  font-size: 14px;
}

.council-loading p {
  margin: 3px 0 0;
}

.loading-seal {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(217, 183, 111, 0.22);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: sealSpin 860ms linear infinite;
}

.loading-seal.inline {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-width: 2px;
}

@keyframes sealSpin {
  to {
    transform: rotate(360deg);
  }
}

.council-draft-head {
  display: grid;
  gap: 4px;
}

.council-draft-head small {
  color: var(--gold);
  font-size: 12px;
}

.council-draft-head strong {
  color: var(--ink);
}

.council-form {
  display: grid;
  gap: 10px;
}

.council-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.council-actions .primary-button {
  width: auto;
  margin-top: 0;
}

.event-card.pending {
  border-color: rgba(217, 183, 111, 0.86);
  background:
    linear-gradient(180deg, rgba(217, 183, 111, 0.16), rgba(25, 28, 31, 0.92) 46%),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(217, 183, 111, 0.24),
    0 22px 76px rgba(217, 183, 111, 0.16),
    0 18px 60px rgba(0, 0, 0, 0.28);
  animation: pendingPulse 1.8s ease-in-out infinite;
}

@keyframes pendingPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(217, 183, 111, 0.22),
      0 22px 76px rgba(217, 183, 111, 0.12),
      0 18px 60px rgba(0, 0, 0, 0.28);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(217, 183, 111, 0.42),
      0 24px 86px rgba(217, 183, 111, 0.22),
      0 18px 60px rgba(0, 0, 0, 0.28);
  }
}

.speaker-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 14px;
}

.event-card.pending .speaker-row {
  border-bottom: 1px solid rgba(217, 183, 111, 0.28);
  margin-bottom: 16px;
  padding-bottom: 10px;
}

.event-card.pending #eventState {
  border-radius: 999px;
  background: var(--gold);
  color: #171715;
  font-weight: 700;
  padding: 4px 9px;
}

.event-card.result-card {
  border-color: rgba(118, 168, 135, 0.58);
  background:
    linear-gradient(180deg, rgba(118, 168, 135, 0.13), rgba(25, 28, 31, 0.92) 42%),
    var(--panel);
}

h2 {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.25;
  letter-spacing: 0;
}

#eventBody {
  margin: 0;
  color: #dfd3bd;
  font-size: 17px;
  line-height: 1.8;
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.choice-stack,
.result-reveal {
  display: grid;
  gap: 10px;
}

.choice {
  text-align: left;
  color: var(--ink);
  background: rgba(217, 183, 111, 0.1);
  border: 1px solid rgba(217, 183, 111, 0.38);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
}

.choice:hover {
  border-color: var(--gold);
  background: rgba(217, 183, 111, 0.2);
  transform: translateY(-1px);
}

.choice small {
  display: inline-flex;
  margin-bottom: 7px;
  border-radius: 999px;
  background: rgba(217, 183, 111, 0.2);
  color: var(--gold);
  font-size: 11px;
  padding: 3px 7px;
}

.choice strong {
  display: block;
  margin-bottom: 5px;
}

.choice span {
  display: block;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.knowledge-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.knowledge-grid > strong {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.knowledge-panel {
  border: 1px solid rgba(217, 183, 111, 0.22);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  overflow: hidden;
}

.knowledge-panel summary {
  cursor: pointer;
  color: #ead8b5;
  font-size: 13px;
  font-weight: 700;
  list-style-position: inside;
  padding: 10px 12px;
}

.knowledge-panel p {
  margin: 0;
  padding: 0 12px 12px;
  color: #d9ccba;
  font-size: 13px;
  line-height: 1.72;
}

.source-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.source-list a {
  display: grid;
  gap: 3px;
  color: #ead8b5;
  line-height: 1.45;
  text-decoration: none;
}

.source-list a:hover {
  color: var(--gold);
}

.source-list span {
  color: var(--muted);
  font-size: 12px;
}

.source-note-list {
  display: grid;
  gap: 6px;
  margin: 2px 12px 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(217, 183, 111, 0.16);
}

.source-note-list small {
  color: rgba(238, 226, 198, 0.52);
  font-size: 11px;
  letter-spacing: 0;
}

.source-note-list a {
  display: grid;
  gap: 2px;
  color: rgba(234, 216, 181, 0.78);
  font-size: 11px;
  line-height: 1.45;
  text-decoration: none;
}

.source-note-list a:hover {
  color: var(--gold);
}

.source-note-list span {
  color: rgba(238, 226, 198, 0.5);
}

.historical-footnote {
  margin-bottom: 12px;
  border-color: rgba(217, 183, 111, 0.16);
  background: rgba(255, 255, 255, 0.035);
}

.historical-footnote-body {
  display: grid;
  gap: 4px;
  padding: 0 12px 8px;
}

.historical-footnote-body small {
  color: rgba(238, 226, 198, 0.56);
  font-size: 11px;
  line-height: 1.5;
}

.effect-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.effect-chip {
  position: relative;
  display: inline-flex;
  border: 1px solid rgba(149, 156, 146, 0.32);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d8d0c1;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 9px;
}

.effect-chip .impact-popover {
  left: 0;
  top: calc(100% + 8px);
  transform: translateY(-4px);
  width: min(280px, 78vw);
}

.effect-chip .impact-popover::before {
  left: 18px;
  transform: rotate(45deg);
}

.effect-chip.positive {
  border-color: rgba(118, 168, 135, 0.72);
  background: rgba(118, 168, 135, 0.16);
  color: #d9f0dd;
}

.effect-chip.negative {
  border-color: rgba(214, 109, 98, 0.78);
  background: rgba(92, 26, 25, 0.24);
  color: #f3c8c3;
}

.effect-chip.neutral {
  border-color: rgba(217, 183, 111, 0.3);
  background: rgba(217, 183, 111, 0.08);
  color: #e2d4bd;
}

.effect-chip.subtle {
  font-weight: 600;
  opacity: 0.92;
}

.effect-chip.subtle.positive {
  border-color: rgba(118, 168, 135, 0.52);
  background: rgba(118, 168, 135, 0.1);
}

.effect-chip.subtle.negative {
  border-color: rgba(214, 109, 98, 0.56);
  background: rgba(92, 26, 25, 0.18);
}

.notes,
.decision-log {
  display: grid;
  gap: 10px;
}

.note,
.log-item {
  border-left: 2px solid rgba(217, 183, 111, 0.6);
  padding-left: 10px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.log-item span {
  display: block;
  color: var(--gold);
  font-size: 12px;
  margin-bottom: 4px;
}

.decision-log {
  margin-top: 18px;
}

.chronicle-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  align-items: center;
  justify-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 18%, rgba(217, 183, 111, 0.12), transparent 28%),
    rgba(7, 8, 8, 0.72);
  backdrop-filter: blur(10px);
}

body.chronicle-open {
  overflow: hidden;
}

.chronicle-book {
  width: min(980px, 100%);
  max-height: min(86vh, 920px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(217, 183, 111, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(52, 42, 30, 0.94), rgba(22, 21, 20, 0.96)),
    repeating-linear-gradient(90deg, rgba(243, 234, 216, 0.025) 0 1px, transparent 1px 18px);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.58), inset 0 0 42px rgba(217, 183, 111, 0.06);
  overflow: hidden;
}

.chronicle-book-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(217, 183, 111, 0.18);
  padding: 20px 22px 18px;
  background: linear-gradient(90deg, rgba(82, 55, 32, 0.46), rgba(23, 22, 20, 0.2));
}

.chronicle-book-head h2 {
  margin-bottom: 8px;
}

.chronicle-book-head p:last-child {
  margin: 0;
  max-width: 680px;
  color: #d8c9ad;
  line-height: 1.7;
}

.chronicle-scroll {
  overflow: auto;
  padding: 22px;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 183, 111, 0.5) rgba(255, 255, 255, 0.07);
}

.chronicle-section-title {
  border-bottom: 1px solid rgba(217, 183, 111, 0.14);
  margin-bottom: 12px;
  padding-bottom: 10px;
}

.chronicle-book .note,
.chronicle-book .log-item {
  border-left-color: rgba(217, 183, 111, 0.82);
  color: #e3d6bf;
  font-size: 15px;
  line-height: 1.95;
  padding: 10px 0 10px 14px;
}

.chronicle-book .log-item span {
  color: #dfbf76;
  font-size: 12px;
  letter-spacing: 0;
}

.chronicle-book .decision-log {
  margin-top: 22px;
}

.collapse {
  border-color: rgba(214, 109, 98, 0.6);
  background: rgba(80, 24, 24, 0.76);
}

.endgame-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(217, 183, 111, 0.5);
  background:
    linear-gradient(145deg, rgba(80, 24, 24, 0.72), rgba(17, 18, 18, 0.92)),
    rgba(32, 24, 20, 0.9);
}

.endgame-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(217, 183, 111, 0.08), transparent 28%, transparent 72%, rgba(217, 183, 111, 0.07)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 34%);
}

.endgame-card > * {
  position: relative;
}

.endgame-council-card {
  margin: 2px 0 14px;
  padding: 16px;
}

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

.endgame-header {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid rgba(217, 183, 111, 0.16);
  padding-bottom: 14px;
}

.endgame-header small {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
}

.endgame-header h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.2;
  margin: 0;
}

.endgame-header p {
  color: rgba(238, 226, 198, 0.78);
  font-size: 14px;
  line-height: 1.75;
  margin: 0;
}

.endgame-cause {
  width: fit-content;
  border: 1px solid rgba(217, 183, 111, 0.42);
  border-radius: 999px;
  background: rgba(217, 183, 111, 0.1);
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 6px 10px;
}

.posthumous-title {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 8px 12px;
  border: 1px solid rgba(217, 183, 111, 0.28);
  border-radius: 8px;
  background: rgba(12, 10, 8, 0.34);
  padding: 12px;
}

.posthumous-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.posthumous-title strong {
  color: #f2dca2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
  line-height: 1;
}

.posthumous-title em {
  width: fit-content;
  border: 1px solid rgba(238, 226, 198, 0.18);
  border-radius: 999px;
  color: rgba(238, 226, 198, 0.82);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  padding: 4px 8px;
}

.posthumous-title p {
  grid-column: 1 / -1;
  color: rgba(238, 226, 198, 0.78);
  font-size: 13px;
  line-height: 1.7;
  margin: 0;
}

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

.endgame-stat-grid span {
  border: 1px solid rgba(238, 226, 198, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: rgba(238, 226, 198, 0.76);
  font-size: 12px;
  line-height: 1.45;
  padding: 9px 10px;
}

.endgame-prose {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(217, 183, 111, 0.16);
  padding-top: 14px;
}

.endgame-prose p {
  color: rgba(238, 226, 198, 0.8);
  font-size: 14px;
  line-height: 1.8;
  margin: 0;
}

.endgame-prose strong {
  color: #f0d99d;
  font-size: 14px;
  line-height: 1.7;
}

.endgame-writing {
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid rgba(217, 183, 111, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 14px;
}

.endgame-writing strong {
  color: var(--gold);
  font-size: 13px;
}

.endgame-writing p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  margin: 4px 0 0;
}

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

.compact-archive-button {
  width: fit-content;
}

.endgame-mode .court-panel,
.endgame-mode .side-panel {
  box-shadow: inset 0 0 0 1px rgba(217, 183, 111, 0.08);
}

.endgame-notice-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 22%, rgba(217, 183, 111, 0.16), transparent 34%),
    rgba(4, 5, 5, 0.72);
  backdrop-filter: blur(8px);
  padding: 18px;
}

.endgame-notice {
  width: min(560px, 100%);
  border: 1px solid rgba(217, 183, 111, 0.44);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(80, 24, 24, 0.92), rgba(13, 14, 14, 0.96)),
    rgba(20, 16, 14, 0.96);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48);
  padding: 22px;
}

.endgame-notice small {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
}

.endgame-notice h2 {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  line-height: 1.15;
  margin: 8px 0 10px;
}

.endgame-notice p {
  color: rgba(238, 226, 198, 0.82);
  font-size: 14px;
  line-height: 1.8;
  margin: 0;
}

.endgame-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1100px) {
  .app-shell {
    background:
      linear-gradient(180deg, rgba(11, 13, 14, 0.2), #151819 82%),
      url("/assets/austria-1444-heraldry.svg") center top / cover fixed,
      url("/assets/end.png") center top / cover fixed;
  }

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

  .status-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }

  body.war-mode .status-panel {
    top: auto;
    max-height: none;
  }

  .topbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
    top: 0;
  }

  .war-banner {
    grid-template-columns: 1fr;
    margin-top: 8px;
  }

  body.war-mode .war-banner {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px 12px;
  }

  body.war-mode .game-grid {
    margin-top: 0;
  }

  .war-banner-ledger {
    justify-content: flex-start;
  }

  .vital-hud {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .pillars-grid {
    grid-template-columns: repeat(4, minmax(86px, 1fr));
  }

  .tools-grid {
    grid-template-columns: repeat(3, minmax(86px, 1fr));
  }

  .chronicle-overlay {
    padding: 12px;
  }

  .chronicle-book {
    max-height: 92vh;
  }

  .chronicle-book-head {
    flex-direction: column;
    padding: 16px;
  }

  .chronicle-scroll {
    padding: 16px;
  }

  .clock {
    justify-items: start;
    width: 100%;
  }

  .date-card {
    justify-items: start;
    width: 100%;
  }

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

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

  .library-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .court,
  .library-view {
    padding: 14px;
  }

  h1 {
    font-size: 28px;
  }

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

  .resource-treasury {
    grid-column: auto;
  }

  .vital-hud {
    grid-template-columns: 1fr;
  }

  .pillars-grid,
  .tools-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .library-event-head,
  .hall-head {
    flex-direction: column;
  }
}
