/* ================================================================
   AstroDice.ai — Shared Design System
   所有页面引入此文件，保证设计一致性
   使用方式：<link rel="stylesheet" href="/shared.css">
   ================================================================ */

/* ── Google Fonts (non-blocking) ── */
/* 每个页面自行用 preload 方式加载，此处不重复 */

/* ── CSS Tokens ── */
:root {
  /* ── Background ── */
  --bg:         #f5f0e8;
  --bg2:        #fffdf7;
  --bg3:        #ede8d8;

  /* ── Gold ── */
  --gold:       #8a6820;
  --gold2:      #c9a84c;
  --gold3:      #f0d88a;
  --gold-dim:   #a07828;
  --gold-glow:  rgba(201,168,76,0.22);

  /* ── Accent ── */
  --purple:     #5a3e8a;
  --purple2:    #7c5cb8;
  --teal:       #1e8a5a;
  --red:        #b03030;
  --green:      #1e8a5a;

  /* ── Text ── */
  --text:       #2c2418;
  --text-dim:   #5c4e38;
  --text-faint: #9a8a6a;

  /* ── Border ── */
  --border:     rgba(138,104,32,0.22);
  --border2:    rgba(138,104,32,0.10);
  --mist:       rgba(138,104,32,0.05);

  /* ── Typography ── */
  --font-display: 'Cinzel', serif;
  --font-body:    'Crimson Pro', Georgia, serif;
  --font-ui:      'DM Mono', monospace;
  --font-sans:    system-ui, -apple-system, sans-serif;

  /* ── Spacing ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* ── Shape ── */
  --radius:    12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* ── Shadow ── */
  --shadow-sm:   0 2px 8px  rgba(138,104,32,0.10);
  --shadow:      0 4px 20px rgba(138,104,32,0.14);
  --shadow-lg:   0 12px 40px rgba(138,104,32,0.18);
  --shadow-gold: 0 4px 20px rgba(201,168,76,0.30);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── Base ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── Ambient background ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 15% 0%,   rgba(255,220,100,0.14) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 5%,   rgba(255,200,80,0.08)  0%, transparent 45%),
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(200,160,50,0.07)  0%, transparent 50%);
}

/* ── Layout ── */
#app {
  position: relative; z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ================================================================
   HEADER (rendered by components.js)
   ================================================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border2);
}
.logo { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.logo-main {
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  color: var(--gold); letter-spacing: 0.15em;
}
.logo-sub {
  font-family: var(--font-body); font-size: 11px;
  color: var(--text-faint); letter-spacing: 0.28em; font-style: italic;
}
nav { display: flex; align-items: center; gap: 16px; }
.nav-link {
  font-family: var(--font-sans); font-size: 13px;
  color: var(--text-dim); text-decoration: none;
  letter-spacing: 0.04em; transition: color 0.2s; cursor: pointer;
}
.nav-link:hover { color: var(--gold); }
#lang-switcher {
  display: flex; gap: 4px;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: 20px; padding: 3px;
}
.lang-btn {
  font-family: var(--font-sans); font-size: 11px;
  padding: 3px 9px; border-radius: 16px; border: none;
  background: transparent; color: var(--text-faint);
  cursor: pointer; transition: all 0.2s; letter-spacing: 0.04em;
}
.lang-btn.active { background: var(--gold); color: var(--bg2); font-weight: 500; }
.auth-btn-fill {
  font-family: var(--font-sans); font-size: 12px;
  padding: 6px 16px; border-radius: 20px; border: none;
  background: var(--gold); color: var(--bg2);
  cursor: pointer; font-weight: 500; letter-spacing: 0.05em;
  transition: all 0.2s; white-space: nowrap;
}
.auth-btn-fill:hover { opacity: 0.88; }
.auth-btn-outline {
  font-family: var(--font-sans); font-size: 12px;
  padding: 6px 16px; border-radius: 20px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); cursor: pointer;
  letter-spacing: 0.05em; transition: all 0.2s; white-space: nowrap;
}
.auth-btn-outline:hover { border-color: var(--gold-dim); color: var(--gold); }
.credits-badge {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 12px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--bg3);
  font-family: var(--font-sans); font-size: 12px; color: var(--gold);
  cursor: pointer; transition: border-color 0.2s; white-space: nowrap;
}
.credits-badge:hover { border-color: var(--gold-dim); }
.credits-star { font-size: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 13px; color: var(--gold);
  cursor: pointer; transition: border-color 0.2s;
}
.user-avatar:hover { border-color: var(--gold-dim); }

