:root {
  color-scheme: light;
  --ink: #18222c;
  --ink-soft: #324051;
  --paper: #f4ecd5;
  --paper-deep: #e3d0a8;
  --paper-line: #c7ad78;
  --oxblood: #9f3f35;
  --oxblood-dark: #6f2926;
  --pine: #2e5746;
  --blue: #31576f;
  --gold: #c99543;
  --shadow: rgba(24, 34, 44, 0.18);
  --focus: #1f6f8b;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(24, 34, 44, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 34, 44, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, #263746 0%, #1d2a35 42%, #6d4634 100%);
  background-size: 38px 38px, 38px 38px, auto;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

a {
  color: inherit;
}

.page-frame {
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  border: 1px solid rgba(244, 236, 213, 0.22);
  background:
    radial-gradient(circle at 25% 0%, rgba(244, 236, 213, 0.2), transparent 34rem),
    rgba(244, 236, 213, 0.08);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 90px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(244, 236, 213, 0.22);
  color: var(--paper);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
}

.brand img {
  width: 72px;
  height: 48px;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22));
}

.brand-kicker,
.eyebrow {
  display: block;
  margin: 0 0 2px;
  color: var(--oxblood);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brand-kicker {
  color: var(--gold);
}

.brand-name {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.top-actions a,
.support-placeholder {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid rgba(244, 236, 213, 0.32);
  border-radius: var(--radius);
  color: var(--paper);
  text-decoration: none;
  background: rgba(24, 34, 44, 0.24);
}

.support-placeholder {
  opacity: 0.62;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 0;
}

.command-panel {
  min-height: calc(100vh - 123px);
  padding: 22px;
  border-right: 1px solid rgba(244, 236, 213, 0.22);
  background:
    linear-gradient(90deg, rgba(24, 34, 44, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 34, 44, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
}

.panel[hidden] {
  display: none;
}

.panel {
  animation: rise-in 240ms ease both;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading h1,
.panel-heading h2 {
  margin: 0;
  font-size: 1.8rem;
  line-height: 1.04;
}

.panel-copy {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.choice-group,
.party-fieldset,
.segmented-field {
  min-width: 0;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

legend,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.persona-picker {
  min-width: 0;
}

.persona-carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: stretch;
}

.persona-arrow {
  min-height: 100%;
  border: 1px solid rgba(24, 34, 44, 0.26);
  border-radius: var(--radius);
  color: #fff8df;
  background: var(--ink);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 800;
}

.persona-arrow:hover {
  background: var(--blue);
}

.persona-focus-card {
  display: grid;
  gap: 7px;
  min-height: 196px;
  padding: 14px;
  border: 1px solid rgba(24, 34, 44, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(201, 149, 67, 0.16), rgba(255, 252, 239, 0.88)),
    #fff8df;
  box-shadow: inset 5px 0 0 var(--oxblood), 0 3px 0 rgba(24, 34, 44, 0.14);
}

.persona-focus-card strong,
.persona-focus-card span {
  display: block;
}

.persona-focus-card strong {
  font-size: 1.35rem;
  line-height: 1;
}

.persona-focus-card span {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.persona-count,
.persona-cash {
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-weight: 700;
  text-transform: uppercase;
}

.persona-count {
  color: var(--oxblood-dark);
  font-size: 0.72rem;
}

.persona-stat-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.persona-stat-row span {
  min-height: 30px;
  padding: 6px 7px;
  border: 1px solid rgba(24, 34, 44, 0.14);
  border-radius: 6px;
  background: rgba(255, 252, 239, 0.82);
  font-size: 0.75rem;
}

.choice-card,
.route-card,
.resume-card,
.score-card {
  width: 100%;
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(24, 34, 44, 0.26);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  background: rgba(255, 252, 239, 0.72);
  box-shadow: 0 2px 0 rgba(24, 34, 44, 0.12);
}

.choice-card strong,
.route-card strong,
.resume-card strong,
.score-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1rem;
}

.choice-card span,
.route-card span,
.resume-card span,
.score-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.choice-card[aria-pressed="true"],
.route-card:hover,
.choice-card:hover {
  border-color: var(--oxblood);
  background: #fff8df;
}

.choice-card[aria-pressed="true"] {
  box-shadow: inset 4px 0 0 var(--oxblood), 0 3px 0 rgba(24, 34, 44, 0.12);
}

.name-grid {
  display: grid;
  gap: 8px;
}

.name-grid input,
.select-input,
.store-stepper input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(24, 34, 44, 0.3);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 252, 239, 0.82);
}

.name-grid input,
.select-input {
  padding: 9px 10px;
}

.name-grid input:focus,
.select-input:focus,
.store-stepper input:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(31, 111, 139, 0.34);
  outline-offset: 2px;
}

.button-row,
.button-stack {
  display: grid;
  gap: 10px;
}

.button-row {
  grid-template-columns: 1fr 1fr;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-action {
  color: #fff8df;
  background: linear-gradient(180deg, #b34a3e, var(--oxblood-dark));
  box-shadow: 0 4px 0 #4f1d1b;
}

.secondary-action {
  color: var(--ink);
  background: #fff8df;
  border-color: rgba(24, 34, 44, 0.28);
  box-shadow: 0 3px 0 rgba(24, 34, 44, 0.18);
}

.primary-action:active,
.secondary-action:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(24, 34, 44, 0.28);
}

.money-strip,
.store-total,
.load-strip,
.hunt-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(24, 34, 44, 0.24);
  border-radius: var(--radius);
  background: rgba(49, 87, 111, 0.1);
}

.load-strip.overloaded {
  border-color: rgba(159, 63, 53, 0.45);
  color: var(--oxblood-dark);
  background: rgba(159, 63, 53, 0.12);
}

.load-strip.understocked {
  border-color: rgba(201, 149, 67, 0.7);
  background: rgba(201, 149, 67, 0.14);
}

.load-strip small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.store-list {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.store-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 152px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(24, 34, 44, 0.24);
}

.store-item:last-child {
  border-bottom: 0;
}

.store-item strong,
.store-item span {
  display: block;
}

.store-item span {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.store-item .owned-line {
  margin-top: 4px;
  color: var(--pine);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.store-stepper {
  display: grid;
  grid-template-columns: 34px 72px 34px;
  gap: 4px;
  align-items: center;
  justify-content: end;
}

.store-stepper button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(24, 34, 44, 0.26);
  border-radius: 6px;
  color: var(--ink);
  background: #fff8df;
}

.store-stepper input {
  min-height: 34px;
  padding: 4px;
  text-align: center;
}

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

.segmented button {
  min-height: 42px;
  padding: 8px;
  border: 1px solid rgba(24, 34, 44, 0.26);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 252, 239, 0.78);
}

.segmented button[aria-pressed="true"] {
  color: #fff8df;
  border-color: var(--pine);
  background: var(--pine);
}

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

.resume-card,
.score-card {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(46, 87, 70, 0.14), rgba(255, 252, 239, 0.8)),
    rgba(255, 252, 239, 0.74);
}

.resume-card[hidden] {
  display: none;
}

.score-card {
  min-height: 0;
  border-left: 5px solid var(--gold);
}

.trail-board {
  min-width: 0;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(244, 236, 213, 0.96), rgba(233, 215, 176, 0.96)),
    var(--paper);
}

.status-deck {
  margin-bottom: 14px;
}

.status-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.status-heading h2 {
  margin: 0;
  font-size: 1.34rem;
  line-height: 1.05;
}

.status-heading .eyebrow {
  margin-bottom: 1px;
}

.trail-date {
  padding-bottom: 2px;
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-ribbon {
  display: grid;
  grid-template-columns: repeat(4, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.status-tile {
  position: relative;
  display: grid;
  align-content: start;
  width: 100%;
  min-height: 102px;
  padding: 12px 12px 15px;
  overflow: hidden;
  border: 1px solid rgba(24, 34, 44, 0.18);
  border-radius: var(--radius);
  color: var(--ink);
  text-align: left;
  background: rgba(255, 252, 239, 0.72);
}

button.status-tile {
  cursor: pointer;
}

button.status-tile:hover {
  border-color: var(--blue);
  box-shadow: 0 5px 14px rgba(24, 34, 44, 0.1);
  transform: translateY(-1px);
}

.status-tile span {
  display: block;
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-tile strong {
  display: block;
  margin-top: 3px;
  font-size: 1.42rem;
  line-height: 1.05;
}

.status-tile small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.1;
}

.status-tile > i {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--pine) 0 var(--stat-level), rgba(24, 34, 44, 0.1) var(--stat-level) 100%);
}

.status-tile[data-tone="caution"] > i {
  background: linear-gradient(90deg, var(--gold) 0 var(--stat-level), rgba(24, 34, 44, 0.1) var(--stat-level) 100%);
}

.status-tile[data-tone="danger"] {
  border-color: rgba(159, 63, 53, 0.42);
  background: rgba(159, 63, 53, 0.08);
}

.status-tile[data-tone="danger"] > i {
  background: linear-gradient(90deg, var(--oxblood) 0 var(--stat-level), rgba(24, 34, 44, 0.1) var(--stat-level) 100%);
}

.supply-ledger {
  border: 1px solid rgba(24, 34, 44, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 252, 239, 0.48);
}

.supply-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px 6px;
  border-bottom: 1px solid rgba(24, 34, 44, 0.13);
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
}

.supply-ribbon {
  display: grid;
  grid-template-columns: repeat(7, minmax(78px, 1fr));
}

.supply-stat {
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px dashed rgba(24, 34, 44, 0.2);
  border-radius: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.supply-stat:last-child {
  border-right: 0;
}

.supply-stat:hover {
  color: var(--oxblood-dark);
  background: rgba(201, 149, 67, 0.12);
}

.supply-stat span,
.supply-stat strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.supply-stat span {
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.supply-stat strong {
  margin-top: 2px;
  font-size: 0.9rem;
  line-height: 1.05;
}

.scene-frame,
.trail-brief,
.route-board,
.party-board,
.logbook {
  border: 1px solid rgba(24, 34, 44, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 252, 239, 0.64);
  box-shadow: 0 12px 24px var(--shadow);
}

.scene-frame {
  overflow: hidden;
  margin-bottom: 14px;
  background: #95b5bd;
}

.compact-scene {
  margin-bottom: 0;
  box-shadow: none;
}

canvas {
  display: block;
  max-width: 100%;
}

#sceneCanvas,
#mapCanvas {
  width: 100%;
  height: auto;
}

.route-board,
.trail-brief,
.party-board,
.logbook {
  padding: 16px;
}

.trail-brief,
.logbook {
  margin-bottom: 14px;
}

.route-board,
.party-board {
  margin-bottom: 14px;
}

.board-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
}

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

.brief-card {
  min-height: 72px;
  padding: 10px;
  border: 1px solid rgba(24, 34, 44, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 252, 239, 0.74);
}

.brief-card span {
  display: block;
  color: var(--ink-soft);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.brief-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
  line-height: 1.15;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.section-title h2 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.1;
}

.section-title .eyebrow {
  margin: 0;
}

#mapCanvas {
  border-bottom: 1px solid rgba(24, 34, 44, 0.22);
  background: #f8f0d8;
}

