/* Forge — Mastery Practice Tracker
   Palette: Copper × Charcoal-warm (forge metaphor) */

:root {
  /* Surfaces */
  --bg: #100A07;
  --bg-2: #15100C;
  --surface: #1B1612;
  --surface-2: #251C16;
  --surface-3: #2E231B;
  --border: rgba(217, 162, 74, 0.14);
  --border-strong: rgba(217, 162, 74, 0.28);

  /* Brand */
  --copper: #C2683B;
  --copper-2: #A2502A;
  --ember: #E8743A;
  --ember-2: #FF8C42;
  --brass: #D9A24A;
  --brass-2: #E7B968;
  --brass-dim: #8B6B2E;
  --smoke: #4B3D33;

  /* Text */
  --text: #F5EBDA;
  --text-2: #D7C5AA;
  --text-3: #B0A091;
  --text-4: #756758;

  /* Semantic */
  --good: #6FB97A;
  --warn: #E0A050;
  --bad: #C2563E;

  /* Motion */
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.4, 0, .2, 1);

  /* Layout */
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-1: 0 4px 18px -6px rgba(0,0,0,0.55), 0 0 0 1px var(--border);
  --shadow-2: 0 14px 40px -16px rgba(0,0,0,0.7), 0 0 0 1px var(--border);
  --shadow-ember: 0 0 30px -4px rgba(232,116,58,0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: 'Heebo', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(232,116,58,0.10), transparent 60%),
    radial-gradient(900px 700px at -10% 110%, rgba(194,104,59,0.08), transparent 60%),
    radial-gradient(600px 400px at 50% 50%, rgba(217,162,74,0.04), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 110px;
}

/* film grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  mix-blend-mode: overlay;
}

/* floating embers */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.ambient .orb {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.30;
  animation: drift 18s ease-in-out infinite alternate;
}
.ambient .orb-a { top: -120px; right: -90px; background: radial-gradient(circle, var(--ember) 0%, transparent 60%); }
.ambient .orb-b { bottom: -100px; left: -80px; background: radial-gradient(circle, var(--copper) 0%, transparent 60%); animation-delay: -6s; }
.ambient .orb-c { top: 40%; left: 60%; width: 220px; height: 220px; background: radial-gradient(circle, var(--brass) 0%, transparent 60%); opacity: 0.18; animation-delay: -12s; }
@keyframes drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px, -30px) scale(1.1); }
}

/* Typography utility */
.h-serif { font-family: 'Frank Ruhl Libre', 'David Libre', Georgia, serif; font-weight: 500; }
.h-italic { font-family: 'Instrument Serif', Georgia, serif; font-style: italic; font-weight: 400; }
.h-mono { font-family: 'IBM Plex Mono', 'Menlo', monospace; font-variant-numeric: tabular-nums; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  background: linear-gradient(180deg, rgba(16,10,7,0.85), rgba(16,10,7,0.55) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
}
.brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  display: grid;
  place-items: center;
  position: relative;
  box-shadow: var(--shadow-ember), inset 0 1px 0 rgba(255,255,255,0.04);
  border: 1px solid var(--border-strong);
}
.brand .mark img { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: 'Frank Ruhl Libre', serif; font-weight: 600; font-size: 19px; letter-spacing: 0.5px; color: var(--text); }
.brand-text span { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 13px; color: var(--brass); }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(37, 28, 22, 0.6);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 200ms var(--spring);
  font-size: 16px;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--border-strong); color: var(--brass); background: var(--surface-2); }
.icon-btn:active { transform: scale(0.95); }

