:root {
  color-scheme: light;
  --willow-ink: #17251d;
  --willow-muted: #667067;
  --willow-soft: #667067;
  --willow-green: #4f765d;
  --willow-green-deep: #31523d;
  --willow-sage: #dce7d8;
  --willow-paper: #fbfcf7;
  --willow-line: rgba(35, 65, 45, 0.13);
  --willow-shadow: 0 24px 70px rgba(40, 62, 45, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #eef2e7;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--willow-ink);
  background:
    radial-gradient(circle at 12% -4%, rgba(181, 205, 172, 0.66), transparent 36%),
    radial-gradient(circle at 94% 18%, rgba(225, 214, 176, 0.42), transparent 30%),
    linear-gradient(180deg, #f7f8f0 0%, #eef2e7 55%, #e7ecdf 100%);
  font-family: "Avenir Next", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #4f765d;
  outline-offset: 3px;
}

.wish-page {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 18px calc(40px + env(safe-area-inset-bottom, 0px));
}

.wish-topbar {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto minmax(76px, 1fr);
  align-items: center;
  min-height: 64px;
  padding-top: env(safe-area-inset-top, 0px);
}

.wish-back,
.wish-topbar-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--willow-muted);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.wish-back {
  gap: 6px;
  justify-self: start;
  padding: 0 8px 0 0;
  font-size: 14px;
}

.wish-back span:first-child {
  font-size: 20px;
  line-height: 1;
}

.wish-topbar-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.wish-topbar-action {
  justify-self: end;
  justify-content: flex-end;
  padding: 0 0 0 10px;
  font-size: 13px;
}

.wish-main {
  position: relative;
  z-index: 1;
}

.wish-hero {
  display: grid;
  justify-items: center;
  padding: 26px 0 12px;
  text-align: center;
}

.wish-kicker,
.wish-card-kicker,
.wish-analysis-eyebrow {
  margin: 0;
  color: var(--willow-green);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.wish-hero h1 {
  margin: 7px 0 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 560;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.wish-willow-art {
  position: relative;
  width: min(360px, 88vw);
  height: 178px;
  margin-top: 8px;
  overflow: hidden;
}

.wish-branch {
  position: absolute;
  display: block;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #584c35, #887759 56%, rgba(122, 105, 76, 0.05));
  transform-origin: left center;
}

.wish-branch-main {
  top: 36px;
  left: -16px;
  width: 318px;
  transform: rotate(4deg);
}

.wish-branch-small {
  top: 39px;
  left: 116px;
  width: 100px;
  height: 2px;
  transform: rotate(23deg);
}

.wish-thread {
  position: absolute;
  top: 44px;
  left: 55%;
  width: 1px;
  height: 44px;
  background: linear-gradient(180deg, rgba(85, 91, 67, 0.56), rgba(85, 91, 67, 0.2));
  transform-origin: top center;
  animation: wish-thread-breathe 5.4s ease-in-out infinite;
}

.wish-leaf {
  position: absolute;
  display: block;
  width: 42px;
  height: 72px;
  border-radius: 100% 0 100% 0;
  background:
    linear-gradient(70deg, transparent 48%, rgba(235, 246, 227, 0.42) 49%, transparent 52%),
    linear-gradient(145deg, #719879, #3f6e51 68%, #315944);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 18px 32px rgba(45, 80, 56, 0.16);
  transform-origin: 50% 0;
}

.wish-leaf-main {
  top: 83px;
  left: calc(55% - 20px);
  animation: wish-leaf-sway 5.4s ease-in-out infinite;
  transition: top 1s cubic-bezier(.2, .8, .2, 1), left 1s ease, transform 1s ease, opacity .45s ease, filter .45s ease;
}

.wish-leaf-ambient {
  width: 16px;
  height: 30px;
  opacity: 0.48;
  box-shadow: none;
}

.wish-leaf-ambient-one {
  top: 43px;
  left: 25%;
  transform: rotate(32deg);
}

.wish-leaf-ambient-two {
  top: 25px;
  right: 27%;
  transform: rotate(78deg) scale(.78);
}

.wish-ground {
  position: absolute;
  left: 19%;
  right: 12%;
  bottom: 8px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(61, 76, 59, 0.15), transparent);
}

.wish-willow-art[data-state="empty"] .wish-leaf-main {
  opacity: 0.2;
  filter: saturate(.4);
}

.wish-willow-art[data-state="due"] .wish-leaf-main,
.wish-willow-art[data-state="opened"] .wish-leaf-main {
  filter: saturate(1.18) drop-shadow(0 0 16px rgba(104, 149, 92, 0.34));
}

.wish-willow-art[data-state="pending-release"] .wish-leaf-main,
.wish-willow-art[data-state="resolved-release"] .wish-leaf-main {
  top: 142px;
  left: calc(55% + 28px);
  transform: rotate(118deg) scale(.9);
  animation: none;
  filter: saturate(.66);
}

.wish-willow-art[data-state="pending-unclear"] .wish-leaf-main,
.wish-willow-art[data-state="resolved-unclear"] .wish-leaf-main {
  transform: rotate(13deg) scaleX(.38);
  animation: none;
  filter: saturate(.7);
}

.wish-willow-art[data-state="pending-still"] .wish-leaf-main,
.wish-willow-art[data-state="resolved-still"] .wish-leaf-main {
  transform: rotate(-4deg) scale(1.06);
  animation: none;
  filter: saturate(1.2) drop-shadow(0 8px 14px rgba(55, 91, 61, .24));
}

.wish-global-status {
  min-height: 1px;
  margin: 0;
  color: #9a503e;
  font-size: 13px;
  text-align: center;
}

.wish-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 4px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 28px;
  background: rgba(251, 252, 247, 0.82);
  box-shadow: var(--willow-shadow);
  backdrop-filter: blur(18px);
}

.wish-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79, 118, 93, 0.25), transparent);
}

