:root {
  --bg: #0a0e14;
  --card: #1c232d;
  --card-elevated: #151a26;
  --green: #a3e635;
  --ink: #ffffff;
  --slate: #949ca8;
  --sheet-light: #f5f7f2;
  --radius: 16px;
  --hero-radius: 20px;
  --pad: 20px;
  --tab-h: 56px;
  --safe-top: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
  --safe-right: 0px;
  --frame-w: 402px;
  --frame-h: 874px;
  --frame-radius: 44px;
  --frame-scale: 1;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
}
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100svh;
  background: #05070b;
}

/* ── 机型切换栏 ── */
.device-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #111820;
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 100;
}
.device-bar__label {
  font-size: 13px;
  color: var(--slate);
  white-space: nowrap;
}
.device-bar__select {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 14px;
}
.device-bar__meta {
  font-size: 11px;
  color: var(--slate);
  white-space: nowrap;
}

/* ── 预览舞台：手机居中，不拉伸整屏 ── */
.preview-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #151b24 0%, #05070b 72%);
}

/* 手机外框 */
.phone-chassis {
  flex-shrink: 0;
  transform: scale(var(--frame-scale));
  transform-origin: center center;
}

.phone-chassis__bezel {
  position: relative;
  padding: 12px 10px 10px;
  background: linear-gradient(160deg, #3a3a40 0%, #121214 45%, #1c1c20 100%);
  border-radius: calc(var(--frame-radius) + 16px);
  border: 2px solid #4a4a52;
  box-shadow:
    0 28px 72px rgba(0,0,0,.72),
    inset 0 1px 0 rgba(255,255,255,.12),
    inset 0 -1px 0 rgba(0,0,0,.35);
}

.phone-chassis__bezel::before,
.phone-chassis__bezel::after {
  content: "";
  position: absolute;
  top: 108px;
  width: 3px;
  height: 52px;
  border-radius: 2px;
  background: linear-gradient(180deg, #555, #2a2a2e);
  opacity: .65;
}
.phone-chassis__bezel::before { left: -1px; }
.phone-chassis__bezel::after { right: -1px; height: 72px; }

.phone-chassis__island {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 96px;
  height: 26px;
  background: #000;
  border-radius: 18px;
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.04);
}

.phone-chassis.no-island .phone-chassis__island { display: none; }
.phone-chassis.is-android .phone-chassis__island {
  width: 10px;
  height: 10px;
  top: 16px;
  border-radius: 999px;
  background: #1a1a1a;
  box-shadow: 0 0 0 2px #2a2a2e;
}

.phone-chassis__indicator {
  width: 108px;
  height: 4px;
  margin: 8px auto 2px;
  border-radius: 4px;
  background: rgba(255,255,255,.28);
}

.phone-chassis.is-android .phone-chassis__indicator { display: none; }

.device-frame {
  width: var(--frame-w);
  height: var(--frame-h);
  border-radius: var(--frame-radius);
  overflow: hidden;
  background: var(--bg);
  position: relative;
  z-index: 1;
}

/* ── App 壳：flex 纵向，Tab 贴底，消灭底部空白 ── */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

.app-main {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.app-main.no-tab {
  /* 子页面无 Tab，占满剩余高度 */
}

.screen { padding: 8px var(--pad) 16px; }
.screen-title { font-size: 34px; font-weight: 700; margin: 0 0 6px; line-height: 1.1; }
.screen-sub { color: var(--slate); font-size: 15px; margin: 0 0 18px; }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.card {
  background: var(--card);
  border-radius: var(--hero-radius);
  padding: 16px;
}

.btn-green {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; border-radius: var(--radius);
  background: var(--green); color: #000; font-size: 17px; font-weight: 700;
  padding: 15px 18px; cursor: pointer;
}
.btn-green.inline { width: auto; }
.btn-ghost {
  border: 0; background: transparent; color: var(--green);
  font-weight: 600; cursor: pointer; padding: 8px;
}
.btn-icon {
  width: 40px; height: 40px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25);
  background: transparent; color: var(--ink); cursor: pointer;
}
.btn-fab {
  width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: var(--green); color: #000; font-size: 18px; cursor: pointer;
}

.avatar {
  width: 40px; height: 40px; border-radius: 999px; background: var(--card);
  display: grid; place-items: center; color: var(--green); flex-shrink: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }

.cover {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-elevated);
  width: 100%;
  max-width: 100%;
}
.cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.08);
}
.cover .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0,0,0,.35) 60%, rgba(0,0,0,.78) 100%);
}
.cover .scrim-side {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,.28) 42%, transparent 72%);
}
.cover .label {
  position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 1;
}
.cover .label h3 {
  margin: 0; font-size: 20px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cover .label p {
  margin: 4px 0 0; font-size: 12px; color: rgba(255,255,255,.82);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.hero { height: 248px; border-radius: var(--hero-radius); }
.hero .title { font-size: 28px; font-weight: 700; margin: 0 0 6px; line-height: 1.15; }
.hero .sub { margin: 0 0 12px; color: rgba(255,255,255,.78); font-size: 14px; }
.hero .cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green); color: #000; border: 0; border-radius: 14px;
  padding: 13px 18px; font-weight: 700; cursor: pointer;
}

