

:root {
  --dc-arc-1: #FD849B; --dc-arc-2: #F96BDF; --dc-arc-3: #AF5CF9; --dc-arc-4: #7480FC;
  --dc-arc-5: #6494FA; --dc-arc-6: #5FC3F5; --dc-arc-7: #60D3E4;

  --dc-ink: #412164;
  --dc-line: #1A1030;
  --dc-paper: #FFFFFF;

  --dc-shell: #2B1550;
  --dc-shell-raised: #3A1E68;
  --dc-shell-sunk: #1D0E39;
  --dc-control: #FFFFFF;

  --dc-radius-sm: 12px; --dc-radius-md: 20px; --dc-radius-lg: 32px; --dc-radius-pill: 999px;
  --dc-shadow: 0 4px 16px rgba(43, 21, 80, 0.28);

  --dc-font-ui: "Nunito", system-ui, -apple-system, sans-serif;
  --dc-text-xs: 16px;

  --dc-target: 56px;                 
  --dc-gap: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--dc-shell);
  color: var(--dc-control);
  font-family: var(--dc-font-ui);
  font-size: var(--dc-text-xs);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;        
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.dc-app {
  position: fixed;
  inset: 0;
  height: 100dvh;
  display: grid;
  gap: var(--dc-gap);
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
           max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-template-areas: "stage" "palette" "tools" "controls";
}

@media (orientation: landscape) {
  .dc-app {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "tools stage palette" "tools controls palette";
  }
}

.dc-stage {
  grid-area: stage;
  min-width: 0; min-height: 0;
  display: grid;
  place-items: center;
  padding: 2px;
}

.dc-paper {
  position: relative;
  background: var(--dc-paper);        
  border-radius: var(--dc-radius-md);
  overflow: hidden;
  box-shadow: var(--dc-shadow);
  touch-action: none;                 
}

.dc-paint-layer, .dc-ink-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.dc-ink-layer { pointer-events: none; }

.dc-ink-layer #regions path { fill: none !important; }

.dc-fatal {
  margin: 0; padding: 16px; color: var(--dc-line);
  font: 13px/1.5 ui-monospace, monospace; white-space: pre-wrap;
}

.dc-toolbar {
  grid-area: tools;
  display: flex;
  gap: var(--dc-gap);
  align-items: center;
  justify-content: center;
}
.dc-rack { display: flex; gap: var(--dc-gap); }
.dc-sizes { display: flex; gap: 6px; align-items: center; }
.dc-sizes.is-hidden { visibility: hidden; }

@media (orientation: landscape) {
  .dc-toolbar { flex-direction: column; justify-content: center; }
  .dc-rack { flex-direction: column; }
  .dc-sizes { flex-direction: column; }
}

.dc-tool {
  width: 96px;
  min-height: var(--dc-target);
  padding: 6px 8px 8px;
  border: 0;
  border-radius: var(--dc-radius-md);
  background: var(--dc-control);
  color: var(--dc-ink);
  box-shadow: var(--dc-shadow);
  display: grid;
  gap: 4px;
  justify-items: center;
  position: relative;
  cursor: pointer;
}
.dc-tool__glyph { display: block; height: 26px; }
.dc-tool__glyph svg { height: 26px; width: 26px; fill: var(--dc-ink); }
.dc-tool__mark { width: 78px; height: 22px; border-radius: 6px; display: block; }

.dc-tool.is-on { outline: 4px solid var(--dc-arc-3); outline-offset: 2px; }
.dc-tool.is-on::after {
  content: "";
  position: absolute; right: -6px; bottom: -6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--dc-arc-3);
  border: 3px solid var(--dc-shell);
}

.dc-size {
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--dc-control);
  box-shadow: var(--dc-shadow);
  display: grid; place-items: center;
  cursor: pointer;
}
.dc-size.is-on { outline: 4px solid var(--dc-arc-3); outline-offset: 2px; }
.dc-size__dot { display: block; border-radius: 50%; background: var(--dc-ink); }