/* ---------------- Layout container ---------------- */
.wrap {
  position: relative;
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 18px 40px;
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  isolation: isolate;
  box-shadow: var(--shadow-2);
  border: 1px solid var(--border);
  background: var(--surface);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: 70% 50%;
  z-index: -2;
  transform: scale(1.05);
  transition: transform 800ms var(--ease);
}
.hero:hover .hero-bg { transform: scale(1.08); }
.hero-grad {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(85deg, rgba(16,10,7,0.95) 0%, rgba(16,10,7,0.75) 35%, rgba(16,10,7,0.30) 70%, transparent 100%),
    linear-gradient(180deg, transparent 60%, rgba(16,10,7,0.75) 100%);
}
.hero-inner {
  position: relative;
  padding: 32px 28px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  min-height: 280px;
}
.hero-text { max-width: 560px; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brass);
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(217, 162, 74, 0.06);
  margin-bottom: 14px;
}
.hero-eyebrow .dot { width: 7px; height: 7px; background: var(--ember); border-radius: 50%; box-shadow: 0 0 12px var(--ember); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: 0.7; } }

.hero-title {
  font-family: 'Frank Ruhl Libre', serif;
  font-weight: 600;
  font-size: clamp(28px, 5.4vw, 44px);
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.5px;
}
.hero-title em { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--brass-2); font-weight: 400; }
.hero-sub {
  font-size: 15px;
  color: var(--text-3);
  margin: 0 0 18px;
  max-width: 460px;
  line-height: 1.7;
}
.hero-active {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(27, 22, 18, 0.7);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  width: fit-content;
  cursor: pointer;
  transition: all 220ms var(--spring);
}
.hero-active:hover { transform: translateY(-2px); border-color: var(--brass); background: var(--surface-2); }
.hero-active .label { font-size: 11px; color: var(--text-4); text-transform: uppercase; letter-spacing: 1.2px; font-family: 'IBM Plex Mono', monospace; }
.hero-active .blade-name { font-family: 'Frank Ruhl Libre', serif; font-size: 18px; color: var(--text); font-weight: 500; }
.hero-active i { color: var(--brass); margin-right: 6px; }

/* Hero ring */
.hero-ring {
  width: 168px;
  height: 168px;
  flex-shrink: 0;
}
.hero-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); filter: drop-shadow(0 0 12px rgba(232,116,58,0.35)); }
.ring-track { stroke: rgba(217,162,74,0.10); fill: none; stroke-width: 6; }
.ring-fill { stroke: url(#emberGrad); fill: none; stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 800ms var(--ease); }
.ring-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.ring-center .pct { font-family: 'IBM Plex Mono', monospace; font-size: 32px; font-weight: 500; color: var(--text); line-height: 1; }
.ring-center .sub { font-size: 11px; color: var(--text-4); margin-top: 4px; text-transform: uppercase; letter-spacing: 1.5px; font-family: 'IBM Plex Mono', monospace; }
.hero-ring-wrap { position: relative; display: grid; place-items: center; }

@media (max-width: 640px) {
  .hero-inner { grid-template-columns: 1fr; min-height: auto; padding: 26px 22px 22px; }
  .hero-ring { width: 130px; height: 130px; justify-self: end; }
  .hero-ring-wrap { justify-self: center; }
}

/* ---------------- Stats grid ---------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
@media (max-width: 720px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  position: relative;
  padding: 16px 16px 18px;
  background: linear-gradient(150deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 280ms var(--spring), border-color 280ms;
}
.kpi:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.kpi::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(232,116,58,0.06), transparent 50%);
  pointer-events: none;
}
.kpi .ic {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: rgba(232, 116, 58, 0.12);
  color: var(--ember);
  display: grid; place-items: center;
  font-size: 14px;
  margin-bottom: 10px;
  border: 1px solid rgba(232, 116, 58, 0.18);
}
.kpi .label {
  font-size: 11px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 4px;
}
.kpi .value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 26px;
  color: var(--text);
  line-height: 1.1;
  font-weight: 500;
}
.kpi .value small {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 400;
  margin-right: 3px;
}
.kpi .delta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace;
}
.kpi .delta.up { color: var(--good); }
.kpi .delta.flat { color: var(--text-4); }

/* ---------------- Section ---------------- */
.section {
  margin-bottom: 28px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}
.section-head h2 {
  font-family: 'Frank Ruhl Libre', serif;
  font-weight: 500;
  font-size: 22px;
  margin: 0;
  color: var(--text);
}
.section-head h2 em { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--brass); font-weight: 400; }
.section-head .head-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.section-head .action-link {
  font-size: 13px;
  color: var(--brass);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  font-family: inherit;
  transition: color 200ms;
}
.section-head .action-link:hover { color: var(--ember-2); }

/* ---------------- Blade cards ---------------- */
.blades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.blade-card {
  position: relative;
  padding: 18px;
  background: linear-gradient(155deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 280ms var(--spring);
  overflow: hidden;
}
.blade-card:hover { transform: translateY(-3px); border-color: var(--brass-dim); box-shadow: var(--shadow-2); }
.blade-card.active { border-color: var(--ember); }
.blade-card.active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(232,116,58,0.07), transparent 60%);
  pointer-events: none;
}
.blade-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.blade-name {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 19px;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}
.blade-stage {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--brass);
}
.blade-mini-ring { width: 56px; height: 56px; position: relative; flex-shrink: 0; }
.blade-mini-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.blade-mini-ring .pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--text-2);
}
.blade-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.blade-stats .stat strong { color: var(--text); font-family: 'IBM Plex Mono', monospace; font-weight: 500; }
.blade-spark {
  width: 100%;
  height: 38px;
  margin-top: 6px;
}
.blade-last {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 8px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.5px;
}

