:root {
  font-family:"Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
  color:#302d26;
  background:#c8c2af;
  font-synthesis:none;
  --paper:rgba(250,246,236,.94);
  --green:#475b35;
}
* {
  box-sizing:border-box;
}
body {
  margin:0;
  overflow:hidden;
}
button,a {
  -webkit-tap-highlight-color:transparent;
}
button {
  font:inherit;
  cursor:pointer;
  border:0;
  color:inherit;
  touch-action:none;
}
button:focus-visible,a:focus-visible {
  outline:3px solid #ac681d;
  outline-offset:4px;
}
button:disabled {
  cursor:wait;
  opacity:.65;
}
#world {
  display:block;
  width:100vw;
  height:100dvh;
  touch-action:none;
}
.hud {
  position:absolute;
  inset:max(24px,env(safe-area-inset-top)) 28px auto;
  display:flex;
  gap:12px;
  align-items:flex-start;
  pointer-events:none;
}
.hud>* {
  pointer-events:auto;
}
.identity {
  padding:16px 24px;
  background:var(--paper);
  border-radius:8px;
  box-shadow:0 4px 24px #0001;
}
.identity a {
  color:#676050;
  font-size:11px;
  text-underline-offset:3px;
}
.identity h1 {
  margin:4px 0;
  font-family:"Yu Mincho","Hiragino Mincho ProN",serif;
  font-size:28px;
  font-weight:700;
  letter-spacing:.05em;
}
.identity p {
  margin:0;
  font-size:12px;
  color:#6d654e;
}
.status {
  margin-left:auto;
  width:236px;
  background:var(--paper);
  padding:15px 20px;
  border-radius:8px;
  box-shadow:0 4px 24px #0001;
}
.status>div {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.status span {
  font-size:12px;
}
.status strong {
  font-size:27px;
  font-variant-numeric:tabular-nums;
}
.status small {
  font-size:16px;
  margin-left:3px;
}
progress {
  display:block;
  width:100%;
  height:7px;
  border:0;
  border-radius:8px;
  overflow:hidden;
  background:#d5cdbc;
  margin-top:9px;
}
progress::-webkit-progress-bar {
  background:#d5cdbc;
}
progress::-webkit-progress-value {
  background:#748642;
}
progress::-moz-progress-bar {
  background:#748642;
}
.quiet {
  border-radius:7px;
  padding:12px 15px;
  background:var(--paper);
  font-size:12px;
}
.notice {
  position:absolute;
  top:164px;
  left:50%;
  transform:translateX(-50%);
  padding:10px 18px;
  background:var(--paper);
  border-radius:6px;
  font-size:13px;
  white-space:nowrap;
  pointer-events:none;
}
.bottom {
  position:absolute;
  bottom:max(24px,env(safe-area-inset-bottom));
  left:28px;
  right:28px;
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  pointer-events:none;
}
.bottom>* {
  pointer-events:auto;
}
.desktop-help {
  margin:0;
  padding:14px 18px;
  background:var(--paper);
  border-radius:8px;
  font-size:12px;
  line-height:2;
}
kbd {
  font:inherit;
  border:1px solid #b9b09b;
  border-radius:3px;
  padding:2px 5px;
}
.actions {
  display:flex;
  align-items:center;
  gap:10px;
}
.blow {
  padding:18px 23px;
  background:var(--paper);
  border-radius:8px;
  box-shadow:0 4px 24px #0002;
  font-weight:700;
  font-size:16px;
}
.blow span {
  display:block;
  font-size:10px;
  font-weight:400;
  margin-top:5px;
  letter-spacing:.1em;
}
.blow.active {
  background:#e7b967;
  transform:translateY(2px);
}
.characters[hidden] {
  display:none;
}
.veil {
  grid-template-columns:minmax(0,1fr);
  justify-items:center;
  overflow-y:auto;
}
.menu {
  min-width:0;
}
.veil {
  position:absolute;
  inset:0;
  background:#252e2626;
  backdrop-filter:blur(3px);
  display:grid;
  place-items:center;
  padding:20px;
}
.veil[hidden] {
  display:none;
}
.menu {
  background:var(--paper);
  padding:38px 42px;
  width:440px;
  max-width:100%;
  border-radius:12px;
  box-shadow:0 20px 80px #171b2433;
}
.chapter {
  font-size:12px;
  color:#766a50;
  margin:0 0 16px;
}
.menu h2 {
  font-family:"Yu Mincho","Hiragino Mincho ProN",serif;
  font-size:36px;
  line-height:1.4;
  margin:0 0 16px;
  letter-spacing:.035em;
}
.menu>p {
  line-height:1.9;
}
.menu #menu-description {
  font-size:13px;
  color:#6b6455;
  margin-bottom:24px;
}
.characters {
  display:flex;
  gap:10px;
  margin-bottom:18px;
}
.characters button {
  width:50%;
  padding:15px 12px;
  text-align:left;
  border:1px solid #cec6b6;
  background:transparent;
  border-radius:7px;
}
.characters button[aria-pressed=true] {
  border:2px solid var(--green);
  background:#e7ebdd;
  padding:14px 11px;
}
.characters strong {
  font-size:16px;
}
.characters span {
  display:block;
  font-size:10px;
  margin-top:7px;
  color:#756e5e;
}
.primary {
  width:100%;
  background:var(--green);
  color:white;
  padding:17px;
  border-radius:7px;
  font-weight:700;
  font-size:15px;
}
.tip {
  font-size:10px;
  color:#7e7565;
  margin:20px 0 0;
}
.prototype {
  font-size:10px;
  color:#8a8170;
  margin:10px 0 0;
}
#joystick {
  display:none;
  position:absolute;
  bottom:max(26px,env(safe-area-inset-bottom));
  left:28px;
  width:112px;
  height:112px;
  border:1px solid #fff8;
  background:#faf6ec55;
  border-radius:50%;
  touch-action:none;
}
#stick {
  position:absolute;
  width:44px;
  height:44px;
  left:33px;
  top:33px;
  background:#faf6ecbd;
  border:1px solid #fff9;
  box-shadow:0 2px 8px #0002;
  border-radius:50%;
  pointer-events:none;
}
@media(pointer:coarse) {
  #joystick {
    display:block;
  }
  .desktop-help {
    display:none;
  }
}
@media(max-width:650px) {
  .hud {
    inset:max(12px,env(safe-area-inset-top)) 12px auto;
    gap:8px;
    flex-wrap:wrap;
  }
  .identity {
    padding:10px 14px;
  }
  .identity h1 {
    font-size:18px;
  }
  .identity a {
    font-size:9px;
  }
  .identity p {
    font-size:10px;
  }
  .status {
    width:145px;
    padding:9px 12px;
  }
  .status strong {
    font-size:20px;
  }
  .status span {
    font-size:10px;
  }
  .hud>.quiet {
    position:absolute;
    top:90px;
    right:0;
    padding:9px 11px;
  }
  .notice {
    top:124px;
    font-size:10px;
    padding:8px 10px;
  }
  .bottom {
    left:12px;
    right:12px;
    bottom:max(20px,env(safe-area-inset-bottom));
  }
  .actions {
    margin-left:auto;
    gap:7px;
    align-items:flex-end;
    flex-direction:column;
  }
  .blow {
    padding:17px 18px;
    font-size:13px;
  }
  .menu {
    padding:28px;
  }
  .menu h2 {
    font-size:30px;
  }
  .desktop-help {
    font-size:9px;
    padding:9px;
    max-width:50%;
  }
  #joystick {
    left:20px;
  }
  .veil {
    padding:16px;
  }
  .prototype {
    margin-bottom:0;
  }
}
@media(max-height:620px) {
  .menu {
    padding:20px 28px;
  }
  .menu h2 {
    font-size:26px;
    margin-bottom:8px;
  }
  .chapter {
    margin-bottom:6px;
  }
  .menu #menu-description {
    margin:8px 0 12px;
  }
  .tip {
    margin-top:10px;
  }
  .identity {
    padding:8px 14px;
  }
  .notice {
    top:128px;
  }
}
@media(max-width:650px) {
  #joystick {
    display:block;
  }
  .desktop-help {
    display:none;
  }
  .notice {
    top:150px;
  }
}

