/* MAMTI Style - Mother's Day Warm Pink Theme */

:root {
  --bg: #fef8f6;
  --panel: #ffffff;
  --text: #2d1f1a;
  --muted: #8a7068;
  --line: #f0ddd7;
  --soft: #fef0ed;
  --accent: #e8836b;
  --accent-strong: #d4634a;
  --accent-light: #fce8e3;
  --shadow: 0 16px 40px rgba(180, 80, 60, .08);
  --radius: 22px;
  --radius-sm: 14px;
  --transition: .22s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: radial-gradient(circle at top left, #fffcfb 0%, var(--bg) 36%, #fdf2ef);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ── Shell ── */
.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  min-height: 100vh;
}

/* ── Page system ── */
.page {
  display: none;
  animation: pageIn .35s ease;
}
.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes optionBounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(.94); }
  60%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

/* ── Brand ── */
.brand {
  text-align: center;
  margin-bottom: 32px;
}
.brand-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 8px;
}
.brand-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent-strong);
}
.brand-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  letter-spacing: .08em;
}
.brand-tagline {
  margin-top: 16px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.7;
}

/* ── Input ── */
.input-group {
  margin: 20px 0;
}
.input-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.input-field {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--panel);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.input-field::placeholder { color: #c4a8a0; }

/* ── Role selector ── */
.role-selector {
  display: flex;
  gap: 12px;
  margin: 20px 0;
}
.role-btn {
  flex: 1;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  font-family: inherit;
}
.role-btn:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.role-btn.selected {
  border-color: var(--accent-strong);
  background: var(--soft);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.role-btn .role-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.role-btn .role-label { font-size: 15px; font-weight: 700; color: var(--text); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
  padding: 16px 24px;
  width: 100%;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.btn-primary {
  background: var(--accent-strong);
  color: #fff;
  box-shadow: 0 12px 30px rgba(212, 99, 74, .25);
}
.btn-secondary {
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
}
.btn-sm {
  padding: 10px 16px;
  font-size: 14px;
  width: auto;
}

/* ── Quiz ── */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}
.quiz-user {
  font-weight: 700;
  color: var(--text);
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--accent-light);
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 20px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}

.dim-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-strong);
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 16px;
}

.question-text {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.65;
  margin-bottom: 20px;
  animation: fadeSlideIn .3s ease;
}

.options {
  display: grid;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  text-align: left;
  color: var(--text);
  width: 100%;
}
.option-card:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.option-card.selected {
  border-color: var(--accent-strong);
  background: var(--soft);
  animation: optionBounce .4s ease;
}
.option-code {
  font-weight: 800;
  color: var(--accent-strong);
  min-width: 22px;
  flex-shrink: 0;
}

/* ── Share page ── */
.share-box {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 20px 0;
  word-break: break-all;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.share-link-label {
  font-size: 12px;
  color: var(--accent-strong);
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
}

/* ── Result ── */
.result-vs {
  text-align: center;
  margin-bottom: 24px;
}
.result-names {
  font-size: 20px;
  font-weight: 800;
}
.result-vs-divider {
  color: var(--accent);
  margin: 0 8px;
}

.score-ring-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}
.score-ring {
  position: relative;
  width: 160px;
  height: 160px;
}
.score-ring svg {
  transform: rotate(-90deg);
  width: 160px;
  height: 160px;
}
.score-ring-bg {
  fill: none;
  stroke: var(--accent-light);
  stroke-width: 10;
}
.score-ring-fill {
  fill: none;
  stroke: var(--accent-strong);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 408;
  stroke-dashoffset: 408;
  transition: stroke-dashoffset 1.5s ease;
}
.score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-value {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent-strong);
  line-height: 1;
}
.score-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.tag-pair {
  display: flex;
  gap: 12px;
  margin: 20px 0;
  justify-content: center;
  flex-wrap: wrap;
}
.tag-item {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  text-align: center;
  flex: 1;
  min-width: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tag-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}
.tag-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.tag-info {
  text-align: center;
}
.tag-code {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent-strong);
}
.tag-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}
.tag-desc {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.combo-title {
  text-align: center;
  margin: 16px 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-strong);
}
.combo-emoji {
  font-size: 24px;
  margin-right: 6px;
}

.ai-comment {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin: 20px 0;
  line-height: 1.85;
  font-size: 15px;
  color: #3d2a24;
}
.ai-comment-line {
  display: block;
  margin-bottom: 8px;
}
.ai-comment-line:last-child { margin-bottom: 0; }
.ai-signature {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

/* ── Radar Chart ── */
.radar-wrap {
  display: flex;
  justify-content: center;
  margin: 24px 0;
  position: relative;
}
.radar-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.radar-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.radar-legend-dot.a { background: #e8836b; }
.radar-legend-dot.b { background: #6b9de8; }

.dim-insight {
  text-align: center;
  margin: 12px 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}
.dim-insight strong { color: var(--text); }

/* ── Loading overlay ── */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 248, 246, .95);
  z-index: 100;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 16px;
}
.loading-overlay.active { display: flex; }
.loading-spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--accent-light);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}

/* ── Result actions ── */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

/* ── Theme selector ── */
.theme-selector-wrap {
  margin-top: 24px;
  text-align: center;
}
.theme-selector-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.theme-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.theme-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.theme-btn:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.theme-btn.active {
  border-color: var(--accent-strong);
  background: var(--soft);
  color: var(--accent-strong);
}

/* ── Footer ── */
.footer {
  text-align: center;
  margin-top: 32px;
  font-size: 12px;
  color: var(--muted);
  opacity: .7;
  line-height: 1.6;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent-strong);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all .3s ease;
  z-index: 200;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Invite info ── */
.invite-info {
  text-align: center;
  margin: 20px 0;
}
.invite-from {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-strong);
}
.invite-sub {
  font-size: 15px;
  color: var(--muted);
  margin-top: 8px;
}

/* ── Types page ── */
.types-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.type-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.type-card-info {
  text-align: center;
}
.type-card-code {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-strong);
}
.type-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.type-card-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.5;
}

.footer-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}
.footer-link:hover {
  text-decoration: underline;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .shell { padding: 16px 12px 42px; }
  .card { padding: 20px 16px; }
  .brand-title { font-size: 30px; }
  .question-text { font-size: 16px; }
  .tag-pair { flex-direction: column; align-items: center; }
  .tag-item { min-width: 100%; }
}
