/* TypeCraft panel — v0.2 design (Claude Design handoff, July 2026).
   © FAAV Studio. Tokens + components; fonts bundled for offline CEP. */

/* ------------------------------------------------------------- fonts ----- */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/Geist-var.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("fonts/SpaceGrotesk-var.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("fonts/InstrumentSans-var.woff2") format("woff2");
}

/* ------------------------------------------------------------- tokens ---- */
:root {
  --accent: #4DFFBC;
  --mint: #4DFFBC;
  --mint-rgb: 77, 255, 188;   /* the accent as channels, for every rgba() tint — set with --mint by ⋮ ▸ ACCENT */
  --on-accent: #14100C;
  --bg: #0D0D0F;
  --card: #131316;
  --inset: #0A0A0C;
  --b1: #202026;      /* card border */
  --b2: #1C1C21;      /* inset border */
  --b3: #232328;      /* chip border */
  --b4: #2A2A31;      /* ghost border / toggle off */
  --b-hover: #3A3A42;
  --grid: #1E1E24;
  --t-primary: #EDEDED;
  --t-body: #D9D9D9;
  --t-secondary: #C9C9D0;
  --t-muted: #898989;
  --t-faint: #5A5A5A;
  --sg: "Geist", "Space Grotesk", sans-serif;   /* labels, headers, the logo — Geist since 2026-09-19 (his pick, B); Grotesk stays bundled as the fallback */
  --is: "Instrument Sans", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--b4); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

html, body { background: var(--bg); }
body {
  font-family: var(--is);
  color: var(--t-body);
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  -webkit-user-select: none;
  user-select: none;
}

/* entrance stagger */
@keyframes tcIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.sec-anim { animation: tcIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) var(--in-delay, 0s) backwards; }

/* ------------------------------------------------------------- header ---- */
#header { display: flex; align-items: center; justify-content: space-between; }
.wm-wrap { display: flex; align-items: baseline; gap: 10px; }
.wordmark {
  font-family: var(--sg); font-size: 22px; font-weight: 700;
  letter-spacing: -0.03em; color: var(--t-primary);
}
.wm-accent { color: var(--accent); }
.ver { font-family: var(--sg); font-size: 11px; font-weight: 500; color: var(--t-muted); letter-spacing: 0.04em; }
.head-right { display: flex; align-items: center; gap: 8px; }
.chip {
  font-size: 12px; font-weight: 500; color: var(--t-muted);
  padding: 5px 12px; border: 1px solid var(--b3); border-radius: 999px;
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.chip.live { color: var(--accent); border-color: var(--accent); }
.cta {
  height: 32px; padding: 0 16px; border: none; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font-family: var(--sg); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: box-shadow 0.2s, filter 0.2s, transform 0.1s;
}
.cta:hover { filter: brightness(1.08); box-shadow: 0 0 14px rgba(var(--mint-rgb), 0.45); }
.cta:active { transform: scale(0.98); }

/* ------------------------------------------------------------- sections -- */
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec-head {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.sec-label {
  font-family: var(--sg); font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; color: var(--t-muted);
}
.sec-hint { font-size: 11px; color: var(--t-faint); }
.chev { margin-left: auto; font-size: 11px; color: var(--t-faint); width: 12px; text-align: center; }
.sec-head .onoff { margin-left: auto; }
.sec-head .onoff + .chev { margin-left: 0; }
.sec-head .pv-input + .chev { margin-left: 0; }
.sec.closed .sec-body { display: none; }
.sec-body { display: flex; flex-direction: column; gap: 12px; }

.tag { font-family: var(--sg); font-size: 11px; font-weight: 700; letter-spacing: 0.1em; }
.tag-in { color: var(--accent); }
.tag-out { color: var(--mint); }

/* ------------------------------------------------------------- preview --- */
.pv-input {
  margin-left: auto; width: 150px;
  background: var(--card); border: 1px solid var(--b1); border-radius: 999px;
  outline: none; color: var(--t-secondary);
  font-family: var(--is); font-size: 12px; font-weight: 500;
  padding: 5px 12px;
  -webkit-user-select: text; user-select: text;
}
.pv-input:focus { border-color: var(--mint); color: var(--t-primary); }
.pv-canvas {
  background: var(--inset); border: 1px solid var(--b2); border-radius: 14px;
  height: 96px; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.pv-text {
  font-family: var(--sg); font-size: 30px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--t-primary); line-height: 1;
  white-space: nowrap;
}
.pv-text span { display: inline-block; white-space: pre; will-change: transform, opacity, filter; }

/* ------------------------------------------------------------- presets --- */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#presetChips { display: contents; }
.ghost-pill {
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--b4); background: transparent; color: var(--t-secondary);
  font-family: var(--sg); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.15s, color 0.15s;
}
.ghost-pill:hover {
  border-color: var(--b-hover); color: var(--t-primary);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.2);
}
.preset-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--b4); background: transparent; color: var(--t-secondary);
  font-family: var(--is); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.15s;
}
.preset-chip:hover {
  border-color: var(--b-hover);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.2);
}
.preset-chip.active {
  border-color: var(--mint);
  background: rgba(var(--mint-rgb), 0.1);
  color: var(--mint);
}
.preset-chip .x { color: var(--t-faint); font-size: 13px; line-height: 1; }
.preset-chip .x:hover { color: var(--accent); }
.preset-chip .exp { color: var(--t-faint); font-size: 12px; line-height: 1; }
.preset-chip .exp:hover { color: var(--mint); }

