/* FirstOfCAD Web — application chrome (titlebar, ribbon, panels, statusbar). */

html, body { height: 100%; overflow: hidden; }

body {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto auto;
  grid-template-areas:
    "titlebar"
    "ribbon"
    "workspace"
    "cmdline"
    "statusbar";
  background: var(--foc-bg-darkest);
}

/* ====== Premium animated splash ====== */
.splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem;
  background: radial-gradient(ellipse at top, #1F1740 0%, #0B0820 55%, #04020F 100%);
  overflow: hidden;
}
/* Layered animated background */
.splash-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.splash-grid {
  position: absolute; inset: -10%;
  background-image:
    linear-gradient(rgba(167, 139, 250, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.05) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  animation: splashGridDrift 30s linear infinite;
}
@keyframes splashGridDrift {
  from { transform: translate(0, 0); }
  to   { transform: translate(60px, 60px); }
}
.splash-orb {
  position: absolute; border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: splashOrbFloat 14s ease-in-out infinite;
}
.splash-orb-1 { width: 360px; height: 360px; top: -80px; left: -60px;
  background: radial-gradient(circle, #7C3AED, transparent 70%); animation-delay: 0s; }
.splash-orb-2 { width: 460px; height: 460px; bottom: -120px; right: -120px;
  background: radial-gradient(circle, #6D28D9, transparent 70%); animation-delay: -5s; }
.splash-orb-3 { width: 300px; height: 300px; top: 40%; left: 60%;
  background: radial-gradient(circle, #C4B5FD, transparent 70%); animation-delay: -9s; opacity: 0.35; }
@keyframes splashOrbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.08); }
  66%      { transform: translate(-30px, 40px) scale(0.95); }
}

/* SVG monogram */
.splash-mark { position: relative; margin-bottom: .4rem; }
.splash-mark svg { display: block; filter: drop-shadow(0 0 50px rgba(124, 58, 237, 0.55)); }
.splash-hex { transform-origin: 60px 60px; animation: splashRot 18s linear infinite; }
@keyframes splashRot { to { transform: rotate(360deg); } }
.splash-f {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: splashDraw 1.8s 0.2s cubic-bezier(.7,.0,.3,1) forwards, splashPulse 2.6s 2s ease-in-out infinite;
}
@keyframes splashDraw { to { stroke-dashoffset: 0; } }
@keyframes splashPulse { 50% { filter: drop-shadow(0 0 14px rgba(196, 181, 253, 0.9)); } }
.splash-dot {
  animation: splashDotPulse 1.8s ease-in-out infinite;
  transform-origin: 60px 60px;
}
@keyframes splashDotPulse { 50% { r: 4; opacity: 0.4; } }

/* Wordmark */
.splash-wordmark {
  display: flex; align-items: baseline; gap: 0;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 800; font-size: 2rem; letter-spacing: -0.02em;
  margin: 0;
  background: linear-gradient(135deg, #FFFFFF 0%, #C4B5FD 50%, #A78BFA 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: splashWordFade 1.4s 0.8s ease-out backwards;
}
.splash-w2 { opacity: 0.6; font-weight: 300; font-style: italic; padding: 0 0.05em; }
@keyframes splashWordFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Tagline */
.splash-tag {
  font-size: 0.92rem;
  color: rgba(196, 181, 253, 0.75);
  letter-spacing: 0.04em;
  margin: 0.2rem 0 0.6rem;
  animation: splashWordFade 1.4s 1.1s ease-out backwards;
}

/* Animated progress dots */
.splash-dots {
  display: flex; gap: 8px;
  margin-top: 0.4rem;
  animation: splashWordFade 1.4s 1.3s ease-out backwards;
}
.splash-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  opacity: 0.35;
  animation: splashDotsBlink 1.4s ease-in-out infinite;
}
.splash-dots span:nth-child(1) { animation-delay: 0s; }
.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }
.splash-dots span:nth-child(4) { animation-delay: 0.45s; }
.splash-dots span:nth-child(5) { animation-delay: 0.6s; }
@keyframes splashDotsBlink {
  0%, 100% { opacity: 0.35; transform: scale(1); box-shadow: none; }
  50%      { opacity: 1;    transform: scale(1.25); box-shadow: 0 0 14px rgba(167, 139, 250, 0.8); }
}

/* Recovery-state buttons (when shown) */
#foc-recovery-actions {
  animation: splashWordFade 0.4s ease-out backwards;
}

/* Trial banner */
.trial-banner {
  grid-column: 1; grid-row: 1;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.18), rgba(167, 139, 250, 0.18));
  border-bottom: 1px solid var(--foc-border);
  padding: 0.4rem 1rem;
  font-size: 0.86rem;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  color: var(--foc-light-purple);
}

