/* ====== 虾丸 AI身份证 H5 — 撞色版 v2（珊瑚橙×薄荷青 + IP真图） ====== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700;900&family=Noto+Sans+SC:wght@400;700;900&display=swap');

:root {
  --bg: #0c0c14;
  --bg-card: #141420;
  --bg-card-hover: #1c1c2e;
  --border: #2a2a40;

  --coral: #fe7969;
  --coral-light: #ffbdb4;
  --coral-deep: #eb5044;

  --mint: #5af9cb;
  --mint-light: #a0fde4;
  --mint-deep: #2ec4a0;

  --text-bright: #f0eef5;
  --text: #c8c4d4;
  --text-dim: #7a7690;

  --gold: #e0a840;

  --font-display: 'Outfit', 'Noto Sans SC', system-ui, sans-serif;
  --font-body: 'Noto Sans SC', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 30% 20%, rgba(254,121,105,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 70% 80%, rgba(90,249,203,0.06) 0%, transparent 60%);
  pointer-events: none;
}

/* ====== 页面切换 ====== */
.page { display: none; min-height: 100vh; width: 100%; position: relative; z-index: 1; }
.page.active { display: flex; align-items: center; justify-content: center; }

/* ====== 虾丸真图 ====== */
.mascot-img {
  width: 160px;
  height: auto;
  border-radius: 50%;
  object-fit: cover;
  filter:
    drop-shadow(-4px 6px 16px rgba(254,121,105,0.35))
    drop-shadow(4px -4px 16px rgba(90,249,203,0.2));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.mascot-img.bouncing {
  width: 120px;
  animation: bounce 0.5s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.08); }
}

/* ====== 页面1：输入 ====== */
.input-container {
  text-align: center;
  padding: 48px 24px;
  width: 100%;
  max-width: 400px;
}

.mascot-area { margin-bottom: 28px; }

.main-question {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 12px;
  color: var(--text-bright);
  letter-spacing: -0.03em;
}

.sub-question {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#name-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 17px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-bright);
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
#name-input:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(90,249,203,0.15);
}
#name-input::placeholder { color: var(--text-dim); opacity: 0.6; }

/* 心愿输入框 */
.wish-input-wrap {
  position: relative;
  width: 100%;
}

#wish-input {
  width: 100%;
  padding: 16px 50px 16px 20px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-bright);
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
#wish-input:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(254,121,105,0.15);
}
#wish-input::placeholder { color: var(--text-dim); opacity: 0.6; font-size: 14px; }

.wish-count {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 17px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-deep) 100%);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  transition: transform 0.1s, box-shadow 0.2s;
  box-shadow: 0 4px 16px rgba(254,121,105,0.3);
}
.btn-primary:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-primary:not(:disabled):active { transform: scale(0.97); }

.hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--mint-deep);
  opacity: 0.7;
}

/* ====== 页面2：加载 ====== */
.loading-container { text-align: center; }
.loading-text {
  margin-top: 20px;
  font-size: 15px;
  color: var(--mint);
  animation: pulse-text 1.5s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ====== 页面3：结果 ====== */
.result-container {
  padding: 20px 16px 40px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ====== 身份证卡片 ====== */
.identity-card {
  width: 100%;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 0;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.2),
    0 12px 32px rgba(0,0,0,0.2),
    0 0 48px rgba(254,121,105,0.06),
    0 0 48px rgba(90,249,203,0.04);
  animation: cardIn 0.5s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 顶部双色光线 */
.identity-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    var(--coral) 0%,
    var(--coral-light) 30%,
    var(--mint) 70%,
    var(--mint-deep) 100%
  );
  z-index: 2;
}

/* ---- 顶部标识栏 ---- */
.card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  position: relative;
  z-index: 2;
}

.card-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--mint);
  font-family: var(--font-display);
}

.card-id {
  font-size: 11px;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace, sans-serif;
}

/* ---- 插画区：占卡片上半部 ---- */
.card-illustration {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  position: relative;
}

.card-illustration img.species-illustration {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 插画占位（未生成时显示） */
.illustration-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, rgba(254,121,105,0.05) 0%, rgba(90,249,203,0.03) 100%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.placeholder-mascot {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  opacity: 0.6;
  filter: drop-shadow(0 4px 12px rgba(254,121,105,0.2));
}

.placeholder-text {
  font-size: 12px;
  color: var(--text-dim);
  opacity: 0.5;
  letter-spacing: 2px;
}

/* ---- 物种名：紧跟插画下方 ---- */
.card-species-hero {
  text-align: center;
  padding: 16px 24px 12px;
}

.species-name {
  display: block;
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  color: var(--coral);
  line-height: 1.15;
  letter-spacing: -0.02em;
  animation: textIn 0.4s cubic-bezier(0.16,1,0.3,1) 0.2s both;
}
@keyframes textIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.species-group {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--mint);
  background: rgba(90,249,203,0.08);
  padding: 5px 16px;
  border-radius: 100px;
  margin-top: 10px;
  border: 1px solid rgba(90,249,203,0.15);
  font-family: var(--font-display);
}

/* ---- 信息区（紧凑） ---- */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 20px;
}

.card-field-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(42,42,64,0.5);
}

.card-field-row:first-child {
  border-top: 1px solid var(--border);
}

.field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 52px;
}

.field-value {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

/* 危险预言：珊瑚暖光 */
.danger-field {
  background: linear-gradient(135deg, rgba(254,121,105,0.06) 0%, rgba(235,80,68,0.03) 100%);
  margin: 0 -20px;
  padding: 10px 20px;
  border-top: 1px solid rgba(254,121,105,0.1);
}

.danger-field .field-label { color: var(--coral); }

.stars {
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 3px;
}

/* ---- 卡片底部 ---- */
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(90,249,203,0.02) 100%);
}