/* Campaign and combat UI keep the original paper-and-autumn visual direction. */
[hidden] { display: none !important; }
.menu { width: 540px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px 34px; }
.menu h2 { font-size: 30px; margin-bottom: 10px; }
.menu #menu-description { margin-bottom: 16px; }
.chapter { margin-bottom: 8px; }
.characters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.characters button { width: 100%; padding: 12px; }
.characters button[aria-pressed=true] { padding: 11px; }
.characters strong { font-size: 15px; }
.characters span { font-size: 10px; }
.mode-switch { display: flex; gap: 7px; margin-bottom: 12px; }
.mode-switch button { flex: 1; padding: 9px; border: 1px solid #c6bfaf; border-radius: 5px; background: transparent; font-size: 12px; }
.mode-switch button[aria-pressed=true] { background: #e2e8d8; border-color: #667854; }
.field { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 12px; }
select, input { font: inherit; color: #403c31; background: #fffaf0; border: 1px solid #b8b09e; border-radius: 4px; padding: 8px 10px; max-width: 70%; }
.room-controls { display: flex; gap: 8px; align-items: flex-end; }
.room-controls label { font-size: 11px; }
.room-controls input { display: block; width: 100px; max-width: 100%; margin-top: 4px; }
.room-controls button { border: 1px solid #b8b09e; white-space: nowrap; }
#network-status { font-size: 12px; line-height: 1.8; color: #71583b; }
#results { padding: 8px 0 16px; }
#results div { display: flex; justify-content: space-between; font-size: 13px; line-height: 2; gap: 12px; }
#results strong { text-align: right; }
.back-title { width: 100%; background: transparent; color: #796e5b; font-size: 12px; padding: 13px 0 0; }
.tip { margin-top: 14px; white-space: pre-line; }
.prototype { margin-top: 5px; }
.player-status { position: absolute; top: 162px; left: 28px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.player-card { width: 205px; background: var(--paper); padding: 12px 16px; border-radius: 7px; box-shadow: 0 4px 20px #0001; }
.player-card strong { display: block; font-size: 12px; }
.player-card span { display: block; margin-top: 5px; color: #a45d48; font-size: 13px; letter-spacing: 1px; }
.player-card small { display: block; font-size: 10px; color: #766953; margin-top: 5px; }
.player-card progress { margin-top: 7px; height: 4px; }
.player-card progress::-webkit-progress-value { background: #7a9aa8; }
.boss-hud { position: absolute; left: 50%; transform: translateX(-50%); top: 130px; width: min(420px, 45vw); background: var(--paper); padding: 11px 18px; border-radius: 7px; text-align: center; }
.boss-hud strong { font-size: 14px; }
.boss-hud progress::-webkit-progress-value { background: #b87145; }
#combo { margin: 4px 0 0; font-size: 11px; color: #8c683c; }
.notice { top: 211px; max-width: 55vw; white-space: normal; text-align: center; line-height: 1.5; }
.notice.warning { background: #edc175ee; color: #593420; font-weight: 700; }
.combat-actions { display: flex; gap: 8px; }
.combat-actions .quiet { min-width: 105px; padding: 17px 12px; font-weight: 700; border: 1px solid #e2d9c9; }
.combat-actions button:not(:disabled) { background: #d9e4c5; border-color: #879568; }
.actions { flex-wrap: wrap; max-width: 430px; justify-content: flex-end; }
.desktop-help { white-space: pre-line; }
#floating-texts { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.floating-label { position: absolute; top: 0; left: 0; font-size: 12px; font-weight: 700; padding: 4px 8px; background: #fbf4dded; color: #735326; border-radius: 4px; white-space: nowrap; box-shadow: 0 2px 10px #0002; }
.floating-label.speech { font-size: 11px; font-weight: 400; color: #514b3f; background: #fff9edef; }
.floating-label.damage { color: #a5412b; }
.floating-label.player-label { color: #355475; background: #f4efdfaa; font-size: 10px; padding: 2px 5px; }
@media(max-width:650px) {
  .menu { padding: 22px; }
  .menu h2 { font-size: 25px; }
  .menu #menu-description { font-size: 12px; }
  .characters strong { font-size: 13px; }
  .characters span { font-size: 9px; }
  .characters button { padding: 10px; }
  .characters button[aria-pressed=true] { padding: 9px; }
  .player-status { left: 12px; right: 80px; top: 118px; flex-direction: row; gap: 5px; }
  .player-card { width: 160px; max-width: 100%; flex: 1; padding: 8px 10px; }
  .player-card strong { font-size: 10px; }
  .player-card span { font-size: 11px; margin-top: 3px; letter-spacing: 0; }
  .player-card small { font-size: 8px; margin-top: 3px; }
  .notice { top: 216px; max-width: calc(100vw - 24px); width: max-content; font-size: 10px; }
  .boss-hud { top: 202px; width: calc(100vw - 24px); padding: 8px 12px; }
  .boss-hud strong { font-size: 11px; }
  body:has(.boss-hud:not([hidden])) .notice { top: 264px; }
  .actions { max-width: 200px; gap: 7px; }
  .combat-actions { flex-direction: column; gap: 7px; align-items: flex-end; }
  .combat-actions .quiet { min-width: 130px; font-size: 11px; padding: 11px 12px; }
  .blow { padding: 17px 18px; min-width: 155px; }
  .blow span { font-size: 8px; }
  .floating-label { font-size: 10px; }
  .floating-label.speech { font-size: 9px; }
}
@media(max-height:650px) and (min-width:651px) {
  .menu { max-height: calc(100dvh - 24px); padding: 20px 28px; }
  .player-status { top: 118px; }
  .notice { top: 185px; }
  .boss-hud { top: 112px; }
}
@media(min-aspect-ratio:3/2) and (min-width:651px) {
  .boss-hud { top: 26px; width: clamp(140px, calc(100vw - 800px), 420px); }
}
@media(min-width:651px) and (max-width:900px) {
  .identity h1 { font-size: 21px; }
  .identity { padding: 12px 16px; }
  .status { width: 190px; }
}

.floating-label.party-target{border:2px dashed #ffe1a1;border-radius:50%;padding:20px 12px;background:#f4cb4e22;color:#fff1c4;font-size:13px;}
