:root {
  --bg: #efe0ca;
  --paper: #fff8ec;
  --paper-2: #f8e7ce;
  --ink: #2b2119;
  --muted: #7b6756;
  --line: rgba(91, 62, 39, 0.22);
  --accent: #9a5630;
  --accent-2: #536441;
  --text-card: #857b72;
  --image-card: #51759a;
  --shadow: 0 18px 42px rgba(61, 37, 18, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Hannotate SC", "Xingkai SC", "Kaiti SC", "STKaiti", "KaiTi", "Yuanti SC", cursive;
  background:
    linear-gradient(90deg, rgba(83, 100, 65, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(83, 100, 65, 0.05) 1px, transparent 1px),
    linear-gradient(145deg, #f7ead8, #dfc39f);
  background-size: 30px 30px, 30px 30px, auto;
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.screen {
  display: none;
  min-height: calc(100dvh - 32px);
}

.screen.is-active {
  display: flex;
  flex-direction: column;
}

.topbar,
.draw-head,
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  min-height: 44px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 760;
}

.ghost-btn,
.text-btn {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 248, 236, 0.68);
  color: var(--accent);
}

.text-btn {
  align-self: center;
  margin-top: auto;
  background: transparent;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  background: var(--accent);
  color: #fffaf0;
  font-weight: 820;
  box-shadow: 0 14px 28px rgba(154, 86, 48, 0.26);
}

.primary-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.breath-stage {
  display: grid;
  flex: 1;
  place-items: center;
  align-content: start;
  text-align: center;
  padding: min(17dvh, 132px) 16px 22px;
}

.breath-orb {
  width: 230px;
  height: 230px;
  margin-bottom: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.96) 0 10%, rgba(248, 224, 191, 0.72) 30%, rgba(236, 188, 133, 0.42) 58%, rgba(236, 188, 133, 0) 76%);
  box-shadow:
    0 0 42px 28px rgba(255, 248, 236, 0.48),
    0 0 92px 42px rgba(238, 193, 137, 0.26),
    0 26px 74px rgba(87, 51, 28, 0.12);
  filter: blur(0.4px);
  animation: breathe 5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: scale(0.82); opacity: 0.76; }
  50% { transform: scale(1.08); opacity: 1; }
}

.breath-stage h1,
.intent-card h2,
.closing-card h2 {
  margin: 0;
  font-size: clamp(1.7rem, 8vw, 2.55rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.breath-copy {
  display: grid;
  gap: 8px;
  max-width: 16em;
  margin: 34px auto 0;
  color: rgba(76, 68, 62, 0.76);
  font-family: "Hannotate SC", "HanziPen SC", "Xingkai SC", "Kaiti SC", "STKaiti", "KaiTi", cursive;
  font-size: clamp(1.42rem, 7vw, 1.9rem);
  font-weight: 400;
  line-height: 1.36;
  letter-spacing: 0.03em;
}

.breath-count {
  margin: 50px 0 30px;
  color: rgba(154, 112, 66, 0.28);
  font-size: clamp(2.45rem, 12vw, 3.35rem);
  font-weight: 400;
  line-height: 1;
}

.breath-done {
  width: min(280px, 100%);
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.breath-actions {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: auto;
}

.breath-actions .text-btn,
.breath-actions .ghost-btn {
  align-self: auto;
  margin-top: 0;
}

.restart-btn {
  color: var(--muted);
  background: transparent;
}

.intent-card,
.question-strip,
.closing-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: rgba(255, 248, 236, 0.78);
  box-shadow: var(--shadow);
}

.intent-card {
  flex: 1;
  margin-top: 0;
  display: grid;
  grid-template-rows: 36dvh auto 1fr auto;
  gap: 0;
  text-align: center;
  border: 0;
  border-radius: 0;
  padding: min(11dvh, 92px) 12px 0;
  background: transparent;
  box-shadow: none;
}

.intent-line {
  margin: 0;
  color: rgba(126, 91, 62, 0.72);
  font-size: clamp(1.16rem, 5.4vw, 1.55rem);
  line-height: 1.55;
}

.intent-card .intent-line:first-child {
  align-self: center;
  justify-self: center;
  position: relative;
  width: max-content;
  max-width: 100%;
  margin-bottom: 18px;
  animation: textGlow 4.8s ease-in-out infinite;
}

.intent-card .intent-line:first-child::before {
  content: "";
  position: absolute;
  inset: -16px -24px;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 226, 159, 0.5), rgba(255, 226, 159, 0) 68%);
  filter: blur(7px);
  animation: haloBreath 4.8s ease-in-out infinite;
}

