/* ─── ForgeCAD Mobile — Redesigned ─── */

/* ════════════════════════════════════
   APP SHELL
════════════════════════════════════ */

.fc-mobile {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--fc-viewportBg, var(--fc-bg));
  color: var(--fc-text);
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ════════════════════════════════════
   VIEWPORT — full-bleed, always rendered
════════════════════════════════════ */

.fc-mobile-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.fc-mobile-viewport-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fc-textDim);
  font-size: 13px;
  background: var(--fc-bg);
  z-index: 5;
}

/* ════════════════════════════════════
   VIEWPORT FABS (fit / iso / focus)
════════════════════════════════════ */

.fc-mobile-viewport-fabs {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  pointer-events: auto;
}

.fc-mobile-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--fc-bgPanel) 88%, transparent);
  border: 1px solid var(--fc-border);
  color: var(--fc-textMuted);
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
}

.fc-mobile-fab:active {
  background: var(--fc-bgHover);
  transform: scale(0.94);
}

.fc-mobile-fab--focus {
  background: rgba(255, 71, 87, 0.15);
  border-color: rgba(255, 71, 87, 0.2);
  color: #ff4757;
}

/* ════════════════════════════════════
   OBJECT INFO PANEL
════════════════════════════════════ */

.fc-mobile-objinfo-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
}

.fc-mobile-objinfo-sheet {
  width: 100%;
  background: var(--fc-bgPanel);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--fc-border);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  animation: fc-m-slide-up 0.2s ease-out;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.fc-mobile-objinfo-handle {
  width: 40px;
  height: 4px;
  background: var(--fc-border);
  border-radius: 2px;
  margin: 10px auto 14px;
}

.fc-mobile-objinfo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.fc-mobile-objinfo-color {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--fc-border);
}

.fc-mobile-objinfo-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--fc-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-mobile-objinfo-actions {
  display: flex;
  gap: 10px;
}

.fc-mobile-objinfo-btn {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 1px solid var(--fc-border);
  color: var(--fc-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.fc-mobile-objinfo-btn--close {
  background: none;
  color: var(--fc-accent);
  border-color: var(--fc-border);
}

/* ════════════════════════════════════
   STATUS PILL — floating top-center
════════════════════════════════════ */

.fc-m-status-pill {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 30;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.fc-m-status-pill--ok {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: #34d399;
}

.fc-m-status-pill--building {
  background: rgba(120, 120, 160, 0.1);
  border: 1px solid rgba(120, 120, 160, 0.15);
  color: var(--fc-textMuted);
}

.fc-m-status-pill--error {
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.22);
  color: #ff4757;
}

.fc-m-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.fc-m-status-pill--ok .fc-m-status-dot { background: #34d399; }
.fc-m-status-pill--error .fc-m-status-dot { background: #ff4757; }

.fc-m-status-divider {
  width: 1px;
  height: 10px;
  border-radius: 1px;
  flex-shrink: 0;
  opacity: 0.3;
}
.fc-m-status-pill--ok .fc-m-status-divider { background: #34d399; }
.fc-m-status-pill--error .fc-m-status-divider { background: #ff4757; }

/* ════════════════════════════════════
   CORNER BUTTONS — top-right export
════════════════════════════════════ */

.fc-m-corners {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 30;
}

.fc-m-corner-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--fc-bgPanel) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--fc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fc-textMuted);
}

.fc-m-corner-btn:active {
  background: var(--fc-bgHover);
}

.fc-m-corner-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ════════════════════════════════════
   PARAM CHIPS — floating row above command bar
════════════════════════════════════ */

.fc-m-param-chips-wrap {
  position: absolute;
  bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  padding: 4px 14px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 25;
  -webkit-mask-image: linear-gradient(90deg, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
}

.fc-m-param-chips-wrap::-webkit-scrollbar { display: none; }

.fc-m-param-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  background: color-mix(in srgb, var(--fc-bgPanel) 90%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s, border-color 0.1s;
}

.fc-m-param-chip:active,
.fc-m-param-chip--active {
  background: color-mix(in srgb, var(--fc-accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--fc-accent) 25%, transparent);
}

.fc-m-param-chip-name {
  font-size: 10px;
  color: var(--fc-textMuted);
  font-weight: 500;
}

.fc-m-param-chip-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--fc-text);
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Menlo", monospace;
}

.fc-m-param-chip--active .fc-m-param-chip-val {
  color: var(--fc-accent);
}

/* ════════════════════════════════════
   COMMAND BAR — always visible at bottom
════════════════════════════════════ */

.fc-m-cmdbar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 14px calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
}

.fc-m-cmdbar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  background: color-mix(in srgb, var(--fc-bgPanel) 94%, transparent);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid var(--fc-border);
  border-radius: 17px;
  padding: 0 8px 0 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.fc-m-cmdbar-search-icon {
  width: 16px;
  height: 16px;
  stroke: var(--fc-textDim);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  flex-shrink: 0;
}

.fc-m-cmdbar-placeholder {
  flex: 1;
  font-size: 14px;
  color: var(--fc-textMuted);
  user-select: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-m-cmdbar-code-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  background: var(--fc-bgSurface, var(--fc-bgInput));
  border: 1px solid var(--fc-border);
  border-radius: 10px;
  color: var(--fc-textMuted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
}

.fc-m-cmdbar-code-btn:active,
.fc-m-cmdbar-code-btn--active {
  background: color-mix(in srgb, var(--fc-accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--fc-accent) 20%, transparent);
  color: var(--fc-accent);
}

.fc-m-cmdbar-code-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.fc-m-cmdbar-run-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--fc-accent);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 18px color-mix(in srgb, var(--fc-accent) 25%, transparent);
  transition: opacity 0.15s;
}

