:root {
  --ink: #22192f;
  --paper: #fff8df;
  --panel: #fff2bd;
  --panel-2: #fef0ff;
  --line: #2b2240;
  --shadow: #59406f;
  --hot: #ff5f7e;
  --orange: #ff9f1c;
  --sun: #ffd84d;
  --mint: #39d98a;
  --aqua: #21c7d9;
  --blue: #4b7bec;
  --violet: #915eff;
  --pink: #ff82c8;
  --good: #2fbd7f;
  --bad: #f04f78;
  --warn: #ffb000;
  --radius: 8px;
  --pixel-shadow: 0 5px 0 var(--line), 0 10px 0 rgba(35, 25, 47, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.modal-backdrop[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Courier New", "Noto Sans SC", monospace;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.22) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(135deg, #ffe66d 0%, #ff9f6e 26%, #75e6da 52%, #a88bff 78%, #ff8ac7 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  overflow-x: hidden;
}

button {
  font-family: inherit;
}

.app-shell {
  width: min(1440px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.pixel-panel {
  position: relative;
  border: 4px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--pixel-shadow);
}

.hero-panel {
  min-height: 292px;
  overflow: hidden;
  background: #1b1f4f;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: auto;
}

.hero-overlay {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
  min-height: 292px;
  padding: clamp(18px, 3vw, 34px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fffbea;
  text-shadow: 0 3px 0 var(--line), 2px 2px 0 var(--line);
  background:
    linear-gradient(90deg, rgba(34, 25, 47, 0.88) 0%, rgba(34, 25, 47, 0.62) 58%, rgba(34, 25, 47, 0) 100%);
}

.kicker {
  width: fit-content;
  margin: 0 0 10px;
  padding: 6px 9px;
  color: var(--line);
  text-shadow: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  background: var(--sun);
  border: 3px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
}

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

h1 {
  margin-bottom: 6px;
  font-size: clamp(34px, 7vw, 62px);
  line-height: 1;
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 12px;
  color: #ffe66d;
  font-size: clamp(20px, 4vw, 34px);
  font-weight: 900;
}

.hero-copy {
  max-width: 560px;
  margin-bottom: 14px;
  font-size: 17px;
  line-height: 1.8;
}

.hero-actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.layout-toggle {
  display: inline-flex;
  width: fit-content;
  margin-top: 12px;
  padding: 3px;
  gap: 3px;
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 0 var(--line);
  text-shadow: none;
}

.layout-option {
  min-width: 48px;
  min-height: 30px;
  padding: 5px 8px;
  color: var(--line);
  font-size: 12px;
  font-weight: 900;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.layout-option.is-active {
  background: var(--sun);
  box-shadow: inset 0 -3px 0 rgba(34, 25, 47, 0.2);
}

.layout-option:hover {
  background: #d6fff6;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) minmax(460px, 1.8fr) minmax(260px, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: stretch;
}

.stats-panel,
.game-panel,
.log-panel {
  padding: 16px;
}

.stats-panel {
  background: #f1fff4;
}

.game-panel {
  background: #fff9d7;
}

.log-panel {
  background: #f5f0ff;
}

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

.panel-title-row h2,
.panel-title-row h3 {
  margin: 0;
  font-size: 18px;
}

.panel-title-row.compact {
  margin-bottom: 10px;
}

.tiny-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.divider {
  height: 4px;
  margin: 14px 0;
  background:
    linear-gradient(90deg, var(--hot) 0 18%, var(--orange) 18% 36%, var(--sun) 36% 54%, var(--mint) 54% 72%, var(--aqua) 72% 86%, var(--violet) 86% 100%);
  border: 2px solid var(--line);
  border-radius: 4px;
}

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

.stat-row {
  display: grid;
  gap: 5px;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
}

.stat-value {
  padding: 1px 6px;
  color: #fff;
  background: var(--line);
  border-radius: 4px;
}

.meter {
  height: 17px;
  padding: 3px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 6px;
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: var(--aqua);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: width 240ms steps(6), background-color 180ms linear;
}

.hidden-list {
  opacity: 0.96;
}

.hidden-list .stat-head {
  font-size: 12px;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.day-strip > div {
  min-width: 0;
  padding: 9px 10px;
  background: #ffffff;
  border: 3px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--line);
}

.label {
  display: block;
  margin-bottom: 3px;
  color: #675077;
  font-size: 11px;
  font-weight: 900;
}

.day-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.event-card {
  display: grid;
  grid-template-columns: minmax(190px, 0.72fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 16px;
  transition: transform 180ms ease, filter 180ms ease;
}

.event-card.bump {
  transform: translateY(-3px) rotate(-0.2deg);
  filter: saturate(1.12);
}

.scene-frame {
  position: relative;
  min-height: 244px;
  overflow: hidden;
  border: 4px solid var(--line);
  border-radius: 8px;
  background: #261940;
  box-shadow: 0 5px 0 var(--line);
}

.scene-sprite {
  width: 100%;
  height: 100%;
  min-height: 244px;
  background-image: url("assets/scenes.webp");
  background-repeat: no-repeat;
  background-size: 300% 200%;
  image-rendering: auto;
}

.scene-fruit {
  background-position: 0% 0%;
}

.scene-night {
  background-position: 50% 0%;
}

.scene-supply {
  background-position: 100% 0%;
}

.scene-lecture {
  background-position: 0% 100%;
}

.scene-crisis {
  background-position: 50% 100%;
}

.scene-ending {
  background-position: 100% 100%;
}

.scanline {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.08) 0,
    rgba(255, 255, 255, 0.08) 2px,
    rgba(0, 0, 0, 0.04) 2px,
    rgba(0, 0, 0, 0.04) 4px
  );
  mix-blend-mode: soft-light;
}

.event-copy {
  min-width: 0;
  padding: 4px 0 0;
}

.event-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 10px;
  padding: 3px 9px;
  color: var(--line);
  font-size: 13px;
  font-weight: 900;
  background: var(--mint);
  border: 3px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 3px 0 var(--line);
}

.event-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.14;
  letter-spacing: 0;
}

.event-copy p {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.85;
}

.choices {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.choice-btn,
.pixel-button,
.mini-button {
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pixel-button,
.mini-button {
  min-height: 42px;
  color: var(--line);
  font-weight: 900;
  border: 3px solid var(--line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 4px 0 var(--line);
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.pixel-button {
  padding: 9px 14px;
  font-size: 15px;
}

.pixel-button.primary {
  background: var(--sun);
}

.pixel-button.secondary {
  background: #fff;
}

.pixel-button.small {
  min-height: 38px;
  padding: 8px 11px;
  font-size: 13px;
}

.mini-button {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 11px;
  background: #d6fff6;
}

.pixel-button:hover,
.mini-button:hover {
  transform: translate(-2px, -3px);
  box-shadow: 2px 7px 0 var(--line);
  filter: saturate(1.16);
}

.pixel-button:active,
.mini-button:active {
  transform: translate(0, 2px);
  box-shadow: 0 2px 0 var(--line);
}

.choice-btn {
  position: relative;
  min-height: 96px;
  padding: 14px 14px 13px 48px;
  overflow: hidden;
  color: var(--line);
  text-align: left;
  border: 4px solid var(--line);
  border-radius: 8px;
  background: var(--choice-bg, #fff);
  box-shadow: 0 6px 0 var(--line);
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}

.choice-btn::before {
  content: attr(data-key);
  position: absolute;
  left: 12px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  background: var(--line);
  border-radius: 4px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.22);
}

.choice-btn::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(var(--line), var(--line)) center / 4px 18px no-repeat,
    linear-gradient(var(--line), var(--line)) center / 18px 4px no-repeat;
  opacity: 0.12;
  transform: rotate(45deg);
}

.choice-title {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.45;
}

.choice-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 21px;
}

.effect-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid var(--line);
  border-radius: 5px;
  background: var(--blue);
}

.effect-chip.up {
  background: var(--good);
}

.effect-chip.down {
  background: var(--bad);
}

.choice-btn:hover {
  transform: translate(-3px, -5px) rotate(-0.45deg);
  box-shadow: 3px 10px 0 var(--line);
  filter: saturate(1.22) brightness(1.02);
}

.choice-btn:hover::after {
  opacity: 0.2;
  animation: sparkle 500ms steps(3) infinite;
}

.choice-btn:active,
.choice-btn.is-picked {
  transform: translate(0, 3px) scale(0.99);
  box-shadow: 0 2px 0 var(--line);
  filter: saturate(1.35);
}

.choice-btn.is-picked {
  animation: choice-pop 260ms steps(3);
}

.choice-btn:disabled {
  cursor: not-allowed;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 542px;
  max-height: 58vh;
  overflow: auto;
  padding-right: 4px;
}

.log-entry {
  padding: 9px 10px;
  font-size: 13px;
  line-height: 1.55;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--line);
}

.log-entry strong {
  display: block;
  margin-bottom: 3px;
  color: #6b3df2;
}

.ending-card {
  grid-column: 1 / -1;
  padding: 16px;
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 5px 0 var(--line);
}

.ending-card h3 {
  margin-bottom: 8px;
  font-size: 24px;
}

.ending-card p {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.8;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(34, 25, 47, 0.55);
}

.modal {
  width: min(560px, 100%);
  padding: 20px;
  background: #fff8df;
}

.modal p {
  font-size: 15px;
  line-height: 1.8;
}

.modal .pixel-button {
  margin-top: 4px;
}

.privacy-note {
  margin: 12px auto 0;
  max-width: 980px;
  color: rgba(36, 65, 91, 0.78);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

@keyframes choice-pop {
  0% {
    transform: translate(-3px, -5px) scale(1);
  }
  45% {
    transform: translate(0, 2px) scale(0.98);
  }
  100% {
    transform: translate(-1px, -2px) scale(1.01);
  }
}

@keyframes sparkle {
  0% {
    transform: rotate(45deg) scale(1);
  }
  50% {
    transform: rotate(90deg) scale(1.18);
  }
  100% {
    transform: rotate(45deg) scale(1);
  }
}

@media (max-width: 1080px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
  }

  .game-panel {
    grid-column: 1 / -1;
    order: -1;
  }

  .log-list {
    height: 360px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    width: 100vw;
    height: 100svh;
    padding: 6px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    overflow: hidden;
  }

  .pixel-panel {
    border-width: 3px;
    box-shadow: 0 3px 0 var(--line), 0 6px 0 rgba(35, 25, 47, 0.16);
  }

  .hero-panel,
  .hero-overlay {
    min-height: 0;
    height: 112px;
  }

  .hero-overlay {
    width: 100%;
    padding: 8px 10px;
    justify-content: center;
    background: linear-gradient(90deg, rgba(34, 25, 47, 0.9) 0%, rgba(34, 25, 47, 0.68) 68%, rgba(34, 25, 47, 0.16) 100%);
  }

  .kicker {
    display: none;
  }

  h1 {
    margin-bottom: 2px;
    font-size: 23px;
  }

  .subtitle {
    margin-bottom: 3px;
    font-size: 13px;
  }

  .hero-copy {
    max-width: 310px;
    margin-bottom: 5px;
    font-size: 10.5px;
    line-height: 1.3;
  }

  .hero-actions {
    gap: 6px;
  }

  .layout-toggle {
    margin-top: 3px;
    padding: 2px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--line);
  }

  .layout-option {
    min-width: 38px;
    min-height: 22px;
    padding: 2px 5px;
    font-size: 10px;
  }

  .pixel-button {
    min-height: 28px;
    padding: 5px 8px;
    border-width: 2px;
    box-shadow: 0 3px 0 var(--line);
    font-size: 12px;
  }

  .dashboard {
    height: 100%;
    min-height: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    margin-top: 0;
    overflow: hidden;
  }

  .stats-panel {
    order: 0;
    padding: 6px;
  }

  .stats-panel .panel-title-row {
    margin-bottom: 5px;
  }

  .panel-title-row h2 {
    font-size: 13px;
  }

  .tiny-badge {
    min-height: 18px;
    padding: 1px 4px;
    border-width: 2px;
    font-size: 8px;
  }

  .stats-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }

  .stat-row {
    gap: 0;
    padding: 3px 2px;
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 5px;
  }

  .stat-head {
    display: grid;
    place-items: center;
    gap: 1px;
    text-align: center;
    font-size: 9px;
  }

  .stat-value {
    padding: 0 3px;
    font-size: 9px;
  }

  .meter {
    display: none;
  }

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

  .log-panel {
    display: none;
  }

  .event-card {
    height: 100%;
    min-height: 0;
    grid-template-columns: 110px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px;
    overflow: hidden;
  }

  .choices {
    grid-template-columns: 1fr;
    gap: 6px;
    align-self: end;
    overflow: hidden;
  }

  .day-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
  }

  .day-strip > div {
    padding: 4px 5px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--line);
  }

  .label {
    margin-bottom: 1px;
    font-size: 8px;
  }

  .day-strip strong {
    font-size: 10px;
  }

  .scene-frame,
  .scene-sprite {
    min-height: 0;
    height: 112px;
  }

  .scene-frame {
    border-width: 3px;
    box-shadow: 0 3px 0 var(--line);
  }

  .event-copy {
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }

  .event-tag {
    min-height: 20px;
    margin-bottom: 4px;
    padding: 1px 5px;
    border-width: 2px;
    box-shadow: 0 2px 0 var(--line);
    font-size: 10px;
  }

  .event-copy h2 {
    margin-bottom: 4px;
    font-size: 19px;
    line-height: 1.05;
  }

  .event-copy p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
  }

  .choice-btn {
    min-height: 48px;
    padding: 7px 8px 7px 34px;
    border-width: 3px;
    box-shadow: 0 3px 0 var(--line);
  }

  .choice-btn::before {
    left: 8px;
    top: 8px;
    width: 20px;
    height: 20px;
    font-size: 12px;
  }

  .choice-btn::after {
    display: none;
  }

  .choice-title {
    margin-bottom: 3px;
    font-size: 13px;
    line-height: 1.25;
  }

  .choice-hint {
    gap: 3px;
    min-height: 0;
  }

  .effect-chip {
    min-height: 16px;
    padding: 0 4px;
    border-width: 1px;
    font-size: 9px;
  }

  .ending-card {
    padding: 8px;
    border-width: 3px;
    box-shadow: 0 3px 0 var(--line);
  }

  .ending-card h3 {
    margin-bottom: 3px;
    font-size: 16px;
  }

  .ending-card p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11.5px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

