/* Focus Room workspace. Root rules are scoped to .uwapp-root.uwapp-focusroom (the body carries .uwapp-focusroom too).
   Own colour tokens for light and dark (html[data-theme] / prefers-color-scheme). The stage (generative canvas) has
   its own palette; text drawn over it sits on a translucent backdrop so it stays readable on every theme. */
.uwapp-root.uwapp-focusroom {
  --fr-bg: #f3f2fa; --fr-surface: #ffffff; --fr-surface-2: #ebe9f6; --fr-ink: #1d1b33; --fr-muted: #4f4c6e;
  --fr-line: #d7d4ea; --fr-control: #6c6895; --fr-accent: #5b4bb7; --fr-accent-ink: #4a3ba3; --fr-on-accent: #ffffff;
  --fr-teal: #0e7490; --fr-warn: #9a3412; --fr-focus: #b45309;
  --fr-h0: #e4e1f2; --fr-h1: #c3d9e6; --fr-h2: #7fb6cc; --fr-h3: #2f8aa8; --fr-h4: #0b5f78;
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: var(--fr-bg); color: var(--fr-ink); color-scheme: light;
}
:root[data-theme="dark"] .uwapp-root.uwapp-focusroom {
  --fr-bg: #0f0f1d; --fr-surface: #191929; --fr-surface-2: #24243a; --fr-ink: #ecebfa; --fr-muted: #bab8d8;
  --fr-line: #34345a; --fr-control: #8d89b9; --fr-accent: #b2a6ff; --fr-accent-ink: #c8c0ff; --fr-on-accent: #16132e;
  --fr-teal: #67e8f9; --fr-warn: #fdba74; --fr-focus: #fbbf24;
  --fr-h0: #26263c; --fr-h1: #1f4a5c; --fr-h2: #23718a; --fr-h3: #3ca2c0; --fr-h4: #8de1f5;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .uwapp-root.uwapp-focusroom {
    --fr-bg: #0f0f1d; --fr-surface: #191929; --fr-surface-2: #24243a; --fr-ink: #ecebfa; --fr-muted: #bab8d8;
    --fr-line: #34345a; --fr-control: #8d89b9; --fr-accent: #b2a6ff; --fr-accent-ink: #c8c0ff; --fr-on-accent: #16132e;
    --fr-teal: #67e8f9; --fr-warn: #fdba74; --fr-focus: #fbbf24;
    --fr-h0: #26263c; --fr-h1: #1f4a5c; --fr-h2: #23718a; --fr-h3: #3ca2c0; --fr-h4: #8de1f5;
    color-scheme: dark;
  }
}

/* Platform element defaults leak into app workspaces: reset them at zero specificity. */
:where(.fr-app) button { font: inherit; font-size: .9rem; font-weight: 600; padding: 0; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; width: auto; min-height: 0; }
:where(.fr-app) button:hover { background: none; }
:where(.fr-app) :is(input, select, textarea) { font: inherit; color: var(--fr-ink); background: var(--fr-surface); border: 1px solid var(--fr-control); border-radius: 8px; }
:where(.fr-app) :is(input[type=text], input[type=number], input[type=datetime-local], select) { padding: .35rem .5rem; min-height: 34px; box-sizing: border-box; max-width: 100%; }
:where(.fr-app) input[type=range] { accent-color: var(--fr-accent); width: 100%; border: 0; background: none; padding: 0; min-height: 24px; }
:where(.fr-app) input[type=checkbox] { accent-color: var(--fr-accent); width: 24px; height: 24px; margin: 0; flex: none; }
:where(.fr-app) table { border-collapse: collapse; width: 100%; margin: 0; font-size: .92rem; }
:where(.fr-app) :is(th, td) { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--fr-line); }
:where(.fr-app) thead th { background: var(--fr-surface-2); color: var(--fr-ink); }
:where(.fr-app) kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; padding: 1px 6px; border: 1px solid var(--fr-control); border-bottom-width: 2px; border-radius: 5px; background: var(--fr-surface-2); color: var(--fr-ink); white-space: nowrap; }
:where(.fr-app) :is(h1, h2, h3, p, ul, ol, dl) { margin: 0; }
:where(.fr-app) progress { accent-color: var(--fr-accent); }

