:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  --ink: #594738;
  --ink-soft: #806c5b;
  --cream: #fff8ea;
  --peach: #f2a979;
  --peach-deep: #d97a58;
  --sun: #ffd58c;
  --sea-one: #8fd5cf;
  --sea-two: #5fb8bd;
  --mint: #8fbf98;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #f7ddb1; color: var(--ink); }

body { overscroll-behavior: none; }

button, textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100svh; display: grid; place-items: center; }

.world {
  position: relative;
  width: min(100%, 480px);
  min-height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, #f8c98d 0%, #f8dfad 38%, var(--sea-one) 39%, var(--sea-two) 100%);
  isolation: isolate;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: calc(20px + env(safe-area-inset-top)) 20px 0;
}

.eyebrow { margin: 0 0 2px; font-size: 11px; letter-spacing: .18em; color: rgba(89,71,56,.7); }
.topbar h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: .03em; }

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255,248,234,.65);
  box-shadow: 0 6px 20px rgba(104,78,52,.12);
}

.sun {
  position: absolute;
  z-index: 1;
  top: 92px;
  right: 42px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #ffe8a5;
  box-shadow: 0 0 0 14px rgba(255,232,165,.14), 0 0 50px rgba(255,238,171,.62);
}

.cloud { position: absolute; z-index: 2; width: 82px; height: 24px; border-radius: 50px; background: rgba(255,248,230,.48); filter: blur(.2px); }
.cloud::before, .cloud::after { content: ""; position: absolute; bottom: 3px; border-radius: 50%; background: inherit; }
.cloud::before { width: 36px; height: 36px; left: 13px; }
.cloud::after { width: 29px; height: 29px; right: 10px; }
.cloud-one { top: 140px; left: 18px; animation: drift 8s ease-in-out infinite alternate; }
.cloud-two { top: 205px; right: -18px; transform: scale(.78); animation: drift 11s ease-in-out infinite alternate-reverse; }

