:root {
  --ink: #0f172a;
  --ink-2: #172033;
  --cobalt: #1b63ff;
  --cyan: #10c7e8;
  --cyan-2: #18d3f3;
  --human: #ff5d62;
  --slate: #6c7789;
  --muted: #7a8494;
  --muted-2: #4f5b6d;
  --line: #dfe7f0;
  --line-strong: #cbd5e1;
  --soft: #eef3f8;
  --soft-2: #f7faff;
  --panel: #ffffff;
  --desk: #0b1020;
  --success: #0e9f6e;
  --warning: #f59e0b;
  --shadow: 0 30px 80px rgba(6, 12, 28, .46);
  --shadow-sm: 0 10px 28px rgba(15, 23, 42, .08);
  --radius-card: 8px;
  --radius-btn: 8px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(27, 99, 255, .18), rgba(16, 199, 232, .08) 34%, rgba(255, 93, 98, .12) 100%),
    var(--desk);
  color: var(--ink);
  font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

button,
input,
textarea {
  font: inherit;
}

button { cursor: pointer; }
input,
textarea { cursor: text; }
a { color: inherit; text-decoration: none; }
svg { display: block; }

.app-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 28px;
}

.app-screen {
  width: 390px;
  height: 844px;
  background: var(--soft);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.app-header {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  padding: 18px 20px 0;
  color: #fff;
  background:
    linear-gradient(135deg, #0f172a 0%, #111827 56%, #162a5f 100%);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.header-signal {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .78;
}

.header-signal::before,
.header-signal::after {
  content: "";
  position: absolute;
  left: 154px;
  right: -42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(24, 211, 243, .5), rgba(27, 99, 255, .92), transparent);
  transform: rotate(-12deg);
}

.header-signal::before { top: 36px; }
.header-signal::after {
  top: 86px;
  opacity: .52;
  transform: rotate(-8deg);
}

.header-signal span {
  position: absolute;
  right: 24px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .08);
}

.header-signal span:nth-child(1) {
  top: 26px;
  width: 45px;
  height: 24px;
  background: rgba(27, 99, 255, .36);
}

.header-signal span:nth-child(2) {
  top: 60px;
  right: 72px;
  width: 30px;
  height: 30px;
  background: rgba(255, 93, 98, .84);
}

.header-signal span:nth-child(3) {
  top: 94px;
  width: 62px;
  height: 20px;
  background: rgba(16, 199, 232, .24);
}

.header-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 14px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .22);
}

.brand-copy { min-width: 0; }

.brand-kicker {
  color: var(--cyan-2);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  line-height: 1.2;
  margin-bottom: 6px;
}

.brand-name {
  color: #fff;
  font-size: 23px;
  font-weight: 850;
  line-height: 1.12;
}

.brand-slogan {
  margin-top: 6px;
  color: rgba(255, 255, 255, .68);
  font-size: 12px;
  line-height: 1.35;
}

.plan-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-btn);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.channel-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.channel-tabs::-webkit-scrollbar { display: none; }

.tab-button {
  flex: 0 0 auto;
  min-width: 68px;
  min-height: 34px;
  padding: 0 12px;
  color: rgba(255, 255, 255, .62);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}

.tab-button.is-active {
  color: #fff;
  background: var(--cobalt);
  border-color: rgba(255, 255, 255, .18);
}

.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px 16px;
}

.app-panel { display: none; }
.app-panel.is-active { display: block; }

.featured-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, #111827 0%, #14265c 58%, #104557 100%);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-card);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.featured-card::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: 17px;
  width: 150px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--cobalt));
  transform: rotate(-16deg);
  opacity: .72;
}

.featured-tag {
  position: relative;
  z-index: 1;
  margin-bottom: 7px;
  color: var(--cyan-2);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.featured-title {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.48;
}

.featured-meta {
  position: relative;
  z-index: 1;
  margin-top: 7px;
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  line-height: 1.4;
}

.feed-list { display: grid; gap: 10px; }

.info-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(203, 213, 225, .78);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.info-card.expanded {
  border-color: rgba(27, 99, 255, .28);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .12);
}

