/* ===== 素纸水墨 token ===== */
:root {
  --paper: #FAFAF7;
  --card: #FFFFFF;
  --ink-deep: #1A1A1A;
  --ink-mid: #3D3A36;
  --ink-light: #8A857E;
  --ink-faint: rgba(26, 26, 26, 0.08);
  --ink-faint-2: rgba(26, 26, 26, 0.05);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "PingFang SC", serif;
  --radius-card: 28px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink-deep);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  /* 微纸纹 */
  background-image:
    radial-gradient(circle at 20% 10%, rgba(26,26,26,0.018) 0, transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(26,26,26,0.018) 0, transparent 40%);
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ===== 屏幕系统 ===== */
.screen-host {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), 32px) 24px max(env(safe-area-inset-bottom), 24px);
}
.screen.is-active {
  display: flex;
  animation: screen-fade-in 380ms ease both;
}

@keyframes screen-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== Splash ===== */
.screen--splash {
  align-items: center;
  justify-content: center;
  background: var(--paper);
}
.splash__icon {
  width: 96px;
  height: 96px;
  position: relative;
}
.splash__icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 8px;
  background: var(--ink-deep);
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  animation: splash-stroke 800ms 100ms cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes splash-stroke {
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.screen--splash.is-leaving {
  animation: splash-leave 400ms ease forwards;
}
@keyframes splash-leave {
  to { opacity: 0; }
}

/* ===== 入口 ===== */
.screen--entry { padding-top: 56px; padding-bottom: 56px; }
.brand {
  text-align: center;
}
.brand__title {
  font-weight: 500;
  font-size: 22px;
  letter-spacing: 16px;
  margin: 0 0 10px;
  padding-left: 16px;
  color: var(--ink-deep);
}
.brand__subtitle {
  margin: 0;
  color: var(--ink-light);
  letter-spacing: 6px;
  font-size: 12px;
  font-weight: 300;
}

.entry__center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

/* 入口圆按钮 */
.draw-btn {
  position: relative;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--ink-faint);
  color: var(--ink-deep);
  font-family: inherit;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 14px;
  padding-left: 14px;
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 12px 32px -16px rgba(26,26,26,0.18);
  transition: transform 200ms ease, box-shadow 200ms ease, opacity 400ms ease;
}
.draw-btn:hover {
  box-shadow:
    0 1px 0 rgba(0,0,0,0.02),
    0 18px 40px -18px rgba(26,26,26,0.28);
}
.draw-btn:active { transform: scale(0.97); }
.draw-btn__ring {
  position: absolute; inset: 10px;
  border-radius: 50%;
  border: 1px solid rgba(26,26,26,0.06);
  pointer-events: none;
}
.draw-btn__label { display: inline-block; }

.entry__hint {
  margin: 0;
  color: var(--ink-light);
  letter-spacing: 5px;
  font-size: 12px;
}

.entry__date {
  text-align: center;
  color: var(--ink-mid);
}
.entry__date-greg {
  font-size: 13px;
  letter-spacing: 3px;
}
.entry__date-lunar {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--ink-light);
  margin-top: 6px;
}

/* ===== 抽卡动画(墨晕扩散) ===== */
.screen--drawing {
  align-items: center;
  justify-content: center;
  background: var(--paper);
}
.ink-blot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(70vw, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(26,26,26,0.10) 0%,
    rgba(26,26,26,0.05) 40%,
    transparent 72%);
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
}
.ink-blot.is-spreading {
  animation: ink-spread 1600ms cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes ink-spread {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(2.4); opacity: 1; }
}

/* ===== 卡片 ===== */
.screen--card {
  align-items: center;
  padding-top: 56px;
  padding-bottom: 32px;
  gap: 20px;
}

.card {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3 / 4;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow:
    0 1px 0 rgba(0,0,0,0.03),
    0 24px 60px -28px rgba(26,26,26,0.25);
  padding: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  /* 入场:scale + alpha + translateY */
  opacity: 0;
  transform: scale(0.92) translateY(20px);
}
.card.is-entering {
  animation: card-enter 700ms cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes card-enter {
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.card > * {
  opacity: 0;
}
.card.is-entering > * {
  animation: card-content 700ms 280ms ease-out forwards;
}
@keyframes card-content {
  to { opacity: 1; }
}

.card__quote {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 900;
  font-size: 24px;
  line-height: 1.7;
  letter-spacing: 5px;
  color: var(--ink-deep);
  padding: 12px 4px;
  white-space: pre-wrap;
}
.card__source {
  text-align: center;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ink-mid);
  margin-top: 8px;
}
.card__year {
  text-align: center;
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--ink-light);
  margin-top: 4px;
}
.card__category {
  text-align: center;
  font-size: 10px;
  letter-spacing: 5px;
  color: rgba(138,133,126,0.7);
  margin-top: 10px;
}

/* ===== 卡片操作按钮 ===== */
.card-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.primary-btn, .ghost-btn {
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 13px;
  letter-spacing: 4px;
  padding: 10px 22px;
  border: 1px solid var(--ink-faint);
  background: var(--card);
  color: var(--ink-deep);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.primary-btn {
  background: var(--ink-deep);
  color: var(--paper);
  border-color: var(--ink-deep);
}
.primary-btn:active, .ghost-btn:active { transform: scale(0.97); }

/* 重置按钮(开发测试用) */
.reset-link {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: transparent;
  border: 0;
  color: var(--ink-light);
  font-size: 11px;
  letter-spacing: 2px;
  padding: 6px 10px;
  opacity: 0.5;
}
.reset-link:hover { opacity: 1; }
