:root {
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 0.18s ease;
  }

  [data-theme="dark"] {
    --bg-base:       #0d0d10;
    --bg-surface:    #141418;
    --bg-raised:     #1c1c22;
    --bg-hover:      #22222a;
    --border:        rgba(255,255,255,0.07);
    --border-mid:    rgba(255,255,255,0.12);
    --text-primary:  #f0f0f3;
    --text-secondary:#a0a0b0;
    --text-muted:    #606070;
    --accent:        #6e86ff;
    --accent-subtle: rgba(110,134,255,0.12);

    --green:         #3ecf8e;
    --green-bg:      rgba(62,207,142,0.1);
    --green-border:  rgba(62,207,142,0.3);

    --blue:          #5b9cf6;
    --blue-bg:       rgba(91,156,246,0.1);
    --blue-border:   rgba(91,156,246,0.3);

    --amber:         #f5a623;
    --amber-bg:      rgba(245,166,35,0.1);
    --amber-border:  rgba(245,166,35,0.3);

    --red:           #f16060;
    --red-bg:        rgba(241,96,96,0.1);
    --red-border:    rgba(241,96,96,0.3);

    --gray:          #888899;
    --gray-bg:       rgba(136,136,153,0.1);
    --gray-border:   rgba(136,136,153,0.25);
  }

  [data-theme="light"] {
    --bg-base:       #f5f5f8;
    --bg-surface:    #ffffff;
    --bg-raised:     #f0f0f4;
    --bg-hover:      #e8e8f0;
    --border:        rgba(0,0,0,0.07);
    --border-mid:    rgba(0,0,0,0.12);
    --text-primary:  #18181f;
    --text-secondary:#50505e;
    --text-muted:    #9090a0;
    --accent:        #4a6cf7;
    --accent-subtle: rgba(74,108,247,0.08);

    --green:         #1a9e6a;
    --green-bg:      rgba(26,158,106,0.08);
    --green-border:  rgba(26,158,106,0.25);

    --blue:          #2d7dd2;
    --blue-bg:       rgba(45,125,210,0.08);
    --blue-border:   rgba(45,125,210,0.25);

    --amber:         #c47c00;
    --amber-bg:      rgba(196,124,0,0.08);
    --amber-border:  rgba(196,124,0,0.25);

    --red:           #cc3a3a;
    --red-bg:        rgba(204,58,58,0.08);
    --red-border:    rgba(204,58,58,0.25);

    --gray:          #696978;
    --gray-bg:       rgba(105,105,120,0.08);
    --gray-border:   rgba(105,105,120,0.2);
  }

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  html { scroll-behavior: smooth; }
  [id] { scroll-margin-top: 92px; }

  body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
  }

  /* ── HEADER ── */
  .site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 20px;
    display: flex; align-items: center; justify-content: space-between;
    min-height: 52px;
    gap: 14px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .header-title {
    font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
    color: var(--text-primary); text-transform: uppercase;
    display: flex; align-items: center; gap: 8px;
  }
  .header-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); display: inline-block;
  }
  .header-controls {
    display: flex; align-items: center; gap: 8px;
  }
  .header-nav {
    display: flex; align-items: center; justify-content: center; gap: 4px;
    flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none;
  }
  .header-nav::-webkit-scrollbar { display: none; }
  .header-nav a {
    color: var(--text-muted); text-decoration: none;
    font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
    padding: 6px 9px; border-radius: var(--radius-sm);
    white-space: nowrap; transition: background var(--transition), color var(--transition);
  }
  .header-nav a:hover,
  .header-nav a:focus-visible {
    background: var(--bg-raised); color: var(--text-primary); outline: none;
  }
  .ctrl-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-mid);
    background: var(--bg-raised); color: var(--text-secondary);
    font-family: var(--font-body); font-size: 12px; font-weight: 500;
    cursor: pointer; transition: all var(--transition);
    white-space: nowrap;
  }
  .ctrl-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
  .ctrl-btn i { font-size: 14px; }
  .donate-trigger {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--accent-subtle);
  }
  .icon-only {
    width: 34px; height: 34px; padding: 0; justify-content: center;
  }

  @media (max-width: 760px) {
    .site-header {
      flex-wrap: wrap;
      align-items: flex-start;
      padding: 8px 12px;
    }
    .header-nav {
      order: 3;
      flex-basis: 100%;
      justify-content: flex-start;
    }
    .header-controls {
      margin-left: auto;
    }
  }

  @media (max-width: 460px) {
    .header-title { max-width: 148px; }
    .header-controls { gap: 5px; }
    .ctrl-btn { padding: 5px 8px; }
  }

  /* ── LAYOUT ── */
  .page {
    max-width: 840px; margin: 0 auto;
    padding: 32px 20px 60px;
  }

  /* ── SECTION HEADER ── */
  .section-label {
    font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--text-muted); font-weight: 600;
    margin-bottom: 14px;
  }
  .section-divider {
    height: 1px; background: var(--border);
    margin: 36px 0 28px;
  }
  .section-title {
    font-size: 18px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 6px;
  }
  .section-sub {
    font-size: 13px; color: var(--text-muted); margin-bottom: 20px;
    line-height: 1.5;
  }

  /* ── HERO ── */
  .hero {
    padding: 28px 0 4px;
    margin-bottom: 32px;
  }
  .hero-eyebrow {
    font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--accent); font-weight: 600; margin-bottom: 10px;
    font-family: var(--font-mono);
  }
  .hero-h1 {
    font-size: clamp(22px, 4vw, 30px);
    font-weight: 600; line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 10px;
  }
  .hero-desc {
    font-size: 14px; color: var(--text-secondary);
    line-height: 1.7; max-width: 560px;
  }

  /* ── STATE GRID ── */
  #state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .state-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
  }
  .state-card:hover {
    border-color: var(--border-mid);
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  }
  .state-card.selected {
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  }
  .state-icon {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px;
  }
  .state-icon i { font-size: 17px; }
  .state-name {
    font-size: 13px; font-weight: 500; color: var(--text-primary);
    margin-bottom: 6px; line-height: 1.3;
  }
  .state-badge {
    display: inline-block;
    font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
    padding: 2px 8px; border-radius: 4px;
  }

  /* ── DETAIL PANEL ── */
  #detail-panel {
    display: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 4px;
  }

  .detail-head {
    display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  }
  .detail-icon {
    width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
  }
  .detail-icon i { font-size: 22px; }
  .detail-name { font-size: 17px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
  .detail-badge { font-size: 11px; font-weight: 500; }

  .detail-what {
    font-size: 13px; color: var(--text-secondary);
    line-height: 1.7; margin-bottom: 18px;
    padding: 12px 14px;
    background: var(--bg-raised); border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-mid);
  }

  .detail-col-label {
    font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
    font-weight: 600; margin-bottom: 10px;
  }

  .signs-row {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px;
  }
  .sign-chip {
    font-size: 12px; color: var(--text-secondary);
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 3px 10px;
  }

  .do-dont-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  }
  @media (max-width: 520px) { .do-dont-grid { grid-template-columns: 1fr; } }

  .action-item {
    font-size: 13px; color: var(--text-primary);
    line-height: 1.55; padding: 7px 10px 7px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    margin-bottom: 6px;
  }

  /* ── FRICTION LIST ── */
  #friction-list { display: flex; flex-direction: column; gap: 10px; }

  .friction-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    transition: border-color var(--transition);
  }
  .friction-card:hover { border-color: var(--border-mid); }

  .friction-looks-label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px;
  }
  .friction-looks {
    font-size: 14px; font-weight: 500; font-style: italic;
    color: var(--text-primary); margin-bottom: 10px;
  }
  .friction-cause {
    font-size: 13px; color: var(--text-secondary); line-height: 1.65;
    margin-bottom: 10px; padding-left: 12px;
    border-left: 2px solid var(--border-mid);
  }
  .friction-helps {
    display: flex; gap: 8px; align-items: flex-start;
  }
  .friction-helps i { font-size: 14px; color: var(--green); margin-top: 2px; flex-shrink: 0; }
  .friction-helps-text { font-size: 13px; color: var(--green); line-height: 1.6; }

  /* ── SLEEP & FOOD CARDS ── */
  .notes-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px;
  }
  @media (max-width: 600px) { .notes-grid { grid-template-columns: 1fr; } }

  .note-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
  }
  .note-card-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  }
  .note-card-icon {
    width: 36px; height: 36px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .note-card-icon i { font-size: 18px; }
  .note-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
  .note-card-who { font-size: 11px; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }

  .note-item {
    display: flex; gap: 8px; align-items: flex-start;
    margin-bottom: 9px;
  }
  .note-item:last-child { margin-bottom: 0; }
  .note-bullet {
    width: 5px; height: 5px; border-radius: 50%;
    flex-shrink: 0; margin-top: 6px;
  }
  .note-text {
    font-size: 13px; color: var(--text-secondary);
    line-height: 1.6;
  }
  .note-text strong { color: var(--text-primary); font-weight: 500; }

  .note-warn {
    margin-top: 12px;
    padding: 9px 12px;
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
    border-radius: var(--radius-sm);
    font-size: 12px; color: var(--amber); line-height: 1.55;
  }
  .note-warn i { font-size: 13px; vertical-align: -1px; margin-right: 3px; }

  .note-tip {
    margin-top: 10px;
    padding: 9px 12px;
    background: var(--blue-bg);
    border: 1px solid var(--blue-border);
    border-radius: var(--radius-sm);
    font-size: 12px; color: var(--blue); line-height: 1.55;
  }
  .note-tip i { font-size: 13px; vertical-align: -1px; margin-right: 3px; }

  /* ── FOR-ME SECTION ── */
  .for-me-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 10px;
  }
  .for-me-header {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  }
  .for-me-icon {
    width: 34px; height: 34px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .for-me-icon i { font-size: 17px; }
  .for-me-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

  /* ── FOOTER ── */
  .footer {
    padding: 24px 20px 0;
    border-top: 1px solid var(--border);
    text-align: center;
  }
  .footer-text {
    font-size: 11px; color: var(--text-muted); line-height: 1.6;
    font-family: var(--font-mono);
  }

  /* ── SCROLLBAR ── */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 3px; }
