@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/assets/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-style: normal; font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-style: normal; font-weight: 500; font-display: swap; }

:root {
  --cs-bg: #0E0F0F; --cs-surface: #161717; --cs-surface-raised: #1A1B1B; --cs-board-well: #070808;
  --cs-text: #F2EEE6; --cs-text-2: #C9C5BD; --cs-text-muted: #A29E96; --cs-text-faint: #7F7B74;
  --cs-divider: #232424; --cs-border: #2A2B2B; --cs-border-card: #262727; --cs-border-control: #2E2F2F; --cs-border-strong: #3A3B3B;
  --cs-accent: #E8A33D; --cs-accent-hover: #F4BE6A; --cs-accent-fill: #E8A33D; --cs-accent-fill-hover: #F4BE6A; --cs-on-accent: #141414; --cs-on-danger: #141414; --cs-accent-tint: #1A1610; --cs-accent-tint-pressed: #221D14; --cs-accent-edge: #5A4A2E; --cs-accent-edge-solid: #8A5E1F;
  --cs-danger: #E5806F; --cs-danger-edge: #5A3530; --cs-danger-hover: #F09A8C; --cs-online: #7BC67B; --cs-offline: #6F6B65;
  --cs-toast-bg: #F2EEE6; --cs-toast-text: #141414; --cs-scrim: rgba(0,0,0,0.62);
  --cs-accent-soft: #F4D49A; --cs-accent-muted: #E8C27A; --cs-danger-strong: #9A3B30;
  --cs-danger-surface-bg: #2A1A18; --cs-danger-surface-border: #8E3A30; --cs-danger-surface-text: #F0A99D;
  --cs-success: #4A9A5E; --cs-success-surface-bg: #1A2A1E; --cs-success-surface-text: #9FD8AE;
  --cs-info: #3A82B4; --cs-info-text: #84B4D8; --cs-info-surface-bg: #13202B; --cs-info-surface-border: #1F4E73;
  --cs-disabled-bg: #2A2B2B; --cs-disabled-text: #6F6B65; --cs-map-empty: #111212;
}
:root[data-controller-theme="light"] {
  --cs-bg: #F6F3EC; --cs-surface: #EDE9DF; --cs-surface-raised: #FFFFFF; --cs-board-well: #E2DDD0;
  --cs-text: #1C1B19; --cs-text-2: #4A4741; --cs-text-muted: #6B665D; --cs-text-faint: #655F56;
  --cs-divider: #DDD8CC; --cs-border: #D2CCBE; --cs-border-card: #D8D3C7; --cs-border-control: #CFC9BB; --cs-border-strong: #B9B2A2;
  --cs-accent: #B06F12; --cs-accent-hover: #9A5F0C; --cs-accent-fill: #E8A33D; --cs-accent-fill-hover: #F4BE6A; --cs-on-accent: #141414; --cs-on-danger: #FFFFFF; --cs-accent-tint: #F3E7D2; --cs-accent-tint-pressed: #EAD9B8; --cs-accent-edge: #9A5F0C; --cs-accent-edge-solid: #7C4B08;
  --cs-danger: #B3402F; --cs-danger-edge: #9B3829; --cs-danger-hover: #923526; --cs-online: #256D32; --cs-offline: #655F56;
  --cs-toast-bg: #1C1B19; --cs-toast-text: #F6F3EC; --cs-scrim: rgba(0,0,0,0.4);
  --cs-accent-soft: #754706; --cs-accent-muted: #78500E; --cs-danger-strong: #923526;
  --cs-danger-surface-bg: #F9E5DF; --cs-danger-surface-border: #B3402F; --cs-danger-surface-text: #923526;
  --cs-success: #256D32; --cs-success-surface-bg: #E0EFE2; --cs-success-surface-text: #215F2C;
  --cs-info: #24638B; --cs-info-text: #245E83; --cs-info-surface-bg: #DFEDF5; --cs-info-surface-border: #39729A;
  --cs-disabled-bg: #E2DED5; --cs-disabled-text: #655F56; --cs-map-empty: #D5D0C5;
}