/* ====== Titlebar — premium glassmorphism ====== */
.cad-titlebar {
  grid-area: titlebar;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: linear-gradient(180deg, rgba(27, 22, 56, 0.95), rgba(20, 16, 42, 0.95));
  border-bottom: 1px solid rgba(167, 139, 250, 0.18);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 0 0.8rem;
  min-height: 52px;
  position: relative;
}
/* Subtle glow underneath the titlebar */
.cad-titlebar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.35), transparent);
}
.title-left { display: flex; align-items: center; gap: 1.1rem; }
.title-logo {
  display: flex; align-items: center; gap: 0.55rem;
  text-decoration: none; color: var(--foc-text-primary);
  font-weight: 800; font-size: 0.95rem;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
  border-radius: 10px;
  letter-spacing: -0.01em;
  transition: background 0.15s ease;
}
/* Replace the small raster icon next to "FirstOfCAD" with an inline SVG mark
   so the workspace logo is crisp at any DPR. The <img> still loads but is hidden. */
.title-logo img { display: none; }
.title-logo::before {
  content: '';
  width: 26px; height: 26px;
  background:
    radial-gradient(circle at 35% 30%, #C4B5FD 0%, transparent 50%),
    linear-gradient(135deg, #7C3AED, #6D28D9);
  border-radius: 8px;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.08),
    0 4px 12px rgba(124, 58, 237, 0.45);
  /* Embed a tiny "F" as a CSS mask for that 1-of-a-kind monogram look */
  -webkit-mask: linear-gradient(#fff, #fff); mask: linear-gradient(#fff, #fff);
}
.title-logo span { background: linear-gradient(135deg, #fff 0%, #C4B5FD 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.title-logo:hover { background: rgba(167, 139, 250, 0.08); }

/* Ribbon tabs */
.ribbon-tabs { display: flex; gap: 0.15rem; }
.ribbon-tab {
  position: relative;
  padding: 0.42rem 0.95rem;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--foc-text-secondary);
  transition: color 0.15s ease, background 0.15s ease;
}
.ribbon-tab:hover { background: rgba(167, 139, 250, 0.08); color: #fff; }
.ribbon-tab.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(109, 40, 217, 0.95));
  color: #fff;
  box-shadow:
    0 4px 14px rgba(124, 58, 237, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.ribbon-tab.active::after {
  content: ''; position: absolute; left: 50%; bottom: -10px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #A78BFA; transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
  animation: ribbonTabPulse 2s ease-in-out infinite;
}
@keyframes ribbonTabPulse { 50% { opacity: 0.4; transform: translateX(-50%) scale(1.3); } }

.title-center { font-size: 0.88rem; color: var(--foc-text-secondary); text-align: center; }
.title-center .modified-dot { color: var(--foc-status-warning); margin-left: 0.3rem; }

/* Document tabs */
.doc-tabs {
  display: flex; align-items: center; gap: 0.15rem;
  background: var(--foc-bg-medium);
  border-radius: 8px;
  padding: 0.2rem;
}
.doc-tab {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--foc-text-secondary);
  cursor: pointer;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.12s var(--foc-ease);
}
.doc-tab.active {
  background: var(--foc-bg-light);
  color: var(--foc-text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.doc-tab:hover { color: var(--foc-text-primary); }
.doc-tab-close {
  width: 16px; height: 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  margin-left: 0.2rem;
  color: var(--foc-text-muted);
}
.doc-tab-close:hover { background: var(--foc-bg-lighter); color: var(--foc-status-error); }
.doc-tab-add {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--foc-text-muted);
  margin-left: 0.2rem;
}
.doc-tab-add:hover { background: var(--foc-bg-light); color: var(--foc-text-primary); }

/* Blocks panel grid */
.blocks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.block-card {
  aspect-ratio: 1;
  background: var(--foc-bg-medium);
  border: 1px solid var(--foc-border);
  border-radius: var(--foc-radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.3rem;
  gap: 0.2rem;
  cursor: pointer;
  transition: all 0.12s var(--foc-ease);
}
.block-card:hover {
  border-color: var(--foc-border-strong);
  background: var(--foc-bg-light);
  transform: translateY(-1px);
}
.block-card svg {
  width: 60%; height: 60%; flex: 1;
  color: var(--foc-light-purple);
}
.block-card-name {
  font-size: 0.66rem;
  text-align: center;
  color: var(--foc-text-secondary);
  line-height: 1.2;
  word-break: break-word;
}

.title-right { display: flex; align-items: center; gap: 0.4rem; justify-content: flex-end; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--foc-text-secondary);
  font-size: 1rem;
  transition: all 0.15s var(--foc-ease);
}
.icon-btn:hover { background: var(--foc-hover-bg); color: var(--foc-text-primary); }
.icon-btn.active { background: var(--foc-active-selection-bg); color: var(--foc-light-purple); }

.user-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  background: var(--foc-bg-medium);
  border: 1px solid var(--foc-border);
  border-radius: 999px;
  font-size: 0.82rem;
}
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--foc-vibrant-purple), var(--foc-light-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 0.78rem;
}

/* ====================  Ribbon (pro CAD look)  ==================== */
.ribbon {
  grid-area: ribbon;
  background: linear-gradient(180deg, var(--foc-bg-medium) 0%, var(--foc-bg-dark) 100%);
  border-bottom: 1px solid var(--foc-border);
  padding: 0.45rem 0.6rem 0.3rem;
  display: flex; gap: 0.35rem; flex-wrap: nowrap;
  overflow-x: auto;
  scroll-behavior: smooth;
}
.ribbon::-webkit-scrollbar { height: 6px; }
.ribbon::-webkit-scrollbar-thumb { background: rgba(124,58,237,.35); border-radius: 4px; }
.ribbon-group {
  display: flex; flex-direction: column;
  padding: 0 0.55rem 0.1rem;
  min-width: max-content;
  position: relative;
}
.ribbon-group::after {
  content: ""; position: absolute; right: 0; top: 4px; bottom: 18px;
  width: 1px; background: linear-gradient(180deg, transparent, var(--foc-border) 30%, var(--foc-border) 70%, transparent);
}
.ribbon-group:last-child::after { display: none; }
.ribbon-group-title {
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--foc-text-muted); margin-top: 0.25rem; text-align: center;
  font-weight: 600;
}
.ribbon-buttons { display: flex; gap: 0.15rem; align-items: stretch; }
/* Ribbon tool buttons — refined with gradient hover and glowing active state */
.ribbon-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 0.3rem;
  min-width: 60px; max-width: 80px;
  padding: 0.5rem 0.5rem 0.42rem;
  border-radius: 9px;
  font-size: 0.7rem;
  color: var(--foc-text-secondary);
  text-align: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.1;
  position: relative;
  overflow: hidden;
}
/* Soft shimmer that sweeps across on hover */
.ribbon-btn::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(167, 139, 250, 0.08) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  pointer-events: none;
}
.ribbon-btn:hover::before { transform: translateX(100%); }
.ribbon-btn .ico {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--foc-light-purple);
  transition: color 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}
