:root {
  color-scheme: light;
  --ink: #20243b;
  --muted: #66697b;
  --navy: #18234b;
  --navy-light: #2a3b70;
  --red: #a72c31;
  --red-dark: #762026;
  --gold: #bd8b48;
  --paper: #fbf7ed;
  --paper-deep: #f0e6d3;
  --panel: rgba(255, 253, 247, 0.94);
  --line: #ded4c2;
  --green: #397a58;
  --shadow: 0 14px 36px rgba(32, 36, 59, 0.1);
  font-family: "Courier New", "Lucida Console", monospace;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 10% 20%, rgba(255, 255, 255, 0.8), transparent 28rem),
    radial-gradient(ellipse at 90% 80%, rgba(226, 210, 182, 0.35), transparent 32rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #c99345;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.site-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 3.5rem);
  color: #fff;
  background:
    linear-gradient(110deg, rgba(14, 20, 44, 0.98), rgba(30, 41, 80, 0.97)),
    var(--navy);
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 5px 18px rgba(16, 22, 43, 0.2);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
}

.brand-title,
.brand-subtitle {
  display: block;
}

.brand-title {
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.035em;
}

.brand-subtitle {
  margin-top: 0.12rem;
  color: #e4d7c2;
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.header-actions,
.button-row,
.attribute-footer,
.combat-topline,
.panel-heading,
.health-label,
.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.header-actions {
  justify-content: flex-end;
  margin-left: auto;
}

.rules-link {
  min-width: 5.8rem;
  white-space: nowrap;
  text-decoration: none;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: calc(100vh - 140px);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

.screen {
  animation: arrive 240ms ease-out;
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(7px);
  }

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

.hero-intro {
  max-width: 690px;
  margin: 0 auto 2rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1,
h2 {
  font-family: "Cinzel", Georgia, serif;
}

.hero-intro h1,
.combat-topline h1 {
  margin-bottom: 0.7rem;
  color: var(--navy);
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.15;
}

.hero-intro > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(275px, 0.8fr);
  align-items: start;
  gap: 1.1rem;
}

.creation-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.panel,
.combatant {
  border: 1px solid rgba(158, 141, 113, 0.32);
  border-radius: 15px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: clamp(1rem, 2.4vw, 1.55rem);
}

.panel-heading {
  margin-bottom: 1.25rem;
}

.panel-heading h2,
.combatant h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  line-height: 1.25;
}

.panel-heading .eyebrow {
  margin-bottom: 0.3rem;
}

.panel-icon {
  width: 42px;
  height: 42px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e2d2b8;
  border-radius: 50%;
  color: var(--red);
  background: #f8efe0;
  font-size: 1.3rem;
}

.field {
  min-width: 0;
  display: grid;
  gap: 0.42rem;
  color: #4a4c5e;
  font-size: 0.78rem;
  font-weight: 600;
}

.field input {
  width: 100%;
  min-height: 43px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d8cfbf;
  border-radius: 8px;
  color: var(--ink);
  background-color: #fffefa;
  font-size: 0.88rem;
}

.field input::placeholder {
  color: #9693a0;
}

.form-grid,
.attribute-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field-wide {
  grid-column: 1 / -1;
}

.creation-prompt {
  max-width: 36rem;
  margin: 0.35rem 0 0.55rem;
  color: #76664d;
  font-size: 0.75rem;
  line-height: 1.45;
}

.name-input-row,
.attribute-value-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.name-input-row input {
  min-width: 0;
  flex: 1;
}

.name-input-row .button {
  flex: 0 0 auto;
}

.attribute-picker {
  margin: 1.35rem 0 1.1rem;
  padding: 0.95rem;
  border: 1px solid #ded3c0;
  border-radius: 10px;
  background: rgba(242, 234, 218, 0.45);
}

.attribute-picker legend {
  padding: 0 0.4rem;
  color: var(--navy);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.92rem;
  font-weight: 700;
}

.attribute-picker legend span {
  color: var(--muted);
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.73rem;
  font-weight: 500;
}

.attribute-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
}

.attribute-field {
  gap: 0.3rem;
  text-align: center;
}

.attribute-field span {
  font-size: 0.7rem;
}

.attribute-footer {
  flex-wrap: wrap;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.text-button {
  padding: 0.3rem 0;
  border: 0;
  color: var(--navy-light);
  background: transparent;
  font-size: 0.77rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.button {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}

.button:hover,
.action-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.button:active,
.action-button:active {
  transform: translateY(0);
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-dark));
  box-shadow: 0 4px 10px rgba(118, 32, 38, 0.18);
}

.button-quiet {
  border-color: #d7cfbf;
  color: var(--navy);
  background: #fffdf8;
}

.button-small {
  min-height: 34px;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
}

.form-actions {
  margin-top: 0.9rem;
}

.fine-print {
  margin: 1rem 0 0;
  color: #777585;
  font-size: 0.72rem;
  line-height: 1.5;
}

.form-error {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid #edc3bd;
  border-radius: 8px;
  color: #7c2022;
  background: #fff0ed;
  font-size: 0.82rem;
}