:root .eyebrow, :root .section-number, :root .studio-back,
:root .household-role, :root .profile-appearance legend, :root .controller-theme-menu p,
:root .spread-field, :root .content-picker-badge, :root .authoring-heading > span,
:root .write-label-row, :root .write-group legend, :root .position-tools > span,
:root .draw-color-tools > span, :root .selection-tools > span, :root .dwell-editor > span,
:root .library-count, :root .pairing-code, :root time, :root code,
:root .pack-thumbnail-order {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
:root .eyebrow, :root .section-number, :root .studio-back,
:root .household-role, :root .profile-appearance legend, :root .controller-theme-menu p,
:root .authoring-heading > span, :root .write-label-row, :root .write-group legend,
:root .position-tools > span, :root .draw-color-tools > span, :root .selection-tools > span,
:root .dwell-editor > span, :root .library-count { font-size: 11px; letter-spacing: 0.08em; }
/* Mono letters plus letter spacing make a space read about 1.5 characters wide ("AT  THE  END"); pull words back together. */
:root .eyebrow, :root .section-number, :root .household-role, :root .profile-appearance legend,
:root .controller-theme-menu p, :root .authoring-heading > span, :root .write-label-row, :root .write-group legend,
:root .position-tools > span, :root .draw-color-tools > span, :root .selection-tools > span,
:root .dwell-editor > span, :root .spread-field > span, :root .play-label { word-spacing: -0.25em; }

/* Status and error lines: sentence-case sans in muted text, danger text for errors. Mono uppercase is for eyebrows and micro-labels only. */
:root :is(.cs-status, .inline-status, .pairing-error, .content-picker-status, .spread-status, .operator-status, .studio-status, .report-error, .clackify-status, #save-status, #play-status) {
  min-height: 1em; margin: 0; color: var(--cs-text-muted);
  font: 400 13px/1.45 "IBM Plex Sans", sans-serif; letter-spacing: 0; text-transform: none; word-spacing: 0;
}
:root :is(.cs-status, .inline-status, .pairing-error, .content-picker-status, .spread-status, .operator-status, .studio-status, .report-error, .clackify-status, #save-status, #play-status):empty { display: none; }
:root :is(.pairing-error, .report-error) { color: var(--cs-danger); }
:root .pairing-error { margin-top: 12px; }

:root {
  --cs-safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --cs-header-control-size: 44px;
  --cs-header-icon-size: 20px;
  --cs-header-title-line-height: 1.1;
  --cs-toast-edge-gap: 12px;
}
:root :is(.active-display-picker, .spread-heading .section-label-row, .saved-spread-header, .studio-header, #library-screen .library-intro) {
  align-items: center;
}
/* Icons center in their space on every page. Left inline, an icon rests on a text baseline instead
   (the display row's chevron sat 4 px low). Only icon-only buttons (they carry an aria-label) change, so
   icon-and-word buttons like Copy keep flowing. */
:root [data-lucide-icon] {
  display: inline-grid;
  place-items: center;
}
:root :is([data-lucide-icon], button[aria-label]) > svg:only-child {
  display: block;
}

/* One filter-chip style on every page (Create's Library, Curate's Add panel): selected is solid accent. */
:root :is(.library-filter-chips, .content-picker-chips) { display: flex; gap: 7px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
:root :is(.library-filter-chips, .content-picker-chips) button { flex: 0 0 auto; min-height: 40px; padding: 0 16px; border: 1px solid var(--cs-border-control); border-radius: 14px; background: transparent; color: var(--cs-text-2); font: 500 13px/1 "IBM Plex Sans", sans-serif; text-transform: none; letter-spacing: 0; }
:root :is(.library-filter-chips, .content-picker-chips) button[aria-pressed="true"] { border-color: var(--cs-accent-fill); background: var(--cs-accent-fill); color: var(--cs-on-accent); }

/* Reusable choice cards and wrapping choice pills in Controller sheets. */
:root .cs-choice { box-sizing: border-box; display: flex; align-items: center; gap: 7px; min-height: 44px; border: 1px solid var(--cs-border-control); background: var(--cs-surface-raised); color: var(--cs-text-2); font: 500 13px/1.25 "IBM Plex Sans", sans-serif; text-align: left; text-transform: none; letter-spacing: 0; cursor: pointer; }
:root .cs-choice[aria-pressed="true"] { border-color: var(--cs-accent); background: var(--cs-accent-tint); color: var(--cs-accent); }
:root .cs-choice:focus-visible { outline: 2px solid var(--cs-accent); outline-offset: 2px; }
:root .cs-choice-card { position: relative; flex: 1 1 0; min-width: 0; min-height: 88px; display: grid; align-content: start; gap: 4px; padding: 9px; border-radius: 9px; }
:root .cs-choice-pill { padding: 7px 10px; border-radius: 22px; }
:root .cs-choice-card > [data-lucide-icon] { flex: none; align-self: flex-start; }
:root .cs-choice [data-lucide-icon] svg { width: 17px; height: 17px; }
:root .cs-choice-copy { display: grid; gap: 3px; min-width: 0; }
:root .cs-choice-copy strong { color: var(--cs-text); font-size: 13px; }
:root .cs-choice-copy small { color: var(--cs-text-muted); font: 400 11px/1.25 "IBM Plex Sans", sans-serif; }
:root .cs-choice-check { flex: none; margin-left: auto; visibility: hidden; }
:root .cs-choice-card .cs-choice-check { position: absolute; top: 9px; right: 9px; }
:root .cs-choice[aria-pressed="true"] .cs-choice-check { visibility: visible; }

/* Shared category filters for libraries and content pickers. */
:root .library-filter-chips { min-width: 0; align-items: center; }
:root .library-filter-chips button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
:root .library-filter-chips .library-filter-clear { border: 0; padding-inline: 8px; color: var(--cs-text-muted); }
:root .library-filter-chips .library-filter-label { max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
:root .library-filter-chips [data-lucide-icon] svg { width: 16px; height: 16px; }
:root .library-filter-badge { min-width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--cs-accent-fill); color: var(--cs-on-accent); font-size: 11px; }
:root .library-filter-sheet { display: block; }
:root .library-filter-sheet:not([open]) { display: none; }
:root .library-filter-sheet h2 { margin: 0 44px 16px 0; }
:root .library-filter-sheet .play-sheet-close { position: absolute; top: 16px; right: 16px; min-width: 44px; min-height: 44px; display: grid; place-items: center; }
:root .library-filter-sheet .play-sheet-close svg { width: 20px; height: 20px; }
:root .library-filter-sheet-body { display: grid; gap: 18px; }
:root .library-filter-section { display: grid; gap: 8px; }
:root .library-filter-section h3, :root .library-filter-section p { margin: 0; }
:root .library-filter-section p { color: var(--cs-text-muted); font-size: 13px; }
:root .library-filter-sheet .library-filter-choice { width: 100%; border-radius: 9px; }
:root .library-filter-actions { position: sticky; bottom: -1.5rem; display: flex; gap: 8px; margin: 16px -1.5rem -1.5rem; padding: 12px 1.5rem 1.5rem; background: var(--cs-surface); }
:root .library-filter-actions button { min-height: 44px; flex: 1; }

/* Native choice inputs share one mechanical finish across Controller, Studio and Play. */
:root input.cs-switch { appearance: none; position: relative; flex: none; box-sizing: border-box; width: 48px; height: 28px; min-height: 28px; margin: 0; padding: 0; border: 1px solid var(--cs-border-strong); border-radius: 20px; background: var(--cs-surface-raised); cursor: pointer; }
:root input.cs-switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--cs-text-muted); }
:root input.cs-switch:checked { border-color: var(--cs-accent-fill); background: var(--cs-accent-fill); }
:root input.cs-switch:checked::before { transform: translateX(20px); background: var(--cs-on-accent); }
:root input.cs-check { appearance: none; position: relative; flex: none; box-sizing: border-box; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; border: 2px solid var(--cs-border-strong); border-radius: 4px; background: var(--cs-surface-raised); cursor: pointer; }
:root input.cs-check:checked { border-color: var(--cs-accent-fill); background: var(--cs-accent-fill); }
:root input.cs-check:checked::after { content: ""; position: absolute; inset: 1px; background: var(--cs-on-accent); mask: url('/icons/check.svg') center / contain no-repeat; }
:root input:is(.cs-switch, .cs-check):focus-visible { outline: 3px solid var(--cs-accent); outline-offset: 3px; }

/* Search boxes everywhere: our clear (X) button instead of the browser's own (search-clear.js). */
.search-field { position: relative; display: block; width: 100%; }
.search-field input[type="search"] { width: 100%; padding-right: 44px; }
.search-field input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.search-clear { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--cs-text-muted); }
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--cs-text); }
.search-clear svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* The caret marks focus in fields; the border changes without a ring that can clip in a sheet. */
:root input:is(:not([type]), [type="text"], [type="search"], [type="email"], [type="number"], [type="password"], [type="url"], [type="tel"]):focus,
:root textarea:focus { outline: none; box-shadow: none; border-color: var(--cs-text-faint); caret-color: var(--cs-accent); }

