:root {
  color-scheme: dark;
  --bg: #050812;
  --card: rgba(13, 22, 38, .72);
  --card-strong: rgba(18, 31, 52, .88);
  --text: #eef7ff;
  --muted: #8fa6bd;
  --primary: #25f7a0;
  --primary-dark: #12c8ff;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --warning: #ffd166;
  --line: rgba(124, 246, 255, .18);
  --soft: rgba(255,255,255,.06);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 18% -10%, rgba(37,247,160,.28), transparent 32%),
    radial-gradient(circle at 90% 8%, rgba(34,211,238,.24), transparent 28%),
    radial-gradient(circle at 50% 115%, rgba(139,92,246,.22), transparent 34%),
    linear-gradient(180deg, #06101f 0%, #050812 58%, #03050c 100%);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 78%);
}
body::after {
  content: "";
  position: fixed;
  inset: auto -20% 0;
  height: 210px;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(37,247,160,.18), transparent 62%);
  filter: blur(18px);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.phone-shell { width: min(480px, 100%); min-height: 100vh; margin: 0 auto; padding: 18px 14px 96px; position: relative; z-index: 1; }
.top-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 8px 4px 16px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 950; letter-spacing: .16em; margin: 0 0 4px; text-transform: uppercase; text-shadow: 0 0 16px rgba(37,247,160,.55); }
h1, h2, p { margin-top: 0; }
h1 { font-size: 31px; margin-bottom: 0; letter-spacing: -0.05em; text-shadow: 0 0 22px rgba(34,211,238,.22); }
h2 { font-size: 20px; margin-bottom: 14px; letter-spacing: -0.03em; }
.muted { color: var(--muted); line-height: 1.65; }
.card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(17, 28, 48, .86), rgba(8, 15, 28, .66));
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255,255,255,.08);
  padding: 20px;
  backdrop-filter: blur(18px);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,.12), transparent 28%, rgba(37,247,160,.08));
  opacity: .72;
}
.card > * { position: relative; z-index: 1; }
.view { display: none; gap: 14px; }
.view.active { display: grid; }
.status-pill { white-space: nowrap; border-radius: 999px; padding: 9px 12px; background: rgba(255,209,102,.13); border: 1px solid rgba(255,209,102,.34); color: var(--warning); font-weight: 950; font-size: 13px; box-shadow: 0 0 20px rgba(255,209,102,.1); }
.status-pill.done { background: rgba(37,247,160,.13); border-color: rgba(37,247,160,.36); color: var(--primary); box-shadow: 0 0 24px rgba(37,247,160,.18); }
.hero-card { background: radial-gradient(circle at 86% 16%, rgba(37,247,160,.22), transparent 26%), linear-gradient(145deg, rgba(16, 35, 54, .95), rgba(5, 12, 25, .78)); }
.steps-display { display: flex; align-items: baseline; gap: 8px; margin: 22px 0 14px; }
.steps-display strong { font-size: 78px; letter-spacing: -0.09em; line-height: .86; color: #f8ffff; text-shadow: 0 0 16px rgba(37,247,160,.42), 0 0 44px rgba(18,200,255,.22); }
.steps-display span { color: var(--primary); font-weight: 950; }
.progress-track { height: 14px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; box-shadow: inset 0 0 14px rgba(0,0,0,.28); }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan), var(--violet)); box-shadow: 0 0 18px rgba(37,247,160,.58); transition: width .35s ease; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button { border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 12px 14px; background: rgba(255,255,255,.08); color: var(--text); font-weight: 950; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); border-color: rgba(37,247,160,.42); box-shadow: 0 0 22px rgba(37,247,160,.12); }
.button.primary { background: linear-gradient(135deg, var(--primary), var(--cyan)); color: #031018; border: 0; box-shadow: 0 0 22px rgba(37,247,160,.24); }
.button.primary:hover { background: linear-gradient(135deg, #7cffc4, #4ce7ff); }
.text-button { border: 0; background: transparent; color: var(--primary); font-weight: 950; }
.people-card, .health-card, .smoke-card, .coach-card, .member-card, .location-card, .payment-card { background: linear-gradient(145deg, rgba(18, 31, 52, .88), rgba(8, 15, 30, .72)); }
.people-card .card-title-row span, .health-card .card-title-row span, .smoke-card .card-title-row span, .challenge-card .card-title-row span { color: var(--primary); font-weight: 950; }
.people-gallery { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 10px; }
.people-gallery figure { position: relative; min-height: 132px; margin: 0; overflow: hidden; border-radius: 20px; background: var(--soft); border: 1px solid rgba(255,255,255,.08); }
.people-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(1.1) contrast(1.05) brightness(.86); }
.people-gallery figure::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(2,8,18,.72)); }
.people-gallery figure:first-child { min-height: 180px; grid-row: span 2; }
.people-gallery figcaption { position: absolute; left: 10px; bottom: 10px; z-index: 1; border-radius: 999px; padding: 5px 9px; background: rgba(3, 16, 24, .72); color: var(--primary); border: 1px solid rgba(37,247,160,.22); font-size: 12px; font-weight: 950; backdrop-filter: blur(8px); }
.photo-credit { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { padding: 16px; background: linear-gradient(145deg, rgba(13, 24, 44, .9), rgba(7, 14, 26, .74)); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 24px; margin-top: 6px; color: var(--primary); text-shadow: 0 0 18px rgba(37,247,160,.28); }
.health-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.health-grid div { display: grid; gap: 5px; border-radius: 20px; padding: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); }
.health-grid small, .health-grid span { color: var(--muted); }
.health-grid strong { font-size: 24px; color: #fff; text-shadow: 0 0 18px rgba(34,211,238,.25); }
.health-actions { display: flex; align-items: end; gap: 10px; margin-top: 14px; }
.health-actions label { display: grid; gap: 6px; flex: 1; color: var(--muted); font-weight: 850; }
.health-actions input { width: 100%; }
.smoke-card { border-color: rgba(37,247,160,.26); }
.smoke-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; }
.smoke-stats div { display: grid; gap: 5px; border-radius: 20px; padding: 14px; background: rgba(37,247,160,.075); border: 1px solid rgba(37,247,160,.16); }
.smoke-stats small, .diary-item small { color: var(--muted); }
.smoke-stats strong { font-size: 27px; color: var(--primary); text-shadow: 0 0 18px rgba(37,247,160,.28); }
.quit-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-bottom: 10px; }
.quit-row label, .diary-controls label { display: grid; gap: 6px; color: var(--muted); font-weight: 850; }
.diary-box { display: grid; gap: 10px; margin-top: 14px; }
.diary-controls { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
.diary-controls input { padding: 0; accent-color: var(--primary); }
textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(4, 10, 20, .62); color: var(--text); padding: 12px; outline: none; font: inherit; line-height: 1.55; }
textarea:focus { border-color: rgba(37,247,160,.55); box-shadow: 0 0 0 3px rgba(37,247,160,.12); }
.diary-list { display: grid; gap: 10px; margin-top: 14px; }
.diary-item, .diary-empty { border-radius: 18px; padding: 13px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.07); }
.diary-item p { margin: 8px 0 0; color: var(--text); line-height: 1.65; }
.diary-empty { color: var(--muted); line-height: 1.6; }
.smoke-community-card .card-title-row span, .community-composer .card-title-row span { color: var(--primary); font-weight: 950; }
.community-composer { display: grid; gap: 12px; }
.community-feed { display: grid; gap: 12px; }
.community-post { border-radius: 22px; padding: 15px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); }
.post-head, .post-foot { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.post-head strong { color: var(--primary); }
.post-head span, .post-foot { color: var(--muted); font-size: 13px; }
.community-post p { margin: 10px 0; color: var(--text); line-height: 1.7; }
.coach-card { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.coach-card h2 { margin-bottom: 6px; }
.coach-card .button { white-space: nowrap; }
.shake-card { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 14px; }
.shake-card .button { grid-column: 1 / -1; }
.shake-orb { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 25%, #dffff3, var(--primary) 38%, #0aa86e 72%); color: #031018; font-size: 34px; font-weight: 950; box-shadow: 0 0 28px rgba(37,247,160,.32), inset 0 -10px 24px rgba(0,0,0,.22); }
.shake-orb.active { animation: pop .45s ease; background: radial-gradient(circle at 35% 25%, #fff8d7, #ffd166 45%, #f97316); }
@keyframes pop { 0% { transform: scale(.9) rotate(-8deg); } 60% { transform: scale(1.08) rotate(8deg); } 100% { transform: scale(1); } }
.card-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-title-row span, .card-title-row select { color: var(--muted); font-size: 13px; }
select, input { border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(4, 10, 20, .62); color: var(--text); padding: 11px 12px; outline: none; }
select:focus, input:focus { border-color: rgba(37,247,160,.55); box-shadow: 0 0 0 3px rgba(37,247,160,.12); }
.record-list, .chat-list, .ranking-list, .challenge-list { display: grid; gap: 10px; margin: 0; padding: 0; }
.record-item, .chat-message, .ranking-list li, .challenge-item { background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.07); border-radius: 20px; padding: 14px; }
.record-item, .ranking-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.record-item small, .chat-message small, .ranking-list small, .challenge-head small, .challenge-item small { color: var(--muted); }
.ranking-list { list-style: none; }
.challenge-item { display: grid; gap: 10px; }
.challenge-item.joined { outline: 2px solid rgba(37,247,160,.42); background: rgba(37,247,160,.075); }
.challenge-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.challenge-head strong { display: block; margin-bottom: 4px; }
.challenge-head span { white-space: nowrap; color: var(--primary); font-weight: 950; }
.challenge-item p { margin: 0; color: var(--muted); line-height: 1.6; }
.challenge-item .button { justify-self: start; }
.mini-progress { height: 9px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.mini-progress div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); box-shadow: 0 0 14px rgba(37,247,160,.45); }
.chat-card { min-height: calc(100vh - 150px); display: flex; flex-direction: column; }
.member-lock { display: none; background: rgba(255,209,102,.12); border: 1px solid rgba(255,209,102,.28); border-radius: 20px; padding: 16px; margin-bottom: 14px; color: #ffe29a; }
.member-lock.location-lock { background: rgba(34,211,238,.1); border-color: rgba(34,211,238,.26); color: #a7f3ff; }
.member-lock.active { display: block; }
.member-lock p { margin: 6px 0 14px; line-height: 1.6; }
.auth-card .card-title-row span { color: var(--primary); font-weight: 950; }
.auth-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.auth-actions .button:disabled { opacity: .45; cursor: not-allowed; }
.member-card { border-color: rgba(255,209,102,.24); }
.member-card.unlocked { border-color: rgba(37,247,160,.34); }
.location-card .card-title-row span, .payment-card .card-title-row span { border-radius: 999px; padding: 6px 10px; background: rgba(34,211,238,.12); color: var(--cyan); font-weight: 950; }
.badge-card .card-title-row span { color: var(--muted); font-weight: 950; }
.badge-wall { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge-item { display: grid; gap: 4px; padding: 14px; border-radius: 20px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.07); }
.badge-item span { font-size: 28px; }
.badge-item strong { font-size: 15px; }
.badge-item small, .badge-empty { color: var(--muted); line-height: 1.55; }
.badge-empty { grid-column: 1 / -1; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.06); }
.compliance-list { display: grid; gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.compliance-list li { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); line-height: 1.55; }
.compliance-list span { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 950; }
.compliance-list .done span { background: rgba(37,247,160,.18); color: var(--primary); }
.compliance-list .pending span { background: rgba(255,255,255,.08); color: var(--muted); }
.chat-list { flex: 1; align-content: start; max-height: calc(100vh - 320px); overflow: auto; padding-right: 4px; }
.chat-message strong { display: block; margin-bottom: 4px; color: var(--primary); }
.chat-form { display: flex; gap: 10px; margin-top: 16px; }
.chat-form input { flex: 1; min-width: 0; }
.profile-card { display: grid; gap: 14px; }
.profile-card label { display: grid; gap: 8px; color: var(--muted); font-weight: 850; }
.avatar { width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(145deg, var(--primary), var(--cyan)); color: #031018; font-size: 30px; font-weight: 950; box-shadow: 0 0 24px rgba(37,247,160,.24); }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid rgba(255,255,255,.08); }
.switch-row span { display: grid; gap: 4px; }
.switch-row small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.switch-row input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--primary); }
.privacy-switch strong { color: var(--text); }
.debug-card .card-title-row span { color: var(--warning); font-weight: 950; }
.debug-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.legal-card .card-title-row span { color: var(--primary); font-weight: 950; }
.legal-links { display: grid; gap: 10px; }
.legal-links a { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; border-radius: 16px; color: var(--text); text-decoration: none; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); font-weight: 900; }
.legal-links a::after { content: "›"; color: var(--primary); font-size: 20px; }
.legal-links a:hover { border-color: rgba(37,247,160,.34); box-shadow: 0 0 18px rgba(37,247,160,.1); }
.rules-card ul { margin: 0 0 14px; padding-left: 20px; color: var(--muted); line-height: 1.8; }
.tab-bar { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(456px, calc(100% - 24px)); display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; background: rgba(5, 11, 22, .9); border: 1px solid rgba(124,246,255,.18); border-radius: 26px; box-shadow: 0 16px 46px rgba(0,0,0,.42), 0 0 28px rgba(34,211,238,.08); padding: 8px; backdrop-filter: blur(18px); z-index: 9999; pointer-events: auto; touch-action: manipulation; }
.top-tab-bar { position: sticky; top: 8px; bottom: auto; left: auto; transform: none; width: 100%; margin: 0 0 14px; border-radius: 22px; z-index: 20; backdrop-filter: none; }
.tab { border: 0; border-radius: 17px; padding: 10px 2px; color: var(--muted); background: transparent; font-weight: 950; font-size: 13px; pointer-events: auto; touch-action: manipulation; position: relative; z-index: 10000; }
.tab.active { background: linear-gradient(135deg, rgba(37,247,160,.2), rgba(34,211,238,.18)); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(37,247,160,.18), 0 0 18px rgba(37,247,160,.12); }
@media (max-width: 380px) {
  .stats-grid, .badge-wall, .people-gallery, .health-grid, .smoke-stats, .quit-row, .diary-controls { grid-template-columns: 1fr; }
  .people-gallery figure:first-child { min-height: 160px; grid-row: auto; }
  .coach-card, .health-actions { align-items: stretch; flex-direction: column; }
  .auth-grid, .auth-actions, .debug-grid { grid-template-columns: 1fr; }
  .shake-card { grid-template-columns: 1fr; text-align: center; }
  .shake-orb { margin: 0 auto; }
  .chat-form { flex-direction: column; }
}
