:root {
  color-scheme: dark;
  --bg: #24201e;
  --panel: #322624;
  --panel-raised: #3c2c29;
  --line: #6b4e40;
  --text: #fdf0da;
  --muted: #d8bdab;
  --honey: #ffc87d;
  --rose: #ec9c9c;
  --rose-dark: #45252e;
  --teal: #a8d9c9;
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 280px;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 20% 0%, #593b2c 0%, transparent 42rem),
    radial-gradient(ellipse at 95% 83%, #303a32 0%, transparent 32rem),
    var(--bg);
}
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: #f5b98932; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
img { display: block; max-width: 100%; }
p, h1, h2, h3 { margin: 0; }
ul { padding: 0; margin: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 3px; }

#app {
  max-width: 1320px;
  margin-inline: auto;
  padding: max(8px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}
#top, #footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
#top { min-height: 58px; margin-bottom: 12px; }
#footer {
  margin-top: 13px;
  color: var(--muted);
  padding: 10px 2px 2px;
  font-size: 0.79rem;
}
#footer a { text-underline-offset: 3px; }
.return-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 670;
}
.return-link span {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  color: var(--honey);
  background: #ffffff0b;
  border: 1px solid #cd9b6c59;
  font-size: 1.6rem;
  line-height: 1;
  padding-bottom: 4px;
}
.top-actions { display: flex; gap: 8px; }