.dc-controls {
  grid-area: controls;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.dc-controls .dc-history { margin-left: auto; }
@media (max-width: 720px) {
  .dc-controls { justify-content: center; }
  .dc-controls .dc-history { margin-left: 0; }
}

.dc-toggle {
  display: flex; align-items: center; gap: 12px;
  min-height: var(--dc-target);
  padding: 6px 18px 6px 8px;
  border: 0; border-radius: var(--dc-radius-lg);
  background: var(--dc-control);
  color: var(--dc-ink);
  box-shadow: var(--dc-shadow);
  cursor: pointer;
}
.dc-toggle__pic { width: 72px; height: 48px; display: block; }
.dc-toggle__outline { fill: none; stroke: var(--dc-line); stroke-width: 5; }
.dc-toggle__paint path { fill: none; stroke: var(--dc-arc-3); stroke-width: 9; stroke-linecap: round; }
.dc-toggle__paint--free { display: none; }
.dc-toggle.is-free .dc-toggle__paint { display: none; }
.dc-toggle.is-free .dc-toggle__paint--free { display: block; }
.dc-toggle__word { font-size: var(--dc-text-xs); font-weight: 700; }

.dc-peek, .dc-blank {
  width: 76px; height: var(--dc-target);
  padding: 0; flex: none;
  border: 0; border-radius: var(--dc-radius-md);
  background: var(--dc-control);
  box-shadow: var(--dc-shadow);
  display: grid; place-items: center;
  cursor: pointer;
}
.dc-peek svg, .dc-blank svg { width: 54px; height: 47px; display: block; }

.dc-peek__paper { fill: var(--dc-paper); }
.dc-peek__frame { fill: none; stroke: var(--dc-line); stroke-width: 3.5; }
.dc-peek__lines { fill: none; stroke: var(--dc-line); stroke-width: 3; }
.dc-peek__fills { display: none; }

.dc-peek.is-on .dc-peek__fills { display: block; }
.dc-peek.is-on { outline: 4px solid var(--dc-arc-3); outline-offset: 2px; }

.dc-blank__paper { fill: var(--dc-paper); }
.dc-blank__frame { fill: none; stroke: var(--dc-line); stroke-width: 3.5; }
.dc-blank__scene { display: none; fill: none; stroke: var(--dc-line); stroke-width: 3; }

.dc-blank.is-on .dc-blank__scene { display: block; }

.dc-peek.is-hidden, .dc-blank.is-hidden, .dc-toggle.is-hidden { display: none; }

.dc-history { display: flex; gap: 10px; align-items: center; }

.dc-undo {
  width: 132px; height: var(--dc-target);
  border: 0; border-radius: var(--dc-radius-pill);
  background: var(--dc-control);
  color: var(--dc-ink);
  box-shadow: var(--dc-shadow);
  display: grid; place-items: center;
  cursor: pointer;
}
.dc-undo svg { width: 34px; height: 34px; fill: currentColor; }
.dc-redo {
  width: var(--dc-target); height: var(--dc-target);
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--dc-ink);
  box-shadow: var(--dc-shadow);
  display: grid; place-items: center;
  cursor: pointer;
}
.dc-redo svg { width: 26px; height: 26px; fill: currentColor; }
.dc-undo:disabled, .dc-redo:disabled { opacity: 0.32; }

.dc-palette {
  grid-area: palette;
  display: grid;
  gap: 8px;
  justify-items: center;
  background: var(--dc-shell-raised);
  border-radius: var(--dc-radius-md);
  padding: 8px;
}
.dc-tabs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.dc-tab {
  display: flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 4px 12px;
  border: 0; border-radius: var(--dc-radius-pill);
  background: rgba(255, 255, 255, 0.12);
  color: var(--dc-control);
  font: 600 var(--dc-text-xs)/1 var(--dc-font-ui);
  cursor: pointer;
}
.dc-tab.is-on { background: var(--dc-control); color: var(--dc-ink); }
.dc-tab__dots { display: flex; }
.dc-tab__dots i {
  width: 14px; height: 14px; border-radius: 50%;
  margin-right: -4px; border: 2px solid rgba(0, 0, 0, 0.12);
}