.combat-topline {
  margin-bottom: 1.2rem;
}

.combat-topline h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
}

.combat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(325px, 0.85fr);
  align-items: start;
  gap: 1rem;
}

.battlefield,
.battle-sidebar {
  display: grid;
  gap: 0.9rem;
}

.combatant {
  overflow: hidden;
  padding: clamp(1rem, 2.6vw, 1.4rem);
}

.enemy-card {
  border-top: 4px solid var(--red);
  background:
    linear-gradient(145deg, rgba(254, 242, 235, 0.92), rgba(255, 253, 247, 0.96) 55%),
    var(--panel);
}

.player-card {
  border-top: 4px solid var(--navy-light);
}

.combatant-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}

.combatant-heading .eyebrow {
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
}

.combatant-symbol {
  width: 52px;
  height: 52px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  font-size: 1.45rem;
}

.enemy-symbol {
  color: var(--red-dark);
  background: #f5ddda;
}

.player-symbol {
  color: var(--navy);
  background: #e5eaf5;
}

.combatant-subtitle {
  margin: 0.28rem 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.health-label {
  margin-bottom: 0.4rem;
  color: #666779;
  font-size: 0.75rem;
}

.health-label strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.health-track,
.xp-track {
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9e2d8;
}

.health-track span,
.xp-track span {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, #92262f, #cf5a4e);
  transition: width 200ms ease;
}

.player-health-track span {
  background: linear-gradient(90deg, #286545, #69a876);
}

.enemy-stats,
.player-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.9rem;
}

.stat-chip {
  padding: 0.38rem 0.55rem;
  border: 1px solid #e5dccd;
  border-radius: 7px;
  color: #5d5c69;
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.7rem;
}

.stat-chip strong {
  margin-left: 0.2rem;
  color: var(--ink);
}

.enemy-weapon {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.resource-row {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.resource-row span {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: #f1eddf;
}

.xp-block {
  margin-top: 1rem;
}

.xp-track {
  height: 7px;
}

.xp-track span {
  background: linear-gradient(90deg, #a3742d, #e1bc70);
}

.battle-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--gold);
  font-size: 0.85rem;
}

.divider-line {
  width: 30%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c6ac83, transparent);
}

.round-panel,
.log-panel {
  padding: 1.15rem;
}

.compact-heading {
  margin-bottom: 0.65rem;
}

.compact-heading h2 {
  font-size: 1.1rem;
}

.initiative-note {
  min-height: 2.5em;
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.5;
}

.action-menu {
  display: grid;
  gap: 0.45rem;
}

.action-button {
  width: 100%;
  min-height: 61px;
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e1d9ca;
  border-radius: 9px;
  color: var(--ink);
  background: #fffefa;
  text-align: left;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.action-button:hover {
  border-color: #c6a978;
  background: #fffaf0;
}

.action-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.48;
  transform: none;
}

.action-button strong,
.action-button small {
  display: block;
}

.action-button strong {
  margin-bottom: 0.18rem;
  color: var(--navy);
  font-size: 0.82rem;
}

.action-button small {
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.35;
}

.action-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--red);
  background: #f7eae2;
  font-size: 1rem;
}

.action-arrow {
  color: #a09a8e;
  font-size: 1.3rem;
}

.spell-picker {
  margin-top: 0.7rem;
}

.action-feedback {
  min-height: 1.35rem;
  margin: 0.7rem 0 0;
  color: var(--green);
  font-size: 0.76rem;
  line-height: 1.45;
}

.combat-log {
  max-height: 260px;
  overflow-y: auto;
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0 0.3rem 0 1.4rem;
  color: #5a5b68;
  font-size: 0.75rem;
  line-height: 1.55;
}

.combat-log li {
  padding-left: 0.15rem;
}

.combat-log li::marker {
  color: var(--gold);
}

.combat-log li:first-child {
  color: var(--ink);
}

.toast {
  position: fixed;
  z-index: 10;
  right: 1rem;
  bottom: 1rem;
  max-width: min(390px, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  border: 1px solid #b7d2bb;
  border-radius: 9px;
  color: #214e34;
  background: #f1faf0;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
}

.toast.error {
  border-color: #edc3bd;
  color: #7c2022;
  background: #fff0ed;
}

.site-footer {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 3.5rem);
  border-top: 1px solid #ded4c2;
  color: #747281;
  font-size: 0.73rem;
}

.site-footer a {
  color: var(--navy-light);
  font-weight: 600;
}

@media (max-width: 850px) {
  .home-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .creation-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .combat-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .battle-sidebar {
    grid-row: 1;
  }
}

