/* =========================================================
   投资驾驶舱 · H5
   Mobile-first, dark by default, light theme via body.light
   ========================================================= */

:root {
  --bg: #05070b;
  --bg-2: #080b12;
  --card: rgba(255, 255, 255, 0.045);
  --card-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --muted: #99a2b4;
  --dim: #626b7d;
  --gold: #e7c46b;
  --gold-2: #f6dfa4;
  --teal: #5eead4;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --blue: #7dd3fc;
  --violet: #a78bfa;
  --radius: 22px;
  --radius-sm: 14px;
  --nav-h: 74px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
    "PingFang SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

body.light {
  --bg: #f2f3f6;
  --bg-2: #f7f8fa;
  --card: rgba(255, 255, 255, 0.86);
  --card-2: rgba(255, 255, 255, 0.96);
  --border: rgba(12, 18, 32, 0.08);
  --border-strong: rgba(12, 18, 32, 0.16);
  --text: #0b0f17;
  --muted: #5c6577;
  --dim: #8a92a2;
  --gold: #a8791c;
  --gold-2: #c79a3a;
  --teal: #0f9f8d;
  --green: #0f8f5f;
  --red: #d93b5c;
  --amber: #b26a00;
  --blue: #1f7fb8;
  --violet: #6d4bd1;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.1);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior-y: none;
  font-variant-numeric: tabular-nums;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

/* ---------- ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
}

.orb-a {
  width: 360px;
  height: 360px;
  left: -120px;
  top: -100px;
  background: radial-gradient(circle, rgba(231, 196, 107, 0.28), transparent 65%);
}

.orb-b {
  width: 420px;
  height: 420px;
  right: -180px;
  top: 34%;
  background: radial-gradient(circle, rgba(94, 234, 212, 0.12), transparent 65%);
}

.grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, transparent 72%);
}

body.light .ambient {
  opacity: 0.25;
}

/* ---------- app shell ---------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 18px calc(var(--nav-h) + var(--safe-b) + 26px);
}

@media (min-width: 560px) {
  body {
    background:
      radial-gradient(900px 600px at 15% 0%, rgba(231, 196, 107, 0.08), transparent 60%),
      radial-gradient(900px 600px at 90% 40%, rgba(94, 234, 212, 0.06), transparent 60%),
      #030407;
  }
  .app {
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 0 90px rgba(0, 0, 0, 0.55);
    min-height: 100vh;
  }
}

/* ---------- topbar ---------- */
.topbar {
  padding: calc(18px + env(safe-area-inset-top, 0px)) 2px 12px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.topbar .eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 650;
}

.topbar h1 em {
  font-style: normal;
  color: var(--gold);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 3px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--card);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--gold), #b98a2e);
  color: #1a1204;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ---------- page & cards ---------- */
.view {
  padding-top: 4px;
}

.page.with-fab {
  padding-bottom: 78px;
}

.page {
  animation: rise 0.38s cubic-bezier(0.22, 0.8, 0.24, 1);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.section {
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 2px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-head a,
.section-head button {
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.section-head svg {
  width: 13px;
  height: 13px;
}

.muted {
  color: var(--muted);
}

.dim {
  color: var(--dim);
}

.up {
  color: var(--green);
}

.down {
  color: var(--red);
}

.tiny {
  font-size: 11px;
}

.demo-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(231, 196, 107, 0.12);
  border: 1px solid rgba(231, 196, 107, 0.22);
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---------- hero ---------- */
.hero {
  margin-top: 6px;
  padding: 20px 20px 18px;
  overflow: hidden;
  background:
    radial-gradient(120% 130% at 100% 0%, rgba(231, 196, 107, 0.22), transparent 48%),
    linear-gradient(155deg, rgba(231, 196, 107, 0.11), rgba(255, 255, 255, 0.03) 42%, rgba(255, 255, 255, 0.015));
  border-color: rgba(231, 196, 107, 0.22);
}

.hero::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -90px;
  bottom: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(231, 196, 107, 0.28), transparent 65%);
  pointer-events: none;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.hero-value {
  margin: 8px 0 4px;
  font-size: 38px;
  line-height: 1.08;
  font-weight: 680;
  letter-spacing: -0.035em;
}

.hero-value small {
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
  margin-right: 2px;
}

.hero-change {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 550;
}

.hero-change .pill {
  padding: 2px 7px;
  border-radius: 7px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  font-size: 11px;
}

.hero-spark {
  margin: 14px 0 2px;
  height: 46px;
  width: 100%;
}

.hero-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11.5px;
}

.hero-foot b {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

/* ---------- allocation ---------- */
.alloc {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
}

.donut {
  position: relative;
  width: 86px;
  height: 86px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(
    var(--gold) 0 var(--a1),
    var(--blue) var(--a1) var(--a2),
    var(--teal) var(--a2) 100%
  );
}

.donut::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--bg-2);
}

body.light .donut::after {
  background: #fff;
}

.donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.donut-center b {
  display: block;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.legend {
  flex: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.legend-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.legend-row span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-row b {
  color: var(--text);
  font-weight: 600;
}

/* ---------- risk ---------- */
.risk {
  padding: 16px 18px 14px;
}

.risk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.risk-title {
  font-size: 13px;
  color: var(--muted);
}

.risk-level {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  row-gap: 4px;
  gap: 8px;
  margin-top: 2px;
}

.risk-level b {
  white-space: nowrap;
}

.risk-level b {
  font-size: 22px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.red {
  color: var(--red);
  background: rgba(251, 113, 133, 0.1);
  border: 1px solid rgba(251, 113, 133, 0.2);
}

.badge.amber {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.badge.green {
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.badge.blue {
  color: var(--blue);
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.2);
}

.gauge {
  width: 108px;
  height: 62px;
  flex: none;
}

.risk-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.risk-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
}

.risk-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.risk-note {
  margin: 11px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* ---------- horizontal events ---------- */
.hscroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 18px 6px 2px;
  margin: 0 -2px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}

.hscroll::-webkit-scrollbar {
  display: none;
}

.event-card {
  flex: none;
  width: 208px;
  padding: 13px 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  scroll-snap-align: start;
}

.event-card.high {
  border-color: rgba(231, 196, 107, 0.24);
  background: linear-gradient(150deg, rgba(231, 196, 107, 0.1), rgba(255, 255, 255, 0.03));
}

.event-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.event-date {
  font-size: 12px;
  color: var(--gold);
  font-weight: 650;
}

.event-card h3 {
  margin: 9px 0 4px;
  font-size: 14px;
  font-weight: 620;
  line-height: 1.35;
}

.event-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- quick actions ---------- */
.quick {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 14px 6px 12px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
}

.quick-btn:active {
  transform: scale(0.97);
}

.quick-btn svg {
  width: 19px;
  height: 19px;
  color: var(--gold);
}

/* ---------- lists ---------- */
.list {
  display: grid;
  gap: 8px;
}

.row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}

.row-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--gold);
  flex: none;
}

.row-icon svg {
  width: 17px;
  height: 17px;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-main b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-main span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.row-side {
  text-align: right;
  flex: none;
}

.row-side b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.row-side span {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

/* ---------- summary grid ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 6px;
}

.summary-cell {
  padding: 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}

.summary-cell span {
  color: var(--muted);
  font-size: 11px;
}

.summary-cell b {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* ---------- chips ---------- */
.chips {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px 4px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
}

.chip.active {
  color: #1a1204;
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}

body.light .chip.active {
  color: #fff;
}

/* ---------- position card ---------- */
.position {
  padding: 15px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
}

.position-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.ticker {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex: none;
  background: rgba(231, 196, 107, 0.12);
  color: var(--gold);
  border: 1px solid rgba(231, 196, 107, 0.18);
}

.ticker.us {
  background: rgba(125, 211, 252, 0.1);
  color: var(--blue);
  border-color: rgba(125, 211, 252, 0.18);
}

.position-name {
  flex: 1;
  min-width: 0;
}

.position-name b {
  display: block;
  font-size: 14px;
  font-weight: 620;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.position-name span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.position-value {
  text-align: right;
  flex: none;
}

.position-value b {
  display: block;
  font-size: 14px;
  font-weight: 650;
}

.position-value span {
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.position-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 10.5px;
}

.weight-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  margin-top: 9px;
  overflow: hidden;
}

.weight-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
}

/* ---------- signals ---------- */
.signal-card {
  padding: 15px 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
}

.signal-card + .signal-card {
  margin-top: 9px;
}

.signal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.signal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 620;
}

.signal-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.signal-value {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 10px 0 9px;
}

.signal-value b {
  font-size: 27px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 680;
}

.signal-value span {
  color: var(--muted);
  font-size: 11px;
}

.track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(52, 211, 153, 0.55) 0 38%,
    rgba(251, 191, 36, 0.55) 38% 66%,
    rgba(251, 113, 133, 0.55) 66% 100%
  );
}