body.layout-mobile {
  height: 100svh;
  overflow: hidden;
}

body.layout-mobile .app-shell {
  width: 100vw;
  height: 100svh;
  padding: 6px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
}

body.layout-mobile .pixel-panel {
  border-width: 3px;
  box-shadow: 0 3px 0 var(--line), 0 6px 0 rgba(35, 25, 47, 0.16);
}

body.layout-mobile .hero-panel,
body.layout-mobile .hero-overlay {
  min-height: 0;
  height: 112px;
}

body.layout-mobile .hero-overlay {
  width: 100%;
  padding: 8px 10px;
  justify-content: center;
  background: linear-gradient(90deg, rgba(34, 25, 47, 0.9) 0%, rgba(34, 25, 47, 0.68) 68%, rgba(34, 25, 47, 0.16) 100%);
}

body.layout-mobile .kicker {
  display: none;
}

body.layout-mobile h1 {
  margin-bottom: 2px;
  font-size: 23px;
}

body.layout-mobile .subtitle {
  margin-bottom: 3px;
  font-size: 13px;
}

body.layout-mobile .hero-copy {
  max-width: 310px;
  margin-bottom: 5px;
  font-size: 10.5px;
  line-height: 1.3;
}

body.layout-mobile .hero-actions {
  gap: 6px;
}