.fc-m-cmdbar-run-btn:active { opacity: 0.8; }
.fc-m-cmdbar-run-btn:disabled { opacity: 0.4; }

.fc-m-cmdbar-run-btn svg {
  width: 13px;
  height: 13px;
  fill: #fff;
  margin-left: 2px;
}

/* ════════════════════════════════════
   CODE DRAWER — slides up from bottom
════════════════════════════════════ */

.fc-m-code-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  animation: fc-m-fade-in 0.15s ease-out;
}

.fc-m-code-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--fc-bgPanel);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--fc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 41;
  animation: fc-m-slide-up 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fc-m-code-drawer-handle-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 18px 0;
  flex-shrink: 0;
}

.fc-m-code-drawer-handle {
  width: 40px;
  height: 4px;
  background: var(--fc-border);
  border-radius: 2px;
  margin-bottom: 10px;
}

.fc-m-code-drawer-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--fc-border);
}

.fc-m-code-drawer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fc-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  margin-right: 10px;
}

.fc-m-code-drawer-actions {
  display: flex;
  gap: 7px;
  flex-shrink: 0;
}

.fc-m-code-drawer-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 1px solid var(--fc-border);
  color: var(--fc-textMuted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

.fc-m-code-drawer-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.fc-m-code-drawer-btn--run {
  background: var(--fc-accent);
  border-color: var(--fc-accent);
  color: #fff;
  font-weight: 700;
}

.fc-m-code-drawer-btn--run svg {
  fill: #fff;
  stroke: none;
  width: 10px;
  height: 10px;
}

/* Editor inside drawer */
.fc-mobile-editor-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* ════════════════════════════════════
   CODE EDITOR (overlay: highlighted pre + transparent textarea)
════════════════════════════════════ */

.fc-mobile-editor-highlight,
.fc-mobile-editor {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  border: none;
  -webkit-text-size-adjust: none;
  tab-size: 2;
  word-wrap: normal;
}

.fc-mobile-editor-highlight {
  background: var(--fc-bgInput, var(--fc-bg));
  color: var(--fc-text);
  pointer-events: none;
  z-index: 0;
}

.fc-mobile-editor {
  background: transparent;
  color: transparent;
  caret-color: var(--fc-text);
  z-index: 1;
  resize: none;
  outline: none;
}

/* ── highlight.js token colours — dark themes (default) ── */
.fc-mobile-editor-highlight .hljs-keyword   { color: #c586c0; }
.fc-mobile-editor-highlight .hljs-string    { color: #ce9178; }
.fc-mobile-editor-highlight .hljs-number    { color: #b5cea8; }
.fc-mobile-editor-highlight .hljs-comment   { color: #6a9955; font-style: italic; }
.fc-mobile-editor-highlight .hljs-function  { color: #dcdcaa; }
.fc-mobile-editor-highlight .hljs-title     { color: #dcdcaa; }
.fc-mobile-editor-highlight .hljs-params    { color: #9cdcfe; }
.fc-mobile-editor-highlight .hljs-built_in  { color: #4ec9b0; }
.fc-mobile-editor-highlight .hljs-literal   { color: #569cd6; }
.fc-mobile-editor-highlight .hljs-attr      { color: #9cdcfe; }
.fc-mobile-editor-highlight .hljs-property  { color: #9cdcfe; }
.fc-mobile-editor-highlight .hljs-variable  { color: #9cdcfe; }
.fc-mobile-editor-highlight .hljs-regexp    { color: #d16969; }
.fc-mobile-editor-highlight .hljs-operator  { color: #d4d4d4; }
.fc-mobile-editor-highlight .hljs-punctuation { color: #d4d4d4; }

/* ── highlight.js token colours — light themes ── */
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-keyword   { color: #af00db; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-string    { color: #a31515; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-number    { color: #098658; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-comment   { color: #008000; font-style: italic; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-function  { color: #795e26; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-title     { color: #795e26; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-params    { color: #001080; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-built_in  { color: #267f99; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-literal   { color: #0000ff; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-attr      { color: #001080; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-property  { color: #001080; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-variable  { color: #001080; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-regexp    { color: #811f3f; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-operator  { color: #3b3b3b; }
:root[data-fc-theme="light"] .fc-mobile-editor-highlight .hljs-punctuation { color: #3b3b3b; }

/* ── highlight.js token colours — kanagawa-lotus ── */
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-keyword   { color: #c84053; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-string    { color: #6f894e; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-number    { color: #cc6d00; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-comment   { color: #8a8980; font-style: italic; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-function  { color: #4d699b; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-title     { color: #4d699b; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-params    { color: #545464; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-built_in  { color: #597b8c; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-literal   { color: #c84053; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-attr      { color: #4d699b; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-property  { color: #4d699b; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-variable  { color: #545464; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-regexp    { color: #c84053; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-operator  { color: #766b6b; }
:root[data-fc-theme="kanagawa-lotus"] .fc-mobile-editor-highlight .hljs-punctuation { color: #766b6b; }

/* ════════════════════════════════════
   PARAM SCRUB ZONE
════════════════════════════════════ */

.fc-m-scrub-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: fc-m-fade-in 0.12s ease-out;
}

.fc-m-scrub-backdrop {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.fc-m-scrub-zone {
  background: var(--fc-bgPanel);
  border-top: 1px solid color-mix(in srgb, var(--fc-accent) 18%, transparent);
  position: relative;
  overflow: hidden;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  animation: fc-m-slide-up 0.18s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}

.fc-m-scrub-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--fc-accent) 4%, transparent) 0px,
    color-mix(in srgb, var(--fc-accent) 4%, transparent) 1px,
    transparent 1px,
    transparent 28px
  );
  pointer-events: none;
}

.fc-m-scrub-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 2px;
}

.fc-m-scrub-param-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--fc-textMuted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}

.fc-m-scrub-hint {
  font-size: 11px;
  color: var(--fc-textDim);
  display: flex;
  align-items: center;
  gap: 4px;
}

.fc-m-scrub-hint svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.fc-m-scrub-value-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 0 20px 6px;
  pointer-events: none;
}

.fc-m-scrub-arrows {
  font-size: 28px;
  color: color-mix(in srgb, var(--fc-accent) 20%, transparent);
  user-select: none;
  font-weight: 300;
  line-height: 1;
  padding-bottom: 10px;
  transition: color 0.1s;
}

.fc-m-scrub-arrows--active {
  color: color-mix(in srgb, var(--fc-accent) 55%, transparent);
}

.fc-m-scrub-number {
  font-size: 66px;
  font-weight: 800;
  color: var(--fc-accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -3px;
  line-height: 1;
  font-family: "SF Pro Display", system-ui, -apple-system, sans-serif;
  user-select: none;
  min-width: 120px;
  text-align: center;
}

.fc-m-scrub-unit {
  font-size: 18px;
  font-weight: 600;
  color: color-mix(in srgb, var(--fc-accent) 40%, transparent);
  align-self: flex-end;
  padding-bottom: 10px;
  user-select: none;
}

.fc-m-scrub-actions {
  display: flex;
  align-items: center;
  padding: 2px 14px 0;
  gap: 7px;
}

.fc-m-scrub-step-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--fc-bgSurface, var(--fc-bgInput));
  border: 1px solid var(--fc-border);
  color: var(--fc-textMuted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: "SF Mono", monospace;
  display: flex;
  align-items: center;
}

.fc-m-scrub-step-btn--active {
  background: color-mix(in srgb, var(--fc-accent) 15%, transparent);
  border-color: color-mix(in srgb, var(--fc-accent) 22%, transparent);
  color: var(--fc-accent);
}

.fc-m-scrub-spacer { flex: 1; }

.fc-m-scrub-type-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  background: var(--fc-bgSurface, var(--fc-bgInput));
  border: 1px solid var(--fc-border);
  color: var(--fc-textDim);
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.fc-m-scrub-type-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.fc-m-scrub-done-btn {
  height: 34px;
  padding: 0 18px;
  border-radius: 10px;
  background: var(--fc-accent);
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--fc-accent) 30%, transparent);
}

/* ── Type mode ── */
.fc-m-type-overlay {
  position: absolute;
  inset: 0;
  z-index: 51;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: fc-m-fade-in 0.12s ease-out;
}

.fc-m-type-card {
  background: var(--fc-bgPanel);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--fc-border);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: fc-m-slide-up 0.15s ease-out;
}

.fc-m-type-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fc-textMuted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}

.fc-m-type-input {
  width: 100%;
  height: 56px;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 2px solid var(--fc-accent);
  border-radius: 12px;
  color: var(--fc-accent);
  font-size: 32px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Menlo", monospace;
  padding: 0 16px;
  outline: none;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc-accent) 10%, transparent);
}

.fc-m-type-actions {
  display: flex;
  gap: 10px;
}

.fc-m-type-cancel {
  flex: 1;
  height: 44px;
  border-radius: 11px;
  background: var(--fc-bgSurface, var(--fc-bgInput));
  border: 1px solid var(--fc-border);
  color: var(--fc-textMuted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.fc-m-type-set {
  flex: 2;
  height: 44px;
  border-radius: 11px;
  background: var(--fc-accent);
  border: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--fc-accent) 35%, transparent);
}

/* ════════════════════════════════════
   ERROR SHEET
════════════════════════════════════ */

.fc-m-error-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 45;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  animation: fc-m-fade-in 0.15s ease-out;
}

.fc-m-error-sheet {
  background: color-mix(in srgb, var(--fc-bgPanel) 90%, #200 10%);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid rgba(255, 71, 87, 0.18);
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 12px);
  animation: fc-m-slide-up 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fc-m-error-handle-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 18px 0;
  flex-shrink: 0;
}

.fc-m-error-handle {
  width: 40px;
  height: 4px;
  background: var(--fc-border);
  border-radius: 2px;
  margin-bottom: 12px;
}

.fc-m-error-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 71, 87, 0.1);
}

.fc-m-error-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: #ff6b6b;
}

.fc-m-error-goto-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.2);
  border-radius: 8px;
  color: #ff6b6b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.fc-m-error-goto-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.fc-m-error-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px;
}

.fc-m-error-message {
  color: #ff8080;
  font-size: 12.5px;
  font-family: "SF Mono", "Menlo", monospace;
  line-height: 1.55;
  margin-bottom: 4px;
  word-break: break-word;
  white-space: pre-wrap;
}

.fc-m-error-location {
  color: var(--fc-textDim);
  font-size: 11px;
  font-family: "SF Mono", monospace;
  margin-bottom: 12px;
}

.fc-m-error-ctx {
  background: rgba(255, 71, 87, 0.05);
  border: 1px solid rgba(255, 71, 87, 0.1);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: "SF Mono", "Menlo", monospace;
  font-size: 11.5px;
  line-height: 1.6;
}

.fc-m-error-ctx-line { color: var(--fc-textDim); }
.fc-m-error-ctx-line--active {
  color: #ff8080;
  background: rgba(255, 71, 87, 0.08);
  border-radius: 3px;
  display: block;
  margin: 0 -4px;
  padding: 0 4px;
}

/* ════════════════════════════════════
   FILE PICKER + EXPORT SHEETS
════════════════════════════════════ */

.fc-mobile-filepicker-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  animation: fc-m-fade-in 0.15s ease-out;
}