.wish-card h2 {
  margin: 7px 0 8px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  font-size: clamp(23px, 6.4vw, 30px);
  font-weight: 600;
  line-height: 1.35;
}

.wish-card > p:not(.wish-card-kicker, .wish-countdown, .wish-open-date, .wish-inline-status, .wish-retention-note),
.wish-card-lead {
  margin: 0;
  color: var(--willow-muted);
  font-size: 14px;
}

#wishComposer {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.wish-label {
  color: var(--willow-green-deep);
  font-size: 13px;
  font-weight: 700;
}

#wishInput {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 16px;
  color: var(--willow-ink);
  border: 1px solid var(--willow-line);
  border-radius: 18px;
  background: rgba(244, 247, 238, 0.82);
  font-size: 16px;
  line-height: 1.65;
  caret-color: var(--willow-green-deep);
}

#wishInput::placeholder {
  color: #9aa199;
}

.wish-input-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 20px;
  color: var(--willow-soft);
  font-size: 12px;
}

#wishInputError {
  color: #9a503e;
}

.wish-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 11px 18px;
  color: var(--willow-ink);
  text-decoration: none;
  border: 0;
  border-radius: 16px;
  background: transparent;
  font-size: 15px;
  font-weight: 720;
  line-height: 1.35;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}

.wish-button:hover {
  transform: translateY(-1px);
}

.wish-button:disabled {
  opacity: 0.52;
  cursor: wait;
  transform: none;
}