.hint-btn {
  margin-left: auto;
  border: none; background: transparent; padding: 0;
  font-family: var(--is); font-size: 11px; color: var(--t-faint);
  cursor: pointer; transition: color 0.15s;
}
.hint-btn:hover { color: var(--mint); }
.sec-head .hint-btn + .chev { margin-left: 10px; }
.preset-chip input {
  width: 90px; background: transparent; border: none; outline: none;
  color: var(--mint); font-family: var(--is); font-size: 12px; font-weight: 600;
  padding: 0;
  -webkit-user-select: text; user-select: text;
}

/* ------------------------------------------------------------- looks ----- */
.looks-row { display: flex; flex-wrap: wrap; gap: 6px; }
.look-pill {
  height: 34px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--b1); background: var(--card); color: var(--t-secondary);
  font-family: var(--sg); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.2s;
}
.look-pill:hover {
  border-color: var(--b-hover);
  box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.22);
}
.look-pill.on {
  border-color: var(--accent);
  background: rgba(var(--mint-rgb), 0.1);
  color: var(--accent);
}
.look-pill .lbl { display: inline-flex; }
.look-pill .pl { display: inline-block; }

/* in-button hover animations, themed per look (from the design prototype) */
@keyframes tcLkRise { 0% { opacity: 0; transform: translateY(9px); } 22% { opacity: 1; transform: translateY(0); } 72% { opacity: 1; transform: translateY(0); } 90%, 100% { opacity: 0; transform: translateY(-4px); } }
@keyframes tcLkDrop { 0% { opacity: 0; transform: translateY(-9px); } 22% { opacity: 1; transform: translateY(0); } 72% { opacity: 1; transform: translateY(0); } 90%, 100% { opacity: 0; transform: translateY(4px); } }
@keyframes tcLkSlide { 0% { opacity: 0; transform: translateX(-10px); } 22% { opacity: 1; transform: translateX(0); } 72% { opacity: 1; transform: translateX(0); } 90%, 100% { opacity: 0; transform: translateX(6px); } }
@keyframes tcLkPop { 0% { opacity: 0; transform: scale(0); } 16% { opacity: 1; transform: scale(1.35); } 28% { transform: scale(0.9); } 38% { transform: scale(1); } 74% { opacity: 1; transform: scale(1); } 90%, 100% { opacity: 0; transform: scale(0.4); } }
@keyframes tcLkFocus { 0% { opacity: 0; filter: blur(6px); transform: scale(1.12); } 32% { opacity: 1; filter: blur(0); transform: scale(1); } 74% { opacity: 1; filter: blur(0); transform: scale(1); } 92%, 100% { opacity: 0; filter: blur(5px); transform: scale(1.08); } }
@keyframes tcLkType { 0% { opacity: 0; } 6% { opacity: 1; } 76% { opacity: 1; } 80%, 100% { opacity: 0; } }
@keyframes tcLkWave { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.look-pill[data-look="rise"]:hover .pl { animation: tcLkRise 1.4s ease var(--d, 0s) infinite; }
.look-pill[data-look="drop"]:hover .pl { animation: tcLkDrop 1.4s ease var(--d, 0s) infinite; }
.look-pill[data-look="slide"]:hover .pl { animation: tcLkSlide 1.4s ease var(--d, 0s) infinite; }
.look-pill[data-look="pop"]:hover .pl { animation: tcLkPop 1.5s ease var(--d, 0s) infinite; }
.look-pill[data-look="typewriter"]:hover .pl { animation: tcLkType 1.9s steps(1, end) var(--d, 0s) infinite; }
.look-pill[data-look="wave"]:hover .pl { animation: tcLkWave 1s ease var(--d, 0s) infinite; }
.look-pill[data-look="focus"]:hover .lbl { animation: tcLkFocus 1.6s ease infinite; }

.dir-row { display: flex; align-items: center; gap: 10px; }
.dir-label { font-size: 12px; font-weight: 600; color: var(--t-muted); }
.dir-seg {
  display: flex; gap: 4px; background: var(--card);
  border: 1px solid var(--b1); border-radius: 999px; padding: 3px;
}
.dir-seg button {
  padding: 6px 14px; border-radius: 999px; border: none; background: transparent;
  color: var(--t-muted); font-family: var(--sg); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, color 0.15s;
}
.dir-seg button.on { background: var(--accent); color: var(--on-accent); }

/* ------------------------------------------------------------- curves ---- */
.curve-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.curve-card {
  background: var(--card); border: 1px solid var(--b1); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.curve-head { display: flex; align-items: center; justify-content: space-between; }
.pts-count { font-size: 12px; font-weight: 500; color: var(--t-muted); display: inline-flex; align-items: center; gap: 6px; }
.reveal {
  border: none; background: transparent; color: var(--t-faint);
  font-size: 12px; cursor: pointer; padding: 0 2px;
  transition: color 0.15s;
}
.reveal:hover { color: var(--accent); }

.curve-svg {
  display: block; width: 100%; height: 148px;
  background: var(--inset); border: 1px solid var(--b2); border-radius: 8px;
  touch-action: none;
}
.curve-svg .gv, .curve-svg .gh { stroke: var(--grid); stroke-width: 1; }
.curve-svg .curve-path { fill: none; stroke: #FFFFFF; stroke-width: 2; stroke-linecap: round; }
.curve-svg .cpt { fill: var(--accent); stroke: var(--inset); stroke-width: 1.5; cursor: grab; }
.curve-svg .cpt.end { fill: #FFFFFF; }
.curve-svg .chandle-line { stroke: var(--mint); stroke-width: 1; opacity: 0.45; }
.curve-svg .chandle-line.hot { opacity: 0.85; }
.curve-svg .chandle-dot { fill: var(--mint); opacity: 0.65; cursor: grab; }
.curve-svg .chandle-dot.hot { opacity: 1; }

.dur-row { display: flex; align-items: center; gap: 10px; }
.dur-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 4px; border-radius: 2px;
  background: var(--b4); outline: none; cursor: pointer;
}
.dur-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #FFFFFF; border: none;
  transition: box-shadow 0.2s;
}
.dur-range::-webkit-slider-thumb:hover { box-shadow: 0 0 10px rgba(var(--mint-rgb), 0.4); }
.dur-val {
  font-family: var(--sg); font-size: 18px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--t-primary);
}
.dur-val em { font-style: normal; font-size: 12px; font-weight: 500; color: var(--t-muted); }

/* ------------------------------------------------------------- segmented - */
.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  background: var(--card); border: 1px solid var(--b1); border-radius: 10px; padding: 4px;
}
.seg-ind {
  position: absolute; top: 4px; bottom: 4px;
  width: calc((100% - 16px) / 3);
  left: calc(4px + var(--idx, 1) * ((100% - 16px) / 3 + 4px));
  border-radius: 7px; background: var(--accent);
  transition: left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.seg-out .seg-ind { background: var(--mint); }
.seg button {
  position: relative; z-index: 1; padding: 9px 0; border-radius: 7px; border: none;
  background: transparent; color: var(--t-muted);
  font-family: var(--sg); font-size: 13px; font-weight: 600; cursor: pointer;
  text-align: center; transition: box-shadow 0.2s, color 0.2s;
}
.seg button:hover { box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.25); }
.seg-out button:hover { box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.25); }
.seg button.on { color: var(--on-accent); }