.fc-mobile-filepicker-sheet,
.fc-mobile-export-sheet {
  width: 100%;
  max-height: 65vh;
  background: var(--fc-bgPanel);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--fc-border);
  overflow-y: auto;
  padding: 0 0 calc(8px + env(safe-area-inset-bottom, 0px));
  animation: fc-m-slide-up 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fc-mobile-filepicker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--fc-border);
  font-size: 15px;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--fc-bgPanel);
  z-index: 1;
}

.fc-mobile-filepicker-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  background: none;
  border: none;
  color: var(--fc-text);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  gap: 10px;
  font-family: inherit;
}

.fc-mobile-filepicker-item:active { background: var(--fc-bgHover); }
.fc-mobile-filepicker-item[data-active="true"] { color: var(--fc-accent); font-weight: 600; }

.fc-mobile-export-item {
  display: flex;
  align-items: center;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  background: none;
  border: none;
  color: var(--fc-text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  gap: 12px;
  font-family: inherit;
}

.fc-mobile-export-item:active { background: var(--fc-bgHover); }
.fc-mobile-export-item:disabled { opacity: 0.5; }

/* ════════════════════════════════════
   JOINT CONTROLS (inside a sheet)
════════════════════════════════════ */

.fc-mobile-joints { padding: 4px 0 8px; }

.fc-mobile-joints-section { padding: 10px 16px; }
.fc-mobile-joints-section + .fc-mobile-joints-section {
  border-top: 1px solid var(--fc-border);
}

.fc-mobile-joints-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--fc-textDim);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.fc-mobile-joints-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.fc-mobile-joints-select {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 8px;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  color: var(--fc-text);
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

.fc-mobile-joints-playbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 38px;
  flex-shrink: 0;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  color: var(--fc-text);
  cursor: pointer;
}

