/* 小津助手 v2.1 — sign-in screen (js/views/auth.js, docs/DESIGN-v21.md §3).
   The weather scene (variant "login") fills .auth-hero and fades into --bg at its bottom edge; the
   owner's photo and the floating sticker tiles sit on it; title, form card and the 斗地主 card follow
   on the page background, so text never depends on the sky colour. */

.auth {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding-bottom: calc(var(--safe-bottom) + var(--sp-2));
}

/* ---------- hero: scene + avatar + stickers ---------- */
.auth-hero {
  position: relative;
  flex: none;
  height: 41vh;
  min-height: 236px;
  max-height: 380px;
  isolation: isolate;
}
.auth-hero > .auth-orbit, .auth-hero > .auth-pill { z-index: 1; }
.auth-pill {
  position: absolute;
  top: calc(var(--safe-top) + var(--sp-3));
  right: calc(var(--page-x) + var(--safe-right));
}
.auth-pill:empty { display: none; }

.auth-orbit {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 280px;
  height: 160px;
  margin: -80px 0 0 -140px;
}
.auth-avatar {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  animation: auth-pop 520ms var(--ease-spring) both;
}

/* Sticker tiles: white rounded squares with duotone glyphs; outer span = position + tilt,
   inner span = gentle bob (staggered), so the two transforms never fight. */
.sticker {
  position: absolute;
  width: 44px;
  height: 44px;
  animation: auth-pop 560ms var(--ease-spring) both;
}
.sticker-in {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--sticker-bg);
  color: var(--tone-ink);
  box-shadow: 0 2px 4px rgba(84, 48, 24, 0.06), 0 10px 22px rgba(84, 48, 24, 0.14);
  animation: auth-bob 4.2s ease-in-out infinite;
}
.sticker .icon { --dt: .26; width: 24px; height: 24px; }
.sticker.s1 { left: 2px; top: 22px; transform: rotate(-10deg); animation-delay: 80ms; }
.sticker.s2 { right: 0; top: 6px; transform: rotate(9deg); animation-delay: 160ms; }
.sticker.s3 { left: 26px; top: 100px; width: 40px; height: 40px; transform: rotate(7deg); animation-delay: 240ms; }
.sticker.s4 { right: 22px; top: 96px; transform: rotate(-7deg); animation-delay: 320ms; }
.sticker.s5 { left: 60px; top: -20px; width: 36px; height: 36px; transform: rotate(-4deg); animation-delay: 400ms; }
.sticker.s5 .sticker-in { border-radius: 12px; }
.sticker.s5 .icon { width: 20px; height: 20px; }
.sticker.s2 .sticker-in { animation-duration: 4.8s; animation-delay: -1.1s; }
.sticker.s3 .sticker-in { animation-duration: 3.9s; animation-delay: -2.2s; }
.sticker.s4 .sticker-in { animation-duration: 5.2s; animation-delay: -0.6s; }
.sticker.s5 .sticker-in { animation-duration: 4.5s; animation-delay: -3s; }
[data-theme="dark"] .sticker-in { box-shadow: inset 0 1px 0 rgba(255, 236, 220, 0.08), 0 0 0 1px rgba(255, 230, 210, 0.07), 0 10px 22px rgba(0, 0, 0, 0.4); }
@keyframes auth-bob { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -6px, 0); } }
@keyframes auth-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; } }

/* ---------- title, card, guest entry, footer ---------- */
.auth-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 calc(var(--page-x) + var(--safe-right)) 0 calc(var(--page-x) + var(--safe-left));
}
.auth-brand { margin-top: calc(-1 * var(--sp-5)); text-align: center; }
.auth-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--text);
}
.auth-sub { margin-top: var(--sp-1); color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-ui); }

.auth-card {
  margin-top: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--r-2xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.auth-seg { margin-bottom: var(--sp-4); }
.auth-form .field + .field { margin-top: var(--sp-3); }
.auth-form .field { gap: var(--sp-1); }
.auth-form .field-error { padding-left: var(--sp-1); font-size: var(--fs-xs); }
.auth-error {
  margin: var(--sp-3) 0 0;
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
  line-height: var(--lh-wrap);
}
.auth-submit { margin-top: var(--sp-4); }

.auth-guest {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 64px;
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-3);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--text);
  text-decoration: none;
  transition: transform var(--dur) var(--ease-out), background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.auth-guest:active, .auth-guest.is-pressed { transform: scale(var(--press-scale)); background: var(--surface-2); box-shadow: var(--shadow-press); transition-duration: var(--dur-press); }
.auth-guest-main { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.auth-guest-title { font-size: var(--fs-base); font-weight: var(--fw-semibold); line-height: var(--lh-ui); }
.auth-guest-sub { margin-top: 2px; color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-ui); }
.auth-guest-chev { flex: none; color: var(--text-3); }

.auth-foot { flex: none; margin-top: auto; padding-top: var(--sp-4); text-align: center; }
.auth-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sp-3);
  color: var(--text-3);
  font-size: var(--fs-xs);
  text-decoration: none;
}
.auth-foot a:active, .auth-foot a.is-pressed { color: var(--text-2); }

/* ---------- short screens (360×640, WeChat heights) ---------- */
@media (max-height: 700px) {
  .auth-hero { height: 31vh; min-height: 196px; }
  .auth-orbit { transform: scale(.82); }
  .auth-brand { margin-top: calc(-1 * var(--sp-6)); }
  .auth-title { font-size: var(--fs-2xl); }
  .auth-card { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-3) var(--sp-4); }
  .auth-seg { margin-bottom: var(--sp-3); }
  .auth-guest { min-height: 56px; padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
}
@media (max-width: 359px) {
  .auth-orbit { transform: scale(.78); }
}

/* ---------- reduced motion: stickers stay still ---------- */
@media (prefers-reduced-motion: reduce) {
  .sticker, .auth-avatar { animation: fade-in var(--dur) linear both; animation-delay: 0s; }
  .sticker-in { animation: none; }
  .auth-guest:active, .auth-guest.is-pressed { transform: none; }
}