@media (max-width: 560px) {
  .site-header {
    min-height: 68px;
    padding-inline: 0.8rem;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    font-size: 0.64rem;
  }

  .rules-link {
    min-height: 32px;
    padding: 0.3rem 0.45rem;
    font-size: 0.68rem;
    min-width: 5.2rem;
  }

  .app-shell {
    width: min(100% - 1rem, 520px);
    padding-block: 1.25rem;
  }

  .hero-intro {
    margin-bottom: 1.3rem;
    text-align: left;
  }

  .hero-intro h1 {
    font-size: 1.8rem;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-wide {
    grid-column: auto;
  }

  .attribute-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-actions .button {
    flex: 1 1 100%;
  }

  .combat-topline {
    align-items: flex-end;
  }

  .combat-topline .button {
    flex: 0 0 auto;
  }

  .resource-row {
    gap: 0.35rem;
  }

  .resource-row span {
    font-size: 0.66rem;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.home-screen {
  max-width: 900px;
  margin-inline: auto;
}

.home-grid {
  grid-template-columns: minmax(0, 1fr);
}

.saved-panel {
  margin: 0 auto 1rem;
}

.saved-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved-character {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffefa;
}

.saved-character > div:first-child,
.saved-character-actions {
  display: grid;
  gap: 0.25rem;
}

.saved-character > div:first-child span {
  color: var(--muted);
  font-size: 0.76rem;
}

.saved-character-actions {
  grid-auto-flow: column;
  align-items: center;
}

.combat-screen {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.65rem;
}

.combat-topline {
  margin: 0;
}

.combat-topline h1 {
  font-size: clamp(1.2rem, 2.5vw, 1.7rem);
}

.combat-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(100px, 1fr) auto;
  align-items: stretch;
  gap: 0.65rem;
}

.enemy-card {
  padding: 0.7rem 1rem;
  border-top-width: 3px;
}

.enemy-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(100px, auto);
  align-items: center;
  gap: 0.8rem;
}

.enemy-summary-main .eyebrow,
.enemy-summary-main h2 {
  margin-bottom: 0.15rem;
}

.enemy-summary-main h2,
.player-card h2 {
  font-size: 1.05rem;
}

.enemy-summary-main .health-label {
  margin: 0.3rem 0 0.2rem;
}

.enemy-summary-main .health-track {
  height: 8px;
}

.enemy-details {
  justify-self: end;
}

.details-toggle summary {
  color: var(--navy-light);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.enemy-details[open] {
  grid-column: 1 / -1;
  justify-self: stretch;
  padding-top: 0.5rem;
}

.enemy-details .enemy-stats {
  margin-top: 0.45rem;
}

.enemy-details .enemy-weapon {
  margin: 0.4rem 0 0;
}

.round-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 0.35rem;
  padding: 0.7rem 1rem;
  overflow: hidden;
}

.round-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.round-heading .eyebrow {
  margin-bottom: 0.15rem;
}

.round-heading h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.turn-indicator {
  color: var(--gold);
  font-size: 1.25rem;
}

.initiative-note,
.enemy-action-note {
  min-height: 1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.enemy-action-note {
  color: var(--red-dark);
  font-weight: 700;
}

.combat-log {
  max-height: none;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  padding: 0 0.25rem 0 1.2rem;
  font-size: 0.69rem;
  line-height: 1.35;
}

.combat-log time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.combat-log li:first-child {
  color: inherit;
}

.next-round-button {
  justify-self: end;
  min-height: 36px;
  padding-block: 0.45rem;
}

.combat-bottom {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: stretch;
  gap: 0.65rem;
}

.player-card {
  display: block;
  overflow: visible;
  padding: 0.75rem 1rem;
  border-top-width: 3px;
}

.player-summary .combatant-heading {
  margin-bottom: 0.45rem;
}

.player-summary .combatant-symbol {
  width: 38px;
  height: 38px;
  font-size: 1rem;
}

.player-summary .health-label {
  margin-bottom: 0.2rem;
}

.player-summary .health-track {
  height: 8px;
}

.resource-row {
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.resource-row span {
  padding: 0.24rem 0.4rem;
  font-size: 0.67rem;
}

.player-details {
  margin-top: 0.45rem;
}

.player-details[open] {
  position: absolute;
  z-index: 2;
  bottom: 100%;
  left: 0;
  width: 100%;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.player-summary {
  position: relative;
}

.player-details .player-stats {
  margin-top: 0.45rem;
}

.player-details .xp-block {
  margin-top: 0.6rem;
}

.player-actions > .eyebrow {
  margin-bottom: 0.35rem;
}

.player-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.65rem 0.8rem;
  border: 1px solid rgba(158, 141, 113, 0.32);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.action-menu {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.action-button {
  min-height: 47px;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
}

.action-icon {
  width: 27px;
  height: 27px;
  font-size: 0.85rem;
}

.action-button strong {
  margin-bottom: 0.05rem;
  font-size: 0.76rem;
}

.action-button small {
  font-size: 0.62rem;
}

.action-feedback {
  min-height: 0;
  margin: 0.25rem 0 0;
  font-size: 0.66rem;
}

.spell-picker {
  margin-top: 0.3rem;
}

body.in-combat {
  overflow: hidden;
}

body.in-combat .site-header {
  min-height: 62px;
  height: 62px;
  padding-block: 0.3rem;
}

body.in-combat .brand img {
  width: 42px;
  height: 42px;
}

body.in-combat .app-shell {
  width: min(1080px, calc(100% - 2rem));
  height: calc(100dvh - 62px);
  min-height: 0;
  margin-inline: auto;
  padding: 0.55rem 0;
}

body.in-combat .site-footer {
  display: none;
}

@media (max-width: 600px) {
  .saved-character {
    align-items: flex-start;
  }

  .saved-character-actions {
    grid-auto-flow: row;
    justify-items: end;
  }

  body.in-combat .site-header {
    min-height: 56px;
    height: 56px;
    padding-inline: 0.65rem;
  }

  body.in-combat .brand {
    gap: 0.45rem;
  }

  body.in-combat .brand img {
    width: 36px;
    height: 36px;
  }

  body.in-combat .brand-title {
    font-size: 0.82rem;
  }

  body.in-combat .brand-subtitle {
    font-size: 0.56rem;
  }

  body.in-combat .app-shell {
    width: calc(100% - 0.7rem);
    height: calc(100dvh - 56px);
    padding: 0.35rem 0;
  }

  .combat-screen {
    gap: 0.35rem;
  }

  .combat-topline {
    gap: 0.4rem;
  }

  .combat-topline .eyebrow {
    margin-bottom: 0.1rem;
    font-size: 0.59rem;
  }

  .combat-topline h1 {
    font-size: 1rem;
  }

  .combat-topline .button {
    min-height: 30px;
    padding: 0.3rem 0.5rem;
    font-size: 0.67rem;
  }

  .combat-layout {
    grid-template-rows: auto minmax(70px, 1fr) auto;
    gap: 0.35rem;
  }

  .combat-bottom {
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 0.35rem;
  }

  .enemy-card,
  .round-panel,
  .player-card {
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
  }

  .enemy-summary {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 0.5rem;
  }

  .enemy-summary .combatant-symbol {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
  }

  .enemy-summary-main .eyebrow,
  .player-summary .eyebrow {
    font-size: 0.58rem;
  }

  .enemy-summary-main h2,
  .player-card h2 {
    font-size: 0.88rem;
  }

  .enemy-summary-main .health-label,
  .player-summary .health-label {
    margin-block: 0.1rem;
    font-size: 0.63rem;
  }

  .enemy-summary-main .health-label strong,
  .player-summary .health-label strong {
    font-size: 0.68rem;
  }

  .enemy-details {
    font-size: 0.65rem;
  }

  .details-toggle summary {
    font-size: 0.65rem;
  }

  .round-panel {
    gap: 0.2rem;
  }

  .round-heading h2 {
    font-size: 0.85rem;
  }

  .initiative-note,
  .enemy-action-note {
    min-height: 0.8rem;
    font-size: 0.63rem;
  }

  .combat-log {
    gap: 0.15rem;
    font-size: 0.61rem;
  }

  .next-round-button {
    min-height: 32px;
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
  }

  .player-summary .combatant-heading {
    margin-bottom: 0.25rem;
  }

  .player-summary .combatant-symbol {
    display: none;
  }

  .resource-row {
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.25rem;
  }

  .resource-row span {
    padding: 0.18rem 0.28rem;
    font-size: 0.58rem;
  }

  .player-details {
    margin-top: 0.25rem;
  }

  .player-details[open] {
    bottom: calc(100% + 0.4rem);
  }

  .player-actions > .eyebrow {
    margin-bottom: 0.22rem;
    font-size: 0.58rem;
  }

  .player-actions {
    padding: 0.35rem 0.4rem;
    border-radius: 9px;
  }

  .action-menu {
    gap: 0.25rem;
  }

  .action-button {
    min-height: 44px;
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 0.28rem;
    padding: 0.25rem 0.3rem;
    border-radius: 7px;
  }

  .action-icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 0.72rem;
  }

  .action-button strong {
    font-size: 0.66rem;
  }

  .action-button small {
    font-size: 0.55rem;
  }

  .action-feedback {
    font-size: 0.59rem;
  }

  .spell-picker .field,
  .spell-picker span {
    font-size: 0.6rem;
  }
}

@media (max-width: 380px), (max-height: 700px) {
  body.in-combat .site-header {
    min-height: 50px;
    height: 50px;
  }

  body.in-combat .app-shell {
    height: calc(100dvh - 50px);
  }

  .combat-layout {
    grid-template-rows: auto minmax(55px, 1fr) auto;
  }

  .enemy-card,
  .round-panel,
  .player-card {
    padding: 0.3rem 0.45rem;
  }

  .combat-log li:nth-last-child(n + 5) {
    display: none;
  }

  .player-card {
    padding: 0.3rem 0.4rem;
  }

  .combat-bottom {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  }

  .action-button small {
    display: none;
  }

  .action-button strong {
    font-size: 0.62rem;
  }
}

/* Final overrides keep the arena layout independent of the landing-page breakpoints. */
:root {
  --ink: #382d20;
  --muted: #76664d;
  --navy: #344c35;
  --navy-light: #50704a;
  --red: #b7472e;
  --red-dark: #873323;
  --gold: #c38b30;
  --paper: #f5edda;
  --paper-deep: #e8d7b4;
  --panel: #fff9e9;
  --line: #a78b60;
  --green: #397446;
  --shadow: 4px 4px 0 rgba(74, 56, 31, 0.2);
  font-family: "Courier New", "Lucida Console", monospace;
}

body {
  background:
    linear-gradient(0deg, rgba(166, 194, 117, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(166, 194, 117, 0.1) 1px, transparent 1px),
    #f5edda;
  background-size: 22px 22px;
}

.site-header {
  border-bottom: 4px solid #a94c2d;
  background: #486744;
  box-shadow: 0 4px 0 #9b7542;
}

.brand img {
  border: 3px solid #e8cf92;
  border-radius: 0;
  image-rendering: pixelated;
}

.brand-title,
.hero-intro h1,
.combat-topline h1,
.panel-heading h2,
.combatant h2,
.dice-dialog h2 {
  font-family: "Courier New", "Lucida Console", monospace;
  font-weight: 700;
}

.panel,
.combatant {
  border: 3px solid #86663c;
  border-radius: 0;
  background: #fff9e9;
  box-shadow: 4px 4px 0 rgba(74, 56, 31, 0.2);
}

.button,
.option-button,
.attribute-adjust,
.home-icon-button,
.spell-option {
  border: 3px solid #765631;
  border-radius: 0;
  box-shadow: 3px 3px 0 #b99a67;
  font-family: inherit;
}

.button-primary {
  color: #fffbea;
  background: #ae4930;
  box-shadow: 3px 3px 0 #713322;
}

.button-quiet,
.option-button,
.attribute-adjust,
.spell-option {
  color: #3b4d36;
  background: #fff6d9;
}

.option-button[aria-pressed="true"],
.spell-option[aria-pressed="true"] {
  color: #fff8e6;
  background: #55774c;
  border-color: #344c35;
}

.action-menu {
  grid-template-columns: minmax(0, 1fr);
}

.action-button {
  border: 2px solid #9a7c4e;
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(74, 56, 31, 0.16);
}

.system-link {
  border: 3px solid #9a7c4e;
  color: #3b4d36;
  background: #fff6d9;
  box-shadow: 3px 3px 0 #b99a67;
  text-decoration: none;
}

body.in-combat {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body.in-combat .site-header,
body.in-combat .site-footer {
  display: none;
}

body.in-combat .app-shell {
  width: min(1440px, 100%);
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(0.4rem, 1.2vh, 0.8rem) clamp(0.5rem, 1.2vw, 1rem);
  overflow: hidden;
}

.combat-screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.combat-topline {
  flex: 0 0 auto;
  margin-bottom: 0.45rem;
}

.combat-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(235px, 0.75fr);
  grid-template-rows: auto minmax(100px, 34%) auto;
  grid-template-areas:
    "enemy enemy"
    "round actions"
    "player player";
  align-content: space-between;
  gap: clamp(0.35rem, 0.8vh, 0.7rem);
}

.enemy-card {
  grid-area: enemy;
}

.round-panel {
  grid-area: round;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.combat-log {
  max-height: none;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
}

.player-actions {
  grid-area: actions;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.player-card {
  grid-area: player;
}

.dice-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(2px);
}

.dice-dialog {
  width: min(520px, 100%);
  max-height: min(80vh, 680px);
  overflow-y: auto;
  padding: clamp(1rem, 3vw, 1.6rem);
  border: 4px solid #765631;
  background: #fff9e9;
  box-shadow: 8px 8px 0 rgba(74, 56, 31, 0.3);
  text-align: center;
}

@media (max-width: 720px) {
  .combat-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(90px, 23%) minmax(105px, 31%) auto;
    grid-template-areas:
      "enemy"
      "round"
      "actions"
      "player";
    align-content: space-between;
    gap: 0.35rem;
  }
}





@media (max-height: 650px) and (min-width: 721px) {
  .combat-layout {
    grid-template-rows: auto minmax(90px, 32%) auto;
  }
}

@media (max-height: 650px) and (max-width: 720px) {
  .combat-layout {
    grid-template-rows: auto minmax(75px, 20%) minmax(90px, 29%) auto;
  }
}

.brand img {
  background: transparent;
}

.panel-icon,
.combatant-symbol,
.action-icon {
  border: 2px solid #896a3e;
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(74, 56, 31, 0.18);
}

.health-track,
.xp-track,
.health-track span,
.xp-track span,
.stat-chip,
.resource-row span {
  border-radius: 0;
}

.choice-field {
  min-width: 0;
  margin: 0;
  padding: 0.65rem;
  border: 2px solid #c3a979;
  background: #fff8e6;
}

.choice-field legend {
  padding: 0 0.35rem;
  color: #405c3d;
  font-size: 0.78rem;
  font-weight: 700;
}

.option-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem 0.2rem 0.45rem;
}

.option-grid-compact {
  max-height: 145px;
}

.option-button,
.spell-option {
  min-height: 36px;
  padding: 0.4rem 0.55rem;
  border: 3px solid #765631;
  color: #3b4d36;
  background: #fff6d9;
  box-shadow: 3px 3px 0 #b99a67;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
}

.attribute-picker {
  border: 2px solid #a78b60;
  border-radius: 0;
  background: #f6edda;
}

.attribute-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.attribute-field > span {
  min-height: 1.8em;
  color: #405c3d;
  font-weight: 700;
}

.attribute-adjust {
  width: 38px;
  min-height: 28px;
  padding: 0;
  border: 3px solid #765631;
  color: #3b4d36;
  background: #fff6d9;
  box-shadow: 3px 3px 0 #b99a67;
  font-weight: 700;
}

.attribute-value {
  min-width: 44px;
  padding: 0.22rem;
  border: 2px solid #a78b60;
  color: #34271e;
  background: #fffdf5;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
}

.attribute-value-row {
  justify-content: center;
  gap: 0.3rem;
}

.attribute-value-row .attribute-adjust {
  width: 32px;
  flex: 0 0 32px;
}

.points-remaining {
  padding: 0.35rem 0.6rem;
  border: 2px solid #a78b60;
  color: #873323;
  background: #fff6d9;
  font-weight: 700;
}

.system-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.75rem;
}

.system-page {
  max-width: 920px;
}

.system-panel {
  margin-inline: auto;
}

.system-link {
  min-height: 125px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem;
}

.system-link:hover {
  color: #873323;
  background: #fffdf5;
}

.system-link strong {
  font-size: 0.9rem;
}

.system-link span {
  color: #76664d;
  font-size: 0.74rem;
  line-height: 1.5;
}

.home-icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0.35rem;
  border: 3px solid #765631;
  color: #405c3d;
  background: #fff6d9;
  box-shadow: 3px 3px 0 #b99a67;
}

.home-icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  shape-rendering: crispEdges;
}

.player-actions {
  padding: clamp(0.45rem, 1vh, 0.75rem);
  justify-content: flex-start;
  border: 3px solid #86663c;
  border-radius: 0;
  background: #f4e6c6;
  box-shadow: 4px 4px 0 rgba(74, 56, 31, 0.2);
}

.player-actions > .eyebrow {
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
}

.action-button {
  min-height: 45px;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 0.45rem;
  padding: 0.3rem 0.45rem;
}

.action-icon {
  width: 27px;
  height: 27px;
  border: 2px solid #896a3e;
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(74, 56, 31, 0.18);
}

.action-button strong {
  color: #405c3d;
  font-size: 0.74rem;
}

.action-button small {
  font-size: 0.62rem;
}

.spell-picker {
  display: grid;
  gap: 0.35rem;
  margin: 0.2rem 0;
}

.spell-options {
  display: grid;
  gap: 0.3rem;
}

.spell-option {
  width: 100%;
}

.dice-dialog h2 {
  margin-bottom: 0.4rem;
  color: #405c3d;
  font-size: 1.35rem;
}

.dice-outcome {
  margin-bottom: 0.8rem;
  color: #873323;
  font-size: 0.9rem;
  font-weight: 700;
}

.dice-results {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  min-height: 58px;
}

.dice-result {
  min-width: 60px;
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.45rem;
  border: 2px solid #c3a979;
  background: #fffdf5;
}

.die-shape {
  min-width: 39px;
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 0.2rem;
  color: #fffbea;
  background: #55774c;
  clip-path: polygon(50% 0, 94% 22%, 100% 70%, 68% 100%, 18% 92%, 0 46%, 14% 11%);
  font-size: 0.68rem;
  font-weight: 700;
}

.die-d2 {
  color: #34271e;
  background: #e3bd61;
  clip-path: circle(45%);
  font-size: 1rem;
}

.dice-result strong {
  color: #34271e;
  font-size: 1.1rem;
}

.no-dice-result {
  color: #76664d;
  font-size: 0.78rem;
}

.dice-continue {
  margin-top: 1rem;
}

.combat-log li:nth-last-child(n + 5) {
  display: list-item;
}

.combat-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(80px, 1fr) auto auto;
  grid-template-areas:
    "enemy"
    "round"
    "actions"
    "player";
  align-content: stretch;
  gap: clamp(0.3rem, 0.65vh, 0.55rem);
}