/* ---------------- Heatmap ---------------- */
.heatmap-card {
  padding: 22px;
  background: linear-gradient(155deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.heatmap-card .heat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.heatmap-card select {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.heatmap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}
.heat-col { display: grid; grid-template-rows: repeat(7, 14px); gap: 3px; }
.heat-cell {
  background: rgba(217, 162, 74, 0.06);
  border-radius: 3px;
  border: 1px solid rgba(217, 162, 74, 0.04);
  transition: transform 160ms var(--spring), background 160ms;
}
.heat-cell.l1 { background: rgba(232, 116, 58, 0.18); }
.heat-cell.l2 { background: rgba(232, 116, 58, 0.36); }
.heat-cell.l3 { background: rgba(232, 116, 58, 0.58); }
.heat-cell.l4 { background: rgba(232, 116, 58, 0.85); box-shadow: 0 0 6px rgba(232,116,58,0.35); }
.heat-cell.future { opacity: 0.2; }
.heat-cell:hover { transform: scale(1.4); z-index: 2; position: relative; }
.heat-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-4);
  font-family: 'IBM Plex Mono', monospace;
  margin-top: 14px;
  justify-content: flex-end;
}
.heat-legend .swatch {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block;
}

/* ---------------- Weekly bars ---------------- */
.bars-card {
  padding: 22px;
  background: linear-gradient(155deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  margin-top: 12px;
}
.bar {
  flex: 1;
  background: linear-gradient(180deg, var(--ember) 0%, var(--copper-2) 100%);
  border-radius: 6px 6px 2px 2px;
  min-height: 4px;
  position: relative;
  transition: all 240ms var(--spring);
  cursor: pointer;
}
.bar:hover { transform: scaleY(1.06); }
.bar.dim { background: rgba(217, 162, 74, 0.12); }
.bar .bar-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-4);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.4px;
}
.bars-wrap { padding-bottom: 26px; }

/* ---------------- Session log ---------------- */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.log-item {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 200ms var(--spring);
  cursor: pointer;
}
.log-item:hover { border-color: var(--border-strong); transform: translateX(-2px); }
.log-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(232, 116, 58, 0.10);
  display: grid; place-items: center;
  color: var(--ember);
  font-size: 14px;
}
.log-main .log-blade {
  font-family: 'Frank Ruhl Libre', serif;
  font-size: 15px;
  color: var(--text);
  margin: 0;
}
.log-main .log-date {
  font-size: 11px;
  color: var(--text-4);
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.5px;
}
.log-dur {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  color: var(--text);
}
.log-intensity {
  display: flex;
  gap: 2px;
}
.log-intensity i {
  width: 5px; height: 14px;
  background: rgba(217, 162, 74, 0.18);
  border-radius: 1px;
}
.log-intensity i.on { background: var(--ember); }

