:root {
  color-scheme: dark;
  --ink: #f3ead8;
  --muted: rgba(243, 234, 216, 0.72);
  --line: rgba(243, 234, 216, 0.16);
  --night-0: #07101c;
  --night-1: #0b1727;
  --night-2: #14233a;
  --wood: #17191d;
  --warm: #e4bd75;
  --warm-soft: rgba(228, 189, 117, 0.22);
  --blue-soft: rgba(76, 115, 157, 0.32);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(74, 96, 123, 0.22), transparent 30vw),
    linear-gradient(145deg, #101725 0%, #0b1019 52%, #05080d 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.prototype-shell {
  display: grid;
  place-items: center;
  min-height: 100svh;
  padding: 16px;
}

.phone {
  width: min(100%, 430px);
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 38px;
  background: #080b10;
  box-shadow: var(--shadow);
}

.app {
  position: relative;
  height: min(820px, calc(100svh - 32px));
  min-height: 670px;
  overflow: hidden;
  border-radius: 30px;
  background: #0a111d;
  isolation: isolate;
  touch-action: manipulation;
}

.app::before {
  position: absolute;
  top: 10px;
  left: 50%;
  z-index: 10;
  width: 78px;
  height: 22px;
  border-radius: 99px;
  background: rgba(4, 6, 10, 0.72);
  content: "";
  transform: translateX(-50%);
}

.app::after {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025), transparent 15%, transparent 85%, rgba(255, 255, 255, 0.025)),
    radial-gradient(circle at 50% 45%, transparent 54%, rgba(0, 0, 0, 0.28));
  content: "";
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(5, 8, 14, 0.02), rgba(5, 8, 14, 0.16)),
    url("./assets/lighthouse-night.webp") center / cover no-repeat,
    #0a111d;
}

.scene::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(3, 7, 13, 0.03), rgba(3, 7, 13, 0.2));
  content: "";
}

.sky,
.ocean,
.window-frame,
.table-edge {
  position: absolute;
}

.sky {
  z-index: 2;
  pointer-events: none;
  background: transparent;
  top: 0;
  right: 8%;
  left: 12%;
  height: 48%;
}

.moon {
  display: none;
  position: absolute;
  top: 20%;
  left: 44%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e6dcc6;
  box-shadow: 0 0 42px rgba(230, 220, 198, 0.35);
}

.moon::after {
  position: absolute;
  top: -4px;
  right: -7px;
  width: 30px;
  height: 30px;
  border-radius: inherit;
  background: #0e1a2c;
  content: "";
}

.star {
  display: none;
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(245, 237, 220, 0.9);
}

.star-a { top: 18%; left: 16%; }
.star-b { top: 11%; left: 70%; }
.star-c { top: 30%; left: 83%; }
.star-d { top: 22%; left: 58%; }

.shooting-star {
  position: absolute;
  top: 22%;
  left: -30%;
  width: 90px;
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(247, 229, 186, 0.9));
  transform: rotate(-18deg);
}

.shooting-star.is-visible {
  animation: shoot 4.6s ease-in-out forwards;
}

.ocean {
  opacity: 0;
  top: 39%;
  right: 8%;
  left: 12%;
  height: 30%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(28, 43, 66, 0.56), rgba(5, 13, 24, 0.9)),
    repeating-linear-gradient(178deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 17px);
}

.moon-road {
  position: absolute;
  top: -20px;
  left: 37%;
  width: 58px;
  height: 170%;
  opacity: 0.55;
  background: linear-gradient(180deg, rgba(238, 224, 190, 0.2), rgba(238, 224, 190, 0));
  clip-path: polygon(45% 0, 58% 0, 100% 100%, 0 100%);
}

.wave {
  position: absolute;
  left: -20%;
  width: 140%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(190, 206, 219, 0.24), transparent);
  animation: drift 9s ease-in-out infinite alternate;
}

.wave-a { top: 28%; }
.wave-b { top: 52%; animation-duration: 13s; }
.wave-c { top: 74%; animation-duration: 17s; }