.round-panel {
  width: 100%;
}

.journey-screen {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.55rem, 1.2vh, 0.9rem);
  overflow: hidden;
}

.level-up-screen {
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
}

.level-up-card {
  width: min(560px, 100%);
  padding: clamp(1.1rem, 3vw, 2rem);
  border: 4px solid #765631;
  color: #34271e;
  background: #fff8e6;
  box-shadow: 8px 8px 0 #b99a67;
  text-align: center;
}

.level-up-card h1 {
  margin: 0.25rem 0 0.8rem;
  color: #405c3d;
  font-family: "Cinzel", Georgia, serif;
}

.level-up-card ul {
  display: inline-grid;
  gap: 0.4rem;
  margin: 0.5rem auto 1.1rem;
  padding-left: 1.3rem;
  text-align: left;
  font-size: 0.82rem;
}

.level-up-card > div > p {
  color: #76664d;
}

.journey-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.65rem, 1.3vh, 1rem);
  border: 3px solid #86663c;
  background: #fff8e6;
  box-shadow: 4px 4px 0 rgba(74, 56, 31, 0.2);
}

.journey-heading h1,
.result-dialog h2 {
  margin: 0;
  color: #405c3d;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.15rem, 2.1vw, 1.7rem);
}

.journey-heading p:last-child {
  margin: 0.3rem 0 0;
  color: #76664d;
  font-size: 0.78rem;
}

