:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-muted: #eef2ec;
  --ink: #11211b;
  --ink-secondary: #495d54;
  --ink-muted: #6c7f76;
  --accent: #0f6b56;
  --accent-soft: #e3f2ed;
  --accent-strong: #0a5241;
  --amber: #b86614;
  --amber-soft: #fdf2e4;
  --border: #e1e7df;
  --danger: #b53a2d;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 2px 10px rgba(17, 33, 27, 0.045);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Inter", system-ui, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  flex-shrink: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.brand-sub {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
}

.banner-demo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--amber-soft);
  border: 1px solid #f0d7b4;
  color: #6f3d0a;
  font-size: 13px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
}

.hero-card {
  background: linear-gradient(155deg, #105e4c 0%, #0b4135 100%);
  color: #f4faf7;
  border: none;
  padding: 20px;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.hero-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.85;
}

.hero-progress-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-variant-numeric: tabular-nums;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.hero-stat {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 10px 9px;
}

.hero-stat-label {
  font-size: 11px;
  opacity: 0.82;
  margin-bottom: 3px;
}

.hero-stat-value {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.hero-stat-band {
  font-size: 11px;
  opacity: 0.78;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #8ee3c5;
  transition: width 0.35s ease;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.focus-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px;
  border-radius: 999px;
}

.focus-selector button {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.focus-selector button.active {
  background: #ffffff;
  color: var(--accent-strong);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 15px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.btn-light {
  background: #ffffff;
  color: var(--accent-strong);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn-soft {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 20px 2px 10px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
}

.section-hint {
  font-size: 12px;
  color: var(--ink-muted);
}

.focus-card {
  border-left: 4px solid var(--accent);
  padding: 16px;
}

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

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-right: 6px;
}

.focus-title-wrap {
  display: flex;
  align-items: flex-start;
}

.focus-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

.grade-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.grade-E1 { background: #dff3ec; color: #0c5846; }
.grade-E2 { background: #e6eef7; color: #244f7a; }
.grade-E3 { background: #f3eee2; color: #6c5323; }
.grade-E4 { background: #f1edf7; color: #563e7d; }
.grade-E0 { background: #fbeae8; color: #8c2d23; }

.utility-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg);
  margin-bottom: 12px;
}

.utility-cell-label {
  font-size: 11px;
  color: var(--ink-muted);
}

.utility-cell-val {
  font-size: 15px;
  font-weight: 750;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.utility-cell-sub {
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.kv-line {
  font-size: 13px;
  color: var(--ink-secondary);
  margin: 6px 0;
}

.kv-line strong {
  color: var(--ink);
}

.hint-box {
  background: var(--accent-soft);
  color: #0e4a3c;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  margin: 10px 0 12px;
}

.card-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.queue-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.queue-row:first-child {
  padding-top: 2px;
}

.queue-left {
  min-width: 0;
}

.queue-name {
  font-size: 14px;
  font-weight: 650;
  margin: 0 0 2px;
}

.queue-sub {
  font-size: 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.queue-right {
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.queue-gain {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-strong);
}

.met-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.met-row:last-child {
  border-bottom: none;
}

.check-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Baseline Form */
.demo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  margin-bottom: 6px;
}

.field-desc {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.input-text, .input-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-wrap input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 28px;
}

.range-val {
  min-width: 78px;
  text-align: right;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.status-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-chip.ok { background: var(--accent-soft); color: var(--accent-strong); }
.status-chip.gap { background: var(--amber-soft); color: var(--amber); }

.seg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.seg-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.seg-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Weekly check-in */
.week-dots {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.week-dot {
  border-radius: var(--radius-sm);
  padding: 8px 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  background: var(--surface-muted);
  color: var(--ink-muted);
  border: 1px solid transparent;
  cursor: pointer;
}

.week-dot.done {
  background: var(--accent);
  color: #fff;
}

.week-dot.current {
  border-color: var(--accent);
}

/* Framework explorer */
.filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.fw-item {
  padding: 14px 16px;
}

.fw-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 8px;
  font-size: 11.5px;
}

.meta-chip {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
}

.disclaimer {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
  margin: 18px 8px 6px;
  line-height: 1.5;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  z-index: 20;
}

.bottom-nav-inner {
  max-width: 640px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  padding: 6px 4px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.nav-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

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

.hidden {
  display: none !important;
}

@media (max-width: 420px) {
  .hero-stat-value { font-size: 17px; }
  .utility-cell-val { font-size: 14px; }
}
