/* OH 卡 · 用户端 H5 —— 暖白 · 苏合主题 */
:root {
  color-scheme: light;
  --bg: #f7f2e9;
  --ink: #2f3d35;
  --ink-soft: #55665b;
  --muted: #7d8a80;
  --gold: #96714a;
  --gold-bright: #b98f5f;
  --gold-deep: #6f5233;
  --sage: #4d6757;
  --sage-deep: #3a5145;
  --clay: #b87c63;
  --panel: rgba(255, 253, 248, 0.88);
  --line: rgba(168, 137, 94, 0.26);
  --line-soft: rgba(168, 137, 94, 0.14);
  --shadow: 0 30px 60px -28px rgba(47, 61, 53, 0.38), 0 2px 8px rgba(47, 61, 53, 0.08), 0 0 0 1px rgba(168, 137, 94, 0.14);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "KaiTi", "STKaiti", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(55% 45% at 12% 4%, rgba(190, 208, 190, 0.58), transparent 72%),
    radial-gradient(50% 40% at 92% 12%, rgba(244, 211, 188, 0.55), transparent 72%),
    radial-gradient(65% 55% at 50% 108%, rgba(222, 204, 172, 0.55), transparent 72%),
    linear-gradient(180deg, #fbf7ef 0%, #f6f0e5 52%, #f1e9db 100%);
  z-index: -2;
}

.sky { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.orb-a { width: 44vmax; height: 44vmax; left: -16vmax; top: -18vmax; background: radial-gradient(circle, rgba(154, 180, 158, 0.6), transparent 66%); animation: drift-a 26s ease-in-out infinite alternate; }
.orb-b { width: 34vmax; height: 34vmax; right: -12vmax; top: 18%; background: radial-gradient(circle, rgba(240, 199, 174, 0.5), transparent 66%); animation: drift-b 32s ease-in-out infinite alternate; }
.orb-c { width: 40vmax; height: 30vmax; left: 20%; bottom: -22vmax; background: radial-gradient(circle, rgba(216, 190, 150, 0.45), transparent 66%); animation: drift-a 38s ease-in-out infinite alternate-reverse; }

.stars { display: none; }

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.055;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 5vw, 36px) max(16px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

/* ---------------- topbar ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(77, 103, 87, 0.3);
  background: linear-gradient(145deg, #5a7565, #3d5648);
  color: #f9f5ec;
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 8px 18px -10px rgba(61, 86, 72, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-name { display: block; font-family: var(--serif); font-size: 16px; letter-spacing: 1px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 9px; letter-spacing: 2.4px; color: #6f7d73; text-transform: uppercase; white-space: nowrap; }

.deck-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(77, 103, 87, 0.16);
  background: rgba(255, 253, 248, 0.6);
  color: var(--ink-soft);
  font-size: 11.5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--clay);
  box-shadow: 0 0 8px rgba(184, 124, 99, 0.7);
  animation: pulse 2.6s ease-in-out infinite;
}

/* ---------------- hero ---------------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 3vh, 30px) 0 0;
}

.hero { text-align: center; max-width: 560px; }

.kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: 4px;
  color: #8a6a3f;
  opacity: 0.9;
}
.kicker-line { width: 26px; height: 1px; background: linear-gradient(90deg, transparent, rgba(138, 106, 63, 0.6)); }
.kicker-line:last-child { transform: scaleX(-1); }

h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(26px, 6.4vw, 38px);
  line-height: 1.42;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #2c4036 0%, #435a4b 58%, #6f5a3f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 30px rgba(90, 80, 60, 0.08);
}

.subhead {
  margin: 12px auto 0;
  max-width: 30em;
  font-size: clamp(12px, 3.3vw, 13.5px);
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: #6b7a70;
  opacity: 0.92;
}

/* ---------------- card stage ---------------- */
.stage {
  position: relative;
  margin-top: clamp(18px, 4vh, 34px);
  display: flex;
  flex-direction: column;
  align-items: center;
  perspective: 1600px;
}
.stage-glow {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 125%;
  height: 80%;
  transform: translateX(-50%);
  background:
    radial-gradient(50% 45% at 50% 45%, rgba(184, 150, 98, 0.22), transparent 68%),
    radial-gradient(48% 55% at 50% 78%, rgba(150, 176, 154, 0.24), transparent 72%);
  filter: blur(16px);
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.card-float {
  position: relative;
  width: min(70vw, 336px);
  width: clamp(206px, min(70vw, 40dvh), 336px);
  perspective: 1600px;
  animation: float 7.5s ease-in-out infinite;
  will-change: transform;
}

.card {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.9s cubic-bezier(0.22, 0.72, 0.24, 1);
  cursor: pointer;
  border-radius: 19px;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.card.is-flipped { transform: rotateY(180deg); cursor: default; }
.card:focus-visible { box-shadow: 0 0 0 2px var(--gold), 0 0 0 6px rgba(150, 113, 74, 0.16); }

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 19px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow);
}
.card-back {
  background: linear-gradient(160deg, #f4e7d2 0%, #ecdcc2 48%, #e2cfb1 100%);
}
.back-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.back-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 252, 242, 0.38) 48%, rgba(255, 252, 242, 0.06) 54%, transparent 62%);
  background-size: 260% 260%;
  animation: sheen 8s ease-in-out infinite;
  pointer-events: none;
}
.card-front {
  transform: rotateY(180deg);
  background: #efe6d6;
}
.card-front img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
}
.front-frame {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 248, 235, 0.72);
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(54, 44, 34, 0.12);
  pointer-events: none;
}
.front-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(40, 34, 26, 0.1) 0%, transparent 22%, transparent 56%, rgba(38, 32, 24, 0.8) 100%),
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(38, 32, 24, 0.28) 100%);
  pointer-events: none;
}
.front-meta {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fffaf0;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.front-no { font-size: 10px; letter-spacing: 3px; color: rgba(247, 226, 186, 0.95); }
.front-title { font-family: var(--serif); font-size: clamp(18px, 4.6vw, 22px); letter-spacing: 0.14em; }

.stage-hint {
  margin: 16px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: #6f7d73;
  transition: opacity 0.4s ease;
}
.stage-hint.is-hidden { opacity: 0; }

.stage.is-busy .stage-glow { animation: breathe 1.4s ease-in-out infinite; }
.stage.is-busy .card-float { animation-play-state: paused; }

/* ---------------- question ---------------- */
.question {
  width: min(100%, 560px);
  margin-top: clamp(16px, 3.4vh, 26px);
  padding: 18px 22px 20px;
  border-radius: 16px;
  border: 1px solid rgba(168, 137, 94, 0.3);
  border-left: 2px solid rgba(77, 103, 87, 0.72);
  background:
    linear-gradient(150deg, rgba(255, 253, 248, 0.96), rgba(250, 245, 235, 0.94));
  box-shadow: 0 22px 50px -30px rgba(47, 61, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: question-in 0.6s cubic-bezier(0.22, 0.7, 0.2, 1) both;
}
.question[hidden] { display: none; }

.question-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.question-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: #8a6a3f;
  white-space: nowrap;
}
.question-rule { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(168, 137, 94, 0.34), transparent); }