.journey-wallet {
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem;
  border: 3px solid #765631;
  color: #704927;
  background: #f2d98f;
  box-shadow: 3px 3px 0 #b99a67;
  font-weight: 700;
  white-space: nowrap;
}

.journey-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 0.15rem 0.2rem 0.5rem;
}

.destination-grid,
.loot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.45rem, 1vw, 0.8rem);
}

.destination-card,
.loot-choice,
.store-item {
  min-width: 0;
  padding: clamp(0.6rem, 1vw, 0.9rem);
  border: 3px solid #765631;
  color: #34271e;
  background: #fff8e6;
  box-shadow: 4px 4px 0 #b99a67;
  font: inherit;
  text-align: left;
}

.destination-card {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  transition: transform 120ms ease, background-color 120ms ease;
}

.destination-card:not(:disabled):hover,
.loot-choice:not(:disabled):hover {
  transform: translate(-2px, -2px);
  background: #fffdf5;
  box-shadow: 6px 6px 0 #b99a67;
}

.destination-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.destination-card strong,
.loot-choice strong {
  color: #405c3d;
  font-size: 0.84rem;
}

.destination-card > span:not(.destination-kind),
.loot-choice > span:not(.loot-choice-mark) {
  color: #76664d;
  font-size: 0.7rem;
  line-height: 1.4;
}