/* ================================================================
   FOOTER (rendered by components.js)
   ================================================================ */
footer {
  text-align: center;
  padding: 40px 0 20px;
  border-top: 1px solid var(--border2);
  margin-top: 60px;
}
footer p {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.2em;
}
footer a { color: var(--text-faint); text-decoration: none; }
footer a:hover { color: var(--gold-dim); }

/* ================================================================
   SHARED COMPONENTS
   ================================================================ */

/* ── Page title block ── */
.page-eyebrow {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.35em; text-transform: uppercase;
  color: var(--gold-dim); margin-bottom: 12px; display: block;
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 400; letter-spacing: 0.04em;
  color: var(--text); line-height: 1.2; margin-bottom: 10px;
}
.page-title em { color: var(--gold); font-style: normal; }
.page-desc {
  font-family: var(--font-body); font-size: 17px;
  color: var(--text-dim); font-style: italic; line-height: 1.7;
}

/* ── Card ── */
.card {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-family: var(--font-display); font-size: 13px;
  letter-spacing: 0.14em; color: var(--text); margin-bottom: 16px;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-block;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.18em;
  color: var(--bg2); background: var(--gold); border: none;
  border-radius: 28px; padding: 13px 32px; cursor: pointer;
  box-shadow: var(--shadow-gold); transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(138,104,32,0.40); }
.btn-secondary {
  display: inline-block;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.18em;
  color: var(--gold); background: transparent;
  border: 1px solid var(--border); border-radius: 28px;
  padding: 12px 28px; cursor: pointer; transition: all 0.2s; text-decoration: none;
}
.btn-secondary:hover { background: var(--mist); border-color: var(--gold-dim); }
.btn-ghost {
  font-family: var(--font-sans); font-size: 13px;
  color: var(--text-faint); background: none; border: none;
  cursor: pointer; transition: color 0.2s; padding: 0;
}
.btn-ghost:hover { color: var(--gold-dim); }

/* ── Form elements ── */
.form-label {
  font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 8px; display: block;
}
.form-input {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 12px 14px; font-family: var(--font-sans); font-size: 14px;
  color: var(--text); outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 3px rgba(138,104,32,0.08); }
.form-input::placeholder { color: var(--text-faint); }
.form-select {
  width: 100%; background: var(--bg3);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 11px 14px; font-family: var(--font-sans); font-size: 14px;
  color: var(--text); outline: none; cursor: pointer;
}

/* ── Badge / Chip ── */
.badge {
  display: inline-block; font-family: var(--font-ui); font-size: 10px;
  letter-spacing: 0.12em; padding: 3px 10px; border-radius: 12px;
}
.badge-gold { background: rgba(138,104,32,0.08); color: var(--gold); border: 1px solid rgba(138,104,32,0.20); }
.badge-teal { background: rgba(30,138,90,0.08); color: var(--teal); border: 1px solid rgba(30,138,90,0.20); }
.badge-red  { background: rgba(176,48,48,0.08); color: var(--red); border: 1px solid rgba(176,48,48,0.18); }

/* ── Divider ── */
.ornament {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  margin: 32px 0;
}
.ornament-line { flex: 1; max-width: 120px; height: 1px; background: var(--border2); }
.ornament-star { color: var(--gold-dim); font-size: 14px; }