.empty-state {
  text-align: center;
  padding: 36px 22px;
}
.empty-state img { width: 130px; height: 130px; opacity: 0.85; margin-bottom: 12px; }
.empty-state p { color: var(--text-3); margin: 0 0 14px; font-family: 'Instrument Serif', serif; font-style: italic; font-size: 18px; }
.empty-state .btn { display: inline-flex; }

/* ---------------- FAB ---------------- */
.fab {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  gap: 10px;
  padding: 8px;
  background: rgba(16, 10, 7, 0.78);
  backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--border-strong);
  border-radius: 28px;
  box-shadow: 0 20px 60px -16px rgba(0,0,0,0.75), 0 0 0 1px rgba(217,162,74,0.06);
}
.fab-btn {
  width: 44px; height: 44px;
  border-radius: 18px;
  background: transparent;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
  transition: all 200ms var(--spring);
  font-family: inherit;
}
.fab-btn:hover { background: var(--surface-2); color: var(--brass); }
.fab-btn.active { background: rgba(232, 116, 58, 0.15); color: var(--ember); }
.fab-primary {
  width: 60px; height: 60px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--ember) 0%, var(--copper) 100%);
  color: #fff;
  font-size: 22px;
  box-shadow: 0 8px 24px -4px rgba(232,116,58,0.55), inset 0 1px 0 rgba(255,255,255,0.18);
  margin-top: -16px;
  position: relative;
}
.fab-primary::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(232,116,58,0.45), transparent 60%);
  z-index: -1;
  animation: emberPulse 2.5s ease-in-out infinite;
}
@keyframes emberPulse { 50% { transform: scale(1.15); opacity: 0.6; } }
.fab-primary:hover { transform: translateY(-3px); }

/* ---------------- Modal / Sheet ---------------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 5, 3, 0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translate(-50%, 100%);
  z-index: 101;
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border-top: 1px solid var(--border-strong);
  border-radius: 28px 28px 0 0;
  padding: 22px 22px 30px;
  box-shadow: 0 -20px 60px -10px rgba(0,0,0,0.7);
  transition: transform 320ms var(--spring);
}
.sheet.open { transform: translate(-50%, 0); }
.sheet::before {
  content: '';
  display: block;
  width: 40px;
  height: 4px;
  background: rgba(217,162,74,0.25);
  border-radius: 2px;
  margin: -8px auto 18px;
}
.sheet h3 {
  font-family: 'Frank Ruhl Libre', serif;
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 6px;
  color: var(--text);
}
.sheet h3 em { font-family: 'Instrument Serif', serif; font-style: italic; color: var(--brass); font-weight: 400; }
.sheet .sub { color: var(--text-3); margin: 0 0 22px; font-size: 14px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 6px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 180ms, background 180ms;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brass);
  background: var(--bg-2);
}
.field textarea { resize: vertical; min-height: 70px; font-family: 'Heebo', sans-serif; }

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

/* intensity picker */
.intensity-pick {
  display: flex;
  gap: 8px;
}
.intensity-pick button {
  flex: 1;
  height: 44px;
  background: var(--surface-3);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  transition: all 200ms var(--spring);
}
.intensity-pick button:hover { border-color: var(--border-strong); }
.intensity-pick button.on {
  background: rgba(232, 116, 58, 0.15);
  border-color: var(--ember);
  color: var(--text);
}

/* threshold pick */
.thresh-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.thresh-pick button {
  background: var(--surface-3);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  padding: 10px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  transition: all 200ms var(--spring);
}
.thresh-pick button.on { background: rgba(217,162,74,0.12); border-color: var(--brass); color: var(--text); }
.thresh-pick button:hover { border-color: var(--border-strong); }