.destination-kind {
  padding: 0.2rem 0.35rem;
  border: 1px solid #a78b60;
  color: #873323;
  background: #f6edda;
  font-size: 0.61rem;
  font-weight: 700;
  text-transform: uppercase;
}

.destination-service {
  background: #f5edce;
}

.destination-price {
  margin-top: auto;
  color: #704927 !important;
  font-weight: 700;
}

.loot-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.loot-choice {
  min-height: 145px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.loot-choice[aria-pressed="true"] {
  border-color: #405c3d;
  background: #e6efd8;
  box-shadow: 4px 4px 0 #708b60;
}

.loot-choice-mark {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 2px solid #765631;
  color: #405c3d;
  background: #fffdf5;
  font-weight: 700;
}

.journey-selection-count {
  margin: 1rem 0 0.6rem;
  color: #704927;
  font-weight: 700;
}

.store-stock {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.market-section {
  margin-bottom: 1.1rem;
}

.market-section > h2,
.equipment-summary h2,
.inventory-items h2 {
  margin: 0 0 0.5rem;
  color: #405c3d;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
}

.equipment-summary,
.inventory-items {
  margin-bottom: 0.9rem;
  padding: 0.7rem;
  border: 3px solid #c3a979;
  background: #fff8e6;
  box-shadow: 3px 3px 0 #b99a67;
}

.equipment-summary ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.72rem;
}

.equipment-summary li {
  display: grid;
  gap: 0.22rem;
  align-content: start;
  padding: 0.45rem;
  border: 1px solid #ded4c2;
  background: #fffdf5;
}

.armor-class-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
  padding: 0.7rem 0.85rem;
  border: 3px solid #55774c;
  color: #405c3d;
  background: #e6efd8;
  box-shadow: 3px 3px 0 #b99a67;
}

