/* Box Sketch. Builds on ../../css/main.css tokens. Classes are sk- prefixed so they never clash with .btn or .brand. */
:root {
  --sk-canvas: var(--surface);
  --sk-box-fill: #011B26; /* --bg at 55% over --surface, opaque so overlapping boxes hide what is under them */
  --sk-box-line: var(--text-dim);
  --sk-grid: rgba(7, 92, 123, 0.9);
}

/* The tool fills the first screen under the fixed header; the footer sits below it. */
.sk-app { position: relative; display: flex; flex-direction: column; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); min-height: 420px; }

/* ---------- Toolbar ---------- */
.sk-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px var(--gutter); background: linear-gradient(180deg, var(--surface), rgba(0, 46, 62, 0.55)); border-bottom: 1px solid var(--line); }
.sk-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin: 0 6px 0 0; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.sk-title::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--pink); }
.sk-bar svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sk-seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.sk-seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-dim); font: inherit; font-size: 0.875rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.sk-seg button svg { width: 15px; height: 15px; }
.sk-seg button:hover { color: var(--text); background: rgba(7, 92, 123, 0.35); }
.sk-seg button[aria-pressed="true"] { background: var(--pink); color: var(--bg); }

.sk-icon, .sk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background-color .15s ease, border-color .15s ease; }
.sk-icon { width: 36px; flex: none; }
.sk-btn { padding: 0 14px; }
.sk-icon svg, .sk-btn svg { width: 16px; height: 16px; }
.sk-icon:hover, .sk-btn:hover { background: rgba(7, 92, 123, 0.35); }
.sk-icon[aria-pressed="true"] { background: var(--plum); border-color: var(--pink); color: var(--pink); }
.sk-icon:disabled, .sk-btn:disabled { opacity: .4; cursor: default; background: transparent; }
.sk-btn-primary { background: var(--pink); border-color: var(--pink); color: var(--bg); }
.sk-btn-primary:hover { background: #ff5683; }

.sk-field { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--text-dim); }
.sk-field input[type="range"] { width: 80px; accent-color: var(--pink); }
.sk-field input[type="number"] { width: 58px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--text); font: inherit; padding: 4px 8px; }
.sk-field input:focus-visible { outline: 2px solid var(--pink); outline-offset: 1px; }
.sk-divider { width: 1px; height: 24px; background: var(--line); flex: none; }
.sk-spacer { flex: 1; }

/* ---------- Stage ---------- */
.sk-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 20px 24px 60px; background: radial-gradient(circle, rgba(7, 92, 123, 0.45) 1px, transparent 1px) 0 0 / 22px 22px, var(--bg); }
.sk-frame { position: relative; display: flex; flex-direction: column; flex: none; overflow: hidden; background: var(--bg); border: 1px solid var(--teal); box-shadow: 0 24px 50px rgba(0, 0, 0, .55); }
.sk-frame.mobile { border-radius: 34px; padding: 10px; }
.sk-frame.web { border-radius: var(--r-sm); }
.sk-notch { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); width: 90px; height: 20px; background: var(--bg); border-radius: 12px; z-index: 5; }
.sk-chrome { height: 30px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.sk-chrome span { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); }
.sk-chrome span:first-child { background: var(--pink); }
.sk-frame canvas { display: block; touch-action: none; cursor: crosshair; background: var(--sk-canvas); }
.sk-frame.mobile canvas { border-radius: 24px; }

.sk-hint { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 2 * var(--gutter)); margin: 0; padding: 6px 14px; font-size: 0.8rem; text-align: center; color: var(--text-dim); background: rgba(2, 11, 18, 0.85); border: 1px solid var(--line); border-radius: 999px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tool names collapse to icons below 1600px so the toolbar keeps one row; the text stays for screen readers. */
@media (max-width: 1600px) {
  .sk-seg .sk-tl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #toolSeg button { padding: 6px 10px; }
}

@media (max-width: 900px) {
  .sk-bar { gap: 8px; }
  .sk-field, .sk-hint { display: none; }
  .sk-stage { padding: 16px; }
  .sk-divider { display: none; }
}