.window-frame span,
.window-frame::before,
.window-frame::after {
  position: absolute;
  background: linear-gradient(90deg, #111721, #2b2d2c 45%, #0b0e13);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.04);
  content: "";
}

.window-frame {
  display: none;
  inset: 0;
  pointer-events: none;
}

.window-frame::before {
  top: 0;
  left: 10%;
  width: 16px;
  height: 72%;
}

.window-frame::after {
  top: 0;
  right: 7%;
  width: 16px;
  height: 73%;
}

.frame-left {
  top: 0;
  left: 58%;
  width: 14px;
  height: 72%;
}

.frame-right {
  top: 0;
  left: 86%;
  width: 16px;
  height: 74%;
}

.frame-bottom {
  top: 68%;
  left: 8%;
  width: 86%;
  height: 22px;
}

.table-edge {
  display: none;
  right: 0;
  bottom: 0;
  left: 0;
  height: 31%;
  background:
    radial-gradient(ellipse at 82% 12%, rgba(227, 185, 111, 0.13), transparent 34%),
    linear-gradient(165deg, #15171b, #22201c 52%, #111318);
  clip-path: polygon(0 20%, 100% 0, 100% 100%, 0 100%);
}

.lantern,
.kettle,
.cup,
.journal-book,
.ship,
.hidden-ship {
  position: absolute;
  z-index: 4;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lantern {
  right: 0;
  bottom: 0;
  width: 34%;
  height: 30%;
}

.lantern-glow {
  display: none;
}

.lantern-body {
  display: none;
}

.lantern-top {
  display: none;
}

.lantern-flame {
  display: none;
  animation: flicker 2.6s ease-in-out infinite alternate;
}

.beam {
  position: absolute;
  top: 24%;
  right: 11%;
  z-index: 2;
  width: 62%;
  height: 12%;
  opacity: 0.28;
  background: linear-gradient(90deg, rgba(239, 221, 178, 0.36), transparent);
  clip-path: polygon(0 25%, 100% 0, 100% 100%, 0 75%);
  transform-origin: right center;
  animation: beamSweep 9s ease-in-out infinite alternate;
}

.beam.is-bright {
  opacity: 0.7;
  filter: blur(0.5px);
}

.kettle {
  right: 0;
  bottom: 0;
  width: 46%;
  height: 36%;
}

.kettle::before {
  position: absolute;
  inset: 0;
  opacity: 0;
  content: "";
}

.kettle::after {
  display: none;
  content: "";
}

.steam {
  position: absolute;
  bottom: 60px;
  width: 8px;
  height: 44px;
  border-radius: 50%;
  opacity: 0;
  border-left: 2px solid rgba(236, 221, 191, 0.55);
}

.kettle.is-warm .steam {
  animation: steam 2.6s ease-in-out infinite;
  opacity: 1;
}

.steam-a { left: 24px; }
.steam-b { left: 44px; animation-delay: 0.4s; }
.steam-c { left: 61px; animation-delay: 0.8s; }

.cup {
  right: 32%;
  bottom: 8%;
  width: 22%;
  height: 17%;
}

.cup::after {
  display: none;
  content: "";
}

.cup.is-filled::before {
  position: absolute;
  top: 16%;
  left: 20%;
  width: 52%;
  height: 12%;
  border-radius: 50%;
  opacity: 0.7;
  background: rgba(224, 171, 96, 0.38);
  content: "";
}

.journal-book {
  left: 0;
  bottom: 0;
  width: 45%;
  height: 28%;
}

.journal-book span {
  display: none;
  max-width: 90px;
  margin: 28px auto 0;
  color: rgba(23, 20, 17, 0.54);
  font-family: Georgia, serif;
  font-size: 0.78rem;
  line-height: 1.35;
}

.ship,
.hidden-ship {
  top: 40%;
  left: 48%;
  width: 18%;
  height: 10%;
}

.ship span,
.hidden-ship span {
  position: absolute;
  bottom: 4px;
  left: 8px;
  width: 32px;
  height: 9px;
  border-radius: 0 0 14px 14px;
  background: #151a22;
}

.ship span {
  display: none;
}

.ship span::before,
.hidden-ship span::before {
  position: absolute;
  bottom: 9px;
  left: 12px;
  width: 8px;
  height: 11px;
  border-radius: 4px 4px 0 0;
  background: rgba(234, 194, 115, 0.8);
  box-shadow: 11px 2px 0 rgba(234, 194, 115, 0.48);
  content: "";
}

.hidden-ship {
  left: 14%;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.75);
}

.hidden-ship.is-visible {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 1.8s ease;
}

.opening {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  align-content: center;
  justify-items: center;
  padding: 42px;
  text-align: center;
  background: linear-gradient(90deg, rgba(8, 12, 18, 0.74), rgba(8, 12, 18, 0.2));
}

.opening.is-active {
  display: grid;
}

.opening p {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 8.4vw, 2.35rem);
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  animation: softIn 2.4s ease both;
}

.opening span {
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  animation: softIn 3.2s ease both;
}

.opening button {
  margin-top: 46px;
  border: 0;
  background: transparent;
  color: rgba(243, 234, 216, 0.86);
  animation: softIn 4s ease both;
}

.hud {
  position: absolute;
  top: 34px;
  right: 18px;
  left: 18px;
  z-index: 9;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.night-copy {
  max-width: 230px;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.has-begun .night-copy {
  opacity: 1;
}

.night-copy span,
.panel header p {
  display: block;
  color: rgba(243, 234, 216, 0.62);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.night-copy strong {
  display: block;
  margin-top: 6px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 400;
}

.corner-control {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 50%;
  background: rgba(8, 11, 15, 0.36);
  color: rgba(243, 234, 216, 0.62);
  pointer-events: auto;
}

.first-guidance {
  position: absolute;
  right: 22px;
  bottom: 132px;
  left: 22px;
  z-index: 9;
  display: none;
  padding: 12px 14px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 18px;
  background: rgba(8, 11, 15, 0.38);
  backdrop-filter: blur(16px);
}

.first-guidance.is-visible {
  display: block;
}

.first-guidance p {
  margin: 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.94rem;
  line-height: 1.45;
}

.activity-dock {
  position: absolute;
  right: 12px;
  bottom: 14px;
  left: 12px;
  z-index: 9;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.has-begun .activity-dock {
  opacity: 1;
  pointer-events: auto;
}

.activity-dock button,
.quiet-button,
.debug-box button,
.choice-button,
.journal-actions button {
  min-height: 43px;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 14px;
  background: rgba(12, 16, 21, 0.58);
  color: rgba(243, 234, 216, 0.86);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.activity-dock button:active,
.choice-button:active {
  transform: translateY(1px);
}

.reflection {
  position: absolute;
  right: 24px;
  bottom: 118px;
  left: 24px;
  z-index: 11;
  min-height: 0;
  color: rgba(244, 234, 214, 0);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  line-height: 1.5;
  text-align: center;
  pointer-events: none;
  transition: color 0.8s ease;
}

.reflection.is-visible {
  color: rgba(244, 234, 214, 0.95);
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: none;
  align-items: end;
  padding: 16px;
  background: linear-gradient(180deg, transparent, rgba(2, 4, 8, 0.54));
}

.panel.is-open {
  display: flex;
}

.panel-card {
  width: 100%;
  max-height: 74%;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 24px;
  background: rgba(9, 13, 18, 0.86);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px);
}

.panel-card.compact {
  max-height: 84%;
}

.panel header {
  display: flex;
  align-items: start;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel header h1 {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 400;
}

.panel header button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.activity-content {
  display: grid;
  gap: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.activity-content p {
  margin: 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.choice-button {
  padding: 12px;
  text-align: left;
}

.listen-meter {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}

.listen-meter span {
  display: block;
  width: var(--listen-progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f91b8, #dfbd79);
  transition: width 0.4s ease;
}

textarea {
  width: 100%;
  min-height: 128px;
  resize: vertical;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 16px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  line-height: 1.5;
}

.journal-actions {
  display: flex;
  gap: 10px;
}

.journal-actions button {
  flex: 1;
}

.entry-list {
  display: grid;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
}

.entry-list article {
  padding: 10px 12px;
  border: 1px solid rgba(243, 234, 216, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.entry-list time {
  display: block;
  margin-bottom: 4px;
  color: rgba(243, 234, 216, 0.48);
  font-size: 0.72rem;
}

.setting-list {
  display: grid;
  gap: 12px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.04);
}

.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row small {
  margin-top: 4px;
  color: rgba(243, 234, 216, 0.58);
}

.switch-row input {
  width: 44px;
  height: 24px;
  accent-color: #d7b574;
}

.debug-box {
  padding: 12px;
  border: 1px dashed rgba(243, 234, 216, 0.18);
  border-radius: 16px;
  color: var(--muted);
}

.debug-box summary {
  cursor: pointer;
}

.debug-box pre {
  overflow: auto;
  margin: 10px 0;
  font-size: 0.72rem;
}

/* Ordered image scene: ocean, boat, beam, window, table, book, cup, lamp. */
.scene {
  background: #07101c;
}

.scene::before {
  z-index: 8;
  background:
    radial-gradient(circle at 50% 46%, transparent 48%, rgba(0, 0, 0, 0.24)),
    linear-gradient(180deg, rgba(3, 6, 10, 0.04), rgba(3, 6, 10, 0.18));
}

.scene-layer,
.scene button img {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}

.scene-layer {
  position: absolute;
  pointer-events: none;
}

.ocean-layer {
  inset: 0;
  z-index: 1;
  object-fit: cover;
}

.sky {
  display: block;
  inset: 0;
  height: auto;
  z-index: 7;
}

.ship,
.hidden-ship {
  top: 38%;
  left: 49%;
  z-index: 2;
  width: 22%;
  height: auto;
  padding: 0;
  opacity: 0.86;
}

.ship img,
.hidden-ship img {
  height: auto;
}

.hidden-ship {
  top: 42%;
  left: 14%;
  width: 17%;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

.hidden-ship.is-visible {
  opacity: 0.76;
  pointer-events: auto;
}

.beam {
  top: -6%;
  left: -34%;
  z-index: 3;
  width: 168%;
  height: 72%;
  opacity: 0.42;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(240, 220, 172, 0.18), transparent 22%),
    linear-gradient(180deg, rgba(242, 220, 166, 0.5), rgba(242, 220, 166, 0.16) 42%, transparent 78%);
  clip-path: polygon(47% 0, 53% 0, 68% 100%, 32% 100%);
  filter: blur(1.5px);
  transform: translateX(var(--beam-x, 0%)) rotate(var(--beam-tilt, 0deg));
  transform-origin: 50% 0;
  animation: beamPan 15s ease-in-out infinite alternate;
}

.beam.is-bright {
  opacity: 0.68;
}

.beam.is-paused {
  animation-play-state: paused;
}

.window-layer {
  inset: 0;
  z-index: 4;
  object-fit: cover;
}

.table-layer {
  left: 0;
  right: 0;
  bottom: -1%;
  z-index: 5;
  width: 100%;
  height: auto;
}

.journal-book,
.cup,
.lantern,
.kettle {
  z-index: 6;
  padding: 0;
  border: 0;
  background: transparent;
}

.journal-book {
  left: 2%;
  bottom: 4%;
  width: 43%;
  height: auto;
  transform: rotate(-4deg);
}

.journal-book img,
.cup img,
.lantern img {
  height: auto;
}

.cup {
  right: 27%;
  bottom: 10%;
  width: 22%;
  height: auto;
}

.cup.is-filled::before {
  display: none;
}

.lantern {
  right: -5%;
  bottom: 0;
  width: 38%;
  height: auto;
}

.kettle {
  right: 22%;
  bottom: 8%;
  width: 28%;
  height: 18%;
}

.kettle.is-warm .steam {
  z-index: 7;
}

.shooting-star {
  z-index: 7;
}

@keyframes beamPan {
  from {
    transform: translateX(-18%) rotate(-10deg);
  }
  to {
    transform: translateX(18%) rotate(10deg);
  }
}

.is-cinema {
  filter: grayscale(1) contrast(1.16);
}

.is-cinema .app::before {
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.02);
}

.is-cinema .app::after {
  background:
    radial-gradient(circle at 50% 45%, transparent 50%, rgba(0, 0, 0, 0.42)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 4px);
}

@keyframes flicker {
  from { transform: scaleY(0.92) translateY(1px); opacity: 0.82; }
  to { transform: scaleY(1.08) translateY(-1px); opacity: 1; }
}

@keyframes beamSweep {
  from { transform: rotate(-2deg); }
  to { transform: rotate(2.5deg); }
}

@keyframes drift {
  from { transform: translateX(-14px); }
  to { transform: translateX(18px); }
}

@keyframes softIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes steam {
  from { transform: translateY(12px) scaleX(0.7); opacity: 0; }
  40% { opacity: 0.7; }
  to { transform: translateY(-18px) scaleX(1.3); opacity: 0; }
}

@keyframes shoot {
  0% { opacity: 0; transform: translateX(0) rotate(-18deg); }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(430px) rotate(-18deg); }
}

@media (max-width: 480px) {
  .prototype-shell {
    padding: 0;
  }

  .phone {
    width: 100%;
    height: 100svh;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .app {
    width: 100%;
    height: 100svh;
    min-height: 0;
    border-radius: 0;
  }
}

@media (max-height: 700px) {
  .app {
    min-height: 0;
  }

  .activity-dock {
    grid-template-columns: repeat(6, 1fr);
  }

  .activity-dock button {
    min-height: 38px;
    font-size: 0.76rem;
  }
}

/* Landscape-first gameplay layout. */
.prototype-shell {
  padding: 0;
}

.phone {
  width: min(calc(100vw - 28px), calc((100svh - 28px) * 16 / 9), 1040px);
  height: auto;
  padding: 10px;
  border-radius: 34px;
}

.app {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  border-radius: 26px;
}

.app::before {
  left: 57%;
}

.scene {
  top: 0;
  right: 0;
  bottom: 0;
  left: 34%;
  border-left: 1px solid rgba(243, 234, 216, 0.08);
}

.scene::before {
  background:
    radial-gradient(circle at 54% 50%, transparent 52%, rgba(0, 0, 0, 0.18)),
    linear-gradient(90deg, rgba(3, 6, 10, 0.06), rgba(3, 6, 10, 0.16));
}

.opening {
  right: auto;
  width: 34%;
  align-content: center;
  justify-items: start;
  padding: clamp(22px, 4vw, 52px);
  text-align: left;
  background:
    linear-gradient(90deg, rgba(10, 13, 19, 0.94), rgba(18, 22, 30, 0.86)),
    radial-gradient(circle at 85% 48%, rgba(226, 187, 116, 0.14), transparent 30%);
}

.opening p {
  max-width: 100%;
  font-size: clamp(1.7rem, 3.1vw, 2.55rem);
  letter-spacing: 0.28em;
  white-space: nowrap;
}

.opening span {
  max-width: 270px;
  line-height: 1.6;
}

.opening button {
  margin-top: 34px;
  text-align: left;
}

.hud {
  top: 24px;
  right: auto;
  left: 24px;
  z-index: 13;
  width: calc(34% - 48px);
}

.night-copy {
  max-width: 100%;
}

.corner-control {
  position: absolute;
  top: 24px;
  right: 24px;
}

.activity-dock {
  right: auto;
  bottom: auto;
  left: 24px;
  top: 34%;
  width: calc(34% - 48px);
  grid-template-columns: 1fr;
  gap: 7px;
}

.activity-dock button {
  min-height: 36px;
  border-radius: 8px;
  background: rgba(19, 18, 19, 0.78);
}

.first-guidance {
  display: none !important;
}

.reflection {
  right: auto;
  bottom: auto;
  top: 24%;
  left: 24px;
  width: calc(34% - 48px);
  text-align: left;
  font-size: 0.86rem;
  line-height: 1.35;
}

.ocean-layer,
.window-layer {
  object-fit: cover;
}

.ship {
  top: 47%;
  left: auto;
  z-index: 2;
  width: 12%;
  opacity: 0.72;
  animation: boatDrift 46s linear infinite;
}

.hidden-ship {
  top: 52%;
  left: 16%;
  width: 9%;
}

.beam {
  top: -20%;
  left: -46%;
  width: 192%;
  height: 88%;
  opacity: 0.26;
}

.table-layer {
  display: none;
}

.journal-book {
  left: 5%;
  bottom: 8%;
  width: 20%;
}

.cup {
  right: 30%;
  bottom: 12%;
  width: 11%;
}

.lantern {
  right: 2%;
  bottom: 0;
  width: 18%;
}

.kettle {
  right: 27%;
  bottom: 9%;
  width: 14%;
  height: 22%;
}

@keyframes boatDrift {
  from {
    transform: translateX(510%);
  }
  to {
    transform: translateX(-210%);
  }
}

@media (max-width: 760px) {
  .prototype-shell {
    padding: 8px;
  }

  .phone {
    width: min(calc(100vw - 16px), calc((100svh - 16px) * 16 / 9));
    border-radius: 24px;
  }

  .app {
    border-radius: 18px;
  }

  .opening {
    padding: 20px;
  }

  .opening p {
    font-size: clamp(1rem, 4.2vw, 1.65rem);
  }

  .opening span,
  .opening button,
  .activity-dock button,
  .night-copy strong {
    font-size: 0.78rem;
  }

  .hud,
  .activity-dock,
  .first-guidance,
  .reflection {
    left: 14px;
    width: calc(34% - 24px);
  }

  .activity-dock {
    gap: 6px;
  }

  .activity-dock button {
    min-height: 31px;
  }
}

/* Final landscape tuning: reference-style menu and quiet activity notes. */
.hud {
  top: 26px;
}

.night-copy span {
  color: rgba(232, 222, 201, 0.86);
  font-size: 0.67rem;
  letter-spacing: 0.22em;
}

.night-copy strong {
  margin-top: 5px;
  color: rgba(247, 238, 218, 0.96);
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  line-height: 1.08;
}

.activity-dock {
  top: 38%;
  gap: clamp(8px, 1.7vh, 15px);
}

.activity-dock button {
  position: relative;
  min-height: 30px;
  padding: 0 0 0 46px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(235, 225, 204, 0.9);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.88rem, 1.55vw, 1.2rem);
  line-height: 1.2;
  text-align: left;
  backdrop-filter: none;
}

.activity-dock button::before {
  position: absolute;
  left: 0;
  top: 50%;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: rgba(235, 225, 204, 0.84);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  content: "·";
  transform: translateY(-50%);
}

.activity-dock button[data-activity="tea"]::before { content: "~"; }
.activity-dock button[data-activity="light"]::before { content: "◐"; }
.activity-dock button[data-activity="listen"]::before { content: "≋"; }
.activity-dock button[data-activity="journal"]::before { content: "□"; }
.activity-dock button[data-activity="ships"]::before { content: "⌁"; }
.activity-dock button[data-activity="rest"]::before { content: "○"; }

.activity-dock button:hover,
.activity-dock button:focus-visible {
  color: #fff6df;
  outline: 0;
}

.activity-dock button:hover::after,
.activity-dock button:focus-visible::after {
  position: absolute;
  right: 0;
  bottom: -4px;
  left: 46px;
  height: 1px;
  opacity: 0.42;
  background: rgba(235, 225, 204, 0.7);
  content: "";
}

.has-panel .activity-dock {
  opacity: 0;
  pointer-events: none;
}

.ship {
  top: 55%;
  width: 9.2%;
  opacity: 0.66;
}

@keyframes boatDrift {
  from {
    transform: translateX(620%);
  }
  to {
    transform: translateX(-260%);
  }
}

.panel.activity-panel {
  inset: auto auto 74px 24px;
  z-index: 24;
  width: calc(34% - 48px);
  padding: 0;
  background: transparent;
  pointer-events: auto;
}

.panel.activity-panel.is-open {
  display: block;
}

.activity-panel .panel-card {
  max-height: min(46vh, 178px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: auto;
}

.activity-panel header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  margin-bottom: 9px;
}

.activity-panel header p {
  grid-column: 1;
  grid-row: 1;
  color: rgba(232, 222, 201, 0.58);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
}

.activity-panel header h1 {
  grid-column: 1;
  grid-row: 2;
  margin-top: 4px;
  color: rgba(247, 238, 218, 0.96);
  font-size: clamp(1.05rem, 2vw, 1.42rem);
  line-height: 1.05;
}

.activity-panel header button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: rgba(232, 222, 201, 0.66);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  line-height: 1;
  pointer-events: auto;
}

.activity-content {
  gap: 8px;
  color: rgba(232, 222, 201, 0.74);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  line-height: 1.38;
}

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

.choice-button,
.journal-actions button {
  min-height: 34px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid rgba(232, 222, 201, 0.22);
  border-radius: 0;
  background: transparent;
  color: rgba(247, 238, 218, 0.9);
  font-family: Georgia, "Times New Roman", serif;
  text-align: left;
  backdrop-filter: none;
}

.reflection {
  top: auto;
  bottom: 24px;
  min-height: 2.9em;
  color: rgba(244, 234, 214, 0);
  font-family: "Courier New", ui-monospace, monospace;
  font-size: clamp(0.72rem, 1.14vw, 0.9rem);
  line-height: 1.45;
  letter-spacing: 0;
}

.has-panel .reflection {
  bottom: 22px;
  z-index: 23;
}

.reflection.is-visible {
  color: rgba(238, 229, 209, 0.92);
}

.reflection.is-visible::after {
  content: "_";
  opacity: 0.72;
  animation: cursorBlink 1s steps(2, end) infinite;
}

@keyframes cursorBlink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .activity-dock {
    top: 39%;
    gap: 4px;
  }

  .activity-dock button {
    min-height: 23px;
    padding-left: 30px;
    font-size: 0.72rem;
  }

  .activity-dock button::before {
    width: 20px;
    height: 20px;
    font-size: 0.78rem;
  }

  .panel.activity-panel {
    bottom: 12px;
    left: 14px;
    width: calc(34% - 24px);
  }

  .activity-content,
  .choice-button,
  .journal-actions button {
    font-size: 0.68rem;
  }
}