.ribbon-btn .ico svg {
  width: 22px; height: 22px;
  stroke: currentColor; stroke-width: 1.7;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.ribbon-btn:hover {
  background: linear-gradient(180deg, rgba(167, 139, 250, 0.12), rgba(124, 58, 237, 0.06));
  color: #fff;
  border-color: rgba(167, 139, 250, 0.3);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -6px rgba(124, 58, 237, 0.4);
}
.ribbon-btn:hover .ico {
  color: #C4B5FD;
  transform: translateY(-1px) scale(1.08);
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.6));
}
.ribbon-btn:active { transform: translateY(0); }
.ribbon-btn.active {
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.45), rgba(76, 29, 149, 0.35));
  color: #fff;
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(167, 139, 250, 0.35),
    0 6px 18px -4px rgba(124, 58, 237, 0.55);
  font-weight: 600;
}
.ribbon-btn.active .ico {
  color: #fff;
  filter: drop-shadow(0 0 8px rgba(196, 181, 253, 0.9));
}
/* Subtle pulse halo on the active tool — guides the eye */
.ribbon-btn.active::after {
  content: ''; position: absolute; inset: -2px;
  border-radius: 11px;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.35);
  opacity: 0; animation: ribbonBtnHalo 2.6s ease-in-out infinite;
}
@keyframes ribbonBtnHalo {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

/* Workspace */
.workspace {
  grid-area: workspace;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 260px;
  min-height: 0;
  min-width: 0;
  background: var(--foc-bg-dark);
  overflow: hidden;
}
.left-panel, .right-panel {
  background: linear-gradient(180deg, rgba(20, 16, 42, 0.65), rgba(15, 12, 32, 0.65));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid rgba(167, 139, 250, 0.12);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex; flex-direction: column;
  min-width: 0;
  width: 260px;
  flex-shrink: 0;
}
.right-panel { border-right: none; border-left: 1px solid rgba(167, 139, 250, 0.12); }
.panel {
  border-bottom: 1px solid rgba(167, 139, 250, 0.08);
  padding: 0.7rem 0.7rem 0.6rem;
}
.panel header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.55rem;
  position: relative;
}
.panel header h4 {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(167, 139, 250, 0.8); font-weight: 700;
  display: flex; align-items: center; gap: 0.4rem;
}
/* Tiny accent dot before each panel title */
.panel header h4::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: linear-gradient(135deg, #A78BFA, #7C3AED);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.7);
}
.muted { color: var(--foc-text-muted); font-size: 0.85rem; }