/* ------------------------------------------------------------- tiles ----- */
.tiles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.tile {
  background: var(--card); border: 1px solid var(--b1); border-radius: 12px;
  padding: 14px 16px; cursor: ew-resize;
}
.tile-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; color: var(--t-muted);
  margin-bottom: 6px;
}
.drag-hint { color: var(--t-faint); letter-spacing: 0; opacity: 0; transition: opacity 0.2s; }
.tile:hover .drag-hint { opacity: 1; }
.tile-val {
  font-family: var(--sg); font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; color: var(--t-primary);
  white-space: nowrap;
}
.tile-val em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--t-muted); }

/* ------------------------------------------------------------- toggles --- */
.toggle-row { display: flex; gap: 24px; align-items: center; }
.toggle, .onoff { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.onoff { gap: 8px; }
.tgl-pill {
  width: 36px; height: 21px; border-radius: 999px; background: var(--b4);
  position: relative; flex: none;
  transition: background 0.15s, box-shadow 0.2s;
}
.tgl-pill i {
  position: absolute; top: 3px; left: 3px; width: 15px; height: 15px;
  border-radius: 50%; background: #FFFFFF; transition: left 0.15s;
}
.toggle:hover .tgl-pill, .onoff:hover .tgl-pill {
  box-shadow: 0 0 10px rgba(var(--mint-rgb), 0.4);
}
.toggle.on .tgl-pill, .onoff.on .tgl-pill { background: var(--accent); }
.toggle.on .tgl-pill i, .onoff.on .tgl-pill i { left: 18px; }
.tgl-label { font-size: 13.5px; font-weight: 600; color: var(--t-muted); transition: color 0.15s; }
.toggle.on .tgl-label { color: var(--t-primary); }
.onoff-label { font-size: 12px; font-weight: 600; color: var(--t-muted); transition: color 0.15s; }
.onoff.on .onoff-label { color: var(--t-primary); }

.gated { display: flex; flex-direction: column; gap: 12px; }
.gated.off { display: none; }

.marker-row { display: flex; gap: 8px; }
.marker-row .ghost-pill { font-family: var(--is); font-size: 12.5px; padding: 9px 16px; }
.mk-in:hover { box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.22); }
.mk-out:hover { box-shadow: 0 0 12px rgba(var(--mint-rgb), 0.22); }

/* ------------------------------------------------------------- toast ----- */
#toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(6px);
  background: var(--card); border: 1px solid var(--b4); border-radius: 999px;
  color: var(--t-secondary); font-size: 12px; font-weight: 500;
  padding: 7px 14px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap; z-index: 99;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { color: #FF6B6B; border-color: #5A2A2A; }
