@font-face {
  font-family: Japanese;
  src: url("/assets/japanese.woff2") format("woff2");
  font-display: swap;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101f2f;
  color: #f6f1df;
  font-family: Arial, Japanese, sans-serif;
}
button,
select {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
button:focus-visible {
  outline: 3px solid #ffdb85;
  outline-offset: 3px;
}
#app {
  height: 100dvh;
  width: 100%;
  max-width: 1440px;
  margin: auto;
  position: relative;
  overflow: hidden;
  background: #162b36;
}
#world {
  position: absolute;
  top: 100px;
  left: 0;
  width: 100%;
  height: calc(100% - 282px);
  display: block;
  image-rendering: pixelated;
  touch-action: none;
}
#ui {
  position: relative;
  z-index: 2;
  height: 100%;
  pointer-events: none;
}
#ui button,
#ui select,
#ui input {
  pointer-events: auto;
}
button {
  border: 1px solid #81919360;
  border-radius: 6px;
  background: #223d50;
  color: #fbf6e5;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 600;
}
button:hover {
  background: #304f61;
}
.primary {
  color: #162b38;
  background: #e8c376;
  border-color: #e8c376;
}
.primary:hover {
  background: #f4d796;
}
.quiet {
  background: transparent;
}
.topbar {
  height: 52px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #102339;
  border-bottom: 1px solid #d6c39144;
}
.place {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}
.topbar button {
  padding: 7px 11px;
  min-height: 36px;
  font-size: 13px;
}
.objective {
  height: 48px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #172f41;
  font-size: 13px;
  line-height: 1.35;
  border-bottom: 2px solid #c9b98155;
}
.objective b {
  color: #e7c37e;
  font-size: 10px;
  letter-spacing: 0.1em;
  display: block;
  white-space: nowrap;
}
.controls {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 182px;
  background: #11273b;
  border-top: 3px solid #c1b68c;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dpad {
  display: grid;
  grid-template-columns: 44px 44px 44px;
  grid-template-rows: 44px 44px 44px;
  gap: 2px;
}
.dpad button {
  padding: 0;
  background: #294558;
  border: 1px solid #557082;
  border-radius: 5px;
  box-shadow: 0 3px #071725;
  font-size: 21px;
  user-select: none;
  touch-action: none;
}
.dpad [data-move="0,-1"] {
  grid-area: 1/2;
}
.dpad [data-move="-1,0"] {
  grid-area: 2/1;
}
.dpad [data-move="1,0"] {
  grid-area: 2/3;
}
.dpad [data-move="0,1"] {
  grid-area: 3/2;
}
.control-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.interact {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  font-size: 25px;
  color: #1d2936;
  background: #e9c582;
  border: 3px solid #f8e2b5;
  box-shadow: 0 5px #6c5229;
}
.hint {
  font-size: 12px;
  max-width: 105px;
  line-height: 1.6;
  color: #d9decf;
}
.hint strong {
  display: block;
  color: #efcd87;
  font-size: 15px;
}
.dialogue {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  min-height: 174px;
  padding: 18px 20px;
  background: #132b43;
  border: 2px solid #e0d3a6;
  box-shadow:
    0 0 0 4px #122238,
    0 12px 30px #08142360;
  border-radius: 3px;
  pointer-events: auto;
}
.speaker {
  color: #edc477;
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: bold;
}
.jp {
  font-family: Japanese, sans-serif;
  line-height: 1.8;
  font-size: 19px;
  margin: 8px 0;
}
.translation {
  color: #ced7d5;
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0;
}
.dialogue footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.dialogue footer button {
  min-height: 36px;
  padding: 7px 13px;
}
.dialogue-progress {
  font-size: 12px;
  color: #b5c5c9;
}
.home #world {
  inset: 0;
  width: 100%;
  height: 100%;
}
.home .home-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(#0a1f3266, #0a1f3210 36%, #091b33f0 85%);
}
.home-top {
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #f0e7d0;
}
.home-top button {
  font-size: 12px;
  min-height: 36px;
  background: #11283cbb;
}
.home-brand {
  position: absolute;
  top: 12%;
  left: 20px;
  right: 20px;
  text-align: center;
  text-shadow: 0 4px #142c37;
}
.home-brand .eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  color: #ffdc8f;
}
.home-brand h1 {
  font-family: Japanese, sans-serif;
  font-weight: 900;
  letter-spacing: 0.07em;
  font-size: clamp(35px, 7.2vw, 72px);
  margin: 10px 0 4px;
  color: #fff0c7;
}
.home-brand .roman {
  letter-spacing: 0.28em;
  font-size: 12px;
  color: #f1e7c8;
}
.home-bottom {
  position: absolute;
  bottom: calc(28px + env(safe-area-inset-bottom));
  left: 24px;
  right: 24px;
  max-width: 420px;
  margin: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.home-bottom p {
  margin: 0 0 10px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
}
.home-bottom button {
  min-height: 48px;
  background: #132c43d9;
}
.home-bottom button.primary {
  background: #edc984;
}
.home-bottom .minor {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.home-bottom .minor button {
  font-size: 12px;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: #d5decf;
}
.home-version {
  font-size: 11px;
  color: #a9bfc4;
}
.logo-rise {
  animation: logo-rise 900ms both;
}
@keyframes logo-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#overlay:empty {
  display: none;
}
#overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #05131cbf;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}
.modal {
  width: 100%;
  max-width: 620px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  background: #142d43;
  border: 1px solid #b8b594;
  border-radius: 8px;
  box-shadow: 0 16px 80px #0008;
  padding: 24px;
  pointer-events: auto;
}
.modal h2 {
  font-family: Japanese, Arial, sans-serif;
  font-size: 24px;
  margin: 8px 0 16px;
  color: #f5e7bd;
  line-height: 1.4;
}
.modal h3 {
  font-size: 16px;
  margin: 18px 0 8px;
}
.modal p {
  font-size: 15px;
  line-height: 1.7;
  color: #d9e0d9;
}
.modal .eyebrow {
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #ddb977;
}
.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.modal header button {
  min-height: 36px;
  padding: 6px 10px;
}
.modal .reading {
  font-size: 13px;
  color: #b6c9cd;
  margin: 0 0 15px;
  line-height: 1.7;
}
.lesson-phrase {
  font:
    23px/1.9 Japanese,
    sans-serif;
  color: #fff1c6;
  border-left: 3px solid #e1be73;
  padding-left: 15px;
  margin: 22px 0 8px;
}
.lesson-rule {
  padding: 14px;
  background: #0d2336;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.7;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stack button {
  text-align: left;
}
.modal .wide {
  width: 100%;
  margin-top: 18px;
}
.choice {
  font-family: Japanese, Arial, sans-serif;
  line-height: 1.6;
  text-align: left;
}
.feedback {
  padding: 12px;
  background: #244e47;
  border-left: 3px solid #a9d09c;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.6;
}
.feedback.wrong {
  background: #513c31;
  border-color: #d6a16c;
}
.small {
  font-size: 12px !important;
  color: #9fb7c0 !important;
}
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}
.chapter-list div {
  padding: 12px 0;
  border-bottom: 1px solid #9cafb82a;
}
.chapter-list b {
  display: block;
  color: #efce85;
  font-size: 15px;
}
.chapter-list span {
  font-size: 13px;
  color: #bdd0d2;
}
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.inventory-grid div {
  padding: 16px 4px;
  background: #0e2337;
  border-radius: 6px;
}
.inventory-grid b {
  display: block;
  font-size: 24px;
  color: #efce85;
}
.inventory-grid span {
  font-size: 11px;
}
.minimap {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid #b8b594;
  margin: 10px 0;
}
.battle #world {
  top: 52px;
  height: calc(100% - 350px);
}
.battle-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #10263a;
  border-top: 3px solid #d3c99c;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  height: 298px;
  pointer-events: auto;
}
.party {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.party-card {
  padding: 7px 8px;
  background: #1d3a4d;
  border: 1px solid #516973;
  font-size: 11px;
  line-height: 1.6;
}
.party-card.active {
  border-color: #f5d28b;
  background: #334b50;
}
.party-card b {
  display: block;
  font-family: Japanese, sans-serif;
  font-size: 14px;
}
.bar {
  height: 4px;
  background: #092335;
  margin: 4px 0;
}
.bar i {
  display: block;
  height: 100%;
  background: #8dd59b;
}
.battle-message {
  min-height: 58px;
  padding: 9px 2px;
  font-size: 13px;
  line-height: 1.5;
  color: #e2deca;
}
.battle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.battle-actions button {
  min-height: 46px;
  font-size: 15px;
  padding: 7px;
}
.battle-actions small {
  display: block;
  font-size: 10px;
  color: #aec0c2;
}
.battle-cue {
  position: absolute;
  top: 64px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}
.battle-cue span {
  background: #102339da;
  padding: 7px 10px;
  border-radius: 4px;
}
#toast {
  position: absolute;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  max-width: 90%;
  width: max-content;
  background: #fff0cd;
  color: #17303e;
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 4px 20px #0005;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
#toast.show {
  opacity: 1;
}
#loading {
  position: absolute;
  inset: 0;
  background: #102339;
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  font:
    32px Japanese,
    sans-serif;
  color: #eed09c;
}
#loading span {
  font:
    14px Arial,
    sans-serif;
  color: #b3c8ca;
}
audio {
  width: 100%;
  margin-top: 10px;
}
.ending-mark {
  font-size: 50px;
  color: #edc67c;
  text-align: center;
  margin: 20px;
}
.statline {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #58707a55;
}
.control-legend {
  display: none;
}
@media (min-width: 800px) {
  #app {
    max-width: 1160px;
    border-left: 1px solid #48606b;
    border-right: 1px solid #48606b;
  }
  .topbar {
    padding: 8px 24px;
  }
  .objective {
    padding-left: 24px;
  }
  #world {
    height: calc(100% - 230px);
  }
  .controls {
    height: 130px;
    padding: 10px 26px;
  }
  .dpad {
    grid-template-columns: 34px 34px 34px;
    grid-template-rows: 32px 32px 32px;
  }
  .dpad button {
    min-height: 32px;
    font-size: 18px;
  }
  .control-legend {
    display: block;
    color: #a9bec5;
    font-size: 13px;
  }
  .dialogue {
    left: calc(50% - 350px);
    right: calc(50% - 350px);
    bottom: 20px;
  }
  .home-brand {
    top: 10%;
  }
  .home-bottom {
    bottom: 6%;
  }
  .home-bottom p {
    font-size: 24px;
  }
  .battle-panel {
    width: 620px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid #c6bd96;
    border-radius: 5px 5px 0 0;
  }
  .battle #world {
    height: calc(100% - 280px);
  }
  .battle-cue {
    left: 25%;
    right: 25%;
  }
}
@media (max-height: 650px) {
  #world {
    top: 86px;
    height: calc(100% - 220px);
  }
  .topbar {
    height: 44px;
  }
  .objective {
    height: 42px;
    font-size: 11px;
  }
  .controls {
    height: 134px;
    padding: 8px 14px;
  }
  .dpad {
    grid-template-columns: 35px 35px 35px;
    grid-template-rows: 35px 35px 35px;
  }
  .dpad button {
    min-height: 35px;
  }
  .interact {
    height: 66px;
    width: 66px;
  }
  .dialogue {
    padding: 12px 14px;
    min-height: 150px;
  }
  .jp {
    font-size: 16px;
    line-height: 1.6;
  }
  .translation {
    font-size: 12px;
  }
  .home-brand {
    top: 11%;
  }
  .home-brand h1 {
    font-size: 35px;
  }
  .home-bottom {
    bottom: 15px;
    gap: 6px;
  }
  .home-bottom p {
    font-size: 16px;
    margin-bottom: 4px;
  }
  .home-bottom button {
    min-height: 40px;
    padding: 8px;
  }
  .home-version {
    display: none;
  }
  .battle-panel {
    height: 266px;
    padding: 8px 12px;
  }
  .battle #world {
    top: 44px;
    height: calc(100% - 310px);
  }
  .party-card {
    padding: 4px 6px;
  }
  .battle-message {
    min-height: 49px;
    font-size: 12px;
  }
  .battle-actions button {
    min-height: 43px;
  }
  .modal {
    padding: 18px;
  }
  .lesson-phrase {
    font-size: 19px;
    margin-top: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-height: 650px) {
  .controls {
    height: 156px;
    padding: 8px 12px;
    gap: 8px;
  }
  .dpad {
    grid-template-columns: 44px 44px 44px;
    grid-template-rows: 44px 44px 44px;
  }
  .dpad button {
    min-height: 44px;
  }
  #world {
    height: calc(100% - 242px);
  }
  .control-right {
    gap: 8px;
  }
  .hint {
    max-width: 75px;
    font-size: 11px;
  }
  .hint strong {
    font-size: 13px;
  }
  .battle #world {
    height: calc(100% - 310px);
  }
}
.dialogue footer .primary {
  white-space: nowrap;
  flex-shrink: 0;
}