/* color pick */
.color-pick { display: flex; gap: 10px; flex-wrap: wrap; }
.color-pick .swatch {
  width: 36px; height: 36px;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 200ms var(--spring);
}
.color-pick .swatch.on { border-color: var(--text); transform: scale(1.1); }

.btn-row { display: flex; gap: 10px; margin-top: 22px; }
.btn {
  flex: 1;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: all 220ms var(--spring);
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--ember) 0%, var(--copper) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 22px -8px rgba(232,116,58,0.55);
}
.btn-primary:hover { box-shadow: 0 12px 26px -6px rgba(232,116,58,0.65); }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; color: var(--bad); border-color: rgba(194,86,62,0.3); }
.btn-danger:hover { background: rgba(194,86,62,0.10); }

/* Settings rows */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .meta { font-size: 12px; color: var(--text-4); margin-top: 2px; }
.setting-row label { color: var(--text); font-family: 'Frank Ruhl Libre', serif; font-size: 15px; }

/* toggle */
.toggle {
  position: relative;
  width: 44px; height: 26px;
  background: var(--surface-3);
  border-radius: 13px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 200ms;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px; right: 2px;
  width: 20px; height: 20px;
  background: var(--text-2);
  border-radius: 50%;
  transition: all 200ms var(--spring);
}
.toggle.on { background: rgba(232, 116, 58, 0.25); border-color: var(--ember); }
.toggle.on::after { right: calc(100% - 22px); background: var(--ember); }

/* About content */
.about-list { list-style: none; padding: 0; margin: 18px 0 0; }
.about-list li {
  display: flex; gap: 10px; padding: 10px 0;
  font-size: 14px; color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.about-list li:last-child { border-bottom: none; }
.about-list li i { color: var(--brass); width: 18px; text-align: center; padding-top: 3px; }
.about-foot {
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--text-4);
  margin-top: 18px;
  letter-spacing: 0.5px;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translate(-50%, -20px);
  z-index: 200;
  background: rgba(27, 22, 18, 0.92);
  backdrop-filter: blur(20px);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 280ms var(--spring);
  font-family: 'IBM Plex Mono', monospace;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast i { color: var(--ember); margin-left: 6px; }

/* Install banner */
.install-banner {
  margin: 0 18px 12px;
  padding: 12px 16px;
  background: linear-gradient(95deg, rgba(232,116,58,0.10), rgba(217,162,74,0.06));
  border: 1px solid rgba(232,116,58,0.25);
  border-radius: var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 13px;
  color: var(--text-2);
}
.install-banner.show { display: flex; }
.install-banner .install-btn {
  padding: 7px 14px;
  background: var(--ember);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* View switcher */
[data-view] { display: none; }
[data-view].active { display: block; animation: fadeIn 240ms var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Sparkline svg ---------------- */
.spark-path { fill: none; stroke: var(--ember); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: url(#sparkGrad); opacity: 0.6; }

/* utility */
.hidden { display: none !important; }
.muted { color: var(--text-4); }
.small { font-size: 12px; }

/* selection */
::selection { background: rgba(232, 116, 58, 0.35); color: var(--text); }

/* Custom scrollbar */
.sheet::-webkit-scrollbar { width: 8px; }
.sheet::-webkit-scrollbar-track { background: transparent; }
.sheet::-webkit-scrollbar-thumb { background: var(--smoke); border-radius: 4px; }

/* responsive tweaks */
@media (max-width: 540px) {
  .wrap { padding: 16px 14px 40px; }
  .topbar { padding: 12px 14px; }
  .brand-text strong { font-size: 17px; }
  .hero-title { font-size: clamp(26px, 7vw, 36px); }
  .blades-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .heatmap { grid-template-columns: repeat(10, 1fr); }
}