.reco-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
}
.reco-card { height: 148px; min-width: 0; }

.progress-card .big { font-size: 28px; font-weight: 700; color: var(--green); }
.dots { display: flex; gap: 8px; }
.dot {
  width: 26px; height: 26px; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.28); display: grid; place-items: center;
  font-size: 10px;
}
.dot.done { background: var(--green); border-color: var(--green); color: #000; }

.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 14px; padding: 12px 14px;
}
.search input {
  flex: 1; border: 0; background: transparent; color: var(--ink); font-size: 16px; outline: none;
}
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filter-btn {
  border: 1px solid rgba(255,255,255,.18); background: rgba(28,35,45,.55);
  color: var(--ink); border-radius: 14px; padding: 12px 14px; text-align: left; cursor: pointer;
}
.library-list {
  background: var(--sheet-light);
  margin: 0 calc(var(--pad) * -1);
  padding: 14px var(--pad) 16px;
}
.library-list .count { color: rgba(0,0,0,.55); font-weight: 600; font-size: 14px; margin-bottom: 12px; }
.library-card { height: 152px; margin-bottom: 12px; cursor: pointer; }

.detail-hero { height: 340px; border-radius: 0; }
.detail-hero .scrim {
  background: linear-gradient(180deg, transparent 55%, rgba(10,14,20,.15) 75%, var(--bg) 100%);
}
.detail-toolbar {
  position: absolute; top: 8px; left: var(--pad); right: var(--pad);
  display: flex; justify-content: space-between; z-index: 2;
}
.icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 999px;
  background: rgba(0,0,0,.35); color: #fff; cursor: pointer;
}
.detail-body { padding: 18px var(--pad) 20px; }
.detail-body h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.15; }
.meta { color: var(--slate); margin: 0 0 20px; }
.points h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; margin: 0 0 12px; }
.points h2::before {
  content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--green);
}
.point {
  display: flex; gap: 12px; margin-bottom: 10px; align-items: flex-start;
}
.point .num {
  width: 28px; height: 28px; border-radius: 999px; background: var(--card);
  color: var(--green); font-size: 12px; font-weight: 700;
  display: grid; place-items: center; flex-shrink: 0;
}
.safety {
  background: #fff; color: #000; border-radius: var(--radius);
  padding: 16px; display: flex; gap: 12px; margin: 18px 0;
}
.safety strong { display: block; margin-bottom: 4px; }
.safety p { margin: 0; color: var(--slate); font-size: 14px; }

.plan-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: rgba(28,35,45,.65); border-radius: 14px;
}
.plan-row .idx { width: 30px; color: var(--green); font-size: 20px; font-weight: 700; }
.thumb { width: 88px; height: 66px; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.weekdays { display: flex; gap: 8px; flex-wrap: wrap; }
.day {
  width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--slate);
}
.day.on { background: var(--green); color: #000; }

.ring-wrap {
  width: 160px; height: 160px; margin: 0 auto; position: relative;
}
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-center .num { font-size: 32px; font-weight: 700; }
.set-row {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  background: var(--card); border-radius: 14px; border: 1.5px solid transparent;
}
.set-row.active { border-color: var(--green); }
.set-row.done .name { color: var(--slate); }

.post-card { margin-bottom: 16px; }
.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.post-head .name { font-weight: 700; font-size: 14px; }
.post-head .time { color: var(--slate); font-size: 12px; }
.post-text { margin: 0 0 12px; line-height: 1.5; }
.post-tag {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--card-elevated); border-radius: 12px; font-size: 12px; font-weight: 600;
}
.post-tag .done { color: var(--green); }
.post-actions { display: flex; gap: 22px; color: var(--slate); font-size: 14px; margin-top: 12px; }
.post-actions .liked { color: var(--green); }