.track.inverse {
  background: linear-gradient(
    90deg,
    rgba(251, 113, 133, 0.55) 0 34%,
    rgba(251, 191, 36, 0.55) 34% 66%,
    rgba(52, 211, 153, 0.55) 66% 100%
  );
}

.track i {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--text);
  border: 2px solid var(--bg-2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.signal-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--dim);
  font-size: 10.5px;
}

.signal-detail {
  margin: 9px 0 0;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}

.trigger-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.trigger-row:last-child {
  border-bottom: 0;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot.red {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.12);
}

.dot.amber {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
}

.dot.green {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
}

.trigger-main {
  flex: 1;
  min-width: 0;
}

.trigger-main b {
  display: block;
  font-size: 12px;
  font-weight: 560;
}

.trigger-main span {
  display: block;
  color: var(--dim);
  font-size: 10.5px;
  margin-top: 1px;
}

.trigger-value {
  text-align: right;
  flex: none;
}

.trigger-value b {
  display: block;
  font-size: 12px;
  font-weight: 620;
}

.trigger-value span {
  display: block;
  color: var(--dim);
  font-size: 10px;
}

.ledger {
  display: flex;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.ledger:last-child {
  border-bottom: 0;
}

.ledger-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--card-2);
  color: var(--gold);
  flex: none;
}