.fc-mobile-joints-playbtn.active {
  background: var(--fc-accent);
  border-color: var(--fc-accent);
  color: #fff;
}

.fc-mobile-joints-playbtn:disabled { opacity: 0.4; }

.fc-mobile-joints-slider {
  flex: 1;
  height: 38px;
  accent-color: var(--fc-accent);
}

.fc-mobile-joints-value {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--fc-textDim);
  text-align: right;
  flex-shrink: 0;
}

.fc-mobile-joints-info {
  font-size: 11px;
  color: var(--fc-textDim);
  margin-top: 4px;
}

.fc-mobile-joint-item { margin-bottom: 8px; }

.fc-mobile-joint-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.fc-mobile-joint-name { font-size: 12px; color: var(--fc-text); }

.fc-mobile-joint-value {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-family: "SF Mono", "Menlo", monospace;
  color: var(--fc-accent);
}

/* ════════════════════════════════════
   COMMAND PALETTE
════════════════════════════════════ */

.fc-mobile-cmdpal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  animation: fc-m-fade-in 0.15s ease-out;
}

.fc-mobile-cmdpal-sheet {
  width: 100%;
  max-height: 72vh;
  background: var(--fc-bgPanel);
  border-radius: 16px 16px 0 0;
  border-top: 1px solid var(--fc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  animation: fc-m-slide-up 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fc-mobile-cmdpal-header {
  display: flex;
  align-items: center;
  padding: 14px 16px 8px;
  gap: 8px;
}

.fc-mobile-cmdpal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fc-text);
}