.fr-app { display: flex; flex-direction: column; flex: 1; min-height: 0; background: var(--fr-bg); color: var(--fr-ink); }
.fr-app :focus-visible { outline: 3px solid var(--fr-focus); outline-offset: 2px; }
.fr-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.fr-spacer { flex: 1; }
.fr-hint { color: var(--fr-muted); font-size: .85rem; margin: .2rem 0 .5rem; }
.fr-note { font-size: .88rem; color: var(--fr-ink); background: var(--fr-surface-2); border-radius: 8px; padding: .55rem .75rem; margin: .5rem 0; }
.fr-empty { color: var(--fr-muted); padding: .8rem; border: 1px dashed var(--fr-control); border-radius: 10px; margin: .4rem 0 .8rem; }
.fr-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.fr-wide { width: 100%; box-sizing: border-box; }
.fr-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .4rem 0; }
.fr-row-end { align-items: flex-end; }
.fr-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .3rem .8rem; }

/* buttons */
.fr-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .35rem .75rem; border: 1px solid var(--fr-control); border-radius: 8px; background: var(--fr-surface); color: var(--fr-ink); font-size: .88rem; }
.fr-btn:hover:not([disabled]) { background: var(--fr-surface-2); }
.fr-btn[disabled], .fr-icon-btn[disabled] { opacity: .5; cursor: not-allowed; }
.fr-btn-primary, .fr-app button[type=submit].fr-btn-primary { background: var(--fr-accent); border-color: var(--fr-accent); color: var(--fr-on-accent); }
.fr-btn-primary:hover:not([disabled]) { background: var(--fr-accent-ink); border-color: var(--fr-accent-ink); color: var(--fr-on-accent); }
.fr-icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid transparent; border-radius: 8px; color: var(--fr-ink); }
.fr-icon-btn:hover:not([disabled]) { background: var(--fr-surface-2); border-color: var(--fr-line); }
.fr-btn[aria-pressed="true"] { border-color: var(--fr-accent); box-shadow: inset 0 0 0 1px var(--fr-accent); }

/* top bar */
.fr-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .45rem .8rem; background: var(--fr-surface); border-bottom: 1px solid var(--fr-line); }
.fr-name { min-width: 8rem; flex: 0 1 18rem; font-weight: 600; }
.fr-save-state { color: var(--fr-muted); font-size: .8rem; }
.fr-menu-wrap { position: relative; }
.fr-menu-btn { display: inline-flex; align-items: center; gap: .2rem; min-height: 36px; padding: .3rem .6rem; border-radius: 8px; color: var(--fr-ink); }
.fr-menu-btn:hover, .fr-menu-btn[aria-expanded="true"] { background: var(--fr-surface-2); }
.fr-menu { position: absolute; z-index: 30; inset-inline-start: 0; top: calc(100% + 4px); min-width: 16rem; max-width: min(24rem, 92vw); padding: .3rem; background: var(--fr-surface); border: 1px solid var(--fr-control); border-radius: 10px; box-shadow: 0 12px 30px rgb(0 0 0 / .22); }
.fr-menu[hidden] { display: none; }
.fr-menu-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 1rem; min-height: 32px; padding: .35rem .6rem; border-radius: 6px; text-align: start; font-weight: 500; color: var(--fr-ink); }
.fr-menu-item:hover, .fr-menu-item:focus { background: var(--fr-surface-2); }
.fr-menu-item[aria-disabled="true"] { color: var(--fr-muted); cursor: not-allowed; }
.fr-menu-key { color: var(--fr-muted); font-size: .78rem; font-weight: 600; }
.fr-menu-sep { height: 1px; margin: .3rem .2rem; background: var(--fr-line); }