.island-wrap { position: absolute; z-index: 3; top: 245px; left: 50%; width: 250px; height: 105px; transform: translateX(-50%); opacity: .72; }
.island-silhouette { position: absolute; inset: 30px 30px 5px; border-radius: 50% 55% 25% 25%; background: #6b9b7b; box-shadow: inset 0 -13px #d8bd83; }
.island-hill { position: absolute; bottom: 34px; border-radius: 80% 80% 15% 15%; background: #79a887; }
.hill-one { width: 76px; height: 56px; left: 38px; transform: rotate(-7deg); }
.hill-two { width: 60px; height: 43px; right: 34px; transform: rotate(8deg); }
.island-light { position: absolute; width: 5px; height: 5px; top: 36px; right: 67px; border-radius: 50%; background: #ffe394; box-shadow: 0 0 15px 6px rgba(255,227,148,.8); }
.mist { position: absolute; left: -10%; width: 120%; height: 44px; border-radius: 50%; background: rgba(255,248,230,.62); filter: blur(11px); }
.mist-back { top: 17px; }
.mist-front { bottom: 0; opacity: .92; }

.boat-scene {
  position: absolute;
  z-index: 10;
  top: 324px;
  left: 50%;
  width: 190px;
  height: 138px;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  animation: bob 3.2s ease-in-out infinite;
}

.boat-shadow { position: absolute; left: 31px; bottom: 9px; width: 132px; height: 16px; border-radius: 50%; background: rgba(43,107,111,.25); filter: blur(3px); }
.boat { position: absolute; left: 20px; bottom: 22px; width: 150px; height: 48px; border-radius: 8px 8px 70px 70px; background: #d97857; border: 4px solid rgba(104,72,50,.25); box-shadow: inset 0 -12px rgba(132,66,48,.16); }
.boat::before { content: ""; position: absolute; top: -8px; left: 9px; width: 124px; height: 12px; border-radius: 50%; background: #f5b47e; border: 3px solid rgba(104,72,50,.18); }
.boat-name { position: absolute; top: 15px; left: 55px; font-size: 10px; letter-spacing: .16em; color: #fff4de; }

.dog { position: absolute; left: 63px; bottom: 55px; width: 74px; height: 75px; }
.dog-body { position: absolute; left: 18px; bottom: 0; width: 45px; height: 49px; border-radius: 48% 48% 35% 35%; background: #efad68; border: 3px solid #9d6644; }
.dog-head { position: absolute; left: 8px; top: 0; width: 59px; height: 52px; border-radius: 48% 48% 44% 44%; background: #f4bd78; border: 3px solid #9d6644; }
.dog-ear { position: absolute; top: -7px; width: 23px; height: 35px; border-radius: 70% 35% 70% 35%; background: #b9744f; border: 3px solid #8e5a40; z-index: -1; }
.dog-ear-left { left: -10px; transform: rotate(-24deg); }
.dog-ear-right { right: -10px; transform: scaleX(-1) rotate(-24deg); }
.dog-eye { position: absolute; top: 19px; width: 5px; height: 7px; border-radius: 50%; background: #594238; }
.dog-eye-left { left: 14px; }
.dog-eye-right { right: 14px; }
.dog-muzzle { position: absolute; left: 17px; bottom: 5px; width: 22px; height: 17px; border-radius: 50%; background: #ffe1aa; }
.dog-nose { position: absolute; left: 24px; bottom: 14px; width: 8px; height: 6px; border-radius: 50%; background: #5a4037; }
.dog-scarf { position: absolute; left: 14px; top: 45px; width: 50px; height: 11px; border-radius: 8px; background: #dc7458; transform: rotate(-3deg); }
.dog-scarf::after { content: ""; position: absolute; right: -8px; top: 5px; width: 22px; height: 10px; border-radius: 7px; background: #dc7458; transform: rotate(31deg); }
.dog-tail { position: absolute; right: 0; bottom: 19px; width: 25px; height: 13px; border: 4px solid #9d6644; border-left: 0; border-bottom: 0; border-radius: 0 90% 0 0; transform: rotate(-25deg); animation: wag .75s ease-in-out infinite alternate; }
.boat-charm { position: absolute; left: 34px; bottom: 55px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: #fff1a9; background: rgba(217,122,88,.76); box-shadow: 0 0 15px rgba(255,231,144,.7); }

.waves { position: absolute; left: -10%; width: 120%; height: 22px; opacity: .4; background: radial-gradient(32px 8px at 32px 0, transparent 95%, rgba(255,255,255,.8) 100%) 0 0 / 64px 20px repeat-x; }
.waves-back { z-index: 5; top: 380px; animation: wave 8s linear infinite; }
.waves-front { z-index: 11; top: 435px; animation: wave 6s linear infinite reverse; }

.sky-tokens { position: absolute; z-index: 7; inset: 100px 0 auto; height: 260px; pointer-events: none; }
.sky-token { position: absolute; font-size: 19px; animation: tokenFloat 3.6s ease-in-out infinite alternate; filter: drop-shadow(0 4px 6px rgba(75,71,50,.15)); }

.dialogue {
  position: relative;
  z-index: 30;
  width: calc(100% - 28px);
  margin: 452px auto 70px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.56);
  border-radius: 28px 28px 18px 18px;
  background: rgba(255,248,234,.91);
  box-shadow: 0 18px 45px rgba(54,92,87,.22);
  backdrop-filter: blur(13px);
}

.speaker-row { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #ffe2b5; font-size: 21px; }
.speaker-row div { display: grid; }
.speaker-row strong { font-size: 15px; }
.speaker-row span:last-child { font-size: 11px; color: var(--ink-soft); }
.dog-line { min-height: 48px; margin: 14px 0; line-height: 1.65; font-size: 15px; }

textarea {
  width: 100%;
  resize: none;
  border: 1px solid rgba(144,108,76,.16);
  border-radius: 17px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255,255,255,.62);
  outline: none;
  font-size: 16px;
  line-height: 1.55;
}
textarea:focus { border-color: rgba(217,122,88,.55); box-shadow: 0 0 0 4px rgba(242,169,121,.13); }

.quick-moods { display: flex; gap: 7px; margin: 10px 0 14px; overflow-x: auto; scrollbar-width: none; }
.quick-moods::-webkit-scrollbar { display: none; }
.quick-moods button { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 8px 11px; color: var(--ink); background: #f7ead2; font-size: 12px; }
.quick-moods button.selected { color: #fff9ef; background: var(--peach-deep); }

.form-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; }
.button-primary, .button-secondary { min-height: 46px; border-radius: 15px; padding: 10px 13px; }
.button-primary { border: 0; color: #fffaf0; background: var(--peach-deep); box-shadow: 0 8px 18px rgba(182,94,65,.22); }
.button-secondary { border: 1px solid rgba(118,89,65,.14); color: var(--ink); background: #f8ecd8; }

.choice-panel, .result-panel { margin-top: 8px; }
.choice-panel > p, .result-panel > p { line-height: 1.65; }
.choices { display: grid; gap: 8px; }
.choice-button { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 9px; width: 100%; min-height: 58px; padding: 9px 12px; text-align: left; border: 1px solid rgba(151,112,76,.14); border-radius: 16px; color: var(--ink); background: #fff9ed; }
.choice-button span:first-child { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #f6e2be; font-size: 18px; }
.choice-button strong { display: block; font-size: 14px; }
.choice-button small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 11px; line-height: 1.35; }
.result-panel .button-secondary { width: 100%; margin-top: 5px; }

.progress-strip { position: absolute; z-index: 32; left: 22px; right: 22px; bottom: calc(13px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; color: rgba(255,248,234,.92); font-size: 11px; text-shadow: 0 1px 4px rgba(44,88,89,.3); }
.day-dots { display: flex; gap: 5px; }
.day-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.34); }
.day-dot.active { background: #fff0bd; box-shadow: 0 0 0 3px rgba(255,240,189,.18); }
.day-dot.done { background: #ffe3a4; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

@keyframes bob { from { transform: translate(-50%, -3px) rotate(-.7deg); } to { transform: translate(-50%, 4px) rotate(.7deg); } }
@keyframes wag { from { transform: rotate(-34deg); } to { transform: rotate(9deg); } }
@keyframes drift { from { transform: translateX(-8px); } to { transform: translateX(14px); } }
@keyframes wave { to { background-position-x: 128px; } }
@keyframes tokenFloat { from { transform: translateY(0) rotate(-5deg); } to { transform: translateY(-9px) rotate(6deg); } }

@media (min-height: 820px) {
  .dialogue { margin-top: 475px; }
  .boat-scene { top: 342px; }
  .island-wrap { top: 258px; }
}

@media (max-height: 700px) {
  .dialogue { margin-top: 420px; }
  .boat-scene { top: 295px; }
  .island-wrap { top: 224px; }
  .sun { top: 78px; }
}

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