/* Splinter Mosaic panel styles, loaded inside a shadow root so the theme cannot restyle the tool.
   Styled after ggdstudio.co.za: Titillium Web, pale blue ground, white cards with pale blue hairlines,
   blue headings, square corners, uppercase outlined buttons. */
:host {
  --bg: #d6e1ff;       /* page */
  --soft: #ccdaff;     /* hero blue: readout, hairlines */
  --stage: #e9effb;    /* 10% blue: the surface the image sits on */
  --card: #ffffff;
  --text: #4a4a4a;
  --head: #3f444b;
  --mute: #6b7078;
  --accent: #285bd3;
  --accent-ink: #ffffff;
  --f: "Titillium Web", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
:host { all: initial; display: block; color: var(--text); font: 400 16px/1.6 var(--f); letter-spacing: .4px; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
/* Preview stays pinned on screen; only the control panel scrolls. */
.stage { background: var(--stage); padding: 16px; display: grid; place-items: center; min-width: 0;
         position: sticky; top: 16px; height: calc(100vh - 32px); }
.stage.drag { outline: 2px dashed var(--accent); outline-offset: -8px; }
#prev { display: block; max-width: 100%; max-height: calc(100vh - 66px); width: auto; height: auto; background: #fff; cursor: grab; touch-action: none; }
#prev.grabbing { cursor: grabbing; }
.tag { position: absolute; left: 24px; top: 24px; font: 600 12px var(--f); letter-spacing: .12em; text-transform: uppercase; background: var(--accent); color: var(--accent-ink); padding: 3px 8px; pointer-events: none; }

/* Control panel: a stack of white cards */
.panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain;
         display: grid; gap: 12px; min-width: 0; align-content: start; padding-right: 4px; }
fieldset { background: var(--card); border: 1px solid var(--soft); padding: 16px; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font: 600 20px/1.2 var(--f); color: var(--accent); letter-spacing: .4px; }
legend + * { clear: both; }
.sub { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--soft); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1.5px solid var(--accent); border-radius: 999px; overflow: hidden; }
.seg button { font: 700 11.2px var(--f); letter-spacing: .4px; background: transparent; color: var(--accent); border: 0; border-right: 1.5px solid var(--accent); text-transform: uppercase; line-height: 1; padding: calc(.667em - .1875em) .667em calc(.667em - .1275em); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--soft); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
#modeSeg button { font-size: 10.4px; padding-inline: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

textarea, select { width: 100%; font: 400 15px var(--f); letter-spacing: .4px; background: #fff; color: var(--text); border: 1px solid var(--soft); border-radius: 0; padding: 8px; }
textarea { resize: vertical; min-height: 64px; font-weight: 600; }
select:hover, textarea:hover { border-color: var(--accent); }

.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; }
.row label { font-weight: 400; color: var(--text); }
.row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.num { display: inline-flex; align-items: baseline; gap: 2px; }
.num input { width: 74px; font: 600 15px var(--f); font-variant-numeric: tabular-nums; text-align: right; color: var(--accent); background: transparent; border: 0; border-bottom: 1px solid var(--soft); border-radius: 0; padding: 2px 0; -moz-appearance: textfield; appearance: textfield; }
.num input:hover { border-bottom-color: var(--accent); }
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num input:focus { outline: none; border-bottom: 2px solid var(--accent); background: #f3f6ff; }
.num i { font: normal 400 14px var(--f); color: var(--mute); min-width: 1ch; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 14px; color: var(--mute); }
input[type=color] { width: 100%; height: 36px; padding: 2px; border: 1px solid var(--soft); border-radius: 0; background: #fff; cursor: pointer; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }

.btn { font: 700 11.2px var(--f); letter-spacing: .4px; text-transform: uppercase; line-height: 1; padding: calc(.667em - .1875em) .667em calc(.667em - .1275em); border: 1.5px solid var(--accent); border-radius: 999px; background: transparent; color: var(--accent); cursor: pointer; text-align: center; display: block; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1f49ab; border-color: #1f49ab; }
.btn[disabled] { opacity: .55; cursor: wait; }
.hint { color: var(--mute); font-size: 14px; margin: 0; line-height: 1.5; }
.readout { font: 400 15px/1.5 var(--f); color: var(--head); background: var(--soft); padding: 8px 10px; white-space: pre-line; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .stage { top: 0; z-index: 5; height: 46vh; padding: 8px; }
  #prev { max-height: calc(46vh - 18px); }
  .panel { position: static; max-height: none; overflow: visible; padding-right: 0; }
}

/* Buttons on white: no frame, a 20% periwinkle fill instead. The filled blue (primary) buttons stay as they are. */
.btn:not(.primary) { border-color: transparent; background: color-mix(in srgb, var(--soft) 50%, #fff); }
.btn:not(.primary):hover { background: var(--soft); }
.seg { border-color: transparent; background: color-mix(in srgb, var(--soft) 50%, #fff); }
.seg button { border-right-color: transparent; }