.intent-question {
  align-self: center;
  justify-self: center;
  position: relative;
  margin: 0;
  color: #e8ad45;
  font-size: clamp(2.35rem, 11vw, 3.18rem);
  line-height: 1.08;
  white-space: nowrap;
  text-shadow: 0 8px 24px rgba(209, 125, 45, 0.2);
  animation: textGlow 4.8s ease-in-out infinite;
}

.intent-question::before {
  content: "";
  position: absolute;
  inset: -22px -36px;
  z-index: -1;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 209, 103, 0.62), rgba(255, 210, 115, 0.24) 42%, rgba(255, 210, 115, 0) 72%);
  filter: blur(11px);
  animation: haloBreath 4.8s ease-in-out infinite;
}

.intent-start {
  grid-row: 4;
  margin-bottom: 8px;
  color: rgba(126, 91, 62, 0.72);
}

.screen-intent .primary-btn {
  border: 1px solid rgba(126, 91, 62, 0.28);
  background: rgba(255, 248, 236, 0.5);
  color: rgba(126, 91, 62, 0.88);
  box-shadow: 0 14px 30px rgba(126, 91, 62, 0.12);
}

@keyframes textGlow {
  0%, 100% { opacity: 0.74; }
  50% { opacity: 1; }
}

@keyframes haloBreath {
  0%, 100% { opacity: 0.28; transform: scale(0.86); }
  50% { opacity: 0.9; transform: scale(1.12); }
}

textarea {
  width: 100%;
  margin-top: 18px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 252, 247, 0.84);
  color: var(--ink);
  line-height: 1.55;
  outline: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(248, 231, 206, 0.62);
  color: var(--muted);
  font-size: 0.86rem;
}

.screen-intent .primary-btn {
  margin-top: auto;
}

.draw-head {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 4;
  margin: -4px -4px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 248, 236, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(61, 37, 18, 0.12);
}

.draw-head h2 {
  margin: 0;
  color: rgba(126, 91, 62, 0.92);
  font-size: 1.36rem;
  line-height: 1.12;
}

.pick-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 46px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fffaf0;
  font-weight: 850;
  white-space: nowrap;
}

.draw-note {
  margin: 14px 4px 10px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.92rem;
}

.screen-draw {
  padding-bottom: 86px;
}

.screen-reading {
  position: relative;
}

.mini-wall {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  margin: 16px 4px auto;
}

.mini-card {
  position: relative;
  aspect-ratio: 5 / 7;
  border: 1px solid rgba(43, 33, 25, 0.14);
  border-radius: 7px;
  overflow: hidden;
  background: var(--text-card);
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 5px 12px rgba(61, 37, 18, 0.15);
}

.image-wall .mini-card {
  background: var(--image-card);
}

.mini-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.78;
}

.mini-card span {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: rgba(30, 22, 16, 0.2);
  font-size: 0.76rem;
  font-weight: 850;
}

.mini-card.is-picked {
  outline: 3px solid var(--accent-2);
  outline-offset: 1px;
  background: var(--accent-2);
}

.mini-card.is-picked span {
  background: rgba(83, 100, 65, 0.5);
}

.bottom-action {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 6;
  width: min(calc(100% - 28px), 452px);
  transform: translateX(-50%);
}

.question-strip {
  display: none;
  box-shadow: none;
}

.question-strip span {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 850;
}

.question-strip p {
  margin: 6px 0 0;
  color: var(--ink);
  line-height: 1.55;
}

.pair-board {
  display: grid;
  gap: 14px;
  margin: 0 -14px;
}

.pair-board.is-closing {
  flex: 1;
  align-content: center;
}

.screen-reading.is-closing .pair-board {
  flex: 1;
  min-height: 0;
}

.pair-card {
  border: 0;
  border-radius: 0;
  padding: 0 14px;
  background: transparent;
  box-shadow: none;
}

.pair-visual {
  display: block;
}

.composite-card {
  position: relative;
  aspect-ratio: 1045 / 1312;
  overflow: hidden;
  width: min(100%, 430px);
  margin: 0 auto;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(61, 37, 18, 0.18);
}

.composite-card .text-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-inlay {
  position: absolute;
  left: 15.1%;
  right: 15.1%;
  top: 12.1%;
  bottom: 10.8%;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(30, 22, 16, 0.18);
}

