:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --ink: #2c2a28;
  --muted: #7a7570;
  --line: #e7e2d9;
  --primary: #5a8f7b;
  --primary-dark: #45705f;
  --primary-soft: #e3efe9;
  --accent: #c98a5e;
  --accent-soft: #f6e7da;
  --danger: #c0584f;
  --shadow: 0 6px 24px rgba(44, 42, 40, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--primary-dark); }

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 244, 239, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-dark);
  text-decoration: none;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .dot { font-size: 1.3rem; }
.nav a.navlink {
  text-decoration: none;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
}
.nav a.navlink:hover { color: var(--ink); background: var(--surface); }
.nav a.navlink.active { color: #fff; background: var(--primary); }

/* Layout */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.narrow { max-width: 720px; }

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

h1 { font-size: 1.9rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
p.lead { font-size: 1.1rem; color: var(--muted); }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
  border-radius: 24px;
  padding: 40px 28px;
  text-align: center;
  margin-bottom: 24px;
}
.hero h1 { font-size: 2.2rem; }
.hero .lead { max-width: 620px; margin: 0 auto 20px; color: #5b5650; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .05s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Domain cards on home */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.domain {
  border-top: 4px solid var(--primary);
}
.domain.alt { border-top-color: var(--accent); }
.domain .emoji { font-size: 2rem; }

/* Forms */
label.field { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.95rem; }
input[type="text"], textarea, select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
  transition: all .12s ease;
}
.chip:hover { border-color: var(--primary); }
.chip.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.accent.selected { background: var(--accent); border-color: var(--accent); }

/* Range */
.range-row { display: flex; align-items: center; gap: 12px; }
input[type="range"] { flex: 1; accent-color: var(--primary); }
.range-val { font-weight: 700; min-width: 28px; text-align: center; }

/* Body map */
.bodymap-wrap { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 640px) { .bodymap-wrap { grid-template-columns: 220px 1fr; } }
.bodymap { width: 100%; max-width: 220px; margin: 0 auto; display: block; }
.bodymap .region {
  fill: var(--primary-soft);
  stroke: var(--primary);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill .12s ease;
}
.bodymap .region:hover { fill: #cfe6dc; }
.bodymap .region.selected { fill: var(--accent); stroke: var(--accent); }
.bodymap-legend { font-size: .85rem; color: var(--muted); text-align: center; margin-top: 6px; }

/* Entry list */
.entry { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.entry .when { font-size: .82rem; color: var(--muted); }
.entry .tags { margin: 8px 0; }
.tag { display: inline-block; background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 3px 10px; font-size: .8rem; margin: 2px 4px 2px 0; }
.tag.accent { background: var(--accent-soft); color: #9c5f33; }
.badge { display:inline-block; padding: 2px 10px; border-radius: 999px; font-size:.78rem; font-weight:600; }
.badge.phys { background:#e3efe9; color:#3c6b58; }
.badge.emo { background:#f6e7da; color:#9c5f33; }
.badge.unsure { background:#eee; color:#777; }

/* Reader */
.reader-text { font-size: 1.12rem; line-height: 1.7; }
.reader-text p { margin: 0 0 14px; }
.affirmation { font-style: italic; font-size: 1.15rem; color: var(--primary-dark); border-left: 3px solid var(--primary); padding-left: 14px; margin: 18px 0; }

/* Day grid */
.days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; font-weight: 700; position: relative;
}
.day-cell small { font-weight: 400; font-size: .65rem; color: var(--muted); }
.day-cell.done { background: var(--primary-soft); border-color: var(--primary); }
.day-cell.current { outline: 2px solid var(--accent); }
.day-cell.locked { opacity: .45; cursor: not-allowed; }
.day-cell .check { position:absolute; top:3px; right:5px; color: var(--primary); font-size:.8rem; }

/* Progress */
.progress { background: var(--line); border-radius: 999px; height: 12px; overflow: hidden; }
.progress > span { display:block; height:100%; background: var(--primary); border-radius:999px; }

/* Stats */
.stat-grid { display:grid; grid-template-columns: repeat(2,1fr); gap:12px; }
@media (min-width:640px){ .stat-grid{ grid-template-columns: repeat(4,1fr); } }
.stat { background:#fff; border:1px solid var(--line); border-radius:12px; padding:14px; text-align:center; }
.stat .num { font-size:1.6rem; font-weight:800; color: var(--primary-dark); }
.stat .lbl { font-size:.8rem; color: var(--muted); }
.bar-row { display:flex; align-items:center; gap:10px; margin:6px 0; }
.bar-row .name { width:120px; font-size:.88rem; }
.bar-row .bar { flex:1; background:var(--line); border-radius:999px; height:14px; overflow:hidden; }
.bar-row .bar > span { display:block; height:100%; background:var(--accent); }
.bar-row .cnt { width:28px; text-align:right; font-size:.85rem; color:var(--muted); }

/* Misc */
.notice { background: var(--accent-soft); border: 1px solid #ecd5c0; border-radius: 12px; padding: 12px 14px; font-size:.92rem; }
.hr { height:1px; background:var(--line); border:0; margin:18px 0; }
.pcm-pick { display:grid; grid-template-columns:1fr; gap:10px; }
@media (min-width:640px){ .pcm-pick{ grid-template-columns:1fr 1fr; } }
.pcm-opt { border:1px solid var(--line); border-radius:12px; padding:12px; cursor:pointer; background:#fff; }
.pcm-opt:hover { border-color: var(--primary); }
.pcm-opt.selected { border-color: var(--primary); background: var(--primary-soft); }
.pcm-opt h4 { margin:0 0 4px; }
.pcm-opt p { margin:0; font-size:.85rem; color:var(--muted); }
.footer { text-align:center; color:var(--muted); font-size:.82rem; padding:24px 16px 40px; }
.hidden { display:none !important; }