.card-button {
  width: 100%;
  padding: 14px 14px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  transition: background .12s;
}

.card-button:active { background: var(--soft-2); }

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.tag,
.time {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.tag {
  color: var(--cobalt);
  background: rgba(27, 99, 255, .1);
}

.time {
  margin-left: auto;
  color: var(--muted);
  background: var(--soft);
}

.info-card h2 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.48;
}

.card-expand-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.card-expand-hint svg { transition: transform .2s; }
.info-card.expanded .card-expand-hint svg { transform: rotate(180deg); }

.card-summary {
  display: none;
  padding: 0 14px 14px;
  animation: slideDown .18s ease;
}

.info-card.expanded .card-summary { display: block; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.summary-box {
  padding: 12px;
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  margin-bottom: 8px;
}

.interpretation-flow {
  display: grid;
  gap: 10px;
}

.interpretation-flow > p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.depth-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  color: var(--cobalt);
  background: var(--panel);
  border: 1px solid rgba(27, 99, 255, .26);
  border-radius: var(--radius-btn);
  font-size: 12px;
  font-weight: 800;
  transition: background .12s, border-color .12s;
}

.depth-toggle-btn:active { background: rgba(27, 99, 255, .08); }
.depth-toggle-btn svg { flex-shrink: 0; transition: transform .2s; }
.info-card.paid-open .depth-toggle-btn svg { transform: rotate(180deg); }

.save-toggle-btn {
  flex: 0 0 58px;
  justify-content: center;
  padding: 0;
  color: var(--muted-2);
}

.paid-depth {
  display: none;
  padding: 0 14px 14px;
  animation: slideDown .18s ease;
}

.info-card.paid-open .paid-depth { display: block; }

.depth-inner {
  padding: 12px;
  background: linear-gradient(135deg, rgba(27, 99, 255, .08), rgba(16, 199, 232, .12));
  border: 1px solid rgba(27, 99, 255, .18);
  border-radius: var(--radius-card);
}

.depth-inner > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--cobalt);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.pro-result-flow {
  display: grid;
  gap: 10px;
}

.pro-result-flow > p,
.primary-action p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.7;
}

.primary-action {
  margin-top: 2px;
  padding: 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(27, 99, 255, .22);
  border-radius: var(--radius-card);
}

.primary-action > span {
  display: block;
  margin-bottom: 5px;
  color: var(--cobalt);
  font-size: 11px;
  font-weight: 860;
}

.pro-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.pro-action-btn {
  min-height: 38px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(203, 213, 225, .82);
  border-radius: var(--radius-btn);
  font-size: 12px;
  font-weight: 780;
}

.pro-action-btn:active {
  background: rgba(27, 99, 255, .08);
  border-color: rgba(27, 99, 255, .28);
}

.paywall-card {
  background: var(--panel);
  border: 1.5px dashed rgba(27, 99, 255, .32);
  border-radius: var(--radius-card);
  padding: 16px;
  text-align: center;
}

.paywall-card .paywall-lock {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.paywall-card .paywall-sub {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.paywall-box {
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  text-align: center;
}

.paywall-box p {
  margin: 0 0 10px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.6;
}

.btn-primary,
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  color: #fff;
  background: var(--cobalt);
  border: 0;
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 850;
  transition: opacity .15s, transform .15s;
}

.btn-cta {
  width: 100%;
  background: var(--human);
}

.btn-primary:active,
.btn-cta:active {
  opacity: .88;
  transform: translateY(1px);
}

.btn-primary.full { width: 100%; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted-2);
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 13px;
  font-weight: 750;
}

.bottom-nav {
  display: flex;
  flex-shrink: 0;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom, 0));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
}

.nav-button {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 48px;
  padding: 7px 0 5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-btn);
  font-size: 11.5px;
  font-weight: 750;
  transition: color .15s, background .15s;
}