.image-inlay img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-inlay.is-covered img {
  object-fit: cover;
}

.reveal-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  width: min(100%, 430px);
  margin: 14px auto 0;
}

.reveal-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 132px;
  min-height: 42px;
  border: 1px solid rgba(91, 62, 39, 0.22);
  border-radius: 999px;
  padding: 0 12px 0 16px;
  background: rgba(255, 248, 236, 0.56);
  color: rgba(126, 91, 62, 0.88);
  box-shadow: 0 8px 18px rgba(61, 37, 18, 0.08);
}

.reveal-toggle strong {
  display: grid;
  width: 34px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(126, 91, 62, 0.16);
  color: rgba(126, 91, 62, 0.86);
  font-size: 0.86rem;
}

.reveal-toggle.is-open {
  border-color: rgba(83, 100, 65, 0.34);
  background: rgba(255, 248, 236, 0.82);
  color: var(--accent-2);
}

.reveal-toggle.is-open strong {
  background: var(--accent-2);
  color: #fffaf0;
}

.solo-image {
  aspect-ratio: 733 / 1027;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(61, 37, 18, 0.18);
}

.solo-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pair-meta {
  width: min(100%, 430px);
  margin: 16px auto 0;
}

.pair-meta h3 {
  margin: 0;
  color: rgba(126, 91, 62, 0.92);
  font-size: 1.2rem;
  line-height: 1.45;
  text-align: center;
}

.pair-meta p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.prompt-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}

.pair-nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: min(100%, 430px);
  margin-top: 18px;
  margin-left: auto;
  margin-right: auto;
}

.pair-tab {
  flex: 1 1 0;
  min-width: 0;
  max-width: 132px;
  background: rgba(255, 248, 236, 0.5);
  color: rgba(126, 91, 62, 0.88);
}

.closing-card {
  width: min(100%, 430px);
  margin: 0 auto;
  box-shadow: none;
}

.closing-page {
  display: grid;
  min-height: 58dvh;
  place-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.screen-reading.is-closing .closing-page {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: min(100%, 430px);
  min-height: 0;
  padding: 0 18px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.closing-mantra {
  display: grid;
  gap: 16px;
  text-align: center;
  color: rgba(126, 91, 62, 0.9);
  font-size: clamp(1.72rem, 8vw, 2.45rem);
  line-height: 1.18;
}

.closing-mantra span {
  animation: mantraPulse 3.6s ease-in-out infinite;
}

.closing-mantra span:nth-child(2) {
  animation-delay: 0.55s;
}

.closing-mantra span:nth-child(3) {
  animation-delay: 1.1s;
}

@keyframes mantraPulse {
  0%, 100% {
    opacity: 0.42;
    text-shadow: 0 0 0 rgba(255, 232, 180, 0);
    transform: scale(0.98);
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 24px rgba(255, 226, 159, 0.78);
    transform: scale(1.02);
  }
}

.reading-restart {
  display: none;
  margin-top: auto;
  margin-bottom: 0;
  color: rgba(126, 91, 62, 0.82);
}

.screen-reading.is-closing .reading-restart {
  display: inline-flex;
}

.pair-dialog {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(14px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  background: #1f1712;
  color: #fff8ec;
}

.pair-dialog::backdrop {
  background: rgba(31, 23, 18, 0.72);
}

.dialog-top {
  min-height: 42px;
}

.circle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 248, 236, 0.12);
  color: #fff8ec;
  font-size: 1.6rem;
}

.pair-slider {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 16px;
  height: calc(100dvh - 84px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.pair-slider::-webkit-scrollbar {
  display: none;
}

.slide {
  display: grid;
  align-content: center;
  gap: 14px;
  scroll-snap-align: center;
}

.slide .composite-card {
  width: min(86vw, 390px);
  margin: 0 auto;
}

.slide h3,
.slide p {
  width: min(86vw, 390px);
  margin-left: auto;
  margin-right: auto;
}

.slide h3 {
  margin-top: 0;
  margin-bottom: 0;
}

.slide p {
  margin-top: 0;
  color: rgba(255, 248, 236, 0.76);
  line-height: 1.55;
}

@media (max-height: 720px) {
  .mini-wall {
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: 4px;
  }

  .mini-card {
    border-radius: 5px;
  }

  .mini-card span {
    font-size: 0.66rem;
  }
}
