* { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Georgia', serif; overflow: hidden; }

  /* ── SCREEN SYSTEM ── */
  .screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden; /* stronger than pointer-events alone — OEM PWA shells ignore the latter */
    pointer-events: none;
    transition: opacity var(--transition), visibility var(--transition);
    z-index: 0;
  }
  .screen.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
  }

  /* S3 与其它屏同为垂直居中；内容过高时仍可滚（safe center 溢出时贴顶） */
  #s3.screen.active {
    justify-content: center;
    justify-content: safe center;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(5.5rem, calc(4.5rem + env(safe-area-inset-bottom)));
  }
  #s3 .fate-logo { margin-bottom: 1.35rem; flex-shrink: 0; }
  #s3 .q-stack { flex-shrink: 0; }

  /* ── SHARED ── */
  .fate-logo {
    font-size: 0.75rem; letter-spacing: 0.3em;
    color: var(--text-dim); text-transform: uppercase;
    margin-bottom: 3rem;
  }
  .fate-logo a {
    color: var(--text-dim); text-decoration: none;
    transition: color var(--transition);
  }
  .fate-logo a:hover { color: var(--accent); }
  .fate-logo .crumb-sep { opacity: 0.45; letter-spacing: 0.12em; }
  .fate-logo .crumb-here { color: var(--text-dim); opacity: 0.85; }
  .headline {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 400; line-height: 1.35;
    text-align: center; margin-bottom: 1rem;
  }
  .sub {
    font-size: 0.95rem; color: var(--text-dim);
    text-align: center; line-height: 1.7;
    max-width: 36ch; margin-bottom: 2.5rem;
  }
  .btn {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.75rem 2.5rem;
    border-radius: 2px;
    font-family: inherit; font-size: 0.9rem;
    letter-spacing: 0.15em; text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
  }
  .btn:hover { background: var(--accent-glow); }
  .btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
  .btn-primary:hover { opacity: 0.88; }
  .btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .divider { width: 40px; height: 1px; background: var(--border); margin: 2rem auto; }

  /* ── S1: LANDING ── */
  #s1 .tool-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(201, 185, 154, 0.28);
    border-radius: 50%;
    background: rgba(201, 185, 154, 0.04);
  }
  #s1 .tool-mark img {
    display: block;
    width: 48px;
    height: 48px;
  }
  #s1 .tagline { font-size: 0.8rem; letter-spacing: 0.25em; color: var(--text-dim); text-transform: uppercase; margin-bottom: 1rem; }

  /* ── S2: UPLOAD ── */
  #s2 .upload-zone {
    display: block;
    width: 100%; max-width: 380px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem 2rem; text-align: center; cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    margin-bottom: 1.5rem; position: relative;
    overflow: hidden;
  }
  #s2 .upload-zone:hover, #s2 .upload-zone.drag-over { border-color: var(--accent); background: var(--accent-glow); }
  /* Default UX: whole zone is the hit target (not display:none — Android WebView care) */
  #s2 .upload-zone .file-hit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.01;
    cursor: pointer;
    z-index: 2;
    font-size: 16px;
  }
  #s2 .upload-icon,
  #s2 .upload-hint { pointer-events: none; position: relative; z-index: 1; }
  #s2 .upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.4; }
  #s2 .upload-hint { font-size: 0.85rem; color: var(--text-dim); }
  /* Only shown on Android standalone PWA (OEM shells that ignore the zone hit target) */
  #s2 .upload-alt {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    max-width: 380px;
    margin: -0.5rem 0 1rem;
  }
  #s2 .upload-alt.visible { display: flex; }
  #s2 .file-native {
    display: block;
    width: 100%;
    font-size: 16px;
    color: var(--text-dim);
    font-family: inherit;
  }
  #s2 .file-native::file-selector-button,
  #s2 .file-native::-webkit-file-upload-button {
    background: var(--accent);
    color: var(--bg);
    border: 1px solid var(--accent);
    border-radius: 2px;
    padding: 0.7rem 1.25rem;
    font-family: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    margin-right: 0.75rem;
  }
  #s2 .upload-alt-note {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-align: center;
    line-height: 1.5;
    opacity: 0.75;
    max-width: 36ch;
  }
  #s2 .upload-alt-note a { color: var(--accent); }
  #s2 .thumb-row { display: flex; gap: 0.5rem; justify-content: center; min-height: 64px; margin-bottom: 1.5rem; flex-wrap: wrap; }
  #s2 .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }

  /* ── S3: QUESTIONNAIRE ── */
  #s3 .q-stack { width: 100%; max-width: 400px; }
  #s3 #s3title {
    font-size: 1.35rem; line-height: 1.35; color: var(--text);
    margin-bottom: 1.5rem; font-weight: 400; text-align: left;
  }
  .q-block {
    margin-bottom: 1.65rem;
    padding-bottom: 1.35rem;
    border-bottom: 1px solid rgba(30, 30, 46, 0.95);
  }
  .q-block:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
    padding-bottom: 0;
  }
  .q-label {
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    color: var(--text);
    margin: 0 0 0.85rem;
    line-height: 1.45;
    font-weight: 400;
  }
  .chip-row-wrap {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
  }
  .chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; flex: 1; min-width: 0; }
  .chip-row.rerolling { animation: chip-reroll 200ms ease-out; }
  @keyframes chip-reroll {
    0% { opacity: 0.3; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
  }
  .dice-btn {
    flex-shrink: 0; width: 36px; height: 36px; border: 1px solid var(--border);
    background: transparent; color: var(--text-dim); border-radius: 6px;
    cursor: pointer; font-size: 1rem; line-height: 1; padding: 0;
    opacity: 0.85; margin-top: 0.05rem;
  }
  .dice-btn:hover { color: var(--accent); border-color: var(--accent); opacity: 1; }
  .q-fallback {
    font-size: 0.84rem; margin: 0.25rem 0 0; min-height: 1.25em;
    transition: opacity 300ms; letter-spacing: 0.01em;
  }
  .q-fallback[hidden] { display: none !important; }
  .q-fallback a {
    color: var(--text-dim); text-decoration: underline;
    text-underline-offset: 3px; cursor: pointer; opacity: 0.9;
  }
  .q-fallback .skip-link { opacity: 0.9; }
  .q-fallback .sep { opacity: 0.45; margin: 0 0.4rem; color: var(--text-dim); }
  .q-fallback .describe-link { opacity: 0.8; }
  .q-fallback a:hover { color: var(--accent); opacity: 1; }
  .q-skip-state {
    font-size: 0.92rem; color: var(--text-dim); opacity: 0.75;
    margin: 0.35rem 0 0; font-style: italic;
  }
  .q-skip-state a {
    opacity: 1; font-style: normal; margin-left: 0.55rem;
    font-size: 0.84rem; color: var(--accent);
  }
  .q-describe-wrap { margin: 0.65rem 0 0; }
  .q-describe-wrap input {
    width: 100%; box-sizing: border-box; background: rgba(18, 18, 26, 0.6);
    border: 1px solid var(--border); color: var(--text); border-radius: 8px;
    padding: 0.55rem 0.8rem; font-size: 0.9rem; outline: none; font-family: inherit;
  }
  .q-describe-wrap input:focus { border-color: rgba(201, 185, 154, 0.45); }
  .q-describe-wrap input.over { border-color: #c66; }
  .q-describe-count { font-size: 0.72rem; color: var(--text-dim); text-align: right; margin-top: 0.3rem; opacity: 0.65; }
  .chip {
    padding: 0.5rem 1rem; border: 1px solid var(--border);
    border-radius: 2px; font-size: 0.9rem; cursor: pointer;
    color: #a8a8bc; transition: all var(--transition);
    background: transparent; font-family: inherit; line-height: 1.4;
    letter-spacing: 0.01em;
  }
  .chip:hover { border-color: var(--accent); color: var(--accent); }
  .chip.selected {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-glow);
  }
  #s3 #s3next { margin-top: 0.75rem; margin-bottom: 0.5rem; }

  @media (max-height: 700px) {
    #s3 #s3title { font-size: 1.2rem; margin-bottom: 1.1rem; }
    .q-block { margin-bottom: 1.2rem; padding-bottom: 1rem; }
    .q-label { font-size: 1rem; margin-bottom: 0.65rem; }
    #s3 .fate-logo { margin-bottom: 0.85rem; }
  }

  /* ── S4: GAZING ── */
  #s4 .gaze-orb {
    width: 96px; height: 96px; border-radius: 50%;
    border: 1px solid var(--accent);
    margin: 0 auto 2.5rem; position: relative;
    animation: pulse 2.4s ease-in-out infinite;
  }
  #s4 .gaze-orb::after {
    content: ''; position: absolute; inset: 8px; border-radius: 50%;
    border: 1px solid rgba(201,185,154,0.3);
    animation: pulse 2.4s ease-in-out infinite 0.8s;
  }
  @keyframes pulse { 0%,100% { opacity:0.4; transform:scale(1); } 50% { opacity:1; transform:scale(1.05); } }
  #s4 .gaze-text { font-size: 0.8rem; letter-spacing: 0.25em; color: var(--text-dim); text-transform: uppercase; text-align: center; }
  #s4 .gaze-lines { font-size: 0.92rem; color: var(--text-dim); text-align: center; line-height: 2; max-width: 32ch; margin-top: 2rem; min-height: 4.5rem; }

  /* ── S5: REVEAL ── */
  #s5 .name-seal {
    width: min(240px, 72vw); height: min(240px, 72vw); margin: 0 auto 2rem;
    border: 1px solid var(--accent); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    position: relative; padding: 1.25rem; box-sizing: border-box;
    background: radial-gradient(ellipse at center, var(--accent-glow) 0%, transparent 70%);
  }
  #s5 .name-seal::before { content:''; position:absolute; inset:6px; border-radius:50%; border:1px solid rgba(201,185,154,0.2); }
  #s5 .revealed-name {
    font-size: clamp(1.35rem, calc(11rem / var(--name-len, 6)), 2.6rem);
    letter-spacing: 0.04em; color: var(--accent); font-weight: 400;
    text-align: center; line-height: 1.15; max-width: 100%;
    overflow-wrap: anywhere; word-break: break-word;
  }
  #s5 .seal-pinyin { font-size: 0.75rem; color: var(--text-dim); letter-spacing: 0.2em; margin-top: 0.3rem; }
  #s5 .free-line { font-size: 0.9rem; color: var(--text-dim); text-align: center; max-width: 34ch; line-height: 1.7; margin-bottom: 0.65rem; font-style: italic; }
  #s5 .source-line { font-size: 0.78rem; color: var(--text-dim); text-align: center; max-width: 36ch; line-height: 1.55; margin: 0 auto 0.85rem; opacity: 0.72; }
  #s5 .alt-name {
    display: none; background: none; border: none; padding: 0; margin: 0 auto 0.85rem;
    font-family: inherit; font-size: 1.05rem; color: var(--accent); opacity: 0.75;
    cursor: pointer; letter-spacing: 0.04em; text-decoration: underline; text-underline-offset: 0.2em;
  }
  #s5 .alt-name:hover { opacity: 1; }
  #s5 .category-tag { display:inline-block; font-size:0.7rem; color:var(--text-dim); opacity:0.68; letter-spacing:0.08em; border:1px solid var(--border); border-radius:999px; padding:0.22rem 0.7rem; margin-bottom:1.75rem; font-weight:300; }
  #s5 .fate-stamp { font-size: 0.7rem; letter-spacing: 0.15em; color: var(--text-dim); opacity: 0.5; text-align: center; margin-bottom: 1.5rem; }
  #s5 .cta-row { display: flex; gap: 1rem; }

  .offering-skip { background:none; border:none; color:var(--text-dim); font-size:0.8rem; letter-spacing:0.1em; opacity:0.5; cursor:pointer; margin-top:0.5rem; transition:opacity var(--transition); }
  .offering-skip:hover { opacity:1; }

  /* ── PROGRESS DOTS ── */
  .dots { position:fixed; bottom:2rem; left:50%; transform:translateX(-50%); display:flex; gap:0.5rem; z-index:10; }
  .dot { width:5px; height:5px; border-radius:50%; background:var(--border); transition:background var(--transition); }
  .dot.on { background:var(--accent); }

  /* ── LEGAL FOOTER ── */
  .legal-footer {
    position:fixed; bottom:0.6rem; right:0.9rem; z-index:10;
    font-size:0.62rem; letter-spacing:0.05em; color:var(--text-dim); opacity:0.35;
  }
  .legal-footer a { color:inherit; text-decoration:none; }
  .legal-footer a:hover { opacity:1; text-decoration:underline; }
  .legal-footer span { margin:0 0.35em; }

  /* ── PAYMENT OVERLAY ── */
  .pay-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(10, 10, 15, 0.92);
    display: none; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2rem; text-align: center;
  }
  .pay-overlay.visible { display: flex; }
  .pay-overlay .pay-title {
    font-size: 1.15rem; color: var(--accent); letter-spacing: 0.12em;
    text-transform: uppercase; margin-bottom: 1rem;
  }
  .pay-overlay .pay-body {
    font-size: 0.9rem; color: var(--text-dim); line-height: 1.7;
    max-width: 32ch; margin-bottom: 1.75rem;
  }
  .pay-overlay .pay-actions { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; max-width: 280px; }
  .pay-overlay .pay-err { font-size: 0.8rem; color: #c97a7a; margin-bottom: 1rem; max-width: 36ch; min-height: 1.2em; }
