:root {
  color-scheme: light;
  --ink: #241914;
  --muted: #725f4d;
  --page: #17120f;
  --surface: #eadfbe;
  --card: #fbf3d9;
  --line: #c6ad78;
  --line-dark: #8f6d36;
  --moss: #355843;
  --moss-2: #59775c;
  --gold: #c29339;
  --red: #8f3d34;
  --blue: #3f6078;
  --parchment-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38), inset 0 -18px 42px rgba(122, 83, 33, 0.08);
  --carved-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), inset 0 -2px 0 rgba(58, 38, 18, 0.14), 0 2px 0 rgba(74, 49, 23, 0.18);
  --shadow: 0 22px 60px rgba(8, 6, 4, 0.42);
  --app-width: 402px;
  --desktop-app-height: min(var(--viewport-height, 100vh), 874px);
  --app-height: var(--viewport-height, 100vh);
  --topbar-base-height: 42px;
  --bottom-bar-base-height: 87px;
  --topbar-height: calc(var(--topbar-base-height) + env(safe-area-inset-top));
  --bottom-bar-height: calc(var(--bottom-bar-base-height) + env(safe-area-inset-bottom));
  --phone-side-pad: 8px;
  --app-frame-width: 100vw;
  --map-width-limit: calc(var(--app-frame-width) - (var(--phone-side-pad) * 2));
  --map-height-limit: calc(var(--app-height) - var(--topbar-height) - var(--bottom-bar-height) - var(--map-intro-reserve) - var(--map-detail-reserve) - var(--map-gap-reserve));
  --map-content-width: var(--map-width-limit);
  --map-min-size: 210px;
  --map-intro-reserve: 58px;
  --map-detail-reserve: 108px;
  --map-gap-reserve: 12px;
  --map-size: clamp(var(--map-min-size), min(var(--map-width-limit), var(--map-height-limit)), var(--map-width-limit));
  --ui-radius: 8px;
  --ui-gap: 8px;
  --ui-pad: 9px;
  --button-press: translateY(1px);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--page);
}

body {
  display: grid;
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #271d17 0%, #17120f 54%, #0f1512 100%);
  background-size: 26px 26px, auto;
  place-items: center;
  overscroll-behavior: none;
  font-family:
    "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease, background-color 120ms ease;
}

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

button:not(:disabled):active {
  transform: var(--button-press);
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: #fff7df;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

input,
select {
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  padding: 9px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-dark);
  box-shadow: 0 0 0 3px rgba(194, 147, 57, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.52);
}

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

.app {
  position: relative;
  width: 100vw;
  height: var(--app-height);
  min-height: 0;
  overflow: hidden;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(82, 54, 24, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #efe4c1, var(--surface));
  background-size: 18px 18px, auto;
  box-shadow: none;
  border: 0;
}

.login-shell {
  display: grid;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  padding: 18px;
}

.app.keyboard-open .login-shell {
  align-items: start;
  justify-items: center;
  overflow: auto;
  padding-top: 8px;
  padding-bottom: 18px;
  -webkit-overflow-scrolling: touch;
}

.app.keyboard-open .create-screen {
  align-content: start;
  overflow: hidden;
}

.app.keyboard-open .create-step-body {
  max-height: calc(var(--visual-viewport-height, var(--app-height)) - var(--topbar-height) - 108px);
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.app.keyboard-open .create-footer {
  display: none;
}

.login-hero {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 16px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 236, 168, 0.42), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--parchment-shadow);
}

.crest {
  width: 72px;
  height: 72px;
  justify-self: center;
  border-radius: 8px;
}

.login-hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-size: clamp(2rem, 11vw, 2.55rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.lead,
.story-copy,
.fine,
.empty,
.location-card p,
.item-row p,
.goal-row p,
.console-row p,
.spec-card p,
.asset-card p,
.audio-slot-row p {
  color: var(--muted);
  line-height: 1.45;
}

.lead {
  font-size: 0.94rem;
}

.login-account-form {
  display: grid;
  gap: 7px;
  width: 100%;
}

.login-account-form input {
  min-height: 38px;
  font-size: 16px;
}

.login-segmented {
  margin-top: 2px;
}

.account-status-card {
  display: grid;
  gap: 3px;
  padding: 8px;
  color: #2d2117;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.72);
  border-radius: 8px;
}

.account-status-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.compact-issue {
  margin: 0;
  padding: 7px;
  font-size: 0.72rem;
}

.topbar {
  position: relative;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: calc(4px + env(safe-area-inset-top)) 6px 4px;
  background:
    linear-gradient(180deg, rgba(255, 250, 228, 0.97), rgba(228, 211, 165, 0.94));
  border-bottom: 2px solid var(--line-dark);
  backdrop-filter: blur(16px);
}

.topbar-spacer {
  display: block;
  width: 30px;
  height: 30px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.brand > div,
.topbar-title-row {
  min-width: 0;
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  min-height: 30px;
  height: 30px;
  overflow: hidden;
}

.brand img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.brand h1 {
  flex: 0 1 auto;
  margin: 0;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-size: 0.98rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-context,
.topbar .eyebrow {
  min-width: 0;
  overflow: hidden;
  font-size: 0.6rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-transform: uppercase;
}

.topbar-context {
  display: block;
  flex: 1 1 auto;
  max-width: none;
  min-width: 32px;
  height: auto;
  padding: 1px 0 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: left;
}

.topbar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: end;
}

.eyebrow,
.field-label,
.fine {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.screen {
  display: grid;
  gap: var(--ui-gap);
  height: calc(100% - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
  padding: var(--ui-pad);
}

.app.has-bottom-bar .screen {
  height: calc(100% - var(--topbar-height) - var(--bottom-bar-height));
  padding-bottom: 8px;
}

.app.has-bottom-bar .screen:not(.map-screen) {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

.title-screen,
.settings-screen {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.title-screen::-webkit-scrollbar,
.settings-screen::-webkit-scrollbar {
  display: none;
}

.title-screen > .panel {
  overflow: hidden;
}

.settings-screen {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 5px;
  overflow: auto;
  padding: 6px 8px 12px;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.settings-screen > .panel {
  overflow: visible;
}

.settings-card {
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 7px;
}

.settings-card h2 {
  margin: 0 0 2px;
  font-size: 0.98rem;
  line-height: 1.02;
}

.settings-card .story-copy {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.material-source-list {
  display: grid;
  gap: 5px;
}

.material-source-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-width: 0;
  padding: 6px;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.78);
  border-radius: 7px;
}

.material-source-row .item-icon {
  width: 34px;
  height: 34px;
}

.material-source-row strong,
.material-source-row p,
.material-source-row small {
  display: block;
  margin: 0;
  min-width: 0;
}

.material-source-row strong {
  font-size: 0.74rem;
  line-height: 1.08;
}

.material-source-row p,
.material-source-row small {
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.18;
}

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

.settings-action-grid .compact {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.7rem;
}

.settings-link-list,
.settings-status-grid {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-link-list article,
.settings-status-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 5px;
  color: #3d2b1b;
  background: rgba(255, 247, 223, 0.74);
  border: 1px solid rgba(198, 173, 120, 0.7);
  border-radius: 6px;
  overflow: visible;
}

.settings-link-list strong,
.settings-status-grid span {
  font-size: 0.66rem;
  font-weight: 850;
}

.settings-link-list code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #5a4634;
  font-family: "Avenir Next", Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.64rem;
  line-height: 1.16;
}

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

.panel,
.character-card,
.create-card,
.locked-card,
.location-card,
.item-row,
.goal-row,
.console-row,
.spec-card,
.asset-card,
.audio-slot-row,
.equipment-slot {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent),
    var(--card);
  border: 1px solid var(--line);
  border-radius: var(--ui-radius);
  box-shadow: var(--parchment-shadow);
}

.panel {
  min-height: 0;
  padding: var(--ui-pad);
  overflow: hidden;
}

.panel > :last-child,
.location-card > :last-child,
.item-row > :last-child,
.goal-row > :last-child {
  margin-bottom: 0;
}

.panel h2,
.panel h3,
.location-card h3,
.character-card h3 {
  margin-bottom: 6px;
}

.hero-panel {
  display: flex;
  gap: 9px;
  align-items: center;
}

.hero-panel > div:first-child {
  min-width: 0;
}

.title-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 5px;
  width: min(42%, 152px);
}

.split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.button-row,
.item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.button-stack {
  display: grid;
  gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  font-weight: 850;
  text-align: center;
  border: 1px solid var(--line-dark);
  box-shadow: var(--carved-shadow);
  line-height: 1.1;
}

.primary-button {
  color: #fff7df;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--moss);
}

.primary-button:not(:disabled):hover,
.secondary-button:not(:disabled):hover,
.icon-button:not(:disabled):hover {
  filter: brightness(1.03);
}

.secondary-button {
  color: var(--ink);
  background:
    linear-gradient(180deg, #fff2c9, #dcc584);
  border-color: #b38b42;
}

.ghost-button,
.quiet-button {
  color: #51381e;
  background: rgba(255, 247, 223, 0.42);
  border: 1px solid var(--line);
}

.danger-button {
  color: #fff5df;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent),
    var(--red);
}

.compact {
  width: auto;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.8rem;
}

.tiny {
  width: auto;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 0.72rem;
}

.icon-button {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  place-items: center;
  color: #51381e;
  background: #fff4d3;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: var(--carved-shadow);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.fullscreen-icon-button.is-active {
  color: #fff8d8;
  background: linear-gradient(180deg, #416d54, #2d5d48);
  border-color: #2d5d48;
}

.card-list,
.location-list,
.content-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.card-list::-webkit-scrollbar,
.location-list::-webkit-scrollbar,
.content-list::-webkit-scrollbar,
.json-sheet::-webkit-scrollbar {
  display: none;
}

.character-card {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 9px;
  padding: 9px;
  align-items: center;
}

.character-card h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1;
}

.character-card .button-row {
  margin-top: 7px;
}

.card-main {
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 3px 7px;
  color: #2d2117;
  background: #e7c979;
  border: 1px solid #b1883b;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.pill.danger {
  color: #fff;
  background: var(--red);
}

.pill.difficulty-easy,
.difficulty-badge.difficulty-easy {
  color: #fff7df;
  background: #3f6d4d;
  border-color: #2c563c;
}

.pill.difficulty-medium,
.difficulty-badge.difficulty-medium {
  color: #2d2117;
  background: #e7c979;
  border-color: #b1883b;
}

.pill.difficulty-tough,
.difficulty-badge.difficulty-tough {
  color: #fff7df;
  background: #9a4f39;
  border-color: #713225;
}

.pill.difficulty-doom,
.difficulty-badge.difficulty-doom {
  color: #fff7df;
  background: #541d21;
  border-color: #301014;
}

.pill.difficulty-locked,
.difficulty-badge.difficulty-locked {
  color: #f6f0dc;
  background: #565147;
  border-color: #3e392f;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin: 6px 0;
}

.mini-grid span {
  min-width: 0;
  padding: 5px 6px;
  overflow: hidden;
  color: #4b341d;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.6);
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-strip .meter-wrap {
  padding: 4px 6px;
  background: rgba(255, 247, 223, 0.36);
  border: 1px solid rgba(198, 173, 120, 0.38);
  border-radius: 6px;
}

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

.resource-strip {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.meter-wrap {
  display: grid;
  gap: 3px;
}

.meter-wrap span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.meter {
  height: 6px;
  overflow: hidden;
  background: #d8c99e;
  border-radius: 999px;
}

.meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #476b54, var(--gold));
}

.portrait {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.32), transparent 18%),
    linear-gradient(145deg, var(--portrait), #28332d);
  border: 3px solid #fff7df;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
}

.portrait.large {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  font-size: 1.25rem;
}

.portrait.small {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  font-size: 0.92rem;
}

.create-card,
.locked-card {
  display: grid;
  gap: 4px;
  min-height: 106px;
  place-items: center;
  padding: 12px;
  color: var(--ink);
  text-align: center;
}

.create-card span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--moss);
  border-radius: 50%;
  font-size: 2rem;
  line-height: 1;
}

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

.create-grid {
  grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1fr) auto auto;
  padding-bottom: 8px;
}

.create-screen {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 6px;
  overflow: hidden;
}

.create-summary {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 7px;
}

.create-summary h2,
.create-summary p {
  margin: 0;
}

.create-summary h2 {
  font-size: clamp(1.15rem, 5.4vw, 1.72rem);
  line-height: 0.98;
}

.create-summary-stats {
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}

.create-summary-stats span {
  font-size: 0.7rem;
  text-align: center;
}

.create-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  min-height: 38px;
}