body.layout-mobile .layout-toggle {
  margin-top: 3px;
  padding: 2px;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--line);
}

body.layout-mobile .layout-option {
  min-width: 38px;
  min-height: 22px;
  padding: 2px 5px;
  font-size: 10px;
}

body.layout-mobile .pixel-button {
  min-height: 28px;
  padding: 5px 8px;
  border-width: 2px;
  box-shadow: 0 3px 0 var(--line);
  font-size: 12px;
}

body.layout-mobile .dashboard {
  height: 100%;
  min-height: 0;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  margin-top: 0;
  overflow: hidden;
}

body.layout-mobile .stats-panel {
  order: 0;
  padding: 6px;
}

body.layout-mobile .stats-panel .panel-title-row {
  margin-bottom: 5px;
}

body.layout-mobile .panel-title-row h2 {
  font-size: 13px;
}

body.layout-mobile .tiny-badge {
  min-height: 18px;
  padding: 1px 4px;
  border-width: 2px;
  font-size: 8px;
}

body.layout-mobile .stats-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

body.layout-mobile .stat-row {
  gap: 0;
  padding: 3px 2px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 5px;
}

body.layout-mobile .stat-head {
  display: grid;
  place-items: center;
  gap: 1px;
  text-align: center;
  font-size: 9px;
}