/* ── Alert / Callout ── */
.callout {
  background: rgba(138,104,32,0.05); border: 1px solid rgba(138,104,32,0.18);
  border-left: 3px solid var(--gold2); border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 18px; margin: 20px 0;
}
.callout-title {
  font-family: var(--font-ui); font-size: 10px; letter-spacing: 0.2em;
  color: var(--gold); margin-bottom: 6px; text-transform: uppercase;
}
.callout p { color: var(--text-dim); font-size: 15px; line-height: 1.7; }

/* ── Loading ── */
.loading-orb {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid var(--border2); border-top-color: var(--gold-dim);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-ui); font-size: 11px;
  letter-spacing: 0.18em; color: var(--text-faint); text-transform: uppercase;
}

/* ── Modal base ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(245,240,232,0.88); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px 28px;
  max-width: 440px; width: 100%; position: relative;
  box-shadow: var(--shadow-lg); animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg3); border: none; cursor: pointer;
  color: var(--text-faint); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close:hover { background: var(--border2); }
.modal-title {
  font-family: var(--font-display); font-size: 15px;
  letter-spacing: 0.12em; color: var(--text); margin-bottom: 16px;
}

/* ── Share modal ── */
.share-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.45);
  align-items: center; justify-content: center;
}
.share-modal-overlay.show { display: flex; }
.share-modal {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 36px 32px 28px;
  max-width: 420px; width: 90%; text-align: center;
  position: relative; box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease-out;
}
.share-modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 20px;
  color: var(--text-faint); cursor: pointer; line-height: 1;
}
.share-modal-icon {
  display: flex; justify-content: center; align-items: center;
  margin-bottom: 16px;
}
.share-modal-title {
  font-family: var(--font-ui); font-size: 14px; letter-spacing: 0.08em;
  color: var(--gold-dim); margin-bottom: 6px;
}
.share-modal-desc {
  font-family: var(--font-sans); font-size: 13px; color: var(--text-faint);
  line-height: 1.6; margin-bottom: 24px;
}
.share-modal-btns { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.share-modal-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 24px; font-family: var(--font-sans);
  font-size: 13px; cursor: pointer; transition: all 0.2s;
  border: 1px solid var(--border); background: transparent; color: var(--text-dim);
}
.share-modal-btn.twitter { background: #1a1a2e; color: #fff; border: 1px solid rgba(255,255,255,0.15); }
.share-modal-btn.twitter:hover { opacity: 0.85; }
.share-modal-btn.copy:hover { border-color: var(--gold-dim); color: var(--gold-dim); }
.share-modal-claim {
  display: none; width: 100%; padding: 13px; border-radius: 24px;
  background: var(--gold); color: var(--bg2); border: none;
  font-family: var(--font-display); font-size: 12px; letter-spacing: 0.15em;
  cursor: pointer; margin-bottom: 8px; box-shadow: var(--shadow-gold);
  transition: opacity 0.2s;
}
.share-modal-claim:hover { opacity: 0.88; }
.share-modal-claimed { font-size: 12px; color: var(--teal); letter-spacing: 0.04em; display: none; }
.share-modal-hint { font-family: var(--font-sans); font-size: 11px; color: var(--text-faint); margin-top: 12px; opacity: 0.7; }

/* ── Page section ── */
.section { margin-bottom: 48px; }
.section-title {
  font-family: var(--font-display); font-size: clamp(16px,2.5vw,22px);
  font-weight: 400; letter-spacing: 0.08em; color: var(--text);
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border2);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  #app { padding: 0 16px 60px; }
  header { padding: 16px 0 14px; }
  .page-title { font-size: 22px; }
  #lang-switcher { display: none; }
  .card { padding: 16px; }
  .modal { padding: 24px 20px; }
  .share-modal { padding: 28px 20px 20px; }
}