.card-slogan {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--coral);
  letter-spacing: 0.02em;
}
.card-cta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  line-height: 1.6;
}
.card-cta em {
  font-style: normal;
  color: var(--mint);
  font-weight: 700;
}

/* ====== 操作按钮 ====== */
.action-buttons { display: flex; gap: 12px; width: 100%; margin-top: 16px; }

.btn-action {
  flex: 1;
  padding: 14px 8px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid rgba(90,249,203,0.2);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--mint-deep);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-action:active {
  background: var(--bg-card-hover);
  color: var(--mint);
  border-color: var(--mint);
  transform: scale(0.97);
}
.btn-icon { font-size: 14px; }

.join-section { width: 100%; margin-top: 12px; }

.btn-join {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral) 0%, var(--coral-deep) 100%);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-display);
  transition: transform 0.1s;
  box-shadow: 0 4px 16px rgba(254,121,105,0.25);
}
.btn-join:active { transform: scale(0.97); }

.btn-text {
  margin-top: 12px;
  background: none; border: none;
  color: var(--mint-deep);
  font-size: 14px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(90,249,203,0.3);
  font-family: inherit;
  opacity: 0.6;
}

/* ====== 弹窗 ====== */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 100; }
.modal.active { display: flex; align-items: center; justify-content: center; }
.modal-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 24px;
  width: calc(100% - 48px);
  max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 20px; color: var(--text-dim); cursor: pointer; }
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--coral); margin-bottom: 20px; }
.qr-placeholder {
  width: 200px; height: 200px; margin: 0 auto;
  background: #f8f5f0;
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px;
}
.qr-placeholder img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.qr-placeholder p { font-size: 13px; color: #666; }
.qr-hint { font-size: 11px !important; margin-top: 4px; opacity: 0.5; }
.modal-subtitle { margin-top: 16px; font-size: 15px; color: var(--text-dim); }

/* ====== Toast ====== */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card-hover);
  border: 1px solid var(--mint-deep);
  color: var(--mint-light);
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0; transition: all 0.3s;
  pointer-events: none; white-space: nowrap; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ====== 保存预览 ====== */
.save-preview {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95); z-index: 300;
  flex-direction: column; align-items: center; justify-content: center; padding: 20px;
}
.save-preview.active { display: flex; }
.save-preview-hint { color: var(--mint); font-size: 15px; margin-bottom: 16px; }
.save-preview img { max-width: 100%; max-height: 70vh; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.save-preview-close {
  margin-top: 20px; padding: 12px 36px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; color: var(--mint-deep); font-size: 15px; cursor: pointer; font-family: inherit;
}

/* ====== 分享海报（隐藏，保存时用） ====== */
.share-poster {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1080px;
  height: 1440px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-body);
}

/* 海报插画区 55% */
.poster-illustration {
  width: 100%;
  height: 792px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, rgba(254,121,105,0.06) 0%, rgba(90,249,203,0.04) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.poster-illustration-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 海报物种名 */
.poster-species {
  text-align: center;
  padding: 40px 60px 20px;
}

.poster-species-name {
  display: block;
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 900;
  color: var(--coral);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.poster-species-group {
  display: inline-block;
  font-size: 32px;
  font-weight: 700;
  color: var(--mint);
  background: rgba(90,249,203,0.08);
  padding: 10px 36px;
  border-radius: 100px;
  margin-top: 16px;
  border: 2px solid rgba(90,249,203,0.15);
  font-family: var(--font-display);
}

/* 海报个人信息 */
.poster-info {
  padding: 24px 80px;
  text-align: center;
}

.poster-info-line {
  font-size: 36px;
  color: var(--text);
  line-height: 1.4;
}

.poster-name {
  font-weight: 900;
  color: var(--text-bright);
}

.poster-label {
  font-weight: 400;
  color: var(--text-dim);
}

.poster-skill {
  font-size: 40px;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 12px;
  line-height: 1.4;
}

/* 海报底部 */
.poster-footer {
  margin-top: auto;
  padding: 32px 60px 48px;
  border-top: 2px solid var(--border);
  text-align: center;
}

.poster-slogan {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  color: var(--coral);
  letter-spacing: 0.05em;
}

.poster-cta {
  font-size: 28px;
  color: var(--text-dim);
  margin-top: 16px;
  line-height: 1.5;
}

/* ====== 适配 ====== */
@media (max-height: 700px) {
  .mascot-img { width: 120px; }
  .main-question { font-size: 28px; }
  .species-name { font-size: 36px; }
}
@media (min-width: 420px) { .species-name { font-size: 48px; } }

/* ====== 了解虾丸按钮 ====== */
.btn-about {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  border: 2px solid var(--coral);
  border-radius: 12px;
  background: transparent;
  color: var(--coral);
  cursor: pointer;
  font-family: var(--font-display);
  transition: all 0.15s;
  margin-top: 8px;
}
.btn-about:active { background: rgba(254,121,105,0.1); transform: scale(0.97); }

/* ====== 了解虾丸弹窗 ====== */
.modal-about-content {
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px 24px;
  -webkit-overflow-scrolling: touch;
}
.modal-about-body { text-align: left; }
.about-card-img {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.about-rules {
  padding: 0 4px;
}
.about-rules h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--coral);
  margin: 16px 0 6px;
}
.about-rules h3:first-child { margin-top: 0; }
.about-rules p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 4px;
}
.about-join-btn-wrap {
  margin-top: 20px;
}
.qr-real {
  display: flex;
  justify-content: center;
  margin: 0 auto;
}