.map-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(24, 34, 44, 0.24);
  border-radius: var(--radius);
  background: #f8f0d8;
}

.map-mileage {
  display: grid;
  grid-template-areas:
    "label value progress"
    "remaining remaining progress";
  grid-template-columns: auto auto minmax(118px, 1fr);
  align-items: center;
  column-gap: 12px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  text-align: left;
  background: rgba(248, 240, 216, 0.98);
  box-shadow: none;
}

.map-mileage:hover {
  background: #fff8df;
}

.map-mileage-label {
  grid-area: label;
  color: var(--oxblood-dark);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
}

.map-mileage strong {
  grid-area: value;
  font-size: 1rem;
  line-height: 1.1;
}

#mapMileageRemaining {
  grid-area: remaining;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.map-progress-line {
  grid-area: progress;
  display: grid;
  grid-template-columns: 10px 1fr 10px;
  align-items: center;
  gap: 5px;
  margin: 0;
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.58rem;
}

.map-progress-line i {
  position: relative;
  height: 4px;
  overflow: hidden;
  background: rgba(24, 34, 44, 0.18);
}

.map-progress-line em {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0;
  background: var(--oxblood);
  transition: width 220ms ease;
}

.logbook ol {
  display: grid;
  gap: 8px;
  max-height: 210px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.logbook li {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(24, 34, 44, 0.2);
}

.logbook time {
  color: var(--oxblood-dark);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.74rem;
  font-weight: 700;
}

.logbook p {
  margin: 0;
}

.trail-advice {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.advice-note {
  min-height: 40px;
  padding: 9px 10px;
  border-left: 4px solid var(--blue);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  background: rgba(49, 87, 111, 0.1);
}

.advice-note.warning {
  border-left-color: var(--oxblood);
  background: rgba(159, 63, 53, 0.1);
}

.advice-note.good {
  border-left-color: var(--pine);
  background: rgba(46, 87, 70, 0.1);
}

.party-roster {
  display: grid;
  gap: 7px;
}

.party-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 48px;
  grid-template-areas:
    "initial person health"
    "initial bar bar";
  gap: 5px 9px;
  align-items: center;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid rgba(24, 34, 44, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(46, 87, 70, 0.08), transparent 48%),
    rgba(255, 252, 239, 0.76);
}

.party-row.dead {
  opacity: 0.68;
  filter: grayscale(0.65);
}

.party-initial {
  grid-area: initial;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(24, 34, 44, 0.22);
  border-radius: 50%;
  color: #fff8df;
  background: var(--ink);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 800;
}

.party-person {
  grid-area: person;
  min-width: 0;
}

.party-person strong,
.party-person span,
.party-health {
  display: block;
}

.party-person strong {
  font-size: 1rem;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-person span {
  color: var(--ink-soft);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.party-health {
  grid-area: health;
  justify-self: end;
  color: var(--oxblood-dark);
  font-family: "Lucida Console", Monaco, Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
}

.health-bar {
  grid-area: bar;
  width: 100%;
  height: 8px;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(24, 34, 44, 0.24);
  border-radius: 999px;
  background: rgba(24, 34, 44, 0.12);
}

.health-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pine);
}

.health-bar.low i {
  background: var(--oxblood);
}

.health-bar.mid i {
  background: var(--gold);
}

#huntCanvas {
  width: 100%;
  height: auto;
  margin: 10px 0 14px;
  border: 1px solid rgba(24, 34, 44, 0.28);
  border-radius: var(--radius);
  background: #b8c4a8;
  cursor: crosshair;
}