#main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 365px);
  align-items: stretch;
  gap: 18px;
}
.scene {
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #d59768a9;
  border-radius: 25px;
  --scene-bg: #55332c;
  background: var(--scene-bg) url("./assets/cedar-bathhouse.webp") center / cover no-repeat;
  box-shadow: 0 13px 36px #130d0d58, inset 0 0 0 3px #f9ca9a22;
}
.scene::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 8px;
  pointer-events: none;
  border: 1px solid #f6cda747;
  border-radius: 18px;
}
#c {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-select: none;
}
#main[data-page="wash"] canvas, #main[data-page="photo"] canvas { touch-action: none; cursor: crosshair; }
#c:focus-visible { outline-offset: -8px; }
.scene-title {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  padding: 32px;
  background: linear-gradient(116deg, #1b130fd1 0%, #2817119b 16%, transparent 51%);
}
.scene-title p {
  color: #ffcf9e;
  font-weight: 780;
  font-size: 0.94rem;
  margin-bottom: 7px;
}
.scene-title h1 {
  margin: 0;
  color: #fff1d2;
  font-family: Georgia, "Songti TC", "YuMincho", serif;
  font-size: 3.2rem;
  letter-spacing: 0;
  font-weight: 800;
  line-height: 1.14;
  text-shadow: 0 2px 9px #260f0d;
}
:lang(ja) .scene-title h1 { font-size: 2.64rem; }
.scene-message {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 15px;
  transform: translateX(-50%);
  max-width: calc(100% - 31px);
  width: max-content;
  padding: 8px 13px;
  border-radius: 13px;
  line-height: 1.45;
  font-size: 0.86rem;
  font-weight: 680;
  text-align: center;
  color: #fff0d8;
  background: #2e1920ed;
  border: 1px solid #e8ad9a83;
  pointer-events: none;
}
.reset-view {
  position: absolute;
  z-index: 3;
  right: 12px;
  top: 12px;
  padding: 7px 11px;
  min-height: 44px;
  border: 1px solid #b78d64;
  border-radius: 11px;
  background: #2c2522e9;
  color: var(--text);
}

.panel {
  min-width: 0;
  padding: 19px;
  background: linear-gradient(158deg, #493228 0%, var(--panel) 51%);
  border: 1px solid #ba87624f;
  box-shadow: 0 10px 30px #190e0b5c, inset 0 1px #f3bc7d2b;
  border-radius: 24px;
}
.counter, .panel-title, .bath-readouts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.counter { margin-bottom: 10px; color: var(--muted); font-weight: 700; font-size: .86rem; }
.ticket {
  color: #ffda9e;
  border: 1px solid #976745b3;
  border-radius: 99px;
  padding: 5px 10px;
  background: #6b42263f;
  white-space: nowrap;
}
.panel-title { margin: 6px 0 12px; }
.panel-title > span { color: var(--teal); font-size: .83rem; font-weight: 760; }
.panel h1 { font-size: 1.55rem; line-height: 1.22; }
.panel h2 { font-size: 1.46rem; line-height: 1.25; }
.bookings { display: grid; gap: 8px; }
.booking {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 73px;
  padding: 8px;
  border: 1px solid #c8916a42;
  border-radius: 14px;
  background: #bb8e7021;
}
.avatar {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: radial-gradient(circle at 47% 34%, #8c6250, #5f4039);
  border-radius: 50%;
  border: 1px solid #d6a77c64;
}
.booking.is-done { background: #59776827; }
.booking-copy strong { font-size: .97rem; margin-right: 6px; }
.booking-mode { display: inline-block; color: var(--honey); font-size: .75rem; font-weight: 700; }
.booking-copy p { margin-top: 4px; color: var(--muted); font-size: .76rem; line-height: 1.4; }
.booked { color: var(--teal); font-size: .78rem; font-weight: 780; }
.closing { border-left: 3px solid var(--honey); padding-left: 11px; margin: 0 0 10px; }
.closing p { font-size: .88rem; line-height: 1.5; margin-bottom: 8px; }
.lobby-actions, .result-actions, .sheet-actions, .wash-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lobby-actions { margin: 13px 0 12px; }
.lobby-actions > * { flex: 1 1 auto; }
.cabinet {
  padding-top: 11px;
  border-top: 1px dashed #c0896359;
  display: grid;
  grid-template-columns: repeat(5,minmax(0,1fr));
  gap: 5px;
}
.cabinet button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  min-height: 47px;
  padding: 4px 0;
  color: var(--muted);
  font-size: .74rem;
  white-space: nowrap;
}
.cabinet button span { display: block; color: var(--honey); font-size: 1.04rem; line-height: 1.25; }

.button, .tool, .extra, .scent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 7px 12px;
  text-decoration: none;
  text-align: center;
  border: 1px solid #b0785f8a;
  border-radius: 12px;
  background: #513733;
  color: var(--text);
  font-size: .86rem;
  font-weight: 760;
  line-height: 1.2;
  box-shadow: inset 0 1px #fbc5a729, 0 2px #1c111559;
  transition: background-color .16s, border-color .16s, transform .16s;
}
.button.primary { color: #371d24; background: #efa4a0; border-color: #efbeb3; }
.button.secondary { color: #daeee6; background: #3a5048; border-color: #70968a; }
.button.accept { color: #422820; background: #f5c188; border-color: #f9d4a6; min-width: 57px; }
.button.quiet { color: var(--muted); background: #4e3734a1; }
.button.gift { color: #ffdda9; background: #6a472f; }
.button.icon { font-size: 1.2rem; padding: 0; width: 44px; height: 44px; }
.button:disabled, .extra:disabled { color: #e1cbb8; opacity: .48; box-shadow: none; }
@media (hover:hover) {
  .button:hover:not(:disabled), .tool:hover, .extra:hover:not(:disabled), .cabinet button:hover, .guest:hover, .scent:hover {
    border-color: var(--honey);
    filter: brightness(1.12);
  }
}
.button:active:not(:disabled), .tool:active, .extra:active, .scent:active { transform: translateY(2px); }

.bath-title { margin-bottom: 6px; }
.bath-title .button { min-height: 41px; }
.wish { color: #ffd4a2; font-size: .82rem; margin-bottom: 9px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.meter label, .temperature label { display: block; color: var(--muted); font-size: .81rem; }
.meter b, .temperature b { color: var(--text); font-variant-numeric: tabular-nums; }
progress {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 8px;
  margin-top: 5px;
  margin-bottom: 7px;
  border: 0;
  border-radius: 99px;
  background: #201718;
  color: var(--teal);
}
progress::-webkit-progress-bar { background: #201718; border-radius: 99px; }
progress::-webkit-progress-value { background: #a4cebc; border-radius: 99px; }
#mood::-webkit-progress-value { background: #e8a5b3; }
progress::-moz-progress-bar { background: #a4cebc; border-radius: 99px; }
#mood::-moz-progress-bar { background: #e8a5b3; }
.bath-readouts { margin: 5px 0 11px; align-items: end; }
.temperature {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(59px,1fr) auto;
  grid-template-rows: auto 10px;
  column-gap: 7px;
  align-items: center;
}
.temperature meter { width: 100%; height: 13px; }
.temperature .warm { grid-column: 2; grid-row: 1 / span 2; min-height: 44px; padding-inline: 9px; }
.mode-readout { flex: 0 1 auto; text-align: right; white-space: nowrap; color: var(--muted); font-size: .77rem; }
.mode-readout span { display: block; color: var(--honey); font-variant-numeric: tabular-nums; font-size: 1.23rem; }
.tool-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
.tool, .extra { flex-direction: column; padding: 4px 2px 7px; font-size: .79rem; min-width: 0; background: #5b4138; }
.tool { min-height: 64px; border-radius: 14px; }
.tool[aria-pressed="true"] { color: #3e2927; background: #f3c789; border-color: #ffdfa1; }
.tool.suggested:not([aria-pressed="true"]) { border-color: #dab780; background: #654737; }
.tool-art { width: 37px; height: 33px; object-fit: contain; pointer-events: none; }
.guide { min-height: 39px; display: flex; align-items: center; color: var(--teal); font-size: .82rem; line-height: 1.4; padding-block: 5px; }
.wash-actions > * { flex: 1 1 auto; }
.wash-actions .primary { flex: 1.5 1 auto; min-height: 48px; }
.wash-actions .waiting { color: #e6c9c2; background: #714852; border-color: #9e6571; }
.extras { margin-top: 9px; display: grid; gap: 6px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.extra { min-height: 54px; background: #3e534b; border-color: #83a79875; font-size: .76rem; }
#rear-button { grid-column: 1 / -1; }
.stars { margin: 12px 0 14px; color: #a4917b; font-size: 2.1rem; line-height: 1; letter-spacing: .14em; }
.stars span { color: #ffd180; text-shadow: 0 0 20px #eea94c50; animation: appear .35s ease-out both; }
@keyframes appear { from { opacity: 0; transform: scale(.65); } to { opacity: 1; transform: scale(1); } }
.rewards { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.rewards span { padding: 6px 9px; border-radius: 8px; background: #7f5a3c50; border: 1px solid #b9886260; color: #ffdbac; font-size: .78rem; }
.result-actions { margin-top: 13px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.note { color: var(--muted); line-height: 1.48; font-size: .84rem; margin: 9px 0; }
.note:empty { display: none; }

#sheet {
  width: min(570px, calc(100vw - 24px));
  max-height: min(86svh, calc(100% - 28px));
  margin: auto;
  padding: 0;
  border: 1px solid #c99672a9;
  border-radius: 22px;
  color: var(--text);
  background: #392b29;
  box-shadow: 0 18px 70px #090607ce;
  overscroll-behavior: contain;
}
#sheet::backdrop { background: #130c0cc5; }
#sheet-content { padding: 0 17px 17px; }
.sheet-head {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 0 12px;
  background: #392b29;
  margin-bottom: 6px;
}
.sheet-head h2 { font-size: 1.35rem; line-height: 1.35; }
.sheet-head > div > p { color: var(--muted); font-size: .86rem; line-height: 1.46; margin-top: 3px; }
.sheet-head .icon { flex: none; font-size: 1.6rem; }
#sheet h3 { margin: 15px 0 10px; font-size: 1rem; }
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  color: var(--muted);
  font-size: .88rem;
}
.choice > select {
  color: var(--text);
  background: #5a4036;
  border: 1px solid #aa795c;
  border-radius: 8px;
  min-height: 44px;
  padding: 5px 25px 5px 10px;
  min-width: 55%;
  max-width: 70%;
  font-size: 1rem;
}
.choice > input { width: 57%; min-height: 44px; }
input { accent-color: var(--rose); }
.check { display: flex; min-height: 44px; gap: 8px; align-items: center; font-size: .88rem; }
.check input { width: 18px; height: 18px; }
.segmented, .scents { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented .selected { color: #392524; background: #f2c48e; }
.guests { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 10px; }
.guest {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 90px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
  background: #5b423a;
  border: 1px solid #b18a6dc4;
  border-radius: 12px;
  padding: 6px 3px;
  font-size: .86rem;
}
.guest small { color: #f5c5b5; }
.guest[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--honey); background: #734d3f; }
.guest b { position: absolute; right: 8px; top: 8px; color: var(--honey); }
.sheet-actions { margin-top: 14px; }
.items { display: grid; gap: 7px; }
.item, .stamp, .letter {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  border: 1px solid #bc8e7252;
  border-radius: 12px;
  padding: 7px;
  background: #c5927319;
}
.item-icon, .stamp > span { flex: 0 0 31px; text-align: center; color: var(--honey); font-size: 1.17rem; }
.item strong, .stamp strong, .letter strong { font-size: .88rem; }
.item button, .stamp small { margin-left: auto; flex-shrink: 0; }
.stamp small, .letter small { font-size: .72rem; color: var(--muted); }
.stamp.earned, .toy.found { background: #3e60504d; border-color: #8ab3a169; }
.item p, .stamp p, .letter p { color: var(--muted); font-size: .79rem; line-height: 1.45; margin: 3px 0 0; }
.letter small { margin-left: 7px; }
.toys, .photos { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.toy, .polaroid {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  border: 1px solid #bc8e7270;
  border-radius: 12px;
  padding: 7px;
  color: var(--muted);
  background: #302421;
  text-align: center;
  font-size: .83rem;
}
.toy span { font-size: 1.6rem; }
.toy:not(.found) span { filter: saturate(.35); opacity: .6; }
.photo-full, .polaroid img { width: 100%; height: auto; border-radius: 6px; }
.polaroid img { aspect-ratio: 1.36; object-fit: cover; }
.help { padding-left: 24px; margin: 0; color: var(--muted); }
.help li { margin-bottom: 8px; line-height: 1.48; }
.scent { min-height: 83px; flex-direction: column; gap: 5px; font-size: .92rem; }
.scent span { font-size: 1.45rem; }
.scent-berry { background: #834a60; }
.scent-yuzu { background: #856132; }
.scent-cedar { background: #416254; }
.scent-lavender { background: #675285; }
.empty { padding: 15px 6px; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.toast {
  z-index: 9;
  position: fixed;
  left: 50%;
  bottom: max(15px,env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-radius: 12px;
  color: #392721;
  background: #ffda9e;
  box-shadow: 0 5px 24px #1f120e82;
  padding: 11px 15px;
  width: max-content;
  max-width: calc(100% - 30px);
  font-size: .87rem;
  font-weight: 760;
  pointer-events: none;
}

@media (max-width: 760px) {
  #app { padding-inline: max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right)); }
  #top { min-height: 46px; margin-bottom: 5px; }
  #main { grid-template-columns: minmax(0,1fr); gap: 9px; }
  .scene { min-height: 0; height: min(56vw,390px); border-radius: 17px; }
  .scene::after { inset: 5px; border-radius: 12px; }
  #main[data-page="wash"] .scene { height: clamp(215px, 35svh, 470px); }
  #main:is([data-page="result"],[data-page="photo"],[data-page="dress"]) .scene { height: clamp(190px, 34svh, 445px); }
  .scene-title { padding: 13px 13px 0; background: linear-gradient(168deg,#2e1b16bf,transparent 50%); }
  .scene-title h1 { font-size: 2.02rem; }
  :lang(ja) .scene-title h1 { font-size: 1.73rem; }
  .scene-title p { font-size: .76rem; margin-bottom: 4px; }
  .panel { padding: 12px; border-radius: 17px; }
  .counter { margin-bottom: 6px; }
  .panel-title { margin: 2px 0 8px; }
  .bath-title { margin-bottom: 1px; }
  .bath-title .button { min-height: 44px; margin-top: -7px; }
  .bath-readouts { margin: 0 0 7px; }
  .tool { min-height: 57px; }
  .tool-art { width: 33px; height: 29px; }
  .guide { min-height: 30px; }
  .booking { min-height: 66px; }
  .bookings { gap: 6px; }
}

@media (max-width: 370px) {
  .booking-copy strong { font-size: .91rem; }
  .booking-copy p { font-size: .7rem; }
  .booking { grid-template-columns: 37px minmax(0,1fr) auto; gap: 6px; }
  .booking .avatar { width: 37px; height: 37px; }
  .tool, .extra { font-size: .74rem; }
  .panel { padding: 10px; }
}

@media (max-width: 760px) and (max-height: 635px) and (orientation: portrait) {
  #main[data-page="wash"] .scene { height: clamp(165px, 29svh, 200px); }
  #main[data-page="wash"] .panel { padding: 9px; }
  #main[data-page="wash"] .wish { margin-bottom: 5px; }
  #main[data-page="wash"] .guide { min-height: 28px; }
}

@media (orientation: landscape) and (max-height: 560px) and (min-width: 610px) {
  #app { padding-inline: max(10px,env(safe-area-inset-left)) max(10px,env(safe-area-inset-right)); }
  #top { min-height: 44px; margin-bottom: 5px; }
  #main { grid-template-columns: minmax(0, 1fr) minmax(265px, 37%); gap: 9px; align-items: start; }
  #main .scene, #main[data-page="wash"] .scene, #main:is([data-page="result"],[data-page="photo"],[data-page="dress"]) .scene {
    height: calc(100svh - 69px);
    min-height: 238px;
  }
  .scene-title { padding: 14px; }
  .scene-title h1 { font-size: 2rem; }
  .panel { padding: 10px; }
  .counter { margin-bottom: 4px; }
  .panel-title { margin-block: 2px 5px; }
  .tool { min-height: 52px; }
  .tool-art { height: 25px; width: 29px; }
  .bath-readouts { margin: 0 0 6px; }
  .guide { min-height: 24px; }
  .wash-actions .primary { min-height: 44px; }
  .meter progress { margin-bottom: 4px; }
  .bath-title .button { min-height: 44px; }
  .booking { min-height: 59px; }
  .panel h1 { font-size: 1.31rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