.fc-mobile-cmdpal-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--fc-accent);
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
}

.fc-mobile-cmdpal-back:active { background: var(--fc-bgHover); }

.fc-mobile-cmdpal-close {
  background: none;
  border: none;
  color: var(--fc-accent);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  font-family: inherit;
}

.fc-mobile-cmdpal-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 12px;
  background: var(--fc-bgCard, var(--fc-bgInput, var(--fc-bg)));
  border: 1px solid var(--fc-border);
  border-radius: 10px;
}

.fc-mobile-cmdpal-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fc-text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
  padding: 0;
  min-width: 0;
}

.fc-mobile-cmdpal-input::placeholder { color: var(--fc-textDim); }

.fc-mobile-cmdpal-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  color: var(--fc-textMuted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.fc-mobile-cmdpal-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 8px;
}

.fc-mobile-cmdpal-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  background: none;
  border: none;
  color: var(--fc-text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  gap: 12px;
  font-family: inherit;
}

.fc-mobile-cmdpal-item:active { background: var(--fc-bgHover); }

.fc-mobile-cmdpal-item-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.fc-mobile-cmdpal-item-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-mobile-cmdpal-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--fc-textDim);
  font-size: 14px;
}

/* ════════════════════════════════════
   LOADING SCREEN
════════════════════════════════════ */

.fc-m-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fc-bg);
  z-index: 100;
}

/* ════════════════════════════════════
   SPINNER
════════════════════════════════════ */

@keyframes fc-m-spin {
  to { transform: rotate(360deg); }
}

/* Keep old name for backward compat in existing components */
@keyframes fc-mobile-spin {
  to { transform: rotate(360deg); }
}

.fc-mobile-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--fc-border);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: fc-mobile-spin 0.65s linear infinite;
  flex-shrink: 0;
}

.fc-m-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--fc-border);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: fc-m-spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ════════════════════════════════════
   ANIMATIONS
════════════════════════════════════ */

@keyframes fc-m-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fc-m-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
/* ============================================================
   ForgeCAD — Global UI Polish Layer
   Adds transitions, hover states, custom scrollbars, and micro-
   interactions to every interactive element in the app.
   ============================================================ */

/* --- Selection color --- */
::selection {
  background: var(--fc-accent);
  color: var(--fc-accentText);
}

/* --- Custom scrollbars (WebKit + Firefox) --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--fc-border);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--fc-textDim);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-corner {
  background: transparent;
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--fc-border) transparent;
}

/* --- Universal interactive element transitions --- */
button,
[role="button"],
a,
input,
select,
textarea {
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease,
    transform 0.1s ease;
}

/* --- Button hover/active/focus states --- */
button:not(:disabled):hover,
[role="button"]:not(:disabled):hover {
  filter: brightness(1.15);
}
button:not(:disabled):active,
[role="button"]:not(:disabled):active {
  transform: scale(0.97);
}
button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--fc-accent);
  outline-offset: 1px;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- fc-btn: Themed button class for toolbar/panel buttons --- */