/* Layer list */
.layer-list { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }
.layer-item {
  display: grid;
  grid-template-columns: 14px 16px 16px 1fr auto;
  align-items: center; gap: 0.45rem;
  padding: 0.36rem 0.5rem;
  border-radius: var(--foc-radius-sm);
  font-size: 0.86rem;
  cursor: pointer;
  transition: background 0.12s var(--foc-ease);
}
.layer-item:hover { background: var(--foc-hover-bg); }
.layer-item.current {
  background: var(--foc-active-selection-bg);
  outline: 1px solid var(--foc-border-strong);
}
.layer-color {
  width: 16px; height: 16px; border-radius: 4px;
  border: 1px solid var(--foc-border-strong);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  cursor: pointer;
}
.layer-toggle {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--foc-text-muted);
}
.layer-toggle:hover { color: var(--foc-text-primary); }
.layer-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-actions { display: flex; gap: 0.1rem; }

/* Properties */
.props-body { font-size: 0.85rem; }
.prop-row {
  display: grid; grid-template-columns: 90px 1fr;
  align-items: center; gap: 0.4rem;
  padding: 0.25rem 0;
}
.prop-row label { color: var(--foc-text-muted); font-size: 0.78rem; }
.prop-row input, .prop-row select { padding: 0.32rem 0.5rem; font-size: 0.8rem; }

/* File list */
.file-list { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; }
.file-item {
  padding: 0.5rem 0.6rem;
  border-radius: var(--foc-radius-sm);
  background: var(--foc-bg-medium);
  border: 1px solid var(--foc-border);
  font-size: 0.82rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 0.4rem;
}
.file-item:hover { background: var(--foc-bg-light); }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { color: var(--foc-text-muted); font-size: 0.72rem; }

/* Command log */
.cmdlog { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; font-family: var(--foc-font-mono); font-size: 0.78rem; max-height: 240px; overflow-y: auto; }
.cmdlog li { color: var(--foc-text-secondary); padding: 0.15rem 0.3rem; }

/* ====================  Canvas — locked-size drawing surface  ==================== */
.canvas-host {
  position: relative;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--foc-canvas-bg);
}
.canvas-stack {
  position: relative;
  flex: 1 1 0;                       /* fill all remaining vertical space */
  min-width: 0; min-height: 0;
  overflow: hidden;
}
#cad-canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  display: block; outline: none;
  cursor: crosshair;
}
.three-host { position: absolute; inset: 0; }