.ledger-icon svg {
  width: 16px;
  height: 16px;
}

.ledger b {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
}

.ledger p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

/* ---------- timeline ---------- */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 12px;
  width: 1px;
  background: linear-gradient(var(--border-strong), transparent);
}

.tl-item {
  position: relative;
  padding-bottom: 14px;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: -23px;
  top: 17px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--dim);
}

.tl-item.high::before {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(231, 196, 107, 0.12);
}

.tl-card {
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
}

.tl-card.high {
  border-color: rgba(231, 196, 107, 0.22);
}

.tl-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tl-date {
  font-size: 11px;
  color: var(--gold);
  font-weight: 650;
}

.tl-card h3 {
  margin: 7px 0 3px;
  font-size: 13.5px;
  font-weight: 620;
}

.tl-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* ---------- playbook ---------- */
.playbook {
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.playbook + .playbook {
  margin-top: 8px;
}

.playbook summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  cursor: pointer;
}

.playbook summary::-webkit-details-marker {
  display: none;
}

.playbook-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  background: rgba(231, 196, 107, 0.1);
  color: var(--gold);
}

.playbook-icon svg {
  width: 16px;
  height: 16px;
}

.playbook-title {
  flex: 1;
  min-width: 0;
}

.playbook-title b {
  display: block;
  font-size: 13px;
  font-weight: 620;
}

.playbook-title span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  margin-top: 1px;
}

.playbook summary .chev {
  color: var(--dim);
  transition: transform 0.2s;
}

.playbook[open] summary .chev {
  transform: rotate(180deg);
}

.playbook-body {
  padding: 0 14px 14px 59px;
}

.playbook-body ol {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}

.playbook-body li + li {
  margin-top: 5px;
}

/* ---------- checklist ---------- */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 13px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  cursor: pointer;
}

.check-item + .check-item {
  margin-top: 7px;
}

.check-box {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
  transition: 0.18s;
}

.check-box svg {
  width: 12px;
  height: 12px;
  opacity: 0;
  transform: scale(0.6);
  transition: 0.18s;
}