.fc-btn {
  padding: 4px 10px;
  background: transparent;
  color: var(--fc-textMuted);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.fc-btn:hover {
  background: var(--fc-bgHover);
  color: var(--fc-text);
  border-color: var(--fc-textDim);
}
.fc-btn:active {
  background: var(--fc-bgActive);
}
.fc-btn.active {
  background: var(--fc-accent);
  color: var(--fc-accentText);
  border-color: var(--fc-accent);
}
.fc-btn.active:hover {
  filter: brightness(1.1);
}

/* --- fc-icon-btn: Small icon-only button --- */
.fc-icon-btn {
  padding: 4px;
  background: transparent;
  color: var(--fc-textDim);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fc-icon-btn:hover {
  background: var(--fc-bgHover);
  color: var(--fc-text);
  border-color: var(--fc-border);
}

/* --- Panel section headers --- */
.fc-panel-header {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--fc-textDim);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background 0.12s ease,
    color 0.12s ease;
}
.fc-panel-header:hover {
  background: var(--fc-bgHover);
  color: var(--fc-textMuted);
}

/* --- Separator --- */
.fc-separator {
  width: 1px;
  height: 20px;
  background: var(--fc-border);
  margin: 0 4px;
  flex-shrink: 0;
}

/* --- Toolbar --- */
.fc-toolbar {
  padding: 0 10px;
  height: 46px;
  background: var(--fc-bgHover);
  border-bottom: 1px solid var(--fc-border);
  display: flex;
  align-items: center;
  user-select: none;
  flex-shrink: 0;
}

/* Toolbar zones — left and right anchor to edges, center fills the middle */
.fc-toolbar-zone {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.fc-toolbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
}

/* File button in center — acts as both filename display and command palette trigger */
.fc-toolbar-file {
  max-width: 340px;
  padding: 5px 12px !important;
  border-radius: 8px !important;
  gap: 8px !important;
  background: var(--fc-bg) !important;
  border-color: var(--fc-border) !important;
}
.fc-toolbar-file:hover {
  background: var(--fc-bgHover) !important;
  border-color: var(--fc-textDim) !important;
}
.fc-toolbar-filename {
  color: var(--fc-text);
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-toolbar-shortcut {
  color: var(--fc-textDim);
  font-size: 10px;
  flex-shrink: 0;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--fc-bgHover);
  border: 1px solid var(--fc-border);
  line-height: 1.3;
}

/* Icon-only toolbar button — square, centered icon, no text */
.fc-toolbar-btn {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  border-radius: 6px;
}

/* Labeled toolbar button — icon + text, for primary actions */
.fc-toolbar-labeled {
  height: 32px;
  padding: 0 10px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px !important;
  font-size: 14px;
  flex-shrink: 0;
  border-radius: 6px;
}
.fc-toolbar-labeled span {
  font-size: 12px;
}

/* --- Input fields --- */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="color"]),
textarea,
select {
  background: var(--fc-bgInput);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--fc-text);
  font-size: 12px;
  font-family: inherit;
}
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="color"]):focus,
textarea:focus,
select:focus {
  border-color: var(--fc-accent);
  box-shadow: 0 0 0 1px var(--fc-accent);
}

/* --- Tooltip-like subtle shadow for floating elements --- */
.fc-floating {
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 1px 4px rgba(0, 0, 0, 0.2);
}

/* --- Animations --- */
@keyframes fc-fadein {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fc-fadein-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fc-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes fc-slide-out-right {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}
@keyframes fc-pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}
@keyframes fc-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
@keyframes fc-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
@keyframes fc-scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Range inputs (sliders) --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--fc-border);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fc-accent);
  cursor: pointer;
  border: 2px solid var(--fc-bgPanel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.1s ease,
    box-shadow 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--fc-accent);
  cursor: pointer;
  border: 2px solid var(--fc-bgPanel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* --- Color input --- */
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  padding: 1px;
  cursor: pointer;
  background: transparent;
}
input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}
input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

/* --- Resize handle polish --- */
.fc-resize-handle {
  transition: background 0.15s ease;
}
.fc-resize-handle:hover {
  background: var(--fc-bgActive);
}

/* =====================================================================
   Documentation page styles
   ===================================================================== */

/* --- Layout shell --- */
.fc-docs-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--fc-bg);
}
.fc-docs-body {
  display: flex;
  flex: 1;
  padding-top: 56px;
}
.fc-docs-main {
  flex: 1;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

/* --- Top nav --- */
.fc-docs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--fc-bg);
  border-bottom: 1px solid var(--fc-border);
  z-index: 100;
  backdrop-filter: blur(8px);
}
.fc-docs-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--fc-text);
}
.fc-docs-nav-logo span:last-child {
  font-size: 16px;
  font-weight: 700;
  color: var(--fc-accent);
  letter-spacing: -0.02em;
}
.fc-docs-nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.fc-docs-nav-active {
  color: var(--fc-accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.fc-docs-nav-link {
  color: var(--fc-textMuted);
  text-decoration: none;
  font-size: 14px;
}
.fc-docs-nav-link:hover { color: var(--fc-text); }
.fc-docs-nav-cta {
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--fc-accent);
  color: var(--fc-accentText);
  border-radius: 6px;
  text-decoration: none;
  transition: opacity 0.15s;
}
.fc-docs-nav-cta:hover { opacity: 0.9; }

/* --- Search trigger in nav --- */
.fc-docs-search-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 6px;
  color: var(--fc-textDim);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.fc-docs-search-trigger:hover {
  border-color: var(--fc-accent);
  color: var(--fc-textMuted);
}
.fc-docs-search-trigger kbd {
  margin-left: 4px;
  padding: 1px 5px;
  font-size: 11px;
  background: var(--fc-bgHover);
  border: 1px solid var(--fc-border);
  border-radius: 3px;
  font-family: var(--fc-mono, 'SF Mono', 'Fira Code', monospace);
  color: var(--fc-textDim);
}

/* --- Sidebar --- */
.fc-docs-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--fc-bgPanel);
  border-right: 1px solid var(--fc-border);
  padding: 20px 0;
  overflow-y: auto;
  height: calc(100vh - 56px);
  position: sticky;
  top: 56px;
}
.fc-docs-sidebar::-webkit-scrollbar { width: 4px; }
.fc-docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.fc-docs-sidebar::-webkit-scrollbar-thumb { background: var(--fc-border); border-radius: 2px; }