.canvas-overlay { position: absolute; inset: 0; pointer-events: none; }
.ucs-icon {
  position: absolute; left: 12px; bottom: 12px;
  display: flex; gap: 6px;
  background: rgba(20, 16, 42, 0.75);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--foc-border);
  font-size: 0.74rem;
  color: var(--foc-text-secondary);
}
.ucs-x { color: #EF4444; }
.ucs-y { color: #22C55E; }
.ucs-z { color: #3B82F6; }
/* ====================  NavCube — interactive 3D cube  ==================== */
.navcube {
  position: absolute; right: 18px; top: 18px;
  width: 72px; height: 72px;
  perspective: 320px;
  pointer-events: auto;
  z-index: 5;
}
.navcube-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(-25deg) rotateY(-32deg);
  transition: transform 0.35s var(--foc-ease);
  cursor: grab;
}
.navcube:hover .navcube-inner { transform: rotateX(-22deg) rotateY(-25deg); }
.navcube-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  background: linear-gradient(135deg, rgba(124,58,237,0.85), rgba(76,29,149,0.95));
  border: 1px solid rgba(167,139,250,0.5);
  color: #fff;
  backface-visibility: hidden;
  box-shadow: inset 0 0 14px rgba(255,255,255,0.06);
  cursor: pointer;
  transition: filter 0.15s var(--foc-ease);
}
.navcube-face:hover { filter: brightness(1.25); }
.navcube-face.front  { transform: rotateY(  0deg) translateZ(36px); }
.navcube-face.back   { transform: rotateY(180deg) translateZ(36px); }
.navcube-face.right  { transform: rotateY( 90deg) translateZ(36px); }
.navcube-face.left   { transform: rotateY(-90deg) translateZ(36px); }
.navcube-face.top    { transform: rotateX( 90deg) translateZ(36px); }
.navcube-face.bottom { transform: rotateX(-90deg) translateZ(36px); }

/* ====================  Rulers (top & left, overlay)  ==================== */
#ruler-h, #ruler-v {
  position: absolute;
  background: rgba(13, 11, 34, 0.85);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 4;
  display: block;
}
#ruler-h { top: 0; left: 20px; right: 0; height: 20px; border-bottom: 1px solid var(--foc-border-strong); }
#ruler-v { top: 20px; left: 0; bottom: 0; width: 20px; border-right: 1px solid var(--foc-border-strong); }
.ruler-corner {
  position: absolute; top: 0; left: 0; width: 20px; height: 20px;
  background: rgba(13, 11, 34, 0.92);
  border-right: 1px solid var(--foc-border-strong);
  border-bottom: 1px solid var(--foc-border-strong);
  z-index: 5; pointer-events: none;
}

.dynamic-input {
  position: absolute;
  background: var(--foc-bg-light);
  border: 1px solid var(--foc-border-strong);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-family: var(--foc-font-mono);
  font-size: 0.78rem;
  color: var(--foc-text-primary);
  pointer-events: none;
  display: none;
}

/* Command line */
.cmdline {
  grid-area: cmdline;
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--foc-bg-medium);
  border-top: 1px solid var(--foc-border);
  padding: 0.45rem 0.9rem;
  font-family: var(--foc-font-mono);
  font-size: 0.85rem;
}
.cmd-prompt { color: var(--foc-light-purple); font-weight: 600; }
#cmd-input { flex: 1; background: transparent; border: none; padding: 0.2rem; color: var(--foc-text-primary); }
#cmd-input:focus { box-shadow: none; }
.cmd-tip { color: var(--foc-text-muted); font-size: 0.78rem; }

/* ====================  Statusbar (pro)  ==================== */
.statusbar {
  grid-area: statusbar;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(180deg, var(--foc-bg-medium) 0%, var(--foc-bg-dark) 100%);
  border-top: 1px solid var(--foc-border-strong);
  font-size: 0.82rem;
  font-family: var(--foc-font-mono);
  color: var(--foc-text-secondary);
  min-height: 34px;
}
.status-cluster { display: flex; align-items: center; gap: 0.4rem; }
#coords {
  display: inline-block;
  min-width: 230px;
  font-size: 0.92rem;
  color: var(--foc-text-primary);
  padding: 0.2rem 0.85rem 0.2rem 0.2rem;
  border-right: 1px solid var(--foc-border-strong);
  margin-right: 0.5rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.status-toggle {
  padding: 0.28rem 0.7rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--foc-text-muted);
  border: 1px solid transparent;
  letter-spacing: 0.05em;
  font-weight: 600;
  background: transparent;
  cursor: pointer;
  transition: all 0.12s var(--foc-ease);
}
.status-toggle:hover {
  background: var(--foc-hover-bg);
  color: var(--foc-text-primary);
  border-color: var(--foc-border);
}
.status-toggle.on {
  background: linear-gradient(180deg, var(--foc-vibrant-purple), #6D28D9);
  color: #fff;
  border-color: var(--foc-vibrant-purple);
  box-shadow: 0 0 0 1px rgba(167,139,250,0.4), 0 2px 6px -1px rgba(124,58,237,0.45);
}
#unit-chip {
  background: rgba(124,58,237,0.18) !important;
  border: 1px solid rgba(124,58,237,0.5) !important;
  color: var(--foc-light-purple) !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
}
.status-mid {
  text-align: center; color: var(--foc-text-primary);
  font-size: 0.85rem; font-family: var(--foc-font-body);
  font-weight: 500;
}