.question-body {
  max-height: min(34vh, 260px);
  overflow: auto;
  padding-right: 6px;
  font-family: var(--serif);
  font-size: clamp(15px, 4vw, 16.5px);
  line-height: 1.9;
  letter-spacing: 0.03em;
  color: #37453c;
  scrollbar-width: thin;
  scrollbar-color: rgba(138, 106, 63, 0.3) transparent;
  overscroll-behavior: contain;
}
.question-body::-webkit-scrollbar { width: 4px; }
.question-body::-webkit-scrollbar-thumb { background: rgba(138, 106, 63, 0.28); border-radius: 4px; }
.question-body p { margin: 0 0 0.6em; }
.question-body p:last-child { margin-bottom: 0; }
.question-body div { margin: 0 0 0.5em; }
.question-body div:last-child { margin-bottom: 0; }
.question-body b, .question-body strong { color: #8f5b43; font-weight: 600; }
.question-body i, .question-body em { opacity: 0.86; }
.question-body ul, .question-body ol { margin: 0.2em 0 0.7em; padding-left: 1.3em; }
.question-body li { margin: 0.24em 0; }
.question-body blockquote { margin: 0.6em 0; padding-left: 12px; border-left: 1px solid rgba(77, 103, 87, 0.35); color: #6b7a70; }
.question-body h3, .question-body h4 { margin: 0.2em 0 0.5em; font-size: 1.02em; letter-spacing: 0.06em; }

/* ---------------- actions ---------------- */
.actions {
  width: min(100%, 340px);
  margin-top: clamp(16px, 3.2vh, 24px);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, opacity 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn[hidden] { display: none; }
.btn-icon { width: 18px; height: 18px; flex: none; opacity: 0.85; }

.btn-primary {
  color: #fbf7ee;
  background: linear-gradient(135deg, #5b7866 0%, #486254 50%, #3a5145 100%);
  box-shadow: 0 16px 30px -14px rgba(58, 81, 69, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 20px 36px -14px rgba(58, 81, 69, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn-primary:active { transform: translateY(0) scale(0.992); }

.btn-ghost {
  color: #3f5b4d;
  background: rgba(255, 253, 248, 0.55);
  border-color: rgba(77, 103, 87, 0.28);
  box-shadow: inset 0 0 24px rgba(77, 103, 87, 0.04);
}
.btn-ghost:hover { background: rgba(77, 103, 87, 0.08); transform: translateY(-1px); }

.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn:disabled { cursor: default; opacity: 0.6; transform: none; }

.btn.is-loading .btn-icon { display: none; }
.btn.is-loading::after {
  content: "";
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.75s linear infinite;
}

.meta {
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #6f7d73;
  text-align: center;
  opacity: 0.9;
}

/* ---------------- footer ---------------- */
.footer {
  margin-top: clamp(18px, 4vh, 32px);
  text-align: center;
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: 0.06em;
  color: #6f7d73;
  opacity: 0.8;
}
.footer p { margin: 0; }
.footer-note { margin-top: 2px !important; opacity: 0.7; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: min(86vw, 420px);
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(168, 137, 94, 0.28);
  background: rgba(255, 252, 246, 0.96);
  color: #37453c;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 20px 44px -20px rgba(47, 61, 53, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 30;
  backdrop-filter: blur(12px);
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- states ---------------- */
body.is-empty .stage { opacity: 0.6; filter: grayscale(0.3); }
body.is-empty .card { cursor: default; }
body.is-empty .stage-hint { color: #8a6a3f; opacity: 0.9; }

.is-embed .footer-note { display: none; }
.is-embed .footer { margin-top: 16px; }

/* ---------------- animations ---------------- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes twinkle { from { opacity: 0.32; } to { opacity: 0.72; } }
@keyframes drift-a { from { transform: translate3d(-2%, -2%, 0) scale(1); } to { transform: translate3d(5%, 4%, 0) scale(1.08); } }
@keyframes drift-b { from { transform: translate3d(2%, 0, 0) scale(1.05); } to { transform: translate3d(-4%, 5%, 0) scale(1); } }
@keyframes sheen { 0%, 100% { background-position: 120% 0; } 50% { background-position: 0 100%; } }
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: translateX(-50%) scale(0.98); } 50% { opacity: 1; transform: translateX(-50%) scale(1.04); } }
@keyframes question-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- responsive ---------------- */
@media (min-width: 900px) {
  .page { padding-left: 40px; padding-right: 40px; }
  h1 { letter-spacing: 0.08em; }
  .card-float { width: 330px; }
  .question { padding: 20px 26px 22px; }
}

@media (max-height: 820px) {
  .hero .subhead { display: none; }
  .kicker { margin-bottom: 8px; }
  h1 { font-size: clamp(22px, 4.8vw, 30px); }
  .card-float { width: clamp(188px, min(60vw, 36dvh), 290px); }
  .stage { margin-top: 16px; }
  .footer { margin-top: 14px; }
}

@media (max-width: 380px) {
  .brand-sub { display: none; }
  .question { padding: 15px 17px 17px; }
  .front-meta { left: 18px; right: 18px; bottom: 17px; }
  .deck-chip { padding: 6px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-float, .stars, .orb, .back-sheen, .pulse-dot { animation: none !important; }
  .card { transition-duration: 0.01ms; }
  .question { animation-duration: 0.01ms; }
  .btn, .btn-primary:hover { transform: none; }
}