.fc-docs-sidebar-group-title {
  padding: 12px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fc-textDim);
}
.fc-docs-sidebar-link {
  display: block;
  padding: 5px 20px 5px 24px;
  font-size: 13px;
  color: var(--fc-textMuted);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.1s, background 0.1s, border-color 0.1s;
}
.fc-docs-sidebar-link:hover {
  color: var(--fc-text);
  background: var(--fc-bgHover);
}
.fc-docs-sidebar-link.active {
  color: var(--fc-accent);
  border-left-color: var(--fc-accent);
  background: var(--fc-bgHover);
  font-weight: 600;
}

/* --- Index page --- */
.fc-docs-index {
  padding: 40px 48px 80px;
  max-width: 800px;
}
.fc-docs-index-hero {
  padding: 60px 0 40px;
  text-align: center;
}
.fc-docs-index-hero h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--fc-text);
  margin: 0 0 12px;
}
.fc-docs-index-hero p {
  font-size: 16px;
  color: var(--fc-textMuted);
  margin: 0 0 8px;
}
.fc-docs-index-hint {
  font-size: 13px;
  color: var(--fc-textDim);
}
.fc-docs-index-hint kbd {
  padding: 2px 6px;
  font-size: 12px;
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  font-family: var(--fc-mono, monospace);
  color: var(--fc-accent);
}
.fc-docs-index-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--fc-textDim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 32px 0 12px;
}
.fc-docs-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}
.fc-docs-index-card {
  display: block;
  padding: 16px 20px;
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.fc-docs-index-card:hover {
  border-color: var(--fc-accent);
  background: var(--fc-bgHover);
}
.fc-docs-index-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fc-text);
  margin-bottom: 4px;
}
.fc-docs-index-card-desc {
  font-size: 13px;
  color: var(--fc-textMuted);
}

/* --- Doc content (markdown) --- */
.fc-docs-content {
  padding: 40px 48px 80px;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.7;
  color: var(--fc-text);
  font-size: 15px;
}
.fc-docs-content h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--fc-border);
  color: var(--fc-text);
}
.fc-docs-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--fc-border);
  color: var(--fc-text);
}
.fc-docs-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 28px 0 8px;
  color: var(--fc-text);
}
.fc-docs-content h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 20px 0 6px;
  color: var(--fc-accent);
}
.fc-docs-content p {
  margin: 0 0 12px;
  color: var(--fc-text);
}
.fc-docs-content ul, .fc-docs-content ol {
  padding-left: 24px;
  margin: 0 0 12px;
}
.fc-docs-content li {
  margin-bottom: 4px;
}
.fc-docs-content li > ul, .fc-docs-content li > ol {
  margin-top: 4px;
  margin-bottom: 0;
}
.fc-docs-content a {
  color: var(--fc-accent);
  text-decoration: none;
}
.fc-docs-content a:hover {
  text-decoration: underline;
}
.fc-docs-content strong {
  font-weight: 600;
  color: var(--fc-text);
}
.fc-docs-content hr {
  border: none;
  border-top: 1px solid var(--fc-border);
  margin: 24px 0;
}
.fc-docs-content img {
  max-width: 100%;
  border-radius: 8px;
}

/* Anchor links on headings */
.fc-docs-anchor {
  opacity: 0;
  margin-left: 8px;
  color: var(--fc-textMuted);
  text-decoration: none;
  font-weight: 400;
  font-size: 0.8em;
  transition: opacity 0.15s;
}
.fc-docs-content h1:hover .fc-docs-anchor,
.fc-docs-content h2:hover .fc-docs-anchor,
.fc-docs-content h3:hover .fc-docs-anchor,
.fc-docs-content h4:hover .fc-docs-anchor {
  opacity: 1;
}

/* Scroll-to highlight */
.fc-docs-highlight {
  animation: fc-docs-flash 1.5s ease-out;
}
@keyframes fc-docs-flash {
  0% { background: var(--fc-bgActive); }
  100% { background: transparent; }
}

/* Code blocks */
.fc-docs-code {
  background: var(--fc-bgPanel);
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 16px;
  font-family: var(--fc-mono, 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace);
}
.fc-docs-code code {
  background: none;
  padding: 0;
  border: none;
  font-size: 13px;
  color: var(--fc-text);
}

/* Inline code — cyan tint for visibility */
.fc-docs-inline-code {
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.9em;
  font-family: var(--fc-mono, 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace);
  color: var(--fc-accent);
}

/* Blockquotes */
.fc-docs-blockquote {
  border-left: 3px solid var(--fc-accent);
  margin: 0 0 12px;
  padding: 8px 16px;
  background: var(--fc-bgSurface);
  border-radius: 0 4px 4px 0;
  color: var(--fc-textMuted);
}
.fc-docs-blockquote p {
  margin: 0;
}