.wish-button-primary {
  color: #fff;
  background: linear-gradient(135deg, #476c54, #2e513b);
  box-shadow: 0 14px 28px rgba(48, 82, 59, 0.2);
}

.wish-button-secondary {
  border: 1px solid var(--willow-line);
  background: rgba(255, 255, 255, 0.58);
}

.wish-button-analysis {
  color: #f9fff8;
  background: linear-gradient(135deg, #63856b, #476753);
}

.wish-button-quiet {
  min-height: 44px;
  color: var(--willow-muted);
  font-size: 13px;
}

.wish-local-note,
.wish-retention-note,
.wish-analysis-disclosure {
  margin: 0;
  color: var(--willow-soft);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

.wish-countdown {
  margin: 16px 0 2px;
  color: var(--willow-green-deep);
  font-family: "Songti SC", "STSong", serif;
  font-size: 25px;
  font-weight: 650;
}

.wish-open-date,
.wish-inline-status {
  margin: 0;
  color: var(--willow-soft);
  font-size: 12px;
}

.wish-actions-row {
  display: flex;
  margin-top: 18px;
}

.wish-analysis {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(64, 100, 75, 0.13);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0, rgba(194, 216, 184, .45), transparent 44%),
    rgba(238, 244, 232, 0.72);
}

.wish-analysis h3 {
  margin: 5px 0 6px;
  font-family: "Songti SC", "STSong", serif;
  font-size: 21px;
  line-height: 1.4;
}

.wish-analysis p:not(.wish-analysis-eyebrow, .wish-analysis-disclosure, .wish-analysis-context, .wish-inline-status) {
  margin: 0;
  color: var(--willow-muted);
  font-size: 13px;
}

.wish-analysis .wish-button {
  margin-top: 14px;
}

.wish-analysis-disclosure {
  margin-top: 9px;
}

.wish-analysis-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
}

.wish-analysis-pulse {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--willow-green);
  box-shadow: 0 0 0 0 rgba(79, 118, 93, 0.35);
  animation: wish-analysis-pulse 1.5s ease-out infinite;
}

.wish-analysis-step {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 2px solid rgba(79, 118, 93, 0.5);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 255, 255, 0.5);
}

.wish-analysis-step span {
  display: block;
  margin-bottom: 3px;
  color: var(--willow-green);
  font-size: 11px;
  font-weight: 760;
}

.wish-analysis-context {
  margin: 12px 0 0;
  color: var(--willow-soft);
  font-size: 11px;
}

.wish-analysis-error .wish-button[hidden] + .wish-button,
.wish-analysis-error .wish-button + .wish-button {
  margin-top: 8px;
}

.wish-retention-note {
  margin-top: 16px;
}

.wish-due-card .wish-button,
.wish-resolved-card .wish-button {
  margin-top: 18px;
}

.wish-original-text {
  position: relative;
  margin: 18px 0 24px;
  padding: 20px 18px;
  color: var(--willow-ink);
  border: 1px solid var(--willow-line);
  border-radius: 18px;
  background: rgba(241, 245, 235, 0.8);
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(21px, 5.8vw, 27px);
  line-height: 1.65;
  text-align: center;
  overflow-wrap: anywhere;
}

.wish-original-text::before,
.wish-original-text::after {
  color: rgba(79, 118, 93, 0.42);
  font-size: 20px;
}

.wish-original-text::before {
  content: "“";
}

.wish-original-text::after {
  content: "”";
}

.wish-original-text-small {
  margin: 18px 0 2px;
  padding: 14px;
  font-size: 16px;
}

.wish-choice-grid {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.wish-choice {
  display: grid;
  justify-items: start;
  width: 100%;
  min-height: 68px;
  padding: 13px 16px;
  color: var(--willow-ink);
  text-align: left;
  border: 1px solid var(--willow-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.wish-choice:hover {
  transform: translateY(-1px);
  border-color: rgba(49, 82, 61, 0.28);
  background: rgba(255, 255, 255, 0.84);
}

.wish-choice strong {
  font-size: 16px;
}

.wish-choice span {
  color: var(--willow-soft);
  font-size: 12px;
}

.wish-pending-card {
  text-align: center;
}

.wish-pending-card .wish-button {
  margin-top: 18px;
}

.wish-missing-card .wish-button {
  margin-top: 18px;
}

@keyframes wish-leaf-sway {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(7deg); }
}

@keyframes wish-thread-breathe {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(3deg); }
}

@keyframes wish-analysis-pulse {
  70% { box-shadow: 0 0 0 10px rgba(79, 118, 93, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 118, 93, 0); }
}

@media (min-width: 620px) {
  .wish-page {
    padding-inline: 24px;
  }

  .wish-choice-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .wish-choice {
    min-height: 92px;
  }
}

@media (max-width: 380px) {
  .wish-page {
    padding-inline: 12px;
  }

  .wish-card {
    padding: 20px 17px;
    border-radius: 23px;
  }

  .wish-hero {
    padding-top: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