.dc-swatches {
  display: grid;
  grid-template-columns: repeat(8, var(--dc-target));
  gap: 6px;
}
.dc-skin {
  display: grid;
  grid-template-columns: repeat(10, 40px);
  gap: 6px;
}
.dc-swatch {
  width: var(--dc-target); height: var(--dc-target);
  border: 0; border-radius: var(--dc-radius-sm);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}
.dc-skin .dc-swatch { width: 40px; height: 40px; border-radius: 10px; }
.dc-swatch.is-on { outline: 4px solid var(--dc-control); outline-offset: 2px; }
.dc-current {
  width: 100%; height: 8px; border-radius: var(--dc-radius-pill);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.2);
}

@media (orientation: landscape) {
  .dc-palette { align-content: center; }
  .dc-swatches { grid-template-columns: repeat(4, 48px); }
  .dc-swatch { width: 48px; height: 48px; }
  .dc-skin { grid-template-columns: repeat(5, 36px); }
  .dc-skin .dc-swatch { width: 36px; height: 36px; }
  .dc-tabs { flex-direction: column; width: 100%; }
  .dc-tab { justify-content: flex-start; }
}

@media (max-height: 460px) {
  .dc-swatches { grid-template-columns: repeat(8, 40px); }
  .dc-swatch { width: 40px; height: 40px; }
}

.dc-probe-btn {
  position: fixed;
  top: max(6px, env(safe-area-inset-top));
  right: max(6px, env(safe-area-inset-right));
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.6);
  font: 700 11px/1 ui-monospace, monospace;
  cursor: pointer;
}

.dc-readout {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: auto;
  padding: 16px;
  background: #120823;
  color: #E9E2F5;
  font: 15px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  -webkit-overflow-scrolling: touch;
}
.dc-readout[hidden] { display: none; }
.dc-readout header { display: flex; justify-content: space-between; align-items: center; }
.dc-readout h1 { font-size: 16px; margin: 0; font-weight: 700; }
.dc-readout h2 { font-size: 13px; margin: 20px 0 8px; color: #9C8CC4; text-transform: uppercase; letter-spacing: .08em; }
.dc-readout #dc-readout-close {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); color: inherit; font-size: 22px; cursor: pointer;
}

.dc-readout__verdict #dc-verdict {
  display: grid; gap: 4px;
  padding: 14px; border-radius: 14px;
  background: #1F1038; border: 2px solid #4B2E86;
}
.dc-readout__verdict b { font-size: 30px; line-height: 1.15; color: #FFE3F2; }
.dc-readout__verdict span { font-size: 14px; color: #B7A8D8; }

.dc-readout__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dc-readout__actions button {
  min-height: 44px; padding: 0 16px;
  border: 0; border-radius: var(--dc-radius-pill);
  background: #3A1E68; color: #EFE7FF;
  font: 600 14px/1 var(--dc-font-ui); cursor: pointer;
}
.dc-readout__actions button:first-child { background: var(--dc-arc-3); color: #1A1030; font-weight: 800; }
.dc-readout__actions button:disabled { opacity: .45; }

.dc-readout__caps div { display: grid; grid-template-columns: 58px 1fr; gap: 8px; padding: 5px 0; align-items: baseline; }
.dc-readout__caps b { font-size: 14px; }
.dc-readout__caps .ok b { color: #7BE3B4; }
.dc-readout__caps .bad b { color: #FF8A8A; }
.dc-readout__caps i { grid-column: 2; display: block; font-style: normal; font-size: 13px; color: #9C8CC4; }

.dc-readout__rows div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #241539; }
.dc-readout__rows span { color: #9C8CC4; }
.dc-readout__rows b { text-align: right; }

.dc-readout pre { white-space: pre-wrap; font-size: 12px; color: #C0A9E8; }