/* main: stage + panel */
.fr-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); }
.fr-stage { position: relative; min-height: 0; overflow: hidden; background: #0b0b18; }
.fr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fr-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; pointer-events: none; padding: 1rem; text-align: center; }
.fr-clock { font-size: clamp(2.6rem, 9vw, 7rem); font-weight: 200; letter-spacing: .02em; line-height: 1; color: #fff; padding: .15em .35em; border-radius: .25em; background: rgb(8 8 20 / .32); font-variant-numeric: tabular-nums; }
.fr-overlay-text { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.fr-stage-now, .fr-stage-timer { color: #fff; background: rgb(8 8 20 / .5); border-radius: 999px; padding: .2rem .8rem; font-size: .95rem; }
.fr-stage-now:empty, .fr-stage-timer:empty { display: none; }
.fr-stage-light .fr-clock { color: #1d1b33; background: rgb(255 255 255 / .5); }
.fr-stage-light :is(.fr-stage-now, .fr-stage-timer) { color: #1d1b33; background: rgb(255 255 255 / .7); }
.fr-kiosk-bar { display: none; }

.fr-panel { min-height: 0; overflow: auto; background: var(--fr-surface); border-inline-start: 1px solid var(--fr-line); padding: 0 0 1rem; }
.fr-tabs { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: .15rem; padding: .45rem .6rem; background: var(--fr-surface); border-bottom: 1px solid var(--fr-line); }
.fr-tab { padding: .3rem .45rem; border-radius: 8px; color: var(--fr-muted); font-size: .86rem; min-height: 34px; }
.fr-tab[aria-selected="true"] { color: var(--fr-ink); background: var(--fr-surface-2); box-shadow: inset 0 -2px 0 var(--fr-accent); }
.fr-tabpanel { padding: .8rem 1rem; }
.fr-tabpanel:focus-visible { outline-offset: -3px; }
.fr-h2 { font-size: 1.1rem; margin-bottom: .5rem; }
.fr-h3 { font-size: .95rem; margin: 1.1rem 0 .4rem; color: var(--fr-ink); }
.fr-field { display: flex; flex-direction: column; gap: .2rem; margin: .45rem 0; }
.fr-field > label, .fr-slider-head label { font-weight: 600; font-size: .85rem; }
.fr-slider-head { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.fr-out { font-variant-numeric: tabular-nums; color: var(--fr-muted); font-size: .85rem; }
.fr-check { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; min-height: 2rem; font-size: .9rem; }

/* playlist */
.fr-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .35rem; margin-bottom: .3rem; }
.fr-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .5rem; padding: .4rem .5rem; border: 1px solid var(--fr-line); border-radius: 10px; background: var(--fr-surface); }
.fr-item-current { border-color: var(--fr-accent); background: var(--fr-surface-2); }
.fr-item-main { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-width: 0; flex: 1 1 9rem; }
.fr-item-name { text-align: start; font-weight: 600; padding: .15rem .2rem; border-radius: 6px; overflow-wrap: anywhere; }
.fr-item-name:hover { text-decoration: underline; }
.fr-item-tools { display: flex; align-items: center; gap: .1rem; }
.fr-mins-wrap { display: inline-flex; align-items: center; gap: .25rem; font-size: .82rem; color: var(--fr-muted); margin-inline-end: .2rem; }
.fr-mins { width: 4.2rem; }
.fr-badge { font-size: .72rem; color: var(--fr-muted); border: 1px solid var(--fr-line); border-radius: 999px; padding: 0 .45rem; }
.fr-add { margin: .7rem 0; padding: .6rem .7rem; background: var(--fr-surface-2); border-radius: 10px; }

/* sound */
.fr-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0; }
.fr-chip { padding: .3rem .7rem; min-height: 34px; border: 1px solid var(--fr-control); border-radius: 999px; background: var(--fr-surface); color: var(--fr-ink); font-size: .85rem; }
.fr-chip[aria-pressed="true"] { background: var(--fr-accent); border-color: var(--fr-accent); color: var(--fr-on-accent); }
.fr-eq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .9rem; }
.fr-eq .fr-field { margin: .25rem 0; }
.fr-eq-curve { background: #ffffff; border: 1px solid var(--fr-line); border-radius: 10px; padding: .3rem; color: #3f4658; }
.fr-eq-svg { display: block; width: 100%; height: auto; }

/* backgrounds */
.fr-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.6rem, 1fr)); gap: .45rem; }
.fr-bg { display: flex; flex-direction: column; gap: .25rem; padding: .25rem; border: 2px solid transparent; border-radius: 10px; text-align: start; }
.fr-bg[aria-checked="true"] { border-color: var(--fr-accent); background: var(--fr-surface-2); }
.fr-thumb { width: 100%; height: auto; aspect-ratio: 5 / 3; border-radius: 7px; display: block; background: #111; }
.fr-bg-name { font-size: .8rem; font-weight: 600; line-height: 1.2; }

/* timer */
.fr-timer-readout { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .8rem; border-radius: 12px; background: var(--fr-surface-2); margin-bottom: .4rem; }
.fr-timer-phase { font-weight: 600; color: var(--fr-muted); }
.fr-timer-time { font-size: 2.6rem; font-weight: 300; font-variant-numeric: tabular-nums; }
.fr-plan { padding-inline-start: 1.3rem; display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; }
.fr-plan-item { display: list-item; }
.fr-plan-item > span + span { margin-inline-start: .5rem; }
.fr-plan-now { font-weight: 700; }

/* log */
.fr-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin: .5rem 0 .8rem; }
.fr-stat { background: var(--fr-surface-2); border-radius: 10px; padding: .45rem .6rem; }
.fr-stat dt { font-size: .78rem; color: var(--fr-muted); }
.fr-stat dd { margin: 0; font-size: 1.15rem; font-weight: 600; }
.fr-heat-wrap { overflow-x: auto; }
.fr-heat { width: auto; border-collapse: separate; border-spacing: 3px; font-size: .72rem; }
.fr-heat :is(th, td) { border: 0; padding: 0; }
.fr-heat th { color: var(--fr-muted); font-weight: 500; padding-inline-end: .3rem; white-space: nowrap; background: none; }
.fr-heat-week { position: relative; width: 16px; height: 1.2rem; }
.fr-heat-label { position: absolute; inset-inline-start: 0; bottom: 2px; white-space: nowrap; }
.fr-cell { width: 16px; height: 16px; border-radius: 3px; background: var(--fr-h0); }
.fr-l1 { background: var(--fr-h1); } .fr-l2 { background: var(--fr-h2); } .fr-l3 { background: var(--fr-h3); } .fr-l4 { background: var(--fr-h4); }
.fr-future { background: transparent; outline: 1px dashed var(--fr-line); outline-offset: -1px; }
.fr-legend { display: flex; align-items: center; gap: 3px; font-size: .75rem; color: var(--fr-muted); margin: .4rem 0; }
.fr-legend-cell { display: inline-block; width: 12px; height: 12px; }
.fr-sessions { list-style: none; padding: 0; display: flex; flex-direction: column; gap: .2rem; font-size: .88rem; }
.fr-sessions li { display: grid; grid-template-columns: 1fr auto; gap: 0 .6rem; padding: .25rem 0; border-bottom: 1px solid var(--fr-line); }
.fr-sessions li .fr-hint { grid-column: 1 / -1; margin: 0; }