.create-stepper button {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 38px;
  padding: 4px;
  color: var(--moss);
  background: #fffefa;
  border: 1px solid var(--line);
  font-size: 0.58rem;
  font-weight: 900;
  box-shadow: var(--carved-shadow);
}

.create-stepper span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  justify-self: center;
  color: #fff;
  background: var(--moss);
  border-radius: 50%;
  font-size: 0.62rem;
}

.create-stepper strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.create-stepper button.is-active {
  color: #fff;
  background: var(--moss);
  border-color: var(--moss);
}

.create-stepper button.is-active span {
  color: var(--moss);
  background: #fffefa;
}

.create-stepper button.is-complete {
  border-color: #b9a25c;
}

.create-step-body,
.create-scroll {
  display: grid;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.create-step-body {
  align-content: start;
}

.create-step-body::-webkit-scrollbar,
.create-scroll::-webkit-scrollbar {
  display: none;
}

.create-footer {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 7px;
  padding: 0;
}

.journey-screen {
  grid-template-rows: minmax(0, 1fr) auto;
}

.journey-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 248, 223, 0.92), rgba(232, 211, 154, 0.88)),
    var(--paper);
}

.journey-portrait-stack {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.journey-portrait-stack .portrait.large {
  width: min(42vw, 168px);
  height: min(52vw, 208px);
  aspect-ratio: 3 / 4;
  object-fit: contain;
}

.journey-portrait-stack span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.mystery-portrait {
  display: grid;
  place-items: center;
  color: rgba(255, 247, 223, 0.94);
  background:
    radial-gradient(circle at 50% 38%, rgba(43, 32, 22, 0.38), transparent 22%),
    linear-gradient(145deg, #75614c, #2b2016);
  border: 2px dashed rgba(255, 247, 223, 0.48);
}

.mystery-portrait span {
  font-family: var(--display-font);
  font-size: 2rem;
}

.journey-copy {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.journey-copy::-webkit-scrollbar {
  display: none;
}

.journey-copy h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 10vw, 3.4rem);
  line-height: 0.95;
}

.journey-copy p {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1.35;
}

.create-step-panel {
  display: grid;
  gap: 8px;
  min-height: 100%;
  align-content: start;
}

.race-step-panel {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.race-step-panel .create-feature-preview {
  grid-template-columns: minmax(108px, 40%) minmax(0, 60%);
  align-items: stretch;
}

.race-step-panel .create-feature-preview .portrait.large {
  width: 100%;
  max-width: 156px;
  height: clamp(126px, 26vh, 184px);
  min-height: 120px;
  aspect-ratio: 3 / 4;
  justify-self: center;
  object-fit: contain;
  border-radius: 8px;
}

.race-step-panel .create-feature-preview h2 {
  font-size: clamp(1.2rem, 5vw, 1.55rem);
  line-height: 1;
}

.race-step-panel .create-feature-preview .story-copy {
  font-size: 0.68rem;
  line-height: 1.22;
}

.race-step-panel .create-feature-preview .fine {
  font-size: 0.64rem;
}

.create-feature-preview {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.create-feature-preview.review {
  grid-template-columns: 74px minmax(0, 1fr);
}

.create-feature-preview h2,
.create-feature-preview p {
  margin: 0;
}

.sex-choice-grid {
  margin-top: 7px;
}

.compact-choices .choice-button {
  min-height: 48px;
  padding: 7px;
}

.compact-choices .choice-button span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.race-choice-grid {
  display: grid;
  gap: 6px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.race-choice-grid::-webkit-scrollbar {
  display: none;
}

.trait-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.trait-row span,
.race-choice-button em {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 20px;
  padding: 2px 6px;
  color: #392817;
  background: #e9cd7c;
  border: 1px solid #b58d45;
  border-radius: 5px;
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 850;
}

.race-choice-button {
  min-height: 72px;
  align-content: start;
}

.race-choice-button small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.race-choice-button em {
  margin-top: 2px;
}

.race-choice-button > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.race-choice-button > div span {
  flex: 0 0 auto;
  font-size: 0.68rem;
  text-align: right;
}

.race-choice-button strong {
  min-width: 0;
}

.class-choice-grid {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.class-choice-grid::-webkit-scrollbar {
  display: none;
}

.class-choice-button {
  min-height: auto;
  align-content: start;
  padding: 8px;
}

.class-choice-button strong {
  font-size: clamp(1rem, 4.6vw, 1.24rem);
  line-height: 1.05;
}

.class-choice-button span {
  display: block;
  overflow: visible;
  color: var(--muted);
  font-size: clamp(0.72rem, 3.4vw, 0.86rem);
  line-height: 1.24;
}

.review-name-block {
  display: grid;
  gap: 5px;
}

.review-name-block h2 {
  margin: 0;
  font-size: clamp(1.18rem, 5.2vw, 1.58rem);
  line-height: 1;
}

.review-step-panel {
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}

.review-step-panel .create-feature-preview.review {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
}

.review-step-panel .create-feature-preview.review .portrait.large {
  width: 54px;
  height: 54px;
}

.review-step-panel .stat-columns {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.review-step-panel .stat-columns::-webkit-scrollbar {
  display: none;
}

.review-step-panel .stat-lines {
  gap: 4px;
}

.review-step-panel .stat-lines span {
  min-height: 24px;
  padding: 3px 7px;
  font-size: 0.72rem;
}

.create-step-panel input {
  min-height: 44px;
  font-size: 16px;
}

.create-grid > .panel:nth-child(3),
.create-grid > .panel:nth-child(4),
.create-grid > .panel:nth-child(5) {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.create-grid > .panel:nth-child(3)::-webkit-scrollbar,
.create-grid > .panel:nth-child(4)::-webkit-scrollbar,
.create-grid > .panel:nth-child(5)::-webkit-scrollbar {
  display: none;
}

.choice-grid {
  display: grid;
  gap: 6px;
  min-height: 0;
  margin-top: 8px;
}

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

.choice-button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px;
  color: var(--ink);
  text-align: left;
  background: #fffefa;
  border: 1px solid var(--line);
}

.choice-button span {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.choice-button.is-active {
  background: #eef5ee;
  border-color: var(--moss-2);
}

.stat-editor {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.stat-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 34px 36px;
  gap: 6px;
  align-items: center;
}

.stat-edit-row > span {
  font-weight: 800;
}

.stat-edit-row strong {
  text-align: center;
}

.stat-help-label {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 5px 6px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}

.stat-help-label span {
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

.stat-help-label small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-step-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.map-screen {
  grid-template-rows: auto var(--map-size) minmax(var(--map-detail-reserve), 1fr);
  gap: 7px;
  overflow: hidden;
  max-width: 100%;
}

.map-intro {
  display: grid;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 8px 9px;
}

.map-intro h2,
.map-intro p {
  margin: 0;
}

.map-intro-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.map-intro-row h2 {
  overflow: hidden;
  font-size: clamp(1.08rem, 1rem + 0.8vw, 1.34rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-intro-row .compact {
  min-height: 28px;
  padding: 5px 8px;
  font-size: 0.72rem;
}

.map-intro .story-copy {
  display: block;
  max-height: 38px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.22;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.map-intro .story-copy::-webkit-scrollbar {
  display: none;
}

.map-panel {
  position: relative;
  align-self: center;
  justify-self: center;
  width: var(--map-size);
  height: var(--map-size);
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 248, 222, 0.45), transparent 32%),
    linear-gradient(135deg, #d9c58b, #b89a58);
  border: 2px solid var(--line-dark);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 247, 223, 0.34), 0 2px 0 rgba(72, 48, 20, 0.16);
}

.map-panel::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 45%, transparent 54%, rgba(40, 28, 17, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 247, 223, 0.06), transparent 32%);
  content: "";
}

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  z-index: 2;
  display: grid;
  min-width: 64px;
  max-width: min(180px, 46%);
  min-height: 28px;
  place-items: center;
  padding: 5px 8px 6px;
  color: #fff7df;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent),
    rgba(53, 88, 67, 0.96);
  border: 1px solid #f0d591;
  border-radius: 6px 6px 5px 5px;
  box-shadow: 0 8px 16px rgba(23, 18, 12, 0.28), inset 0 -2px 0 rgba(40, 27, 14, 0.28);
  font-size: 0.61rem;
  font-weight: 900;
  touch-action: manipulation;
  transform: translate(-50%, -50%);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.map-pin span {
  display: block;
  max-width: 100%;
  overflow: hidden;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-pin:not(.is-locked):hover,
.map-pin.is-selected {
  filter: brightness(1.04);
}

.map-pin::after {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 12px;
  height: 12px;
  background: inherit;
  border-right: 1px solid #f0d591;
  border-bottom: 1px solid #f0d591;
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.map-pin.is-locked {
  color: #f6f3e7;
  background: rgba(74, 69, 58, 0.82);
}

.map-pin.is-selected {
  color: #241914;
  background:
    linear-gradient(180deg, #f1cd6d, var(--gold));
  border-color: #fff4ba;
  box-shadow: 0 0 0 3px rgba(194, 147, 57, 0.28), 0 8px 16px rgba(23, 18, 12, 0.28);
}

.map-pin.is-edge-left {
  transform: translate(0, -50%);
}

.map-pin.is-edge-left::after {
  left: 14px;
}

.map-pin.is-edge-right {
  transform: translate(-100%, -50%);
}

.map-pin.is-edge-right::after {
  left: calc(100% - 14px);
}

.placement-map,
.placement-map.map-panel {
  width: min(100%, 390px);
  height: auto;
  aspect-ratio: 1 / 1;
  min-height: 0;
  touch-action: none;
}

.placement-pin {
  cursor: grab;
  user-select: none;
}

.placement-pin:active {
  cursor: grabbing;
}

.placement-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.placement-list span {
  min-width: 0;
  padding: 5px 6px;
  overflow: visible;
  color: #37443d;
  background: #f0f2e9;
  border-radius: 7px;
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.class-ideas-panel {
  min-height: 0;
  overflow: auto;
}

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

.map-scroll-pane,
.map-detail-pane {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.map-detail-pane > .panel {
  min-width: 0;
}

.map-scroll-pane::-webkit-scrollbar,
.map-detail-pane::-webkit-scrollbar {
  display: none;
}

.location-card {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.selected-location-card {
  align-self: start;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), transparent 50%),
    #fbf3d9;
}

.selected-location-card h3 {
  font-size: 1.05rem;
  line-height: 1;
}

.location-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.location-title-row h3,
.location-title-row p {
  margin: 0;
}

.difficulty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 7px;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  box-shadow: var(--carved-shadow);
  font-size: 0.62rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.selected-location-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.selected-location-card .location-copy {
  display: grid;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.selected-location-card .location-copy::-webkit-scrollbar {
  display: none;
}

.selected-location-card .fine {
  font-size: 0.62rem;
  line-height: 1.16;
  -webkit-line-clamp: 1;
}

.selected-location-card .split-row {
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.selected-location-card .split-row .secondary-button {
  min-height: 34px;
  padding: 6px 12px;
}

.map-empty-detail {
  align-self: start;
  align-content: start;
  gap: 3px;
  min-height: 0;
  padding: 8px 10px;
}

.map-empty-detail h2 {
  font-size: 1.02rem;
  line-height: 1.05;
}

.map-empty-detail h2,
.map-empty-detail p {
  margin: 0;
}

.map-empty-detail h2 {
  font-size: 1rem;
  line-height: 1;
}

.map-empty-detail .story-copy {
  font-size: 0.7rem;
  line-height: 1.18;
}

.areas-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.areas-panel::-webkit-scrollbar {
  display: none;
}

.area-list {
  display: grid;
  gap: 6px;
}

.area-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #fff7df;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.area-row p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.area-row.is-current {
  border-color: #b9a25c;
  background: #ffefbd;
}

.area-row.is-locked {
  opacity: 0.68;
}

.home-rest-inline {
  display: grid;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.home-rest-inline h2 {
  font-size: 0.9rem;
}

.holdings-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.holding-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 8px;
  margin-bottom: 7px;
  background: rgba(255, 247, 223, 0.78);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.holding-row.is-contested {
  border-color: #b8892d;
  background: #fff0c4;
}

.holding-row.is-lost {
  border-color: #9a4a43;
  background: #f4d4cb;
}

.holding-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.location-card.is-locked {
  opacity: 0.65;
}

.encounter-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto minmax(56px, 84px);
  gap: 6px;
  height: calc(100% - var(--topbar-height));
  min-height: 0;
  overflow: hidden;
  padding: 7px 8px 8px;
}

.encounter-notice {
  min-height: 0;
  padding: 6px 8px;
  overflow: hidden;
  color: #3a2a21;
  background:
    linear-gradient(180deg, rgba(255, 247, 223, 0.93), rgba(238, 218, 163, 0.84)),
    var(--paper-grid);
  border: 1px solid rgba(156, 122, 67, 0.72);
  border-radius: 7px;
  box-shadow: inset 0 1px 0 rgba(255, 252, 235, 0.72), 0 2px 0 rgba(82, 64, 43, 0.18);
}

.encounter-notice p {
  display: -webkit-box;
  max-height: 54px;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.18;
}

.encounter-visual {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 0;
  padding: 6px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 247, 223, 0.16), transparent 34%),
    linear-gradient(160deg, var(--portrait), #221713 66%);
  border: 2px solid var(--line-dark);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 247, 223, 0.24);
}

.duel-card {
  display: grid;
  grid-template-columns: minmax(132px, 48%) minmax(0, 1fr);
  gap: 7px;
  min-height: 0;
  padding: 6px;
  overflow: hidden;
  background: linear-gradient(90deg, rgba(17, 26, 23, 0.38), rgba(20, 14, 11, 0.22));
  border: 1px solid rgba(255, 247, 223, 0.18);
  border-radius: 7px;
}

.enemy-duel-card {
  grid-template-columns: minmax(132px, 48%) minmax(0, 1fr);
}

.hero-duel-card {
  grid-template-columns: minmax(132px, 48%) minmax(0, 1fr);
  background: linear-gradient(90deg, rgba(255, 247, 223, 0.12), rgba(53, 88, 67, 0.18));
}

.duel-art {
  display: grid;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  background: rgba(255, 247, 223, 0.1);
  border-radius: 7px;
}

.duel-art .entity-art {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
}

.hero-duel-art {
  width: 100%;
  height: 100%;
  justify-self: stretch;
}

.hero-duel-art .portrait.large {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-width: 2px;
  border-radius: 7px;
}

.duel-copy {
  display: grid;
  align-content: center;
  min-width: 0;
}

.duel-info {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 0;
}

.pokemon-stage {
  position: relative;
  display: block;
  min-height: 0;
  padding: 8px;
  overflow: hidden;
  color: #221713;
  background:
    linear-gradient(rgba(246, 238, 202, 0.18), rgba(28, 21, 16, 0.1)),
    var(--battle-bg, radial-gradient(circle at 55% 30%, #8fae72, #d2c27e 44%, #6d8466 100%));
  background-size: cover;
  background-position: center;
  border: 2px solid var(--line-dark);
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 2px rgba(255, 247, 223, 0.2),
    inset 0 -44px 80px rgba(31, 22, 15, 0.26);
}

.pokemon-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 72% 39%, rgba(255, 247, 223, 0.22), transparent 20%),
    radial-gradient(ellipse at 30% 73%, rgba(255, 247, 223, 0.24), transparent 22%);
  mix-blend-mode: screen;
}

.battle-platform {
  position: absolute;
  z-index: 1;
  height: 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(39, 51, 33, 0.45), rgba(39, 51, 33, 0.2) 46%, transparent 72%);
  filter: blur(0.2px);
}

.enemy-platform {
  top: 40%;
  right: 8%;
  width: 37%;
}

.hero-platform {
  left: 4%;
  bottom: 15%;
  width: 45%;
}

.battle-sprite {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: end center;
  pointer-events: none;
}

.battle-sprite img,
.battle-sprite .entity-art,
.battle-sprite .battle-hero-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 6px 3px rgba(24, 18, 13, 0.36));
}

.battle-sprite .generated {
  display: grid;
  place-items: center;
  color: #fff7df;
  font-family: var(--display-font);
  font-size: 2rem;
  background: linear-gradient(135deg, var(--portrait, #7a8f6b), #211713);
  border: 2px solid rgba(255, 247, 223, 0.65);
  border-radius: 50%;
}

.battle-sprite .missing-battle-art {
  opacity: 0.82;
  border-style: dashed;
}

.enemy-sprite {
  top: 18%;
  right: 10%;
  width: 34%;
  height: 30%;
}

.hero-sprite {
  left: 5%;
  bottom: 19%;
  width: 42%;
  height: 38%;
}

.battle-plate {
  position: absolute;
  z-index: 3;
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 6px 8px;
  color: #211713;
  background: rgba(255, 247, 223, 0.92);
  border: 2px solid rgba(82, 64, 43, 0.78);
  border-radius: 4px 14px 4px 14px;
  box-shadow: 3px 4px 0 rgba(36, 27, 18, 0.26);
  backdrop-filter: blur(4px);
}

.enemy-plate {
  top: 8px;
  left: 9px;
  width: min(54%, 285px);
}

.hero-plate {
  right: 9px;
  bottom: 8px;
  width: min(56%, 300px);
}

.battle-plate-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
}

.battle-plate-title strong {
  min-width: 0;
  overflow: hidden;
  font-family: var(--display-font);
  font-size: clamp(0.92rem, 0.88rem + 0.7vw, 1.08rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-plate-title span {
  flex: 0 0 auto;
  color: #6c5a48;
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.battle-plate .tiny-meter {
  gap: 3px;
  grid-template-columns: 22px 46px minmax(44px, 1fr);
  font-size: 0.64rem;
}

.battle-plate .tiny-meter strong {
  font-size: 0.62rem;
}

.battle-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  margin-top: 2px;
}

.battle-stat-strip span {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 3px 2px;
  background: rgba(232, 211, 153, 0.46);
  border: 1px solid rgba(82, 64, 43, 0.28);
  border-radius: 4px;
}

.battle-stat-strip b,
.battle-stat-strip strong {
  line-height: 1;
}

.battle-stat-strip b {
  color: #6c5a48;
  font-size: 0.52rem;
  text-transform: uppercase;
}

.battle-stat-strip strong {
  font-size: 0.72rem;
}

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

.slash {
  position: absolute;
  z-index: 5;
  width: 30%;
  height: 18%;
  pointer-events: none;
  opacity: 0;
}

.slash::before,
.slash::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: 45%;
  height: 8px;
  background: linear-gradient(90deg, transparent, #fff7df 18%, #f4d35e 52%, transparent);
  border-radius: 999px;
  box-shadow: 0 0 14px rgba(255, 247, 223, 0.8);
  transform: rotate(-32deg);
}

.slash::after {
  height: 4px;
  opacity: 0.86;
  transform: rotate(-20deg) translateY(12px);
}

.slash-enemy-hit {
  top: 22%;
  right: 11%;
}

.slash-hero-hit {
  left: 8%;
  bottom: 25%;
}

.slash-enemy .slash-enemy-hit,
.slash-hero .slash-hero-hit {
  animation: slash-hit 0.48s ease-out;
}

@keyframes slash-hit {
  0% {
    opacity: 0;
    transform: translate(-16px, 16px) scale(0.72);
  }
  32% {
    opacity: 1;
    transform: translate(0, 0) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: translate(18px, -14px) scale(1.24);
  }
}

.enemy-duel-info {
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: center;
}

.hero-duel-info {
  grid-template-rows: auto auto auto auto;
  align-content: center;
}

.hero-duel-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  min-width: 0;
}

.combat-tools {
  display: grid;
  gap: 4px;
  min-width: 44px;
}

.combat-tools .tiny {
  width: 100%;
  min-height: 24px;
  padding: 3px 5px;
  font-size: 0.6rem;
}

.duel-copy .eyebrow {
  margin-bottom: 4px;
}

.duel-copy h2 {
  margin: 0 0 4px;
  overflow: hidden;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-size: clamp(1rem, 4vw, 1.32rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.duel-copy p:last-child {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.duel-meters {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
}

.duel-meters .tiny-meter {
  grid-template-columns: 20px minmax(0, 1fr) 38px;
  gap: 3px 4px;
  font-size: 0.58rem;
}

.duel-meters .tiny-meter strong {
  grid-column: 3;
  grid-row: 1;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
}

.duel-meters .tiny-meter i {
  grid-column: 2;
  grid-row: 1;
  height: 5px;
}

.duel-stat-grid {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.primary-duel-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.duel-stat-chip {
  position: relative;
  display: grid;
  gap: 1px;
  min-width: 0;
  min-height: 24px;
  padding: 2px 3px;
  overflow: hidden;
  color: #2d2117;
  background: rgba(255, 247, 223, 0.78);
  border: 1px solid rgba(198, 173, 120, 0.56);
  border-radius: 5px;
  font-size: 0.55rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

.duel-stat-chip span,
.duel-stat-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
}

.duel-stat-chip span {
  color: var(--muted);
}

.duel-stat-chip:focus-visible {
  overflow: visible;
  z-index: 8;
  outline: 2px solid rgba(194, 147, 57, 0.42);
}

.duel-stat-chip:hover::after,
.duel-stat-chip:focus-visible::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 20;
  width: min(180px, 62vw);
  padding: 6px 7px;
  color: #fff7df;
  background: rgba(36, 25, 20, 0.96);
  border: 1px solid rgba(255, 247, 223, 0.32);
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(8, 6, 4, 0.35);
  content: attr(data-tooltip);
  font-size: 0.64rem;
  line-height: 1.2;
  white-space: normal;
}

.duel-state-note {
  align-self: center;
  justify-self: end;
  padding: 5px 6px;
  color: #fff7df;
  background: rgba(255, 247, 223, 0.12);
  border: 1px solid rgba(255, 247, 223, 0.2);
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.encounter-art-cell {
  display: grid;
  min-width: 0;
  place-items: center;
}

.encounter-copy {
  min-width: 0;
}

.encounter-copy h2 {
  margin: 0 0 5px;
  font-family: Georgia, "Times New Roman", ui-serif, serif;
  font-size: clamp(1.22rem, 4.6vw, 1.55rem);
  line-height: 1;
}

.encounter-copy p:last-child {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.26;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.entity-art {
  display: grid;
  width: min(100%, 238px);
  height: min(100%, 238px);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  object-fit: contain;
  border-radius: 8px;
}

.entity-art.generated {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.55);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 900;
}

.encounter-hud {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.combat-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 7px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--parchment-shadow);
}

.combat-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 0.72rem;
}

.combat-card-title strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combat-card-title span {
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

.tiny-meter {
  display: grid;
  grid-template-columns: 26px 44px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 850;
}

.tiny-meter span,
.tiny-meter strong {
  white-space: nowrap;
}

.tiny-meter strong {
  color: var(--muted);
  text-align: right;
}

.tiny-meter i {
  height: 6px;
  overflow: hidden;
  background: #e6e5d8;
  border-radius: 999px;
}

.tiny-meter b {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--moss-2), var(--gold));
}

.encounter-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.stat-chip {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 28px;
  padding: 4px 5px;
  overflow: hidden;
  color: #4b341d;
  background: rgba(255, 247, 223, 0.78);
  border: 1px solid rgba(198, 173, 120, 0.62);
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 850;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-chip span {
  color: var(--muted);
}

.stat-chip:focus-visible {
  overflow: visible;
  z-index: 5;
  outline: 2px solid rgba(194, 147, 57, 0.42);
  outline-offset: 1px;
}

.stat-chip:hover::after,
.stat-chip:focus-visible::after {
  position: absolute;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 10;
  width: min(190px, 62vw);
  padding: 6px 7px;
  color: #fff7df;
  background: rgba(36, 25, 20, 0.96);
  border: 1px solid rgba(255, 247, 223, 0.32);
  border-radius: 6px;
  box-shadow: 0 10px 20px rgba(8, 6, 4, 0.35);
  content: attr(data-tooltip);
  font-size: 0.66rem;
  line-height: 1.2;
  white-space: normal;
}

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

.action-panel button {
  display: grid;
  gap: 2px;
  min-height: 42px;
  padding: 5px;
  line-height: 1.08;
  border-radius: 8px;
}

.action-panel small {
  font-size: 0.62rem;
  opacity: 0.78;
}

.log-panel {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  max-height: 64px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.log-panel::-webkit-scrollbar {
  display: none;
}

.log-panel p {
  margin: 0;
  padding: 5px 7px;
  overflow-wrap: anywhere;
  color: #344139;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.7rem;
  line-height: 1.22;
  text-overflow: ellipsis;
}

.log-panel p.is-current {
  color: #261b13;
  background: rgba(255, 247, 223, 0.88);
  border-color: #b99249;
  font-weight: 760;
}

.log-panel p.is-empty {
  color: rgba(77, 62, 48, 0.68);
  background: rgba(255, 247, 223, 0.36);
  border-style: dashed;
  font-style: italic;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  background: rgba(17, 26, 23, 0.54);
}

.result-sheet,
.json-sheet {
  width: 100%;
  max-height: calc(var(--app-height) - 18px);
  margin: 0 auto;
  overflow: auto;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow);
}

.result-sheet {
  border-top: 2px solid var(--line-dark);
}

.reward-hero {
  display: grid;
  gap: 4px;
  padding: 11px;
  margin-bottom: 8px;
  color: #fff7df;
  background: linear-gradient(145deg, rgba(58, 45, 33, 0.96), rgba(27, 39, 34, 0.96));
  border: 1px solid rgba(239, 209, 130, 0.45);
  border-radius: 8px;
}

.reward-hero h2 {
  font-size: clamp(1.18rem, 6vw, 1.7rem);
  line-height: 1;
}

.reward-hero h2,
.reward-hero p {
  margin: 0;
}

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

.reward-grid span,
.simulator-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px;
  color: #2b2018;
  background: #fff8df;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 850;
}

.reward-grid strong,
.simulator-grid strong {
  color: var(--muted);
  font-size: 0.58rem;
  text-transform: uppercase;
}

.xp-ceremony {
  display: grid;
  gap: 5px;
  margin: 8px 0;
}

.loot-ceremony {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.loot-ceremony h3 {
  margin: 0;
  font-size: 0.9rem;
}

.loot-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 8px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-left: 5px solid var(--rarity, #9a9788);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rarity, #9a9788) 24%, transparent);
}

.loot-card strong,
.loot-card p,
.loot-card small {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
}

.loot-card p,
.loot-card small {
  color: var(--muted);
  font-size: 0.68rem;
}

.item-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  object-fit: contain;
  background: rgba(255, 247, 223, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-icon.generated span {
  color: var(--moss);
  font-weight: 950;
}

.next-prompt {
  margin: 8px 0;
  padding: 8px;
  color: #2d251d;
  background: #f5e7b4;
  border: 1px solid #b78c32;
  border-radius: 8px;
  font-weight: 850;
  line-height: 1.25;
}

.audio-sheet-backdrop {
  z-index: 70;
}

.audio-control-sheet {
  display: grid;
  gap: 10px;
  max-height: 260px;
}

.audio-toggle-row,
.checkbox-row {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #3d2b1b;
  font-weight: 850;
}

.audio-toggle-row input,
.checkbox-row input {
  width: auto;
}

.install-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-color: #d7a946;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 235, 155, 0.42), transparent 34%),
    var(--panel);
}

.install-card h2,
.install-card p {
  margin: 0;
}

.install-card p:not(.eyebrow) {
  font-size: 0.78rem;
}

.install-guide {
  display: grid;
  gap: 5px;
  margin-top: 8px;
}

.install-guide p {
  display: grid;
  gap: 2px;
  padding: 6px 7px;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.72);
  border-radius: 6px;
}

.install-guide strong {
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 950;
}

.install-guide span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  line-height: 1.18;
}

.install-actions {
  display: grid;
  gap: 6px;
  min-width: 104px;
}

.condition-list {
  display: grid;
  gap: 7px;
}

.condition-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: rgba(255, 253, 242, 0.7);
  border: 1px solid rgba(190, 155, 91, 0.54);
  border-radius: 8px;
}

.condition-row.is-rest {
  background:
    linear-gradient(180deg, rgba(255, 239, 180, 0.68), rgba(255, 253, 242, 0.74));
}

.condition-row strong,
.condition-row p {
  margin: 0;
}

.condition-row p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.tutorial-card {
  position: fixed;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  left: 8px;
  z-index: 55;
  display: grid;
  gap: 8px;
  width: min(calc(100% - 16px), var(--app-width));
  max-width: calc(var(--app-width) - 16px);
  margin: 0 auto;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    #ffe3a4;
  border: 2px solid #6f4b22;
  border-radius: 8px;
  outline: 999px solid rgba(21, 15, 10, 0.18);
  box-shadow: 0 16px 40px rgba(29, 19, 9, 0.34), 0 0 0 3px rgba(255, 242, 187, 0.72), var(--parchment-shadow);
}

.tutorial-card .eyebrow {
  display: inline-flex;
  width: max-content;
  padding: 3px 6px;
  color: #fff7df;
  background: #5f3e1d;
  border-radius: 4px;
}

.app.has-bottom-bar .tutorial-card {
  bottom: calc(var(--bottom-bar-height) + 8px);
}

.tutorial-card h2,
.tutorial-card p {
  margin: 0;
}

.tutorial-card h2 {
  font-size: 1rem;
  line-height: 1.05;
}

.tutorial-card p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.28;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 7px;
}

.combat-sheet-backdrop {
  z-index: 60;
}

.combat-sheet {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  max-height: min(calc(var(--app-height) - 24px), 620px);
}

.combat-sheet h2 {
  margin: 0;
  font-size: 1.15rem;
}

.combat-sheet-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.combat-sheet-body::-webkit-scrollbar {
  display: none;
}

.combat-equipment-grid {
  margin-top: 0;
}

.combat-item-row .item-actions {
  justify-content: flex-end;
}

.json-sheet {
  display: grid;
  gap: 9px;
}

.form-sheet {
  align-content: start;
}

.editor-toolbar {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.editor-section {
  display: grid;
  gap: 8px;
  padding: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent),
    #f5e8c5;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--parchment-shadow);
}

.editor-section h3 {
  margin: 0;
}

.sub-section {
  margin-top: 8px;
}

.form-grid,
.number-grid {
  display: grid;
  gap: 8px;
}

.editor-stack {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.visual-editor-grid {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

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

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

.race-sex-preview-grid article {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.race-sex-preview-grid article > span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.race-sex-preview-grid .linked-upload {
  display: grid;
  gap: 5px;
}

.race-sex-preview-grid .linked-upload .compact {
  width: 100%;
  font-size: 0.66rem;
}

.content-thumb {
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.32), transparent 20%),
    linear-gradient(145deg, var(--thumb, #7a8f6b), #28332d);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
}

.content-thumb.small {
  width: 46px;
  height: 46px;
}

.content-thumb.large {
  width: 76px;
  height: 76px;
}

.content-thumb.is-empty {
  background: #eee8d7;
}

.form-field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.form-field > span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.form-field small {
  color: var(--muted);
  line-height: 1.3;
}

.nested-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.roster-card,
.interaction-card {
  background: #fff4d2;
}

.roster-card {
  border-color: #b58d45;
}

.interaction-card {
  border-color: #9aae86;
}

.compact-section {
  gap: 7px;
  padding: 8px;
}

.base-summary {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  padding: 7px;
  background: rgba(255, 247, 223, 0.66);
  border: 1px solid rgba(198, 173, 120, 0.65);
  border-radius: 6px;
}

.base-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

.compare-grid {
  display: grid;
  grid-template-columns: minmax(78px, 0.86fr) minmax(54px, 0.56fr) minmax(82px, 0.82fr);
  gap: 5px;
  align-items: center;
}

.compare-head,
.compare-label,
.base-value {
  min-width: 0;
  padding: 5px 6px;
  overflow: hidden;
  border-radius: 5px;
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-head {
  color: #fff5df;
  background: var(--moss);
  font-weight: 900;
  text-transform: uppercase;
}

.compare-label {
  color: var(--muted);
  background: rgba(255, 247, 223, 0.46);
  font-weight: 850;
}

.base-value {
  color: #4b341d;
  background: rgba(255, 247, 223, 0.82);
  border: 1px solid rgba(198, 173, 120, 0.54);
  font-weight: 850;
}

.table-editor-section {
  min-width: 0;
}

.table-row-editor {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.data-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 7px;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.68);
  border-radius: 6px;
}

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

.loot-data-row .danger-button,
.ability-data-row .danger-button,
.stock-data-row .danger-button,
.reward-data-row .danger-button,
.entry-data-row .danger-button,
.gacha-entry-row .danger-button,
.gacha-pool-row > .danger-button {
  justify-self: end;
  align-self: end;
}

.line-data-row {
  grid-template-columns: 74px minmax(0, 1fr) auto;
  align-items: end;
}

.ability-data-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stock-data-row,
.reward-data-row,
.entry-data-row {
  grid-template-columns: minmax(0, 1fr) 82px 92px auto;
  align-items: end;
}

.reward-data-row {
  grid-template-columns: minmax(0, 1fr) 78px auto;
}

.gacha-pool-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gacha-pool-row .full-row {
  grid-column: 1 / -1;
}

.gacha-entry-row {
  grid-template-columns: minmax(0, 1fr) 64px 64px 64px minmax(92px, 0.8fr) 86px auto;
  align-items: end;
}

@media (max-width: 560px) {
  .gacha-entry-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 8px;
  background: #fff7df;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

.checkbox-line span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.formula-readout {
  display: grid;
  gap: 6px;
  padding: 9px;
  margin-top: 8px;
  background: #fff1c6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.formula-readout h3,
.formula-readout p {
  margin: 0;
}

.formula-readout p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.38;
}

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

.linked-upload {
  display: flex;
  justify-content: flex-start;
}

.json-editor {
  min-height: min(48svh, 420px);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
}

.json-editor.short {
  min-height: 260px;
}

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

.equipment-slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  align-items: start;
}

.equipment-slot span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 850;
  text-transform: uppercase;
}

.equipment-slot strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.equipment-mods {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.24;
}

.equipment-slot.is-open {
  grid-column: 1 / -1;
}

.slot-options {
  display: grid;
  grid-column: 1 / -1;
  gap: 6px;
  margin-top: 6px;
}

.slot-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 7px;
  background: #f6f3e7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.slot-option p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

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

.stat-columns article {
  padding: 8px;
  background: #f8f6ec;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-columns h3 {
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.stat-lines {
  display: grid;
  gap: 4px;
}

.stat-line {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 5px;
  background: #fffefa;
  border-radius: 6px;
  font-size: 0.7rem;
}

.stat-line span {
  color: var(--muted);
  font-weight: 850;
}

.stat-line strong {
  white-space: nowrap;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  padding: 8px;
  margin-top: 6px;
}

.rarity-row {
  border-left: 4px solid var(--rarity, #9a9788);
  background: linear-gradient(90deg, color-mix(in srgb, var(--rarity, #9a9788) 14%, transparent), transparent 45%);
}

.item-row p {
  margin-bottom: 0;
  font-size: 0.74rem;
}

.material-inventory-list {
  display: grid;
  gap: 7px;
}

.material-row {
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  margin-top: 0;
  padding: 8px 10px;
}

.material-row .item-icon {
  width: 42px;
  height: 42px;
  justify-self: center;
}

.material-row > div {
  min-width: 0;
}

.material-row strong,
.material-row p,
.material-row small {
  display: block;
  margin: 0;
  text-align: left;
}

.material-row strong {
  font-size: 0.9rem;
  line-height: 1.08;
}

.material-row p {
  overflow-wrap: anywhere;
  line-height: 1.22;
}

.material-row small {
  font-size: 0.72rem;
  line-height: 1.18;
}

.subheading {
  margin: 10px 0 0;
  color: #39443d;
  font-size: 0.82rem;
}

.goal-row {
  display: block;
  padding: 8px;
  margin-top: 6px;
}

.goal-row-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.goal-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.goal-title-row .tiny {
  min-height: 30px;
  padding: 5px 10px;
  white-space: nowrap;
}

.goal-row.is-done {
  border-color: #b9a25c;
  background: #fff8df;
}

.hero-screen {
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden !important;
}

.levelup-screen {
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden !important;
}

.levelup-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.levelup-hero-panel h2,
.levelup-hero-panel p {
  margin: 0;
}

.levelup-stat-panel {
  display: grid;
  grid-template-rows: minmax(0, auto);
  gap: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.levelup-stat-panel::-webkit-scrollbar {
  display: none;
}

.levelup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  min-height: 0;
  align-content: start;
}

.levelup-stat-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  gap: 5px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 251, 235, 0.86);
}

.levelup-stat-card .stat-step-button {
  display: grid;
  width: 34px;
  min-width: 34px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  border-radius: 7px;
  font-size: 1rem;
  line-height: 1;
}

.levelup-stat-label {
  display: grid;
  gap: 2px;
  min-height: 42px;
  min-width: 0;
  padding: 0;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 0;
  line-height: 1.05;
  text-align: center;
}

.levelup-stat-label small,
.levelup-stat-label strong {
  display: block;
}

.levelup-stat-label small {
  font-size: 0.62rem;
}

.levelup-stat-label strong {
  font-size: 0.9rem;
}

.stat-help-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  min-height: 42px;
  padding: 5px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
}

.stat-help-card strong {
  color: var(--moss);
  font-size: 0.7rem;
  text-align: center;
}

.stat-help-card span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stat-help-line {
  width: 100%;
  border: 0;
  text-align: left;
}

.levelup-footer {
  display: grid;
}

.hero-profile-panel {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 9px;
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 232, 150, 0.34), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent),
    var(--card);
}

.hero-profile-panel p,
.hero-profile-panel h2 {
  margin: 0;
}

.hero-profile-panel h2 {
  font-size: clamp(1.25rem, 6vw, 1.78rem);
  line-height: 0.95;
}

.hero-xp-progress {
  display: grid;
  gap: 3px;
  margin-top: 6px;
  max-width: 100%;
}

.hero-xp-progress small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
}

.accordion-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow: hidden;
}

.hero-accordion {
  display: grid;
  min-height: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-accordion.is-open {
  flex: 1 1 auto;
  grid-template-rows: auto minmax(0, 1fr);
  border-color: rgba(143, 109, 54, 0.82);
  box-shadow: var(--parchment-shadow), 0 2px 0 rgba(74, 49, 23, 0.12);
}

.hero-accordion:not(.is-open) {
  flex: 0 0 auto;
}

.accordion-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fffefa;
  border: 0;
  font-weight: 900;
}

.hero-accordion.is-open .accordion-toggle {
  background: linear-gradient(180deg, #fff7df, #f3e4b5);
}

.accordion-toggle strong {
  color: var(--moss);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.accordion-body {
  min-height: 0;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.accordion-body::-webkit-scrollbar,
.scroll-list::-webkit-scrollbar {
  display: none;
}

.hero-resource-strip {
  margin-top: 0;
}

.shop-screen,
.journal-screen,
.hut-screen {
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden !important;
}

.hut-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, 0.58fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 236, 164, 0.36), transparent 32%),
    var(--card);
}

.hut-header h2,
.hut-header p {
  margin: 0;
}

.hut-header .story-copy {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.75rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.shop-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 8px;
  align-items: start;
  padding: 9px;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 236, 164, 0.36), transparent 32%),
    var(--card);
}

.shop-header h2,
.shop-header p {
  margin: 0;
}

.shop-header .eyebrow,
.shop-header h2,
.shop-header .story-copy {
  grid-column: 1;
}

.shop-header .pill {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
}

.shop-header .story-copy {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.76rem;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.segment-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  min-height: 36px;
}

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

.segment-row.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment-row button {
  color: var(--moss);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
  min-width: 0;
  padding: 5px 6px;
  line-height: 1.08;
}

.segment-row button.is-active {
  color: #fff;
  background: var(--moss);
  border-color: var(--moss);
}

.segment-row button.has-claimable,
.bottom-nav-row button.has-claimable {
  color: #2c2113;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 219, 0.86), transparent 34%),
    linear-gradient(180deg, #f8d878, #c9962e);
  border-color: #f9e6a3;
  box-shadow: 0 0 0 2px rgba(244, 211, 94, 0.28), 0 0 16px rgba(244, 211, 94, 0.62);
}

.segment-row button.has-claimable.is-active {
  color: #241914;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 219, 0.92), transparent 34%),
    linear-gradient(180deg, #ffe69a, #d5a33a);
}

.shop-list-panel,
.journal-list-panel,
.hut-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.reliquary-list {
  gap: 8px;
}

.reliquary-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 90% 0%, rgba(244, 211, 94, 0.2), transparent 34%),
    rgba(255, 251, 235, 0.88);
}

.reliquary-card h3,
.reliquary-card p {
  margin: 0;
}

.reliquary-card p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.reliquary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.forge-layout {
  display: grid;
  grid-template-columns: minmax(104px, 0.42fr) minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.forge-list {
  gap: 6px;
}

.forge-item-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-height: 54px;
  padding: 6px;
  color: var(--ink);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
}

.forge-item-row strong {
  display: block;
  overflow: hidden;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forge-item-row.is-active {
  border-color: var(--moss);
  background: rgba(55, 100, 76, 0.12);
}

.forge-item-row small {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
}

.forge-detail {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.forge-craft-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.forge-craft-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.forge-preview-card {
  display: grid;
  gap: 8px;
}

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

.forge-stat-grid > div,
.forge-costs,
.forge-odds {
  padding: 7px;
  background: rgba(255, 254, 250, 0.84);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.forge-stat-grid p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.22;
}

.forge-costs {
  display: grid;
  gap: 5px;
}

.forge-cost-row,
.forge-odds {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.forge-cost-row.is-missing {
  color: #8d2e24;
}

.forge-catalyst {
  min-height: 34px;
  color: var(--moss);
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.forge-catalyst.is-active {
  color: #241914;
  background: linear-gradient(180deg, #ffe69a, #d5a33a);
  border-color: #b88b2b;
}

.store-product-list {
  gap: 8px;
}

.store-product-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 0.44fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  background:
    radial-gradient(circle at 100% 10%, rgba(244, 211, 94, 0.16), transparent 34%),
    rgba(255, 251, 235, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.store-product-card h3,
.store-product-card p {
  margin: 0;
}

.store-product-card h3 {
  font-size: 1rem;
  line-height: 1;
}

.store-product-card p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.store-product-side {
  display: grid;
  gap: 6px;
  text-align: center;
}

.store-product-side strong {
  color: var(--moss);
  font-size: 0.82rem;
}

.odds-panel {
  font-size: 0.68rem;
}

.odds-panel summary {
  cursor: pointer;
  color: var(--moss);
  font-weight: 900;
}

.odds-grid {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 54px;
  gap: 4px 6px;
  margin-top: 5px;
  align-items: center;
}

.odds-grid strong,
.odds-grid em {
  min-width: 0;
}

.odds-grid em {
  text-align: right;
  font-style: normal;
  font-weight: 900;
}

.rarity-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 3px 5px;
  color: #fff7df;
  background: var(--rarity, #9a9788);
  border: 1px solid rgba(36, 27, 18, 0.28);
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 950;
  text-shadow: 0 1px 0 rgba(36, 27, 18, 0.46);
}

.rarity-immortal.rarity-chip {
  color: #2b2016;
  box-shadow: 0 0 8px rgba(244, 211, 94, 0.75);
  text-shadow: none;
}

.hut-panel {
  display: block;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.hut-panel::-webkit-scrollbar {
  display: none;
}

.hut-storage-grid {
  display: grid;
  gap: 8px;
}

.hut-storage-grid section {
  display: grid;
  gap: 5px;
  min-height: 0;
  padding: 7px;
  background: #fbfaf2;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hut-storage-grid h3 {
  margin: 0;
  font-size: 0.86rem;
}

.hut-list {
  max-height: 178px;
}

.hut-item-row,
.upgrade-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  margin-top: 5px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hut-item-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.hut-item-row p,
.upgrade-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

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

.upgrade-card h3 {
  margin: 0;
}

.notice-list {
  max-height: 170px;
  margin: 8px 0;
}

.notice-list p {
  margin: 0 0 6px;
  padding: 7px;
  background: #f6f3e7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.panel-heading-row h2 {
  margin: 0;
  font-size: 1rem;
}

.scroll-list {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.journal-list .goal-row {
  padding: 7px;
}

.journal-list .goal-row strong,
.history-line {
  font-size: 0.82rem;
}

.journal-list .goal-row p,
.history-line {
  font-size: 0.76rem;
  line-height: 1.3;
}

.history-line {
  margin: 0 0 6px;
  padding: 7px;
  color: #344139;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.journal-subhead {
  margin: 10px 0 4px;
  color: var(--moss);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.omen-card,
.codex-card,
.check-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  margin-bottom: 6px;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.omen-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  background: linear-gradient(145deg, #fff8df, #f2e2ae);
  border-color: #bf9650;
}

.omen-card strong {
  font-size: 1.04rem;
  line-height: 1.05;
}

.omen-card .omen-reward {
  justify-self: start;
  margin-top: 4px;
}

.streak-card {
  display: grid;
  gap: 6px;
  padding: 8px;
  margin-bottom: 6px;
  background: linear-gradient(145deg, #f7f2dd, #edf4d8);
  border: 1px solid rgba(72, 105, 72, 0.4);
  border-radius: 8px;
}

.streak-card strong {
  color: #223929;
}

.streak-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

.streak-claim-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.omen-card strong,
.codex-card strong,
.check-card strong {
  color: #2b2018;
}

.omen-card p,
.codex-card p,
.check-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.28;
}

.timed-goal-row .meter,
.codex-card .meter {
  height: 6px;
}

.codex-list {
  display: block;
}

.deed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
}

.deed-card {
  min-width: 0;
  overflow: hidden;
  background: #fffefa;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.deed-card.is-ready {
  border-color: #d4a437;
  box-shadow: 0 0 14px rgba(245, 205, 91, 0.34);
}

.deed-card.is-claimed {
  opacity: 0.72;
}

.deed-card summary {
  display: grid;
  grid-template-rows: auto minmax(26px, 1fr) auto auto;
  gap: 4px;
  min-height: 96px;
  padding: 7px;
  cursor: pointer;
  list-style: none;
  text-align: center;
}

.deed-card[open] {
  grid-column: span 2;
}

.deed-card summary::-webkit-details-marker {
  display: none;
}

.deed-medal {
  display: grid;
  width: 26px;
  height: 26px;
  margin: 0 auto;
  place-items: center;
  color: #2c2118;
  background: linear-gradient(180deg, #ffe49a, #c99635);
  border: 1px solid #a9822e;
  border-radius: 999px;
  font-weight: 950;
}

.deed-card strong {
  display: -webkit-box;
  overflow: hidden;
  color: #2b2018;
  font-size: 0.64rem;
  line-height: 1.1;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deed-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 850;
}

.deed-card .meter {
  height: 5px;
}

.deed-detail {
  display: grid;
  gap: 5px;
  padding: 0 7px 7px;
  border-top: 1px solid rgba(116, 91, 63, 0.16);
}

.deed-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.25;
}

@media (min-width: 390px) {
  .deed-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.checklist-grid {
  display: grid;
  gap: 7px;
}

.check-card.is-ok {
  border-color: rgba(74, 116, 80, 0.45);
  background: #f3f7e8;
}

.check-card.is-issue {
  border-color: rgba(178, 92, 65, 0.45);
  background: #fff1e8;
}

.bottom-bar {
  position: absolute;
  right: auto;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 31px;
  gap: 3px;
  width: 100%;
  margin: 0 auto;
  height: var(--bottom-bar-height);
  min-height: var(--bottom-bar-height);
  padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  background: rgba(17, 26, 23, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(14px);
}

.bottom-bar button {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 7px;
  font-size: 0.62rem;
  font-weight: 850;
  text-align: center;
}

.bottom-bar button {
  border: 0;
}

.bottom-status {
  display: grid;
  grid-template-columns: minmax(172px, 1.28fr) minmax(120px, 0.72fr);
  gap: 4px;
  min-height: 0;
}

.bottom-status small {
  font-size: 0.54rem;
  opacity: 0.82;
}

.resource-button {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 4px;
}

.hero-status-label {
  display: grid;
  place-items: center;
  align-self: center;
  height: 30px;
  min-height: 30px;
  padding: 0 7px;
  color: #281d14;
  background: linear-gradient(180deg, #f5dc91, #c89b3f);
  border: 1px solid rgba(255, 240, 183, 0.7);
  border-radius: 6px;
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.hero-status-meters {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status-meter {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 32px;
  gap: 4px;
  align-items: center;
  width: 100%;
  font-size: 0.54rem;
}

.status-meter b,
.status-meter strong {
  white-space: nowrap;
}

.status-meter i {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.status-meter em {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--moss-2), var(--gold));
}

.wallet-button {
  grid-template-columns: minmax(76px, 0.9fr) minmax(82px, 1fr);
  gap: 1px 6px;
  align-content: center;
  padding: 4px 6px;
  line-height: 1.05;
  text-align: left;
}

.wallet-button > span,
.wallet-button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-button small,
.status-chip-row {
  grid-column: 1 / -1;
}

.wallet-currency {
  line-height: 1.1;
}

.status-chip-row {
  display: flex;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  padding: 2px 5px;
  color: #fff6dd;
  background: rgba(93, 66, 43, 0.82);
  border: 1px solid rgba(245, 219, 151, 0.34);
  border-radius: 999px;
  font-size: 0.5rem;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip.is-rest {
  color: #271c12;
  background: linear-gradient(180deg, #f5dc91, #c89b3f);
  border-color: #fff0b7;
}

.bottom-nav-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  min-height: 0;
}

.bottom-nav-row button {
  min-height: 34px;
}

.bottom-nav-row button.is-active {
  color: #241914;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 222, 0.74), transparent 34%),
    linear-gradient(180deg, #f4d35e, #c29339);
  box-shadow: 0 0 14px rgba(244, 211, 94, 0.42), inset 0 1px 0 rgba(255, 247, 223, 0.5);
}

.bottom-nav-row button.has-claimable:not(.is-active) {
  animation: claim-lamp 1.9s ease-in-out infinite;
}

@keyframes claim-lamp {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.14); }
}

.tab-row {
  display: flex;
  gap: 5px;
  min-height: 0;
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.tab-row::-webkit-scrollbar,
.console-groups::-webkit-scrollbar {
  display: none;
}

.tab-row button,
.console-groups button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 5px 7px;
  color: var(--moss);
  background: #fffefa;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 850;
}

.tab-row button.is-active,
.console-groups button.is-active {
  color: #fff;
  background: var(--moss);
  border-color: var(--moss);
}

.console-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
}

.console-groups {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.console-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 7px;
  margin-top: 5px;
}

.console-row > div,
.console-row strong {
  min-width: 0;
}

.console-row .item-actions {
  grid-column: 1 / -1;
}

.console-row p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: 0.66rem;
  line-height: 1.24;
}

.console-row strong {
  display: block;
  line-height: 1.08;
}

.item-audit-row {
  grid-template-columns: 40px minmax(0, 1fr) auto;
}

.item-audit-row .pill {
  white-space: nowrap;
}

.danger-pill {
  color: #fff;
  background: #8d2e24;
  border-color: #8d2e24;
}

.console-screen {
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 5px;
  padding: 6px;
  max-width: 100%;
  overflow: hidden;
}

.console-body {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.console-body::-webkit-scrollbar {
  display: none;
}

.console-body > .panel {
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

.console-body:has(.asset-queue-workbench) {
  align-content: stretch;
  overflow: hidden;
}

.console-body > .console-layout {
  height: 100%;
  min-height: 0;
}

.console-screen > .panel:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 7px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent),
    #fff4d3;
}

.console-screen > .panel:first-child h2 {
  margin-bottom: 2px;
  font-size: 0.82rem;
  line-height: 1.05;
}

.console-screen > .panel:first-child .story-copy {
  display: none;
}

.console-builder-banner {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  min-height: 0;
}

.console-builder-banner .eyebrow,
.console-builder-banner h2 {
  margin: 0;
  line-height: 1;
}

.console-builder-banner h2 {
  overflow: hidden;
  font-size: 0.78rem !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-builder-banner .ghost-button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.68rem;
}

.console-layout > .panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.console-layout > .panel h2 {
  font-size: 1.18rem;
  line-height: 1;
}

.console-layout > .panel .story-copy {
  font-size: 0.7rem;
  line-height: 1.26;
}

.console-layout > .panel > .split-row {
  min-height: 0;
}

.mechanics-panel {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.mechanics-panel::-webkit-scrollbar {
  display: none;
}

.spec-grid,
.asset-grid,
.mechanics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.spec-card,
.asset-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 7px;
  font-size: 0.72rem;
}

.spec-card p,
.asset-card p {
  margin: 0;
  font-size: 0.66rem;
  line-height: 1.24;
}

.spec-card span {
  color: var(--moss);
  font-weight: 850;
}

.asset-card img,
.audio-tile {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #e6e5d8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.audio-tile {
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.asset-url-grid {
  display: grid;
  gap: 8px;
}

.audio-slot-row {
  display: grid;
  gap: 6px;
  padding: 7px;
  margin-top: 6px;
}

.issue,
.success {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
}

.issue {
  color: #fff;
  background: var(--red);
}

.success {
  color: #17331f;
  background: #ddefd9;
}

.asset-spec-scroll {
  max-height: min(30vh, 220px);
  padding-right: 2px;
  overflow: auto;
  overscroll-behavior: contain;
}

.asset-production-panel {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.asset-queue-workbench {
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden !important;
}

.asset-queue-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.asset-queue-header h2,
.asset-queue-header p {
  margin: 0;
}

.asset-queue-header .story-copy {
  font-size: 0.68rem;
  line-height: 1.24;
}

.asset-queue-title-row {
  margin-bottom: 0;
}

.console-details {
  min-height: 0;
  background: rgba(255, 247, 223, 0.54);
  border: 1px solid rgba(198, 173, 120, 0.62);
  border-radius: 7px;
}

.console-details summary {
  cursor: pointer;
  padding: 7px 8px;
  color: var(--moss);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.console-details > :not(summary) {
  margin: 0 7px 7px;
}

.prompt-details[open] {
  max-height: min(32vh, 260px);
  overflow: auto;
  overscroll-behavior: contain;
}

.missing-assets-panel {
  grid-template-rows: auto minmax(0, 1fr);
  min-height: min(42vh, 280px);
}

.missing-asset-list,
.prompt-template-list {
  display: grid;
  gap: 7px;
  min-height: 0;
}

.asset-queue-list {
  align-content: start;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.missing-asset-row,
.prompt-card,
.copy-box {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  background: rgba(255, 247, 223, 0.72);
  border: 1px solid rgba(198, 173, 120, 0.7);
  border-radius: 7px;
}

.missing-asset-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.asset-filter-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}

.asset-filter-row button {
  min-height: 28px;
  padding: 4px 3px;
  font-size: 0.58rem;
  line-height: 1.05;
}

.asset-search-row {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.asset-search-row span {
  color: var(--moss);
  font-size: 0.66rem;
  font-weight: 950;
  text-transform: uppercase;
}

.asset-search-row input {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 0.78rem;
}

.asset-queue-row {
  grid-template-columns: 50px minmax(0, 1fr);
}

.asset-queue-row .asset-queue-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 6px;
  flex-wrap: wrap;
}

.asset-queue-row.is-linked {
  background: rgba(221, 239, 217, 0.72);
}

.asset-queue-row .content-thumb.small {
  width: 48px;
  height: 48px;
}

.reaction-rule-section,
.reaction-override-section {
  display: grid;
  gap: 8px;
}

.reaction-rule-card {
  display: grid;
  gap: 8px;
}

.missing-asset-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
}

.prompt-card textarea {
  min-height: 118px;
  font-size: 0.72rem;
  line-height: 1.36;
}

.copy-box code {
  display: block;
  min-width: 0;
  padding: 6px 7px;
  overflow-wrap: anywhere;
  color: #392817;
  background: #fff7df;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.68rem;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(var(--bottom-bar-height) + 8px);
  left: 16px;
  z-index: 80;
  display: none;
  width: min(calc(100% - 32px), 508px);
  margin: 0 auto;
  padding: 12px 14px;
  color: #fff;
  background: rgba(17, 26, 23, 0.96);
  border-radius: 8px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.toast.is-visible {
  display: block;
}

@media (max-height: 720px) and (max-width: 759px) {
  :root {
    --topbar-base-height: 38px;
    --bottom-bar-base-height: 79px;
    --ui-gap: 5px;
    --ui-pad: 6px;
    --map-min-size: 178px;
    --map-intro-reserve: 62px;
    --map-detail-reserve: 96px;
    --map-gap-reserve: 10px;
  }

  .screen {
    gap: 5px;
    padding: 5px;
  }

  .app.has-bottom-bar .screen {
    padding-bottom: 5px;
  }

  .install-card {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .install-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .topbar {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 4px;
    padding: calc(3px + env(safe-area-inset-top)) 5px 3px;
  }

  .topbar-spacer,
  .icon-button {
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
  }

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

  .brand h1 {
    font-size: 0.9rem;
  }

  .map-screen,
  .encounter-screen {
    gap: 4px;
  }

  .create-screen {
    gap: 4px;
    padding: 4px 5px 5px;
  }

  .create-summary {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 5px;
    padding: 5px;
  }

  .create-summary .portrait.small {
    width: 36px;
    height: 36px;
  }

  .create-summary h2 {
    font-size: 1.05rem;
  }

  .create-summary p {
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .create-summary-stats {
    gap: 3px;
  }

  .create-summary-stats span {
    min-height: 24px;
    padding: 3px;
    font-size: 0.58rem;
  }

  .create-stepper {
    min-height: 32px;
  }

  .create-stepper button {
    min-height: 32px;
    padding: 3px;
    font-size: 0.52rem;
  }

  .create-stepper span {
    width: 15px;
    height: 15px;
    font-size: 0.56rem;
  }

  .create-step-panel {
    gap: 6px;
    padding: 7px;
  }

  .review-name-block h2 {
    font-size: 1.06rem;
  }

  .review-name-block input {
    min-height: 38px;
  }

  .review-step-panel .create-feature-preview.review {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .review-step-panel .create-feature-preview.review .portrait.large {
    width: 42px;
    height: 42px;
  }

  .review-step-panel .stat-lines span {
    min-height: 21px;
    font-size: 0.64rem;
  }

  .race-step-panel .create-feature-preview {
    grid-template-columns: minmax(92px, 38%) minmax(0, 62%);
    gap: 7px;
  }

  .race-step-panel .create-feature-preview .portrait.large {
    height: clamp(112px, 24vh, 150px);
    min-height: 108px;
  }

  .race-step-panel .create-feature-preview h2 {
    font-size: 1.08rem;
  }

  .race-step-panel .create-feature-preview .story-copy,
  .race-choice-button small,
  .class-choice-button span {
    font-size: 0.64rem;
    line-height: 1.18;
  }

  .race-step-panel .create-feature-preview .fine,
  .trait-row span,
  .race-choice-button em {
    font-size: 0.56rem;
  }

  .sex-choice-grid {
    gap: 4px;
    margin-top: 5px;
  }

  .compact-choices .choice-button {
    min-height: 34px;
    padding: 4px 5px;
  }

  .race-choice-grid,
  .class-choice-grid {
    gap: 4px;
  }

  .race-choice-button {
    min-height: 58px;
    padding: 6px;
  }

  .class-choice-button {
    padding: 7px;
  }

  .class-choice-button strong {
    font-size: 0.95rem;
  }

  .create-footer {
    gap: 5px;
  }

  .create-footer button {
    min-height: 38px;
    padding: 7px;
  }

  .encounter-notice {
    padding: 5px 6px;
  }

  .encounter-notice p {
    max-height: 42px;
    font-size: 0.68rem;
    line-height: 1.14;
    -webkit-line-clamp: 3;
  }

  .map-intro {
    gap: 3px;
    padding: 5px 6px;
  }

  .map-intro-row h2 {
    font-size: 1.05rem;
  }

  .map-intro .story-copy {
    max-height: 30px;
    font-size: 0.66rem;
  }

  .map-panel {
    width: var(--map-size);
    height: var(--map-size);
    justify-self: center;
  }

  .placement-map.map-panel {
    width: min(100%, 390px);
    height: auto;
  }

  .selected-location-card {
    gap: 5px;
    padding: 7px;
  }

  .selected-location-card h3 {
    font-size: 0.94rem;
  }

  .selected-location-card p {
    font-size: 0.68rem;
    line-height: 1.14;
    -webkit-line-clamp: 1;
  }

  .selected-location-card .fine {
    display: none;
  }

  .selected-location-card .split-row,
  .selected-location-card .split-row .secondary-button {
    min-height: 31px;
  }

  .encounter-screen {
    grid-template-rows: auto minmax(0, 1fr) auto minmax(48px, 68px);
    padding: 4px 5px 5px;
  }

  .encounter-visual,
  .duel-card {
    gap: 4px;
    padding: 4px;
  }

  .duel-copy h2 {
    font-size: 1rem;
  }

  .duel-copy p:last-child {
    font-size: 0.66rem;
    -webkit-line-clamp: 2;
  }

  .duel-stat-chip {
    min-height: 21px;
    padding: 2px;
    font-size: 0.5rem;
  }

  .action-panel {
    gap: 4px;
  }

  .action-panel button {
    min-height: 38px;
    padding: 4px;
  }

  .bottom-bar {
    grid-template-rows: minmax(0, 1fr) 29px;
    gap: 2px;
    padding: 4px 5px calc(4px + env(safe-area-inset-bottom));
  }

  .bottom-status {
    grid-template-columns: minmax(166px, 1.28fr) minmax(116px, 0.72fr);
    gap: 3px;
  }

  .resource-button {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 4px;
  }

  .hero-status-label {
    height: 28px;
    min-height: 28px;
    padding: 0 5px;
    font-size: 0.54rem;
  }

  .status-meter {
    grid-template-columns: 17px minmax(0, 1fr) 30px;
    gap: 3px;
  }

  .levelup-grid {
    gap: 4px;
  }

  .levelup-stat-card {
    grid-template-columns: 30px minmax(0, 1fr) 30px;
    min-height: 50px;
    padding: 3px;
  }

  .levelup-stat-card .stat-step-button {
    width: 30px;
    min-width: 30px;
    height: 36px;
    min-height: 36px;
  }

  .levelup-stat-label {
    min-height: 36px;
  }

  .bottom-nav-row button {
    min-height: 29px;
  }
}

@media (min-width: 760px) {
  :root {
    --app-frame-width: min(100vw, var(--app-width));
  }

  body {
    padding: 0;
    place-items: center;
  }

  .app {
    width: min(100vw, var(--app-width));
    height: var(--desktop-app-height);
    min-height: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
  }

  .bottom-bar {
    bottom: 0;
    border-radius: 0 0 8px 8px;
  }

  .result-sheet,
  .json-sheet {
    width: min(100%, var(--app-width));
  }

  .console-layout {
    grid-template-columns: none;
  }

  .console-groups {
    display: flex;
    overflow-x: auto;
  }

  .spec-grid,
  .asset-grid,
  .mechanics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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