.armor-class-summary strong {
  font-size: 1.15rem;
}

.inventory-items {
  margin-bottom: 1rem;
}

.inventory-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid #ded4c2;
}

.inventory-item > div {
  display: grid;
  gap: 0.2rem;
}

.inventory-item strong {
  color: #405c3d;
  font-size: 0.78rem;
}

.inventory-item span,
.item-unusable,
.item-equipped {
  color: #76664d;
  font-size: 0.67rem;
}

.item-equipped {
  padding: 0.28rem 0.45rem;
  border: 2px solid #55774c;
  color: #405c3d;
  background: #e6efd8;
  font-weight: 700;
}

.store-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.store-item .eyebrow {
  margin: 0;
  font-size: 0.62rem;
}

.store-item h2 {
  margin: 0.15rem 0;
  color: #405c3d;
  font-size: 0.88rem;
}

.store-item p:not(.eyebrow) {
  margin: 0;
  color: #76664d;
  font-size: 0.72rem;
}

.store-item-action {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.65rem;
  color: #704927;
  font-size: 0.75rem;
}

.inventory-panel {
  margin-top: 0.8rem;
  padding: 0.5rem;
  border: 2px solid #c3a979;
  background: #fff8e6;
}

.inventory-panel h3 {
  margin: 0 0 0.35rem;
  color: #405c3d;
  font-size: 0.77rem;
}

.inventory-panel ul {
  display: grid;
  gap: 0.25rem;
  margin: 0;
  padding-left: 1.1rem;
  color: #76664d;
  font-size: 0.68rem;
}

.dice-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
}