/* transport */
.fr-transport { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .5rem .8rem; background: var(--fr-surface); border-top: 1px solid var(--fr-line); }
.fr-transport-btns { display: flex; align-items: center; gap: .3rem; }
.fr-play { min-width: 6.5rem; justify-content: center; }
.fr-now { display: flex; flex-direction: column; min-width: 10rem; flex: 1 1 14rem; gap: .1rem; }
.fr-now-title { overflow-wrap: anywhere; }
.fr-now-meta { color: var(--fr-muted); font-size: .82rem; }
.fr-progress { width: 100%; height: 6px; }
.fr-transport-end { display: flex; align-items: center; gap: .5rem; flex-wrap: nowrap; }
.fr-volume-label { display: inline-flex; color: var(--fr-muted); }
.fr-timer-quick { white-space: nowrap; }
.fr-volume { width: 8rem; }

/* toast + dialogs */
.fr-toast { position: fixed; z-index: 40; inset-inline-end: 1rem; bottom: 4.6rem; max-width: min(28rem, calc(100vw - 2rem)); padding: .55rem .8rem; border-radius: 10px; background: #1d1b33; color: #fff; font-size: .88rem; box-shadow: 0 10px 30px rgb(0 0 0 / .3); }
.fr-toast[hidden] { display: none; }
.fr-dialog { width: min(32rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 1px solid var(--fr-control); border-radius: 14px; background: var(--fr-surface); color: var(--fr-ink); box-shadow: 0 24px 60px rgb(0 0 0 / .35); }
.fr-dialog-wide { width: min(46rem, calc(100vw - 2rem)); }
.fr-dialog::backdrop { background: rgb(12 10 30 / .55); }
.fr-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem .4rem; }
.fr-dialog-head h2 { margin: 0; font-size: 1.15rem; }
.fr-dialog-lede { margin: 0; padding: 0 1rem; color: var(--fr-muted); font-size: .9rem; }
.fr-dialog-body { padding: .6rem 1rem 1rem; }
.fr-dialog-body > label { display: block; font-weight: 600; font-size: .85rem; margin: .3rem 0 .2rem; }
.fr-dialog-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.fr-templates, .fr-recent { list-style: none; padding: 0; display: grid; gap: .6rem; }
.fr-templates { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.fr-templates li { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; padding: .7rem; border: 1px solid var(--fr-line); border-radius: 12px; }
.fr-templates h3 { font-size: 1rem; }
.fr-templates p { font-size: .86rem; color: var(--fr-muted); flex: 1; }
.fr-recent li { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem; border: 1px solid var(--fr-line); border-radius: 10px; }
.fr-recent-text { display: flex; flex-direction: column; flex: 1 1 12rem; min-width: 0; }
.fr-tablewrap { overflow-x: auto; }

/* kiosk mode: the stage fills the app; controls hide after a few seconds without input */
.fr-app.fr-kiosk { position: fixed; inset: 0; z-index: 50; }
.fr-kiosk :is(.fr-bar, .fr-panel, .fr-transport) { display: none; }
.fr-kiosk .fr-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.fr-kiosk .fr-kiosk-bar { position: absolute; inset-inline: 0; bottom: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: 1rem; background: linear-gradient(to top, rgb(0 0 0 / .6), transparent); }
.fr-kiosk .fr-kiosk-btn { color: #fff; background: rgb(20 20 40 / .65); border: 1px solid rgb(255 255 255 / .55); min-height: 40px; }
.fr-kiosk .fr-kiosk-btn:hover:not([disabled]) { background: rgb(40 40 70 / .85); }
.fr-kiosk.fr-idle { cursor: none; }
.fr-kiosk.fr-idle .fr-kiosk-bar { opacity: 0; pointer-events: none; }
.fr-kiosk .fr-clock { font-size: clamp(3.5rem, 14vw, 11rem); }
@media (prefers-reduced-motion: no-preference) {
  .fr-kiosk-bar { transition: opacity .6s ease; }
}

/* tablet and phone */
@media (max-width: 900px) {
  .fr-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(220px, 42vh) auto; overflow: auto; }
  .fr-panel { border-inline-start: 0; border-top: 1px solid var(--fr-line); overflow: visible; }
  .fr-tabs { position: static; }
}
@media (max-width: 560px) {
  .fr-bar { padding: .4rem .5rem; }
  .fr-name { flex: 1 1 100%; order: 5; }
  .fr-save-state { display: none; }
  .fr-transport { gap: .4rem; padding: .45rem .5rem; }
  .fr-volume { width: 6rem; }
  .fr-eq { grid-template-columns: 1fr; }
  .fr-tabpanel { padding: .7rem .7rem; }
}
@media (forced-colors: active) {
  .fr-cell { forced-color-adjust: none; }
  .fr-item-current, .fr-bg[aria-checked="true"], .fr-tab[aria-selected="true"] { outline: 2px solid CanvasText; }
}
