/*
 * Stream Timer's page - only what's its own. The look (colours, fonts, buttons, fields,
 * switches, cards, dialogs, the page frame ...) comes from ui/ui.css (resorted-ui). The
 * overlay (overlay.html) has its own styles inside it.
 */

/* ---- Signed out ---- */
.rui-hero .banner { width: min(100%, 560px); margin: 0 0 18px; text-align: left; }
/* The examples: 2 + 2 (one column on phones), each on a stream-like backdrop */
.st-looks h2 { margin: 0 0 4px; font: 600 20px var(--font-display); }
.st-looks > .note { margin: 0 0 18px; }
.st-looks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.st-look { display: grid; gap: 8px; margin: 0; }
.st-look-scene {
  overflow: hidden; border: 1px solid var(--line2); border-radius: 14px;
  background:
    radial-gradient(60% 80% at 85% 20%, rgba(255, 170, 90, 0.35), transparent 70%),
    radial-gradient(70% 90% at 10% 100%, rgba(80, 160, 255, 0.35), transparent 70%),
    linear-gradient(160deg, #263a4a, #1a2a24 55%, #2e2a3c);
}
.st-look-frame {
  display: block; width: 100%; height: 150px; border: 0; background: transparent; pointer-events: none;
  /* Same scheme as the overlay page, or Chrome paints the frame opaque white. */
  color-scheme: normal;
}
.st-look figcaption { color: var(--muted); font-size: 14px; text-align: center; }

/* ---- The sidebar's timers ---- */
#channels-block { margin-bottom: 22px; }
.st-channel img { flex: none; width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.st-channel span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ---- Shared bits ---- */
.st-card-title { margin: 0 0 10px; font: 600 18px var(--font-display); }
.st-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.save-state { margin: 0; color: var(--faint); font-size: 13px; white-space: nowrap; }
.st-ic { display: inline-flex; }
details.help { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
details.help summary { color: var(--link); cursor: pointer; }
details.help p { margin: 8px 0; }
.card-foot .spacer { flex: 1; }

/* ---- Live preview: the real overlay page in a frame ---- */
.preview-box { overflow: hidden; border: 1px solid var(--line2); border-radius: 12px; background: #06090d; }
.preview-box[data-bg='light'] { background: #e9eaef; }
.preview-box[data-bg='check'] { background: repeating-conic-gradient(#232a35 0 25%, #171d26 0 50%) 0 0 / 20px 20px; }
.preview-frame {
  display: block; width: 100%; height: 130px; border: 0; background: transparent;
  /* Same scheme as the overlay page, or Chrome paints the frame opaque white. */
  color-scheme: normal; transition: height 0.2s;
}
.preview-under { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.preview-under > :first-child { flex: 1; min-width: 0; }
.preview-note { margin: 0; }
.seg.small .seg-btn { min-height: 30px; padding: 0 10px; font-size: 13px; }

/* ---- Timer ---- */
.st-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.st-status .note { margin: 0; }
.st-hidden { margin: 8px 0 0; }
/* Four buttons: one row, 2 + 2 on phones */
.st-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.st-buttons .btn { justify-content: center; gap: 8px; }
.st-resume { margin: 12px 0 0; }
.st-set { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.st-set-label { color: var(--muted); font-size: 14px; font-weight: 500; }
.st-set-row { display: flex; gap: 8px; max-width: 420px; }
.st-set-row .field { flex: 1; min-width: 0; }
.st-set .note { margin: 0; }
.st-url { display: flex; gap: 8px; }
.st-url .field { flex: 1; min-width: 0; color: #bfe9ff; }
.st-url .btn { flex: none; gap: 8px; }
.st-drag { cursor: grab; }
.st-drag:active { cursor: grabbing; }
.st-chat-line { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.st-cmd-list { display: grid; gap: 8px; }
.st-cmd-item { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; align-items: baseline; gap: 12px; }
.st-cmd-action { font-weight: 600; }
.st-cmd-names { display: flex; flex-wrap: wrap; gap: 6px; }
.st-cmd-names code { padding: 1px 7px; border-radius: 6px; background: var(--field); color: #bfe9ff; }
.st-cmd-item .note { margin: 0; text-align: right; }

/* ---- Look: options on the left, the preview on the right (on top, on phones) ---- */
.st-builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 460px); align-items: start; gap: 18px; }
.st-builder-preview { position: sticky; top: 28px; }
.st-options .section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.section h2 { margin: 0 0 12px; font-size: 16px; }
.st-options .label { display: grid; gap: 6px; margin: 0; color: var(--muted); font-size: 14px; font-weight: 500; }
.st-options .label small { font-size: 1em; opacity: 0.8; }
.st-options .label.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; font-size: 15px; cursor: pointer; }
.stack { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 24px; }
.seg { justify-self: start; align-self: start; max-width: 100%; }
.slider-head { display: flex; justify-content: space-between; }
.slider output { color: var(--text); font-variant-numeric: tabular-nums; }
input[type='range'] { width: 100%; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; }
.presets .note { margin: 0 4px 0 0; }
.color-row { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.color { width: 46px; height: 36px; padding: 3px; border: 1px solid var(--line2); border-radius: 10px; background: var(--field); cursor: pointer; }
.color:hover { border-color: var(--line3); }
/* Font picker: each font shown in itself, 4 + 4 (2 x 4 on phones) */
.font-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.font-btn {
  display: grid; gap: 2px; padding: 9px 12px; border: 1px solid var(--line2); border-radius: 12px; background: var(--field);
  color: var(--text); text-align: left; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.font-btn:hover { border-color: var(--line3); }
.font-btn[aria-checked='true'] { border-color: var(--c1); box-shadow: 0 0 0 1px var(--c1) inset, 0 0 18px -8px var(--c1); }
.font-name { overflow: hidden; font-weight: 600; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.font-sample { overflow: hidden; color: var(--muted); font-size: 18px; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

/* ---- Chat commands: switch + what it does | names | who ---- */
.st-cmds { display: grid; gap: 4px; }
.st-cmd { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 220px; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.st-cmd:first-child { border-top: 0; }
.st-cmd-head { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.st-cmd-head > span { display: grid; gap: 2px; }
.st-cmd-head small { color: var(--muted); font-size: 13.5px; }
.st-cmd.off .st-cmd-head > span, .st-cmd.off .field { opacity: 0.55; }
.st-cmd-foot { margin: 14px 0 0; }

/* ---- Editors ---- */
.st-add { display: flex; gap: 8px; margin-bottom: 14px; }
.st-add .field { flex: 1; min-width: 0; }
.st-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.st-editor-name { display: grid; flex: 1; min-width: 0; }
.st-editor-name small { color: var(--faint); }

@media (max-width: 1100px) {
  .st-builder { grid-template-columns: minmax(0, 1fr); }
  /* The preview first, staying in view while scrolling through the options under it */
  .st-builder-preview { order: -1; top: 62px; z-index: 2; box-shadow: 0 10px 14px -12px rgba(0, 0, 0, 0.8); }
}
@media (max-width: 760px) {
  .st-cmd { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 560px) {
  .st-looks-grid { grid-template-columns: 1fr; }
  .st-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-url { flex-direction: column; }
  .font-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Four choices: 2 + 2, never 3 + 1 */
  .seg.quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .color-row { display: grid; gap: 10px; }
  /* "Start from:" over four presets, 2 + 2 */
  .presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .presets .note { grid-column: 1 / -1; }
  .preview-under { flex-direction: column; align-items: flex-start; }
  .st-cmd-item { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .st-cmd-item .note { text-align: left; }
  .st-add { flex-direction: column; }
}

/* The label over the page menu only separates it from the list above (more than one channel); alone, under
   the service's name at the top of the sidebar, it would just repeat it. */
#channels-block[hidden] + .rui-side-label { display: none; }