.check-item.done .check-box {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1204;
}

.check-item.done .check-box svg {
  opacity: 1;
  transform: scale(1);
}

.check-item span {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

.check-item.done span {
  color: var(--dim);
  text-decoration: line-through;
}

/* ---------- me ---------- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 20px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(231, 196, 107, 0.18), transparent 55%),
    var(--card);
  border: 1px solid rgba(231, 196, 107, 0.18);
}

.profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--gold), #b98a2e);
  color: #1a1204;
  font-size: 20px;
  font-weight: 700;
  flex: none;
}

.profile-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.profile-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.menu {
  margin-top: 10px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 15px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  color: var(--text);
  font-size: 12.5px;
}

.menu-item:last-child {
  border-bottom: 0;
}

.menu-item svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.menu-item span {
  flex: 1;
}

.menu-item .val {
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
}

.menu-item:active {
  background: rgba(255, 255, 255, 0.03);
}

.disclaimer {
  margin: 18px 4px 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 7px 8px var(--safe-b);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(6, 8, 13, 0.97);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

body.light .tabbar {
  background: rgba(255, 255, 255, 0.98);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--dim);
  font-size: 9.5px;
  border-radius: 14px;
  position: relative;
}

.tab svg {
  width: 21px;
  height: 21px;
}

.tab.active {
  color: var(--gold);
}

.tab.active::before {
  content: "";
  position: absolute;
  top: 2px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  opacity: 0.85;
}

.tab:active {
  transform: scale(0.95);
}

/* ---------- fab ---------- */
.fab {
  position: fixed;
  z-index: 45;
  left: 50%;
  transform: translateX(calc(min(50vw, 240px) - 74px));
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  color: #1a1204;
  box-shadow: 0 12px 30px rgba(231, 196, 107, 0.3);
}

.fab:active {
  transform: translateX(calc(min(50vw, 240px) - 74px)) scale(0.94);
}

.fab svg {
  width: 22px;
  height: 22px;
}

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s;
}

.sheet-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.sheet {
  position: fixed;
  z-index: 61;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 102%);
  width: min(100%, 480px);
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--bg-2);
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  border: 1px solid var(--border);
  border-bottom: 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.24, 1);
  padding-bottom: calc(18px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.sheet.open {
  transform: translate(-50%, 0);
}

.sheet-grip {
  width: 38px;
  height: 4px;
  border-radius: 4px;
  background: var(--border-strong);
  margin: 9px auto 4px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 8px;
}

.sheet-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.sheet-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--card-2);
  color: var(--muted);
}

.sheet-close svg {
  width: 15px;
  height: 15px;
}

.sheet-body {
  padding: 4px 18px 8px;
}

/* ---------- form ---------- */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.segmented button {
  padding: 9px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
}

.segmented button.active {
  background: var(--gold);
  color: #1a1204;
  font-weight: 650;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin: 0 0 6px 2px;
  color: var(--muted);
  font-size: 11px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 13px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  outline: none;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(231, 196, 107, 0.5);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--gold-2), var(--gold));
  color: #1a1204;
  font-size: 13px;
  font-weight: 680;
  margin-top: 6px;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost svg {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: -2px;
  margin-left: 3px;
}

.btn-ghost {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 8px;
}

.btn-danger {
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid rgba(251, 113, 133, 0.25);
  background: rgba(251, 113, 133, 0.08);
  color: var(--red);
  font-size: 12.5px;
  margin-top: 8px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  transform: translate(-50%, -16px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(24, 30, 43, 0.96);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  max-width: 86vw;
  text-align: center;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.light .toast {
  background: #fff;
}

/* ---------- empty ---------- */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
}

.empty svg {
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  opacity: 0.5;
}

/* ---------- misc ---------- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.footnote {
  margin: 16px 4px 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.6;
}

.gold {
  color: var(--gold);
}

@media (max-width: 360px) {
  .gauge {
    width: 92px;
    height: 56px;
  }
  .risk-level b {
    font-size: 20px;
  }
  .hero-value {
    font-size: 34px;
  }
  .topbar h1 {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