.stats-card {
  display: flex; gap: 14px; padding: 12px; background: var(--card-elevated); border-radius: 14px;
}
.stats-ring {
  width: 88px; height: 88px; position: relative; flex-shrink: 0;
}
.stats-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.stats-ring .val {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}
.stats-mini { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 8px; }
.stats-mini span { display: block; color: var(--slate); font-size: 10px; }
.stats-mini strong { font-size: 12px; color: var(--ink); }

.profile-stats { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; text-align: center; }
.profile-stats .val { font-size: 28px; font-weight: 700; color: var(--green); }
.profile-stats .lbl { color: var(--slate); font-size: 12px; }
.profile-stats .sep { width: 1px; height: 52px; background: var(--card-elevated); }
.menu-group { background: var(--card); border-radius: var(--hero-radius); overflow: hidden; margin-bottom: 16px; }
.menu-item {
  display: flex; align-items: center; gap: 14px; padding: 15px 16px;
  color: var(--ink); text-decoration: none; cursor: pointer; border: 0; width: 100%; background: transparent; font-size: 16px;
}
.menu-item .icon { width: 22px; text-align: center; }
.menu-item .chev { margin-left: auto; color: var(--slate); font-size: 12px; }
.menu-divider { height: 1px; background: var(--card-elevated); margin-left: 52px; }

.empty {
  min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; gap: 14px;
}
.empty .icon { font-size: 48px; color: var(--slate); }
.empty p { color: var(--slate); margin: 0; max-width: 280px; }

.offline-hero { text-align: center; padding: 48px 32px; }
.offline-hero .illus { font-size: 72px; line-height: 1; margin-bottom: 12px; color: var(--card); position: relative; }
.offline-hero .illus .dumb { position: absolute; left: 50%; transform: translateX(-50%); top: 18px; color: var(--green); font-size: 28px; }

/* Tab 在 app-shell 内部贴底，不再 fixed 到窗口 */
.tabbar {
  flex-shrink: 0;
  height: var(--tab-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border-top: 1px solid rgba(255,255,255,.06);
}
.tabbar button {
  border: 0; background: transparent; color: var(--slate);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11px; cursor: pointer; padding: 6px 4px;
}
.tabbar button.active { color: var(--green); }
.tabbar .ico { font-size: 18px; line-height: 1; }

.modal-root[hidden] { display: none; }
.modal-root {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: grid; place-items: end center; z-index: 200; padding: 0;
}
.modal-sheet {
  width: min(100%, var(--frame-w));
  max-height: min(88dvh, var(--frame-h));
  overflow: auto;
  background: var(--bg);
  border-radius: 20px;
  padding: 16px var(--pad) 20px;
  margin: auto 16px 16px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.composer textarea {
  width: 100%; min-height: 140px; resize: vertical; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12); background: var(--card); color: var(--ink);
  padding: 14px; font: inherit;
}
.composer .count { text-align: right; color: var(--slate); font-size: 12px; margin-top: 6px; }
.photo-grid { display: flex; gap: 12px; margin: 14px 0; }
.photo-thumb, .photo-add {
  width: 96px; height: 96px; border-radius: 12px; overflow: hidden; position: relative;
}
.photo-add {
  border: 1px dashed rgba(255,255,255,.25); color: var(--slate);
  display: grid; place-items: center; font-size: 11px; gap: 4px; cursor: pointer;
}

.backbar {
  display: flex; align-items: center; gap: 8px; padding: 8px var(--pad);
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.backbar button { border: 0; background: transparent; color: var(--ink); font-size: 16px; cursor: pointer; }

.line-1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* 窄屏字号微调 */
@media (max-width: 390px) {
  .hero .title { font-size: 24px; }
  .screen-title { font-size: 30px; }
  .hero { height: 220px; }
  .reco-card { height: 132px; }
}