body.layout-mobile .stat-value {
  padding: 0 3px;
  font-size: 9px;
}

body.layout-mobile .meter {
  display: none;
}

body.layout-mobile .game-panel {
  order: 1;
  min-height: 0;
  padding: 6px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

body.layout-mobile .log-panel {
  display: none;
}

body.layout-mobile .event-card {
  height: 100%;
  min-height: 0;
  grid-template-columns: 110px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  overflow: hidden;
}

body.layout-mobile .choices {
  grid-template-columns: 1fr;
  gap: 6px;
  align-self: end;
  overflow: hidden;
}

body.layout-mobile .day-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}

body.layout-mobile .day-strip > div {
  padding: 4px 5px;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--line);
}

body.layout-mobile .label {
  margin-bottom: 1px;
  font-size: 8px;
}

body.layout-mobile .day-strip strong {
  font-size: 10px;
}

body.layout-mobile .scene-frame,
body.layout-mobile .scene-sprite {
  min-height: 0;
  height: 112px;
}

body.layout-mobile .scene-frame {
  border-width: 3px;
  box-shadow: 0 3px 0 var(--line);
}

body.layout-mobile .event-copy {
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

body.layout-mobile .event-tag {
  min-height: 20px;
  margin-bottom: 4px;
  padding: 1px 5px;
  border-width: 2px;
  box-shadow: 0 2px 0 var(--line);
  font-size: 10px;
}

body.layout-mobile .event-copy h2 {
  margin-bottom: 4px;
  font-size: 19px;
  line-height: 1.05;
}

body.layout-mobile .event-copy p {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

body.layout-mobile .choice-btn {
  min-height: 48px;
  padding: 7px 8px 7px 34px;
  border-width: 3px;
  box-shadow: 0 3px 0 var(--line);
}

body.layout-mobile .choice-btn::before {
  left: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  font-size: 12px;
}

body.layout-mobile .choice-btn::after {
  display: none;
}

body.layout-mobile .choice-title {
  margin-bottom: 3px;
  font-size: 13px;
  line-height: 1.25;
}

body.layout-mobile .choice-hint {
  gap: 3px;
  min-height: 0;
}

body.layout-mobile .effect-chip {
  min-height: 16px;
  padding: 0 4px;
  border-width: 1px;
  font-size: 9px;
}

@media (max-width: 460px) {
  .hero-copy,
  .event-copy p {
    font-size: 12px;
  }

  .stats-panel,
  .game-panel {
    padding: 6px;
  }

  .hero-panel,
  .hero-overlay {
    height: 112px;
  }

  .choice-btn {
    min-height: 48px;
    padding-left: 34px;
  }
}

@media (max-width: 760px) and (max-height: 740px) {
  .hero-panel,
  .hero-overlay {
    height: 74px;
  }

  .kicker,
  .hero-copy {
    display: none;
  }

  h1 {
    font-size: 22px;
  }

  .subtitle {
    font-size: 13px;
  }

  .scene-frame,
  .scene-sprite {
    height: 88px;
  }

  .event-copy p {
    -webkit-line-clamp: 3;
  }

  .choice-btn {
    min-height: 42px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .choice-title {
    font-size: 12px;
  }

  .effect-chip {
    display: none;
  }
}

@media (max-width: 760px) {
  html.layout-desktop,
  html.layout-desktop body {
    height: auto;
    overflow: auto;
  }

  html.layout-desktop body .app-shell {
    width: min(1440px, calc(100vw - 28px));
    height: auto;
    display: block;
    padding: 18px 0 28px;
    overflow: visible;
  }

  html.layout-desktop body .hero-panel,
  html.layout-desktop body .hero-overlay {
    min-height: 292px;
    height: auto;
  }

  html.layout-desktop body .hero-overlay {
    width: min(660px, 100%);
    padding: clamp(18px, 3vw, 34px);
    justify-content: center;
    background:
      linear-gradient(90deg, rgba(34, 25, 47, 0.88) 0%, rgba(34, 25, 47, 0.62) 58%, rgba(34, 25, 47, 0) 100%);
  }

  html.layout-desktop body .kicker {
    display: block;
    margin: 0 0 10px;
    padding: 6px 9px;
    border-width: 3px;
    box-shadow: 0 4px 0 var(--line);
    font-size: 13px;
  }

  html.layout-desktop body h1 {
    margin-bottom: 6px;
    font-size: clamp(34px, 7vw, 62px);
  }

  html.layout-desktop body .subtitle {
    margin-bottom: 12px;
    font-size: clamp(20px, 4vw, 34px);
  }

  html.layout-desktop body .hero-copy {
    max-width: 560px;
    margin-bottom: 14px;
    font-size: 17px;
    line-height: 1.8;
  }

  html.layout-desktop body .layout-toggle {
    margin-top: 12px;
    padding: 3px;
    border-width: 3px;
    box-shadow: 0 4px 0 var(--line);
  }

  html.layout-desktop body .layout-option {
    min-width: 48px;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
  }

  html.layout-desktop body .pixel-button {
    min-height: 42px;
    padding: 9px 14px;
    border-width: 3px;
    box-shadow: 0 4px 0 var(--line);
    font-size: 15px;
  }

  html.layout-desktop body .dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    height: auto;
    margin-top: 18px;
    overflow: visible;
  }

  html.layout-desktop body .stats-panel,
  html.layout-desktop body .game-panel,
  html.layout-desktop body .log-panel {
    display: block;
    padding: 16px;
  }

  html.layout-desktop body .stats-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  html.layout-desktop body .stat-row {
    padding: 0;
    background: transparent;
    border: 0;
  }

  html.layout-desktop body .stat-head {
    display: flex;
    justify-content: space-between;
    text-align: left;
    font-size: 13px;
  }

  html.layout-desktop body .stat-value {
    padding: 1px 6px;
    font-size: 13px;
  }

  html.layout-desktop body .meter {
    display: block;
  }

  html.layout-desktop body .day-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
  }

  html.layout-desktop body .day-strip > div {
    padding: 9px 10px;
    border-width: 3px;
    box-shadow: 0 3px 0 var(--line);
  }

  html.layout-desktop body .label {
    font-size: 11px;
  }

  html.layout-desktop body .day-strip strong {
    font-size: 15px;
  }

  html.layout-desktop body .event-card {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 16px;
    overflow: visible;
  }

  html.layout-desktop body .scene-frame,
  html.layout-desktop body .scene-sprite {
    min-height: 260px;
    height: auto;
  }

  html.layout-desktop body .event-copy p {
    display: block;
    overflow: visible;
    font-size: 17px;
    line-height: 1.85;
  }

  html.layout-desktop body .choices {
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: visible;
  }

  html.layout-desktop body .choice-btn {
    min-height: 96px;
    padding: 14px 14px 13px 48px;
    border-width: 4px;
    box-shadow: 0 6px 0 var(--line);
  }

  html.layout-desktop body .choice-btn::before {
    left: 12px;
    top: 14px;
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  html.layout-desktop body .choice-btn::after {
    display: block;
  }

  html.layout-desktop body .choice-title {
    font-size: 16px;
  }

  html.layout-desktop body .effect-chip {
    display: inline-flex;
    min-height: 20px;
    padding: 2px 6px;
    border-width: 2px;
    font-size: 11px;
  }
}