/* Tables */
.fc-docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 13px;
}
.fc-docs-table th,
.fc-docs-table td {
  padding: 8px 12px;
  border: 1px solid var(--fc-border);
  text-align: left;
}
.fc-docs-table th {
  background: var(--fc-bgSurface);
  font-weight: 600;
  color: var(--fc-text);
}
.fc-docs-table td {
  color: var(--fc-textMuted);
}

/* Details/summary (collapsible sections in API docs) */
.fc-docs-content details {
  margin: 0 0 12px;
  border: 1px solid var(--fc-border);
  border-radius: 8px;
  overflow: hidden;
}
.fc-docs-content details summary {
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 500;
  color: var(--fc-textMuted);
  background: var(--fc-bgSurface);
  transition: color 0.1s;
}
.fc-docs-content details summary:hover {
  color: var(--fc-text);
}
.fc-docs-content details[open] summary {
  border-bottom: 1px solid var(--fc-border);
  color: var(--fc-text);
}
.fc-docs-content details > :not(summary) {
  padding: 0 16px;
}
.fc-docs-content details > pre {
  margin: 12px 0;
  border: none;
  border-radius: 0;
}

/* --- Highlight.js token colors (scoped to docs) ---
   Uses theme-aware CSS variables so tokens adapt to any app theme.
   Default palette matches Tokyo Night. */
.fc-docs-content .hljs-keyword,
.fc-docs-content .hljs-tag { color: var(--fc-accent); }
.fc-docs-content .hljs-string,
.fc-docs-content .hljs-template-variable { color: var(--fc-success, #9ece6a); }
.fc-docs-content .hljs-number,
.fc-docs-content .hljs-literal { color: var(--fc-warning, #ff9e64); }
.fc-docs-content .hljs-type,
.fc-docs-content .hljs-title.class_,
.fc-docs-content .hljs-built_in { color: var(--fc-warning, #e0af68); }
.fc-docs-content .hljs-comment { color: var(--fc-textDim); font-style: italic; }
.fc-docs-content .hljs-attr,
.fc-docs-content .hljs-attribute { color: var(--fc-accent); }
.fc-docs-content .hljs-params { color: var(--fc-text); }
.fc-docs-content .hljs-title.function_ { color: var(--fc-accent); }
.fc-docs-content .hljs-punctuation { color: var(--fc-textMuted); }
.fc-docs-content .hljs-property { color: var(--fc-text); }
.fc-docs-content .hljs-variable { color: var(--fc-text); }
.fc-docs-content .hljs-regexp { color: var(--fc-error, #f7768e); }
.fc-docs-content .hljs-meta { color: var(--fc-textDim); }
.fc-docs-content .hljs-selector-class { color: var(--fc-accent); }

/* --- Search overlay --- */
.fc-docs-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(20vh, 160px);
}
.fc-docs-search-modal {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--fc-bgPanel);
  border: 1px solid var(--fc-border);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.fc-docs-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--fc-border);
}
.fc-docs-search-input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  color: var(--fc-text);
}
.fc-docs-search-input-wrap input::placeholder {
  color: var(--fc-textDim);
}
.fc-docs-search-input-wrap kbd {
  padding: 2px 6px;
  font-size: 11px;
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 4px;
  color: var(--fc-textDim);
  font-family: var(--fc-mono, monospace);
}
.fc-docs-search-results {
  max-height: 400px;
  overflow-y: auto;
}
.fc-docs-search-results::-webkit-scrollbar { width: 4px; }
.fc-docs-search-results::-webkit-scrollbar-thumb { background: var(--fc-border); border-radius: 2px; }

.fc-docs-search-result {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--fc-border);
  transition: background 0.08s;
}
.fc-docs-search-result:last-child { border-bottom: none; }
.fc-docs-search-result:hover,
.fc-docs-search-result.selected {
  background: var(--fc-bgHover);
}
.fc-docs-search-result.selected {
  background: var(--fc-bgActive);
}
.fc-docs-search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--fc-text);
}
.fc-docs-search-result-category {
  font-size: 12px;
  color: var(--fc-textDim);
  margin-top: 2px;
}
.fc-docs-search-result-snippet {
  font-size: 12px;
  color: var(--fc-textMuted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-docs-search-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--fc-textDim);
  font-size: 14px;
}
.fc-docs-search-footer {
  display: flex;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--fc-border);
  font-size: 12px;
  color: var(--fc-textDim);
}
.fc-docs-search-footer kbd {
  padding: 1px 5px;
  font-size: 11px;
  background: var(--fc-bgSurface);
  border: 1px solid var(--fc-border);
  border-radius: 3px;
  font-family: var(--fc-mono, monospace);
  color: var(--fc-textMuted);
}

/* --- Project Selector --- */
.fc-project-item:hover {
  background: var(--fc-bgHover, rgba(255, 255, 255, 0.06)) !important;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .fc-docs-sidebar { display: none; }
  .fc-docs-content { padding: 20px 16px 60px; }
  .fc-docs-index { padding: 20px 16px 60px; }
  .fc-docs-index-grid { grid-template-columns: 1fr; }
}