.nav-icon {
  width: 20px;
  height: 20px;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button.is-active {
  color: var(--cobalt);
  background: rgba(27, 99, 255, .08);
}

.section-header {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.mine-section {
  padding: 14px;
  background: var(--panel);
  border: 1px solid rgba(203, 213, 225, .78);
  border-radius: var(--radius-card);
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.section-label {
  margin: 0 0 10px;
  color: var(--cobalt);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.account-logged-out { display: grid; gap: 9px; }
.account-logged-out h3 { margin-bottom: 3px; font-size: 15px; font-weight: 850; }
.account-logged-out p { color: var(--muted-2); font-size: 13px; line-height: 1.5; }

.auth-fields { display: grid; gap: 7px; }

.auth-fields input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 14px;
}

.auth-fields input:focus {
  outline: 2px solid rgba(27, 99, 255, .72);
  outline-offset: -1px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}

.account-logged-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.account-info strong { display: block; font-size: 14px; margin-bottom: 2px; }
.account-info span { color: var(--muted); font-size: 12px; }
.account-actions { display: flex; gap: 7px; flex-shrink: 0; }

.sub-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sub-info strong { display: block; font-size: 16px; font-weight: 850; margin-bottom: 3px; }
.sub-info span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.setting-list { display: grid; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.setting-row:last-child { border-bottom: 0; }
.setting-row > span { color: var(--muted-2); }

.setting-note {
  margin: -2px 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.lang-toggle { display: flex; gap: 6px; }

.lang-btn {
  padding: 5px 12px;
  color: var(--muted-2);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 12px;
  font-weight: 750;
  transition: color .15s, background .15s, border-color .15s;
}

.lang-btn.is-active {
  color: #fff;
  background: var(--cobalt);
  border-color: var(--cobalt);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 9px 3px 4px;
  color: var(--muted);
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 800;
  transition: background .15s, color .15s, border-color .15s;
}

.switch i {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
}

.switch.is-active {
  color: #fff;
  background: var(--cobalt);
  border-color: var(--cobalt);
}

.setting-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 12px;
  color: var(--muted-2);
  background: var(--soft-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 750;
}

.setting-action.danger {
  color: #c43f45;
  background: #fff5f5;
  border-color: #ffd4d6;
}

.legal-page {
  width: min(760px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 20px 40px;
  color: var(--ink);
  background: var(--panel);
}

.legal-page h1 {
  margin: 18px 0 8px;
  font-size: 24px;
  line-height: 1.25;
}

.legal-page h2 {
  margin: 22px 0 8px;
  font-size: 16px;
  line-height: 1.35;
}

.legal-page p,
.legal-page li {
  color: var(--muted-2);
  font-size: 14px;
  line-height: 1.75;
}

.legal-page ul {
  display: grid;
  gap: 6px;
  padding-left: 18px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--cobalt);
  background: rgba(27, 99, 255, .1);
  border: 1px solid rgba(27, 99, 255, .16);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
}

.empty-state {
  padding: 20px 16px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--cobalt);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 16, 32, .52);
  z-index: 100;
}

.sheet-overlay.is-open { display: block; }

.pref-panel {
  position: fixed;
  inset: 0;
  left: 50%;
  translate: -50% 0;
  z-index: 101;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  transform: translateY(100%);
  transition: transform 300ms ease-out;
}

.pref-panel.is-open { transform: translateY(0); }

.pref-header {
  padding: 28px 20px 16px;
  border-bottom: 1px solid var(--line);
}

.pref-header h2 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

.pref-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pref-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.pref-label {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
}

.pref-hint {
  color: var(--muted);
  font-weight: 400;
}

.pref-chips,
.pref-stages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-chip,
.pref-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  transition: border-color .15s, background .15s;
}

.pref-chip span,
.pref-stage span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.pref-chip.is-selected,
.pref-stage.is-selected {
  color: var(--cobalt);
  background: rgba(27, 99, 255, .08);
  border-color: var(--cobalt);
}

.pref-chip.is-selected span,
.pref-stage.is-selected span { color: var(--muted-2); }

.pref-footer {
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--line);
}

.btn-primary.full {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
}

@media (max-width: 520px) {
  body {
    align-items: stretch;
    justify-content: flex-start;
    background: var(--soft);
  }

  .app-shell {
    display: block;
    padding: 0;
    min-height: 100vh;
  }

  .app-screen {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
