:root {
  --paper: #fffaf1;
  --ink: #5d4a3e;
  --muted: #947b69;
  --rose: #e9a6a1;
  --peach: #f7c9a5;
  --sage: #9fbf9b;
  --moss: #6f9b75;
  --butter: #f7df91;
  --line: rgba(121, 91, 68, 0.18);
  --shadow: 0 20px 55px rgba(107, 72, 49, 0.18);
  color: var(--ink);
  font-family:
    "Varela Round", "Noto Sans TC", "Microsoft JhengHei", "PingFang TC",
    ui-rounded, system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.72), transparent 22rem),
    linear-gradient(135deg, #f8dfc6 0%, #f5d4bd 38%, #e8dcbf 72%, #d7e0c2 100%);
}

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

.flower-app {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(20px, 4vw, 54px);
  overflow: hidden;
}

.flower-app::before {
  content: "";
  position: absolute;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.84), transparent 26rem),
    radial-gradient(circle at 48% 48%, rgba(255, 250, 241, 0.7), transparent 39rem);
  filter: blur(6px);
}

.flower-scene,
.flower-scene span {
  position: absolute;
  pointer-events: none;
}

.flower-scene {
  inset: 0;
  overflow: hidden;
}

.sun-patch {
  top: 10vh;
  right: 12vw;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 245, 183, 0.78), rgba(255, 229, 166, 0.12) 62%, transparent 70%);
}

.window-line {
  top: 8vh;
  width: 4px;
  height: 44vh;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  transform: rotate(18deg);
}

.window-line.one {
  right: 20vw;
}

.window-line.two {
  right: 27vw;
}

.leaf {
  width: 120px;
  height: 58px;
  border: 3px solid rgba(79, 120, 75, 0.28);
  border-radius: 100% 0 100% 0;
  background: rgba(144, 180, 132, 0.28);
}

.leaf-a {
  left: 9vw;
  bottom: 18vh;
  transform: rotate(-26deg);
}

.leaf-b {
  right: 8vw;
  bottom: 16vh;
  transform: rotate(36deg);
}

.leaf-c {
  left: 15vw;
  top: 15vh;
  width: 82px;
  height: 42px;
  transform: rotate(42deg);
}

.pot {
  bottom: 4vh;
  width: 170px;
  height: 120px;
  border: 3px solid rgba(112, 79, 58, 0.22);
  border-radius: 26px 26px 54px 54px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 34%),
    #e6a77f;
}

.pot-a {
  left: 8vw;
  transform: rotate(-3deg);
}

.pot-b {
  right: 10vw;
  width: 130px;
  height: 94px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 34%),
    #cda58a;
  transform: rotate(4deg);
}

.petal {
  width: 34px;
  height: 48px;
  border-radius: 60% 60% 70% 70%;
  background: rgba(236, 148, 154, 0.42);
  animation: floatPetal 8s ease-in-out infinite;
}

.petal-a {
  left: 22vw;
  top: 16vh;
}

.petal-b {
  right: 30vw;
  top: 24vh;
  animation-delay: -2s;
}

.petal-c {
  right: 18vw;
  bottom: 24vh;
  animation-delay: -4s;
}

.test-shell {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, 880px);
  min-height: min(760px, calc(100svh - 56px));
  align-content: center;
  gap: 24px;
}

.back-link {
  justify-self: start;
  padding: 10px 16px;
  border: 1px solid rgba(117, 84, 61, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 10px 22px rgba(107, 72, 49, 0.08);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 800;
}

.soft-bubble {
  position: relative;
  display: grid;
  min-height: 520px;
  place-items: center;
  padding: clamp(28px, 6vw, 70px);
  border-radius: 46% 54% 50% 50% / 52% 48% 54% 46%;
  background:
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.76) 54%, rgba(255, 255, 255, 0.08) 76%, transparent 82%);
  filter: drop-shadow(var(--shadow));
}

.question-view,
.loading-view,
.result-view,
.catalog-view {
  width: min(100%, 680px);
  text-align: center;
}

