/* === [S03.1] Demo: tokens, intro and board stage === */
.demo-page {
  --demo-header-h: 64px;
  --demo-intro-h: 92px;
  --demo-surface: rgba(17, 21, 28, 0.94);
  --demo-surface-solid: #11151C;
  --demo-tile: #1A202A;
  --demo-line-dark: rgba(255, 255, 255, 0.08);
  --demo-muted-dark: #8C96A8;
  --demo-accent: #3D7BF2;
  --demo-danger: #FF6B6B;
  --demo-light-tile: #F2F4F7;
  --demo-light-line: #E5E9F0;
  --demo-light-text: #111827;
  --demo-light-muted: #6B7280;
  background: var(--ez-night);
  color: var(--ez-text);
}

.demo-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.demo-i {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
}

[hidden] { display: none !important; }

.demo-intro {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px 10px;
}

.demo-intro h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.demo-intro p {
  margin: 4px 0 0;
  color: var(--ez-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.demo-stage {
  position: relative;
  container-type: size;
  /* One unit = 1px at the 1920x1080 app board size; app-screen measures are multiplied by this. */
  --demo-u: calc(100cqw / 1920);
  height: calc(100vh - var(--demo-header-h) - var(--demo-intro-h));
  height: calc(100dvh - var(--demo-header-h) - var(--demo-intro-h));
  min-height: 460px;
  margin: 0 12px;
  overflow: hidden;
  border-radius: var(--ez-r-lg);
  background: #FFFFFF;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.demo-stage.is-fullscreen {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  border-radius: 0;
}

.demo-board {
  position: absolute;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: crosshair;
}

.demo-board[data-tool="erase"] { cursor: cell; }
.demo-board[data-tool="laser"] { cursor: none; }

.demo-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* === [S03.2] Demo: watermark, timer, hint, toast and exit === */
/* Tiled EZ Board logo watermark: grey (the tile is desaturated in demo_logos.js), about 7 % and turned 45 degrees so the rows rise from bottom-left to top-right. */
.demo-wm {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  /* A square of 150 % of the longer side covers the stage at 45 degrees for any aspect ratio (fallback: vmax). */
  width: 150vmax;
  height: 150vmax;
  width: 150cqmax;
  height: 150cqmax;
  background-size: 240px 130px;
  background-repeat: repeat;
  opacity: 0.07;
  transform: translate(-50%, -50%) rotate(-45deg);
  pointer-events: none;
  user-select: none;
}

.demo-timer {
  position: absolute;
  right: 12px;
  top: 10px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--ez-r-pill);
  background: var(--demo-surface);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.demo-timer .demo-i { width: 14px; height: 14px; }
.demo-timer.is-low { color: var(--ez-amber); }

.demo-hint {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  max-width: calc(100% - 260px);
  padding: 10px 18px;
  border-radius: var(--ez-r-pill);
  background: var(--demo-surface);
  color: #FFFFFF;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.demo-hint.is-gone { opacity: 0; }

.demo-toast {
  position: absolute;
  left: 50%;
  bottom: 96px;
  z-index: 40;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 18px;
  border-radius: var(--ez-r-pill);
  background: #E9EEF5;
  color: #111827;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.demo-toast-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--ez-r-pill);
  background: transparent;
  color: #2D6BE0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.demo-exit {
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 26;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--demo-surface);
  color: #FFFFFF;
  text-decoration: none;
}

/* === [S03.3] Demo: floating bar (dark pill), docking and the bubble === */
.demo-toolbar-wrap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.demo-toolbar-wrap.is-left,
.demo-toolbar-wrap.is-right {
  top: 50%;
  bottom: auto;
  left: 12px;
  right: auto;
  transform: translateY(-50%);
  align-items: flex-start;
}

.demo-toolbar-wrap.is-right {
  left: auto;
  right: 12px;
  align-items: flex-end;
}

.demo-toolbar-wrap.is-free {
  left: 0;
  top: 0;
  right: auto;
  bottom: auto;
  transform: none;
  align-items: flex-start;
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 16px);
  padding: calc(9 * var(--demo-u));
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: var(--ez-r-pill);
  border: 1px solid var(--demo-line-dark);
  background: #1F2229;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  touch-action: pan-x;
}

.demo-bar::-webkit-scrollbar { display: none; }

.demo-toolbar-wrap.is-left .demo-bar,
.demo-toolbar-wrap.is-right .demo-bar,
.demo-toolbar-wrap.is-free .demo-bar {
  flex-direction: column;
  max-width: none;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 28px;
  touch-action: pan-y;
}

.demo-btn,
.demo-count,
.demo-dot {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  height: max(40px, calc(56 * var(--demo-u)));
  min-width: max(40px, calc(56 * var(--demo-u)));
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ez-text);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.demo-btn:hover:not(:disabled):not([aria-pressed="true"]) { background: rgba(255, 255, 255, 0.08); }
.demo-btn[aria-pressed="true"] { background: var(--demo-accent); color: #FFFFFF; }
.demo-btn:disabled { opacity: 0.35; cursor: default; }
.demo-add { background: rgba(255, 255, 255, 0.1); }
.demo-grip { cursor: grab; min-width: 28px; touch-action: none; }
.demo-grip:active { cursor: grabbing; }

.demo-sep {
  flex: none;
  width: 1px;
  height: max(20px, calc(36 * var(--demo-u)));
  margin: 0 6px;
  background: #31333A;
}

.demo-toolbar-wrap.is-left .demo-sep,
.demo-toolbar-wrap.is-right .demo-sep,
.demo-toolbar-wrap.is-free .demo-sep {
  width: 28px;
  height: 1px;
  margin: 6px 0;
}

.demo-tipdot {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--demo-surface-solid);
}

.demo-count {
  min-width: 60px;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.demo-dot { width: 30px; }

.demo-dot span {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.demo-dot[aria-pressed="true"] span {
  box-shadow: 0 0 0 2px var(--demo-surface-solid), 0 0 0 4px #FFFFFF;
}

.demo-bubble {
  display: none;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #FFFFFF;
  color: #111827;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}

.demo-toolbar-wrap.is-collapsed .demo-bar { display: none; }
.demo-toolbar-wrap.is-collapsed .demo-bubble { display: grid; }

/* === [S03.4] Demo: popovers, rows, tiles and sliders (dark cards) === */
.demo-pop {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: clamp(380px, calc(458 * var(--demo-u)), 460px);
  max-width: calc(100% - 16px);
  max-height: calc(100% - 96px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--demo-line-dark);
  border-radius: 22px;
  background: var(--demo-surface);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
  color: var(--ez-text);
  pointer-events: auto;
  touch-action: pan-y;
  scrollbar-width: none;
}

.demo-pop::after {
  content: "";
  position: absolute;
  bottom: -7px;
  left: var(--demo-arrow-x, 50%);
  width: 12px;
  height: 12px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--demo-surface-solid);
  border-right: 1px solid var(--demo-line-dark);
  border-bottom: 1px solid var(--demo-line-dark);
}

.demo-pop.is-side::after { display: none; }

.demo-swatch {
  display: block;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.demo-pop.is-below::after {
  top: -7px;
  bottom: auto;
  transform: translateX(-50%) rotate(225deg);
}

.demo-pop--hl { width: 280px; }
.demo-pop--erase { width: 300px; }
.demo-pop--shape { width: 520px; }
.demo-pop--tools { width: 420px; }
.demo-pop--insert { width: 380px; }
.demo-pop--more { width: 420px; }
.demo-pop--gear { width: 300px; }
.demo-pop--strip { width: min(calc(880 * var(--demo-u)), calc(100% - 16px)); padding: calc(20 * var(--demo-u)); border-radius: calc(24 * var(--demo-u)); }
.demo-pop--pen { width: clamp(380px, calc(458 * var(--demo-u)), 460px); }

@media (max-width: 699px) {
  .demo-pop--pen .demo-cols { grid-template-columns: 1fr; }
}

.demo-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.demo-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.demo-label {
  margin: 6px 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--demo-muted-dark);
}

.demo-col > .demo-label:first-child,
.demo-pop > .demo-label:first-child { margin-top: 0; }

.demo-label--light { color: var(--demo-light-muted); }

.demo-hint-txt {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--demo-muted-dark);
}

.demo-grid {
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: 8px;
}

.demo-sw {
  position: relative;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  cursor: pointer;
}

.demo-sw[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--demo-surface-solid), 0 0 0 4px var(--demo-accent);
}

.demo-sw--add {
  display: grid;
  place-items: center;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  border: 1px dashed rgba(255, 255, 255, 0.4);
  color: var(--ez-text);
}

.demo-sw--add .demo-i { width: 14px; height: 14px; }

.demo-slider {
  display: flex;
  align-items: center;
  gap: 10px;
}

.demo-slider input {
  flex: 1;
  min-width: 0;
  height: 28px;
  accent-color: var(--demo-accent);
}

.demo-value {
  flex: none;
  min-width: 64px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #0B0E13;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: var(--demo-tile);
  color: var(--ez-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.demo-row > span:not(.demo-toggle):not(.demo-state):not(.demo-dot-sm) {
  flex: 1 1 auto;
  min-width: 0;
}

.demo-chev { margin-left: auto; width: 18px; height: 18px; opacity: 0.6; }

.demo-dot-sm {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.demo-state {
  font-size: 0.8rem;
  color: var(--demo-muted-dark);
}

.demo-toggle {
  position: relative;
  flex: none;
  width: 40px;
  height: 24px;
  margin-left: auto;
  border-radius: var(--ez-r-pill);
  background: #3A4352;
}

.demo-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
}

.demo-switch[aria-checked="true"] .demo-toggle { background: var(--demo-accent); }
.demo-switch[aria-checked="true"] .demo-toggle::after { left: 19px; }

.demo-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  border: 1px solid var(--demo-line-dark);
  border-radius: 14px;
  background: transparent;
  color: var(--ez-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.demo-ghost--wide { margin-top: 4px; }
.demo-ghost--danger { color: var(--demo-danger); }

.demo-seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: #0B0E13;
}

.demo-seg-btn {
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--demo-muted-dark);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-seg-btn[aria-pressed="true"] {
  background: #2A3240;
  color: #FFFFFF;
}

.demo-seg--light { background: var(--demo-light-line); }

.demo-seg--light .demo-seg-btn { color: var(--demo-light-muted); }

.demo-seg--light .demo-seg-btn[aria-pressed="true"] {
  background: #FFFFFF;
  color: var(--demo-light-text);
}

.demo-tiles {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
}

.demo-tiles--2 { grid-template-columns: repeat(2, 1fr); }
.demo-tiles--3 { grid-template-columns: repeat(3, 1fr); }
.demo-tiles--4 { grid-template-columns: repeat(4, 1fr); }
.demo-tiles--5 { grid-template-columns: repeat(5, 1fr); }

.demo-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 70px;
  padding: 8px 4px;
  border: 0;
  border-radius: 14px;
  background: var(--demo-tile);
  color: var(--ez-text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.demo-tile span { overflow-wrap: anywhere; }
.demo-tile[aria-pressed="true"] { background: var(--demo-accent); color: #FFFFFF; }

.demo-tile--light {
  background: var(--demo-light-tile);
  color: var(--demo-light-text);
}

.demo-tile--custom { cursor: pointer; }

.demo-swatch--custom {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(#FF3B3B, #FFC53D, #2E9E48, #00A3A3, #1E63D6, #8E24AA, #FF3B3B);
}

.demo-panel { display: flex; flex-direction: column; gap: 10px; }

.demo-pop-foot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--demo-line-dark);
}

.demo-strip-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
}

.demo-strip-head > .demo-hint-txt { flex: 1; font-size: 1rem; }

.demo-strip-hold {
  flex: 1;
  display: flex;
  gap: 8px;
}

.demo-strip-hold .demo-ghost { margin: 0; width: auto; flex: 1; }

.demo-strip-list {
  display: flex;
  gap: calc(22 * var(--demo-u));
  overflow-x: auto;
  padding: calc(6 * var(--demo-u)) calc(4 * var(--demo-u)) calc(8 * var(--demo-u));
  scrollbar-width: none;
}

/* Page thumbnails as in the app: white previews on dark cards, the current page has a blue check badge */
.demo-thumb {
  position: relative;
  flex: none;
  width: calc(160 * var(--demo-u));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8 * var(--demo-u));
  padding: calc(8 * var(--demo-u));
  border: 1px solid var(--demo-line-dark);
  border-radius: calc(16 * var(--demo-u));
  background: var(--demo-tile);
  color: var(--ez-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-thumb[aria-current="true"] {
  border: 2px solid var(--demo-accent);
  padding: calc(7 * var(--demo-u));
}

.demo-thumb[aria-current="true"]::after {
  content: "\2713";
  position: absolute;
  top: calc(-10 * var(--demo-u));
  right: calc(-10 * var(--demo-u));
  display: grid;
  place-items: center;
  width: calc(24 * var(--demo-u));
  height: calc(24 * var(--demo-u));
  border-radius: 50%;
  background: var(--demo-accent);
  color: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 calc(2 * var(--demo-u)) var(--demo-surface-solid);
}

.demo-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: calc(8 * var(--demo-u));
  background: #FBFBF8;
}

.demo-thumb-add {
  flex: none;
  display: grid;
  place-items: center;
  width: calc(64 * var(--demo-u));
  min-height: calc(112 * var(--demo-u));
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 14px;
  background: transparent;
  color: var(--ez-text);
  cursor: pointer;
}

/* Board and display sheet (light card, as in the app) */
.demo-sheet {
  position: absolute;
  top: calc(25 * var(--demo-u));
  right: calc(27 * var(--demo-u));
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(calc(459 * var(--demo-u)), calc(100% - 24px));
  max-height: calc(100% - 40px);
  overflow-y: auto;
  padding: calc(22 * var(--demo-u));
  border: 1px solid var(--demo-light-line);
  border-radius: calc(24 * var(--demo-u));
  background: #F6F8F7;
  color: var(--demo-light-text);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.3);
  touch-action: pan-y;
  pointer-events: auto;
  scrollbar-width: none;
}

.demo-sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.demo-sheet-ico {
  display: grid;
  place-items: center;
  flex: none;
  width: calc(58 * var(--demo-u));
  height: calc(58 * var(--demo-u));
  border-radius: calc(17 * var(--demo-u));
  background: var(--demo-accent);
  color: #FFFFFF;
}

.demo-sheet-title {
  flex: 1;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.demo-row--light { background: var(--demo-light-tile); color: var(--demo-light-text); }

.demo-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
}

.demo-x--light { background: var(--demo-light-tile); }

/* Light sheet controls as in the app: tall tab bar, tiles with rounded swatches, check-ring on the chosen one */
.demo-seg--light { padding: calc(4 * var(--demo-u)); border-radius: calc(18 * var(--demo-u)); }
.demo-seg--light .demo-seg-btn { min-height: calc(66 * var(--demo-u)); font-size: 1.1rem; border-radius: calc(14 * var(--demo-u)); }
.demo-sheet .demo-tiles--4 { gap: calc(10 * var(--demo-u)); }
.demo-sheet .demo-tile--light {
  min-height: calc(84 * var(--demo-u));
  padding: calc(10 * var(--demo-u)) 4px;
  border-radius: calc(14 * var(--demo-u));
  font-size: 0.95rem;
  font-weight: 500;
  gap: calc(10 * var(--demo-u));
}
.demo-sheet .demo-tiles--swatch .demo-tile--light { min-height: calc(170 * var(--demo-u)); }
.demo-sheet .demo-tile--light[aria-pressed="true"] {
  background: #FFFFFF;
  color: var(--demo-light-text);
  box-shadow: inset 0 0 0 calc(2 * var(--demo-u)) var(--demo-accent);
}
.demo-sheet .demo-tile--light .demo-swatch,
.demo-sheet .demo-swatch--custom {
  width: calc(57 * var(--demo-u));
  height: calc(79 * var(--demo-u));
  border-radius: calc(14 * var(--demo-u));
}
.demo-sheet .demo-row--light {
  min-height: calc(60 * var(--demo-u));
  padding: 0 calc(16 * var(--demo-u));
  border-radius: calc(16 * var(--demo-u));
  font-size: 1.05rem;
}
.demo-sheet .demo-note,
.demo-sheet .demo-label--light { font-size: 0.95rem; }

/* Gear Settings sheet: dark card with section labels, rows, toggles and segments as in the app */
.demo-sheet--dark {
  background: #1F2229;
  border-color: #2C2F36;
  color: #F2F5F9;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.demo-sheet--dark .demo-sheet-title { color: #F2F5F9; }
.demo-sheet--dark .demo-label { font-size: 1.05rem; color: var(--demo-muted-dark); }
.demo-sheet--dark .demo-row {
  min-height: calc(68 * var(--demo-u));
  padding: 0 calc(18 * var(--demo-u));
  border-radius: calc(16 * var(--demo-u));
  background: #1A202A;
  color: #F2F5F9;
  font-size: 1.2rem;
  font-weight: 500;
}
.demo-sheet--dark .demo-row-sub { color: var(--demo-muted-dark); font-size: 0.95rem; }
.demo-sheet--dark .demo-row-val { color: var(--demo-muted-dark); font-weight: 500; }
.demo-sheet--dark .demo-seg { background: #0B0E13; border-radius: calc(16 * var(--demo-u)); }
.demo-sheet--dark .demo-seg-btn { min-height: calc(56 * var(--demo-u)); font-size: 1.15rem; border-radius: calc(12 * var(--demo-u)); }
.demo-sheet--dark .demo-seg-btn[aria-pressed="true"] { background: #222935; color: #FFFFFF; }
.demo-sheet--dark .demo-toggle { background: #2F333B; }
.demo-sheet--dark .demo-switch[aria-checked="true"] .demo-toggle { background: var(--demo-accent); }
.demo-setup-card {
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--demo-u));
  padding: calc(16 * var(--demo-u));
  border-radius: calc(16 * var(--demo-u));
  background: #1A202A;
}
.demo-setup-title { margin: 0; font-size: 1.2rem; font-weight: 500; color: #F2F5F9; }
.demo-setup-text { margin: 0; font-size: 1.2rem; color: #F2F5F9; }
.demo-list { display: flex; flex-direction: column; border-radius: calc(12 * var(--demo-u)); overflow: hidden; background: #0B0E13; }
.demo-list-item {
  min-height: calc(52 * var(--demo-u));
  padding: 0 calc(14 * var(--demo-u));
  border: 0;
  background: transparent;
  color: var(--demo-muted-dark);
  font: inherit;
  font-size: 1.15rem;
  text-align: left;
  cursor: pointer;
}
.demo-list-item[aria-pressed="true"] { background: #2F333B; color: #F2F5F9; }
.demo-sheet--dark .demo-note { color: var(--demo-muted-dark); font-size: 1rem; }

/* Display tab rows: value text on the right, and a plain chip for the "System" choice */
.demo-row-val { flex: none; font-size: 0.9rem; font-weight: 600; color: var(--demo-light-muted); }
.demo-row-sub { display: block; margin-top: 2px; font-size: 0.75rem; font-weight: 500; line-height: 1.3; color: var(--demo-light-muted); }
.demo-chip {
  flex: none;
  padding: 4px 10px;
  border: 1px solid var(--demo-light-line);
  border-radius: 999px;
  background: #FFFFFF;
  color: var(--demo-light-text);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Modal popups: app-only notice and end card */
.demo-modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7, 10, 16, 0.5);
}

.demo-modal-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--demo-line-dark);
  border-radius: 24px;
  background: var(--demo-surface-solid);
  color: var(--ez-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.demo-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.demo-modal-text {
  margin: 0;
  color: var(--demo-muted-dark);
  line-height: 1.5;
}

.demo-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.demo-modal-actions .shell-btn { flex: 1 1 auto; }

/* === [S03.5] Demo: phone edge-to-edge board and full screen === */
body.demo-is-edge { padding-bottom: 0; }

.demo-is-edge .shell-header,
.demo-is-edge .shell-footer,
.demo-is-edge .shell-dock,
.demo-is-edge .shell-skip { display: none !important; }

.demo-is-edge .demo-main { padding: 0; }

.demo-is-edge .demo-intro {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  margin: -1px;
  padding: 0;
  border: 0;
}

.demo-is-edge .demo-stage {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.demo-is-edge .demo-toolbar-wrap { bottom: calc(12px + env(safe-area-inset-bottom)); }
.demo-is-edge .demo-exit {
  display: grid;
  left: calc(15vmin + 12px + env(safe-area-inset-left));
  left: calc(15cqmin + 12px + env(safe-area-inset-left));
  top: calc(10px + env(safe-area-inset-top));
}
.demo-is-edge .demo-timer {
  right: calc(12px + env(safe-area-inset-right));
  top: calc(10px + env(safe-area-inset-top));
}
.demo-is-edge .demo-hint {
  top: calc(60px + env(safe-area-inset-top));
  max-width: calc(100% - 24px);
}

.demo-is-edge .demo-toolbar-wrap.is-free { bottom: auto; }

/* === [S03.6] Demo: strip of real-app features and calls to action (light section) === */
.demo-strip-title {
  margin: 0 0 20px;
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ez-text-dark);
}

.demo-cards {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  min-height: 72px;
}

.demo-card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--ez-r-sm);
  color: #FFFFFF;
  background: var(--ez-grad);
}

.demo-card-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-card-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ez-text-dark);
}

.demo-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

@media (min-width: 640px) {
  .demo-intro { padding: 18px 28px 12px; }
  .demo-stage { margin: 0 20px; }
  .demo-cards { grid-template-columns: repeat(2, 1fr); }
  .demo-pop { max-height: calc(100% - 100px); }
}

@media (min-width: 960px) {
  .demo-cards { grid-template-columns: repeat(3, 1fr); }
}

/* === [S03.7] Demo: reduced motion === */
@media (prefers-reduced-motion: reduce) {
  .demo-hint { transition: none; }
  .demo-btn,
  .demo-tile,
  .demo-row { transition: none; }
}

/* === [S03.8] Demo: document colour switch (Original / Invert), shown on document pages === */
.demo-docbar {
  position: absolute;
  bottom: calc(84 * var(--demo-u));   /* a tab pill above the toolbar, as the app's document tabs */
  left: 50%;
  z-index: 21;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--demo-line-dark);
  border-radius: var(--ez-r-pill);
  background: var(--demo-surface);
  color: var(--ez-text);
  font: 600 13px/1 Inter, system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.demo-docbar[hidden] { display: none; }
.demo-docbar span { padding: 9px 12px; border-radius: var(--ez-r-pill); color: var(--demo-muted-dark); }
.demo-docbar[aria-pressed="false"] .demo-docbar-o,
.demo-docbar[aria-pressed="true"] .demo-docbar-i { background: var(--ez-blue); color: #FFFFFF; }

/* === [S03.9] Demo: compact toolbar for landscape phones and small tablets (two rows of eleven, nothing clipped) === */
@media (max-width: 959px) {
  .demo-toolbar-wrap.is-bottom .demo-bar {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: 4px;
    width: 600px;
    max-width: calc(100% - 16px);
    padding: 6px;
    border-radius: 22px;
    overflow: visible;
    touch-action: manipulation;
  }
  .demo-toolbar-wrap.is-bottom .demo-sep { display: none; }
  .demo-toolbar-wrap.is-bottom .demo-btn,
  .demo-toolbar-wrap.is-bottom .demo-dot {
    width: 42px;
    height: 42px;
    min-width: 0;
    justify-self: center;
  }
  .demo-toolbar-wrap.is-bottom .demo-count {
    grid-column: span 2;
    height: 42px;
    min-width: 0;
    justify-self: stretch;
  }
  .demo-toolbar-wrap.is-bottom .demo-bar [hidden] { display: none !important; }
}

/* === [S03.10] Demo: corner logo (the EZ Board logos turning top left), logos sheet panes and preview === */
/* The corner logo is the app's size and place: 12 % of the shorter side, 3 % in from the corner (cq units = stage). */
.demo-logo {
  position: absolute;
  left: 3vmin;
  top: 3vmin;
  left: 3cqmin;
  top: 3cqmin;
  z-index: 4;
  width: 12vmin;
  width: 12cqmin;
  aspect-ratio: 600 / 147;
  perspective: 600px;
  pointer-events: none;
  user-select: none;
}

.demo-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  backface-visibility: hidden;
}

.demo-is-edge .demo-logo {
  left: calc(3vmin + env(safe-area-inset-left));
  top: calc(3vmin + env(safe-area-inset-top));
  left: calc(3cqmin + env(safe-area-inset-left));
  top: calc(3cqmin + env(safe-area-inset-top));
}

.demo-sheet-pane { display: flex; flex-direction: column; gap: 10px; }
.demo-sheet-pane[hidden] { display: none; }

.demo-logo-preview {
  position: relative;
  container-type: size;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--demo-light-line);
  border-radius: 14px;
  background: #FFFFFF;
}

.demo-logo--prev { width: 12vmin; width: max(12cqmin, 56px); }

.demo-logo-pick { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }

.demo-logo-chip {
  display: block;
  width: 100%;
  height: 44px;
  padding: 6px;
  box-sizing: border-box;
  object-fit: contain;
  border-radius: 10px;
  background: #1E293B;
}

.demo-logo-chip--light { background: #F3F4F6; }

.demo-note {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--demo-light-muted);
}

.demo-range {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--demo-light-tile);
  color: var(--demo-light-text);
  font-size: 0.9rem;
  font-weight: 600;
}

.demo-range-head { display: flex; justify-content: space-between; align-items: center; }
.demo-range input { width: 100%; margin: 0; accent-color: var(--demo-accent); }

/* Display tab, as the app: icon, label, slider and value chip on one line */
.demo-disp-row { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--demo-light-text); font-size: 0.95rem; font-weight: 500; }
.demo-disp-row > .demo-i { flex: none; width: 22px; height: 22px; color: var(--demo-light-text); }
.demo-disp-name { flex: none; width: 96px; }
.demo-disp-row input[type="range"] { flex: 1 1 auto; min-width: 0; margin: 0; accent-color: var(--demo-accent); }
.demo-disp-chip { flex: none; min-width: 66px; box-sizing: border-box; padding: 6px 10px; border: 1px solid var(--demo-light-line); border-radius: 10px; background: #fff; text-align: center; font-size: 0.9rem; font-weight: 600; color: var(--demo-light-text); }

/* Acts as: pen, highlighter, eraser icons under the pen popup's "Acts as" label */
.demo-acts { display: flex; gap: 6px; }
.demo-acts-btn { height: 40px; min-width: 40px; border-radius: 10px; background: var(--demo-tile); }
.demo-acts-btn[aria-pressed="true"] { background: var(--demo-accent); }

/* Line, arrows and fill as icon groups in one row of the shapes popup */
.demo-styles { display: flex; gap: 10px; flex-wrap: wrap; }
.demo-style-grp { display: flex; flex-direction: column; gap: 6px; }