.dice-result {
  min-width: 70px;
  min-height: 92px;
  align-content: center;
  gap: 0.1rem;
  border: 3px solid #765631;
  background: #f7eccd;
  box-shadow: 3px 3px 0 #b99a67;
}

.die-art {
  width: 54px;
  height: 46px;
  display: grid;
  place-items: center;
  filter: drop-shadow(2px 2px 0 rgba(74, 56, 31, 0.35));
}

.die-art svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  shape-rendering: crispEdges;
}

.dice-result strong {
  padding-top: 0.15rem;
  border-top: 2px solid #c3a979;
}

.die-image {
  width: 54px;
  height: 50px;
  object-fit: contain;
  image-rendering: pixelated;
}

.action-die-icon {
  width: 18px;
  height: 18px;
  margin-left: 0.2rem;
  vertical-align: middle;
  object-fit: contain;
  image-rendering: pixelated;
}

.encounter-intro-rolls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 0.6rem 0;
}

.encounter-die {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.65rem;
  border: 2px solid #c3a979;
  background: #fffdf5;
}

.encounter-die img {
  width: 46px;
  height: 42px;
  object-fit: contain;
  image-rendering: pixelated;
}

.growth-choice {
  margin: 0.85rem auto;
  padding: 0.65rem;
  border: 2px solid #c3a979;
  background: #fffdf5;
}

.growth-choice h3 {
  margin: 0 0 0.4rem;
  color: #405c3d;
}

.growth-choice .field-label {
  margin: 0.45rem 0 0.2rem;
  color: #5a4937;
  font-weight: 700;
}

.growth-option-grid {
  max-height: 180px;
}

.defeat-screen {
  min-height: calc(100dvh - 150px);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.defeat-card {
  width: min(560px, 100%);
  padding: clamp(1.2rem, 4vw, 2.4rem);
  border: 4px solid #762026;
  color: #34271e;
  background: #fff8e6;
  box-shadow: 8px 8px 0 #b99a67;
  text-align: center;
}

.defeat-card h1 {
  color: #873323;
  font-family: "Cinzel", Georgia, serif;
}

.defeat-card p {
  line-height: 1.6;
}

.button:disabled,
.action-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.result-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(2px);
}

.result-dialog {
  width: min(540px, 100%);
  max-height: min(82vh, 680px);
  overflow-y: auto;
  padding: clamp(1.1rem, 3vw, 1.8rem);
  border: 4px solid #765631;
  color: #34271e;
  background: #fffdf5;
  box-shadow: 8px 8px 0 rgba(74, 56, 31, 0.3);
  text-align: center;
}

.result-dialog h2 {
  margin: 0.3rem 0 0.8rem;
}

.result-dialog > div {
  margin-bottom: 1rem;
  color: #5a4937;
  font-size: 0.85rem;
  line-height: 1.55;
}

.result-dialog ul {
  display: inline-grid;
  gap: 0.25rem;
  margin: 0.4rem auto;
  padding-left: 1.2rem;
  text-align: left;
}

.combat-result-section {
  padding: 0.6rem 0;
  border-bottom: 2px solid #ded4c2;
}

.combat-result-section:last-child {
  border-bottom: 0;
}

.combat-result-section h3 {
  margin: 0 0 0.35rem;
  color: #405c3d;
  font-family: "Cinzel", Georgia, serif;
}

.combat-result-section p {
  margin: 0.25rem 0;
}

@media (max-width: 900px) {
  .destination-grid,
  .loot-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .combat-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(65px, 1fr) auto auto;
    grid-template-areas:
      "enemy"
      "round"
      "actions"
      "player";
    align-content: stretch;
    gap: 0.3rem;
  }

  .player-actions > .eyebrow {
    margin-bottom: 0.22rem;
    font-size: 0.58rem;
  }

  .action-button {
    min-height: 36px;
    grid-template-columns: 23px minmax(0, 1fr);
    gap: 0.28rem;
    padding: 0.25rem 0.3rem;
  }

  .action-icon {
    width: 22px;
    height: 22px;
  }

  .action-button strong {
    font-size: 0.66rem;
  }

  .action-button small {
    font-size: 0.55rem;
  }

  .journey-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }

  .journey-wallet {
    padding: 0.35rem 0.55rem;
    font-size: 0.75rem;
  }

  .destination-grid,
  .loot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .destination-card,
  .loot-choice {
    min-height: 125px;
  }

  .store-item {
    align-items: flex-start;
  }

  .store-item-action {
    align-items: flex-end;
    flex-direction: column;
    gap: 0.4rem;
  }
}

@media (max-width: 720px) {
  body.in-combat {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.in-combat .app-shell {
    height: auto;
    min-height: calc(100vh - 56px);
    min-height: calc(100dvh - 56px);
    overflow: visible;
  }

  .combat-screen {
    height: auto;
    min-height: calc(100vh - 56px);
    min-height: calc(100dvh - 56px);
  }

  .combat-layout {
    grid-template-rows: auto auto auto auto;
    align-content: start;
    overflow: visible;
  }

  .round-panel,
  .player-actions {
    overflow: visible;
  }

  .combat-log {
    max-height: 4.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