/* Focus rings are for keyboards. After a tap or click (input-modality.js), a sheet's
   first button or the button it hands focus back to stays plain on every screen. */
:root[data-input="pointer"] :focus-visible { outline: none !important; }

/* Shared title rhythm for controller pages. Shared by Controller, invitation and guest pages. */
:root .cs-page-title { min-width: 0; }
:root .cs-page-title .cs-page-title-eyebrow,
:root .active-display-picker > .cs-page-title-eyebrow {
  display: block; margin: 0 0 4px; color: var(--cs-text-muted);
  font: 500 11px/1.2 "IBM Plex Mono", monospace;
  letter-spacing: .08em; text-transform: uppercase; word-spacing: -.25em;
}
:root .cs-page-title .cs-page-title-heading,
:root .active-display-picker > .cs-page-title-heading {
  max-width: none; margin: 0; color: var(--cs-text);
  font: 600 28px/1.15 "IBM Plex Sans", sans-serif;
  letter-spacing: -.03em;
}
:root .cs-page-title .cs-page-title-subtitle {
  margin: 6px 0 0; color: var(--cs-text-muted);
  font: 400 15px/1.4 "IBM Plex Sans", sans-serif;
}
.cs-page-title-subtitle[hidden] { display: none; }
.cs-inline-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--cs-accent); text-decoration: underline; text-underline-offset: 3px; }
.cs-inline-link:visited { color: var(--cs-accent); }
.cs-inline-link:hover { color: var(--cs-accent-hover); }