/* Locked overlay */
.locked-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(7, 5, 26, 0.95);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.lock-card {
  width: 100%; max-width: 440px;
  text-align: center;
}
.lock-card .lock-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: rgba(232, 92, 107, 0.12);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; font-size: 2.5rem;
}

/* Templates / Hatch grid */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}
.template-card {
  padding: 0.8rem;
  background: var(--foc-bg-medium);
  border: 1px solid var(--foc-border);
  border-radius: var(--foc-radius-sm);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  text-align: center;
  transition: all 0.12s var(--foc-ease);
}
.template-card:hover {
  border-color: var(--foc-border-strong);
  background: var(--foc-bg-light);
  transform: translateY(-1px);
}
.template-card.selected {
  border-color: var(--foc-vibrant-purple);
  background: var(--foc-active-selection-bg);
  box-shadow: 0 0 0 2px rgba(124,58,237,0.3);
}
.template-name { font-weight: 600; font-size: 0.86rem; }
.template-desc { font-size: 0.74rem; color: var(--foc-text-muted); }

/* ====================  Foc modal — polished entrance  ==================== */
.foc-modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7, 5, 26, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s var(--foc-ease);
  padding: 1rem;
}
.foc-modal-overlay.show, .foc-modal-overlay:not([hidden]) { opacity: 1; pointer-events: auto; }
.foc-modal-card {
  width: 100%; max-width: 480px;
  background: linear-gradient(180deg, var(--foc-bg-card), var(--foc-bg-medium));
  border: 1px solid var(--foc-border-strong);
  border-radius: 14px;
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow: 0 24px 64px -16px rgba(0,0,0,0.7), 0 0 0 1px rgba(167,139,250,0.08);
  max-height: 85vh; overflow: auto;
  transform: translateY(14px) scale(0.97);
  opacity: 0;
  transition: transform 0.28s var(--foc-ease), opacity 0.22s var(--foc-ease);
}
.foc-modal-overlay.show .foc-modal-card,
.foc-modal-overlay:not([hidden]) .foc-modal-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.foc-modal-title {
  font-size: 1.18rem; font-weight: 700; margin-bottom: 0.5rem;
  color: var(--foc-text-primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.foc-modal-body {
  color: var(--foc-text-secondary); margin-bottom: 1.2rem;
  font-size: 0.92rem; line-height: 1.5;
}
.foc-modal-actions {
  display: flex; gap: 0.6rem; justify-content: flex-end;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--foc-border);
}

/* ====================  Scrollbar polish (all panels & lists)  ==================== */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.25); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(124,58,237,0.55); border: 2px solid transparent; background-clip: padding-box; }

/* ====================  Better cursor visuals for tool modes  ==================== */
#cad-canvas { cursor: crosshair; }
#cad-canvas[data-tool="select"] { cursor: default; }
#cad-canvas[data-tool="pan"]    { cursor: grab; }
#cad-canvas[data-tool="erase"]  { cursor: not-allowed; }

/* ====================  Block library — readable card names  ==================== */
.blocks-grid > * .template-name,
.blocks-grid .block-name { font-size: 0.74rem !important; }
.block-tile { font-size: 0.74rem; }

/* ====================  Locked workspace — hard lockdown when overlay is up  ==================== */
body[data-locked="true"] #titlebar,
body[data-locked="true"] #ribbon,
body[data-locked="true"] #workspace,
body[data-locked="true"] #cmdline,
body[data-locked="true"] #statusbar {
  pointer-events: none !important;
  user-select: none !important;
  filter: blur(8px) brightness(0.5);
  opacity: 0.4;
  transition: filter 0.3s var(--foc-ease);
}
body[data-locked="true"] #locked-overlay { z-index: 99999 !important; }
[inert] { pointer-events: none !important; cursor: not-allowed !important; }
[inert] * { pointer-events: none !important; }

/* Mobile */
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .left-panel, .right-panel { display: none; }
}