.catalog-view {
  width: min(100%, 760px);
}

.question-view.is-exiting {
  animation: questionExit 300ms ease forwards;
}

.question-view.is-entering {
  animation: questionEnter 420ms ease-out both;
}

.kicker {
  margin: 0 0 14px;
  color: #b98170;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.1rem, 6vw, 4.7rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.loading-view p:last-child,
.result-summary {
  max-width: 560px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.8;
}

.option-stack {
  display: grid;
  gap: 14px;
  width: min(100%, 620px);
  margin: clamp(26px, 5vw, 44px) auto 0;
}

.option-button {
  min-height: 58px;
  padding: 14px 24px;
  border: 1px solid rgba(139, 101, 76, 0.22);
  border-radius: 9999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    0 12px 22px rgba(118, 83, 61, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(20px);
  animation: optionEnter 400ms ease-out forwards;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.option-button:nth-child(2) {
  animation-delay: 100ms;
}

.option-button:nth-child(3) {
  animation-delay: 200ms;
}

.option-button:nth-child(4) {
  animation-delay: 300ms;
}

.option-button:hover,
.option-button:focus-visible {
  border-color: rgba(177, 117, 93, 0.42);
  background: #fffdf8;
  box-shadow:
    0 16px 26px rgba(118, 83, 61, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
  outline: none;
  transform: translateY(-2px);
}

.option-button:active,
.option-button.is-selected {
  transform: scale(0.98);
}

.option-button.is-selected {
  border-color: rgba(111, 155, 117, 0.48);
  background: #f8fff3;
}

.option-button:disabled {
  cursor: default;
}

.idle-tooltip {
  justify-self: center;
  min-height: 44px;
  padding: 12px 18px;
  border: 1px solid rgba(142, 105, 78, 0.18);
  border-radius: 999px;
  color: #7a5a48;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 26px rgba(100, 71, 50, 0.12);
  font-size: 0.94rem;
  font-weight: 850;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.idle-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.progress-tracker {
  position: relative;
  width: min(100%, 620px);
  height: 72px;
  justify-self: center;
}

.progress-line {
  position: absolute;
  top: 34px;
  right: 22px;
  left: 22px;
  height: 4px;
  border-radius: 999px;
  background: rgba(112, 83, 63, 0.16);
}

.progress-nodes {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  padding: 25px 8px 0;
}

.progress-node {
  position: relative;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(140, 106, 78, 0.18);
  border-radius: 50%;
  background: #fff8ed;
  box-shadow: 0 6px 12px rgba(115, 78, 54, 0.12);
}

.progress-node.is-done,
.progress-node.is-active {
  border-color: rgba(111, 155, 117, 0.68);
  background: #e9f5dc;
}

.progress-sprite {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(110, 146, 91, 0.24);
  border-radius: 50% 50% 46% 54%;
  color: #557b53;
  background:
    radial-gradient(circle at 52% 34%, rgba(255, 255, 255, 0.95), transparent 24%),
    #dcefc7;
  box-shadow: 0 10px 18px rgba(96, 120, 75, 0.18);
  font-size: 0.9rem;
  font-weight: 950;
  transform: translate(var(--sprite-x, 0), 6px);
  transition: transform 560ms cubic-bezier(0.22, 1.28, 0.36, 1);
  animation: spriteBreathe 2.4s ease-in-out infinite;
}

.result-view,
.catalog-view {
  animation: resultEnter 520ms ease-out both;
}

.result-flower,
.catalog-flower {
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  margin: 0 auto 16px;
  border: 2px solid rgba(130, 90, 66, 0.16);
  border-radius: 38% 62% 48% 52% / 54% 44% 56% 46%;
  background:
    radial-gradient(circle at 50% 50%, var(--result-accent, #e9a6a1) 0 18%, transparent 19%),
    radial-gradient(circle at 50% 18%, var(--result-petal, #f6c2bb) 0 20%, transparent 21%),
    radial-gradient(circle at 82% 50%, var(--result-petal, #f6c2bb) 0 20%, transparent 21%),
    radial-gradient(circle at 50% 82%, var(--result-petal, #f6c2bb) 0 20%, transparent 21%),
    radial-gradient(circle at 18% 50%, var(--result-petal, #f6c2bb) 0 20%, transparent 21%),
    #fff9ef;
  box-shadow: 0 14px 24px rgba(111, 75, 51, 0.14);
}

.result-language {
  display: inline-flex;
  margin: 18px 0 0;
  padding: 9px 16px;
  border-radius: 999px;
  color: #7d5a48;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 950;
}

.result-note {
  display: grid;
  gap: 8px;
  max-width: 560px;
  margin: 22px auto 0;
  padding: 18px;
  border: 1px dashed rgba(132, 96, 70, 0.22);
  border-radius: 28px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.52);
  line-height: 1.7;
}

.result-note strong {
  color: var(--ink);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.restart-button {
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid rgba(121, 91, 68, 0.2);
  border-radius: 999px;
  color: #fffaf1;
  background: #8eb07f;
  box-shadow: 0 12px 24px rgba(82, 111, 72, 0.18);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
}

.catalog-button {
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid rgba(121, 91, 68, 0.2);
  border-radius: 999px;
  color: #755a46;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 24px rgba(118, 83, 61, 0.11);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
}

.restart-button:hover,
.restart-button:focus-visible,
.catalog-button:hover,
.catalog-button:focus-visible {
  background: #7fa572;
  color: #fffaf1;
  outline: none;
  transform: translateY(-1px);
}

.catalog-intro {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  line-height: 1.75;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-height: min(52vh, 520px);
  margin-top: 24px;
  padding: 4px 8px 8px;
  overflow: auto;
  scrollbar-color: rgba(134, 100, 75, 0.32) transparent;
}

.catalog-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 5px 12px;
  min-height: 184px;
  padding: 14px;
  border: 1px solid rgba(139, 101, 76, 0.18);
  border-radius: 24px;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 24px rgba(118, 83, 61, 0.09);
}

.catalog-card.is-current {
  border-color: rgba(111, 155, 117, 0.48);
  background: rgba(248, 255, 243, 0.86);
}

.catalog-flower {
  grid-row: span 4;
  width: 54px;
  height: 54px;
  margin: 2px 0 0;
  box-shadow: 0 8px 16px rgba(111, 75, 51, 0.12);
}

.catalog-card span {
  color: #a77766;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.catalog-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
  line-height: 1.2;
}

.catalog-card strong {
  color: #7b604d;
  font-size: 0.92rem;
}

.catalog-card p {
  display: -webkit-box;
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

@keyframes optionEnter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes questionExit {
  to {
    opacity: 0;
    transform: translateY(-18px);
  }
}

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

@keyframes resultEnter {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spriteBreathe {
  0%,
  100% {
    border-radius: 50% 50% 46% 54%;
  }
  50% {
    border-radius: 44% 56% 52% 48%;
  }
}

@keyframes floatPetal {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(14px, 20px, 0) rotate(18deg);
  }
}

@media (max-width: 720px) {
  .flower-app {
    padding: 16px;
  }

  .test-shell {
    min-height: calc(100svh - 32px);
    gap: 16px;
  }

  .soft-bubble {
    min-height: 500px;
    padding: 28px 18px;
    border-radius: 34px;
  }

  .option-button {
    min-height: 56px;
    padding: 13px 18px;
  }

  .catalog-grid {
    grid-template-columns: 1fr;
    max-height: min(48vh, 440px);
    padding-right: 4px;
    padding-left: 4px;
  }

  .catalog-card {
    min-height: 170px;
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .restart-button,
  .catalog-button {
    width: 100%;
  }

  .progress-tracker {
    width: calc(100vw - 44px);
  }

  .idle-tooltip {
    border-radius: 22px;
    text-align: center;
  }

  .pot,
  .leaf {
    opacity: 0.58;
  }
}