/* Welcome screens (sign-in, invitation, guest Join): one full-width amber primary, quiet outline secondaries, and fields like the schedule sheet's. */
:root .cs-welcome-form { display: grid; gap: 18px; margin: 24px 0 0; }
:root .cs-field { display: grid; gap: 8px; margin: 0; color: var(--cs-text-muted); font: 500 11px/1.2 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
:root .cs-field input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 8px 12px; border: 1px solid var(--cs-border-control); border-radius: 8px; background: var(--cs-surface-raised); color: var(--cs-text); caret-color: var(--cs-accent); font: 400 16px/1.3 "IBM Plex Sans", sans-serif; letter-spacing: 0; text-transform: none; }
:root .cs-field input:focus { outline: none; border-color: var(--cs-text-faint); }
:root .cs-button { display: block; box-sizing: border-box; width: 100%; min-height: 48px; margin: 0; padding: 11px 16px; border: 1px solid var(--cs-accent-fill); border-radius: 8px; background: var(--cs-accent-fill); color: var(--cs-on-accent); font: 600 15px/1.25 "IBM Plex Sans", sans-serif; letter-spacing: 0; text-transform: none; text-align: center; cursor: pointer; }
@media (hover: hover) { :root .cs-button:hover:not(:disabled) { border-color: var(--cs-accent-fill-hover); background: var(--cs-accent-fill-hover); } }
:root .cs-button:disabled { border-color: var(--cs-border-control); background: var(--cs-disabled-bg); color: var(--cs-disabled-text); opacity: 1; cursor: default; }
:root .cs-button-outline { border-color: var(--cs-border-control); background: transparent; color: var(--cs-text-2); }
@media (hover: hover) { :root .cs-button-outline:hover:not(:disabled) { border-color: var(--cs-border-strong); background: var(--cs-surface-raised); } }
:root .cs-status { margin: 12px 0 0; color: var(--cs-text-muted); font: 400 13px/1.5 "IBM Plex Sans", sans-serif; letter-spacing: 0; text-transform: none; }
:root .cs-status:empty { display: none; }
:root .cs-page-title + .cs-button { margin-top: 24px; }
:root .cs-links { display: flex; flex-wrap: wrap; gap: 0 20px; margin: 8px 0 0; }
:root .cs-welcome-dev { display: grid; gap: 8px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--cs-divider); }
:root .cs-welcome-dev > * { margin: 0; }
:root .cs-welcome-accounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