.hunt-status {
  min-height: 34px;
  margin: -2px 0 8px;
  padding: 8px 10px;
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink-soft);
  background: rgba(201, 149, 67, 0.12);
  font-size: 0.9rem;
}

.danger {
  color: var(--oxblood-dark);
}

.good {
  color: var(--pine);
}

.graph-overlay[hidden] {
  display: none;
}

.graph-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 34, 44, 0.58);
}

.graph-dialog {
  width: min(860px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  padding: 18px;
  overflow: auto;
  border: 1px solid rgba(24, 34, 44, 0.38);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(24, 34, 44, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(24, 34, 44, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

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

.graph-head h2 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.05;
}

.icon-action {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(24, 34, 44, 0.24);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff8df;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

#statGraphCanvas {
  width: 100%;
  height: auto;
  border: 1px solid rgba(24, 34, 44, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 252, 239, 0.74);
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(24, 34, 44, 0.16);
  border-radius: 999px;
  background: rgba(255, 252, 239, 0.78);
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--oxblood);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

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

  .command-panel {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(244, 236, 213, 0.22);
  }

  .status-ribbon {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .supply-ribbon {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
  }

  .supply-stat:nth-child(4) {
    border-right: 0;
  }

  .supply-stat:nth-child(n + 5) {
    border-top: 1px dashed rgba(24, 34, 44, 0.2);
  }

  .board-grid,
  .brief-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-frame {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border: 0;
  }

  .masthead,
  .trail-board,
  .command-panel {
    padding: 16px;
  }

  .masthead {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-name {
    font-size: 1.55rem;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .status-ribbon {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }

  .status-heading {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .supply-heading span:last-child {
    display: none;
  }

  .supply-ribbon {
    grid-template-columns: repeat(2, minmax(118px, 1fr));
  }

  .supply-stat:nth-child(2n) {
    border-right: 0;
  }

  .supply-stat:nth-child(n + 3) {
    border-top: 1px dashed rgba(24, 34, 44, 0.2);
  }

  .supply-stat:last-child {
    grid-column: 1 / -1;
  }

  .map-mileage {
    grid-template-areas:
      "label value"
      "remaining remaining"
      "progress progress";
    grid-template-columns: 1fr auto;
    row-gap: 4px;
    padding: 8px 9px;
  }

  .board-grid,
  .brief-grid {
    grid-template-columns: 1fr;
  }

  .button-row,
  .segmented {
    grid-template-columns: 1fr;
  }

  .persona-carousel {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
  }

  .persona-stat-row {
    grid-template-columns: 1fr;
  }

  .store-item {
    grid-template-columns: 1fr;
  }

  .store-stepper {
    width: 152px;
  }

  .logbook li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.daily-card {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(24, 34, 44, 0.26);
  border-left: 5px solid var(--oxblood);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(159, 63, 53, 0.12), rgba(255, 252, 239, 0.82)),
    rgba(255, 252, 239, 0.74);
  box-shadow: 0 2px 0 rgba(24, 34, 44, 0.12);
}

.daily-card .eyebrow {
  margin: 0 0 3px;
}

.daily-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.daily-card .eyebrow span {
  display: inline;
  color: inherit;
  font-size: inherit;
}

.headstone {
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: 260px;
  margin: 4px auto 14px;
  padding: 26px 18px 18px;
  border: 2px solid #8d8a80;
  border-radius: 110px 110px 6px 6px;
  color: #2c3036;
  text-align: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), transparent 55%),
    linear-gradient(180deg, #c9c4b6, #a9a497);
  box-shadow: inset 0 -6px 0 rgba(24, 34, 44, 0.16), 0 4px 0 rgba(24, 34, 44, 0.2);
}

.headstone-rip {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.headstone strong {
  font-size: 1.45rem;
  line-height: 1.1;
}

.headstone-dates {
  font-size: 0.82rem;
}

.headstone em {
  min-height: 1.4em;
  font-size: 0.95rem;
}

#graveEpitaph {
  margin-bottom: 10px;
}

.epitaph-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.epitaph-chip {
  padding: 5px 10px;
  border: 1px solid rgba(24, 34, 44, 0.28);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  background: rgba(255, 252, 239, 0.8);
}

.epitaph-chip:hover {
  border-color: var(--oxblood);
  color: var(--ink);
}

.share-card {
  margin: 0 0 14px;
  padding: 12px;
  overflow-x: auto;
  border: 1px dashed rgba(24, 34, 44, 0.35);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 252, 239, 0.86);
}

.share-card:empty {
  display: none;
}
