@font-face { font-family: Onest; src: url('/fonts/onest/onest-400.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Onest; src: url('/fonts/onest/onest-500.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: Onest; src: url('/fonts/onest/onest-600.ttf') format('truetype'); font-weight: 600; font-display: swap; }

:root, :root[data-theme="lavender"] {
  color-scheme: light;
  --paper: #eae5f5; --surface: #f8f5fc; --ink: #17151d; --muted: #6a6273;
  --line: #d0c6dd; --line-strong: #b8a7cb; --subtle: #dfd5ee;
  --control: #17151d; --on-control: #eee5fa; --accent: #7956a1;
  --success: #23694f; --warning: #855118; --error: #a63248;
  --shadow: 0 24px 80px #31223b12;
}
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f8f7fa; --surface: #fff; --ink: #17151d; --muted: #696570;
  --line: #e2dfe8; --line-strong: #c0b5cc; --subtle: #eeebf5;
  --control: #17151d; --on-control: #eee5fa; --accent: #75539b;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #19161f; --surface: #24202c; --ink: #f2ecfa; --muted: #b2a9be;
  --line: #40374d; --line-strong: #746080; --subtle: #302637;
  --control: #e6dcf3; --on-control: #221b2c; --accent: #bea2de;
  --success: #82d4b0; --warning: #edbf7c; --error: #f4a3b0;
  --shadow: 0 24px 80px #0003;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font: 400 16px/1.5 Onest, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .55; }
button, a, input { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
button:active:not(:disabled) { transform: scale(.98); }
a { color: inherit; text-underline-offset: 4px; }
svg { flex-shrink: 0; }
[hidden], .hidden { display: none !important; }
.asset-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-lockup svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.brand-lockup svg .fill { fill: currentColor; stroke: none; }
.brand-lockup__wordmark { font-size: 25px; font-weight: 600; letter-spacing: 1px; line-height: 1; }
.icon-button { width: 46px; height: 46px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; flex-shrink: 0; }
.icon-button:hover { background: var(--subtle); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.eyebrow { display: block; font-size: 11px; font-weight: 500; letter-spacing: 1.7px; text-transform: uppercase; color: var(--muted); }

/* Presentation only: existing transport, projection and reaction hooks stay intact. */
.player-screen { min-height: 100svh; padding: clamp(24px,4vw,60px); display: grid; align-items: center; }
.player-surface { width: 100%; max-width: 1280px; margin: auto; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 32px 56px; }
.player-header, .player-meta { display: contents; }
.player-topbar { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: clamp(28px,7vh,80px); }
.player-topbar__actions { display: flex; align-items: center; gap: 18px; }
.player-location { align-self: center; min-width: 0; grid-column: 1; grid-row: 2; }
.player-location .eyebrow { margin-bottom: 20px; }
.player-location__name { font-size: clamp(34px,4.2vw,64px); line-height: 1.08; font-weight: 500; letter-spacing: -2px; margin: 0; overflow-wrap: anywhere; }
.player-location__address { max-width: 440px; font-size: 16px; color: var(--muted); margin: 22px 0 0; overflow-wrap: anywhere; }
.status-pill { display: flex; align-items: center; gap: 8px; max-width: 240px; min-width: 0; font-size: 12px; color: var(--muted); }
.status-pill__dot { height: 7px; width: 7px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.status-pill[data-tone="online"] { color: var(--success); }
.status-pill[data-tone="warning"], .status-pill[data-tone="cache"] { color: var(--warning); }
.status-pill[data-tone="error"] { color: var(--error); }
.player-stage { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: center; position: relative; min-height: 300px; padding: 35px 20px; min-width: 0; }
.player-stage[data-layout="stacked"] { flex-direction: column; gap: 38px; }
.player-toggle { position: relative; display: grid; place-items: center; width: clamp(190px,20vw,260px); aspect-ratio: 1; border: 0; padding: 0; border-radius: 38%; background: var(--control); color: var(--on-control); flex-shrink: 0; isolation: isolate; }
.player-toggle:before, .player-toggle:after { content: ''; position: absolute; z-index: -1; inset: -28px; border: 1px solid var(--line-strong); border-radius: 41%; transform: rotate(18deg); pointer-events: none; }
.player-toggle:after { inset: -14px; border-color: var(--line); transform: rotate(-15deg); border-radius: 42%; }
.player-toggle__core { display: grid; place-items: center; }
.player-toggle__play-icon { width: 54px; height: 54px; margin-left: 7px; }
.player-toggle__play-icon path { fill: currentColor; stroke: currentColor; stroke-width: 1.5; }
.player-toggle__pause-icon { display: none; align-items: center; gap: 7px; height: 62px; }
.player-toggle__pause-icon span { width: 7px; height: 32px; border-radius: 7px; background: currentColor; }
.player-toggle__pause-icon span:nth-child(2) { height: 47px; }
.player-toggle__pause-icon span:nth-child(3) { height: 60px; }
.player-toggle__pause-icon span:nth-child(4) { height: 39px; }
.player-toggle__pause-icon span:nth-child(5) { height: 24px; }
.player-toggle[data-state="playing"] .player-toggle__play-icon { display: none; }
.player-toggle[data-state="playing"] .player-toggle__pause-icon { display: flex; }
.player-toggle[data-state="busy"]:after { border-top-color: var(--accent); animation: pending-spin 1.8s linear infinite; }
.player-toggle__wave, .player-toggle__field, .player-toggle__ring, .player-toggle__halo, .player-toggle__plate, .ambient { display: none; }
.player-reactions { grid-column: 2; display: flex; justify-content: center; gap: 12px; width: 100%; max-width: 440px; margin: 14px auto 0; }
.reaction-button { position: relative; overflow: hidden; flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 60px; padding: 14px 18px; border: 1px solid var(--line-strong); border-radius: 36px; background: transparent; color: var(--ink); font-size: 14px; }
.reaction-button:hover:not(:disabled), .reaction-button[aria-pressed="true"] { background: var(--subtle); border-color: var(--accent); }
.reaction-button__icon { width: 21px; height: 21px; }
.reaction-button__label { position: relative; z-index: 1; }
.reaction-button[data-feedback-state="undo"] { flex: 1.75; }
.reaction-button[data-feedback-state="undo"]:before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--reaction-progress,0%); background: var(--subtle); }
.reaction-button[data-pending="true"] { opacity: .6; }
.state-panel { width: 100%; max-width: 400px; text-align: center; }
.state-panel__icon { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 24px; border: 1px solid var(--line); border-radius: 24px; color: var(--accent); }
.state-panel__logo { width: 36px; height: 36px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.state-panel__logo .fill { fill: currentColor; stroke: none; }
.state-panel[data-tone="error"] .state-panel__icon { color: var(--error); }
.state-panel__title { font-size: 24px; font-weight: 500; line-height: 1.25; margin: 0 0 12px; }
.state-panel__message { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.player-stage[data-layout="stacked"] .state-panel__icon { display: none; }
.player-footer { grid-column: 1/-1; margin: 48px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* Wide pairing screens have separate instructions and a bounded form. */
.connect-topbar { max-width: 1280px; margin: auto; padding: 32px 40px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.connect-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,440px); align-items: center; gap: clamp(40px,7vw,100px); max-width: 1140px; min-height: calc(100svh - 120px); margin: auto; padding: 40px 40px 90px; }
.connect-intro h1 { max-width: 560px; font-size: clamp(34px,4.5vw,58px); line-height: 1.09; letter-spacing: -1.8px; font-weight: 500; margin: 22px 0; }
.connect-intro > p { max-width: 410px; color: var(--muted); margin: 0; font-size: 16px; }
.connect-steps { list-style: none; padding: 0; margin: 38px 0 0; display: grid; gap: 19px; }
.connect-steps li { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.connect-steps li > span { display: grid; place-items: center; width: 30px; height: 30px; flex-shrink: 0; border: 1px solid var(--line-strong); border-radius: 50%; font-weight: 500; font-size: 12px; }
.connect-steps small { color: var(--muted); }
.connect-card { width: 100%; min-width: 0; position: relative; align-self: center; background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 36px; box-shadow: var(--shadow); }
.connect-card h2 { font-size: 26px; font-weight: 500; letter-spacing: -.7px; line-height: 1.2; margin: 12px 0; }
.connect-card p { font-size: 14px; color: var(--muted); line-height: 1.6; }
#connect-view { margin-top: 30px; }
#connect-view label { color: var(--muted); font-size: 12px; }
.code-shell { position: relative; margin-top: 10px; }
.code-input { position: absolute; inset: 0; z-index: 1; opacity: .01; width: 100%; height: 100%; cursor: text; border: 0; font-size: 20px; }
.code-slots { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 7px; }
.code-slot { display: grid; place-items: center; min-width: 0; height: 56px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); color: var(--ink); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; }
.code-slot.is-placeholder { color: var(--muted); opacity: .65; }
.code-shell:focus-within .code-slot { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.connect-primary { width: 100%; min-height: 54px; margin-top: 24px; padding: 14px 20px; border: 0; border-radius: 28px; background: var(--control); color: var(--on-control); font-size: 14px; font-weight: 500; }
.connect-primary:hover:not(:disabled) { filter: brightness(1.15); }
.connect-note { padding-top: 24px; margin-top: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.connect-note a { display: inline-block; margin-top: 7px; }
#session-view { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 24px; }
#session-pill { display: inline-block; color: var(--success); font-size: 12px; }
#session-title { font-size: 21px; margin-top: 18px; }
#location-name { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
#device-label, #session-detail { overflow-wrap: anywhere; }
.status-banner { position: relative; margin-top: 20px; padding: 16px 34px 16px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.status-banner h2 { font-size: 16px; margin: 5px 0; letter-spacing: 0; }
.status-banner p { font-size: 12px; margin: 4px 0 0; }
#status-banner-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.status-banner-info #status-banner-title { color: var(--accent); }
.status-banner-success #status-banner-title { color: var(--success); }
.status-banner-warning #status-banner-title { color: var(--warning); }
.status-banner-error #status-banner-title { color: var(--error); }
#status-banner-close { position: absolute; top: 8px; right: 7px; width: 28px; height: 28px; border: 0; background: transparent; font-size: 23px; color: var(--muted); border-radius: 50%; }

/* Settings retain readable content widths at tablet and television sizes. */
.appearance-dialog { width: min(720px,calc(100% - 48px)); max-width: none; max-height: calc(100svh - 48px); padding: 30px; margin: auto; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow-y: auto; }
.appearance-dialog::backdrop { background: #17151d88; backdrop-filter: blur(5px); }
.appearance-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.appearance-heading h2 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.6px; }
.appearance-heading .icon-button { font-size: 28px; width: 40px; height: 40px; }
.appearance-content { display: grid; grid-template-columns: 190px minmax(0,1fr); gap: 30px; padding: 28px 0; }
.appearance-description p { font-size: 18px; margin: 15px 0 20px; line-height: 1.4; }
.appearance-description small, .appearance-note { color: var(--muted); font-size: 12px; line-height: 1.6; }
.appearance-note { margin: 0; padding-top: 20px; border-top: 1px solid var(--line); }
.appearance-version { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.theme-options { display: grid; gap: 10px; }
.theme-option { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: transparent; color: var(--ink); font-size: 14px; text-align: left; }
.theme-option[aria-checked="true"] { border-color: var(--accent); background: var(--subtle); }
.theme-check { margin-left: auto; color: var(--accent); opacity: 0; }
.theme-option[aria-checked="true"] .theme-check { opacity: 1; }
.theme-preview { display: block; position: relative; width: 54px; height: 40px; flex-shrink: 0; border: 1px solid #80758955; border-radius: 9px; background: #eae5f5; }
.theme-preview i { position: absolute; left: 8px; top: 12px; width: 12px; height: 2px; background: #17151d; border-radius: 4px; }
.theme-preview b { position: absolute; right: 8px; top: 9px; width: 20px; height: 20px; border-radius: 38%; background: #17151d; }
.theme-preview--light { background: #f8f7fa; }
.theme-preview--dark { background: #19161f; }
.theme-preview--dark i, .theme-preview--dark b { background: #e6dcf3; }

@media (min-width: 1600px) {
  .player-screen { padding: 64px; }
  .player-surface { max-width: 1500px; gap: 44px 80px; }
  .brand-lockup__wordmark { font-size: 30px; }
  .brand-lockup svg { width: 40px; height: 40px; }
  .player-location__name { font-size: 72px; }
  .player-location__address { font-size: 20px; }
  .status-pill { font-size: 16px; }
  .icon-button { width: 56px; height: 56px; }
  .player-toggle { width: 290px; }
  .reaction-button { min-height: 68px; font-size: 17px; }
  .connect-layout { max-width: 1280px; grid-template-columns: minmax(0,1fr) 480px; }
  .connect-card { padding: 40px; }
  .connect-card p, .connect-steps li, .connect-primary { font-size: 17px; }
  .code-slot { height: 66px; }
  .appearance-dialog { width: 840px; padding: 38px; }
  .appearance-content { grid-template-columns: 240px minmax(0,1fr); gap: 38px; }
  .theme-option { min-height: 82px; font-size: 18px; }
  .appearance-description small, .appearance-note { font-size: 14px; }
}
@media (max-width: 760px) {
  .player-screen { padding: 25px 22px; align-items: stretch; }
  .player-surface { display: flex; flex-direction: column; gap: 0; max-width: 480px; min-height: calc(100svh - 50px); }
  .player-header, .player-meta { display: block; }
  .player-topbar { margin-bottom: 40px; gap: 12px; }
  .player-topbar__actions { gap: 12px; }
  .status-pill { font-size: 11px; max-width: 130px; }
  .brand-lockup__wordmark { font-size: 22px; }
  .brand-lockup svg { width: 29px; height: 29px; }
  .brand-lockup { gap: 7px; }
  .icon-button { width: 40px; height: 40px; }
  .player-location { text-align: center; }
  .player-location .eyebrow { font-size: 10px; margin-bottom: 12px; }
  .player-location__name { font-size: clamp(28px,8vw,38px); letter-spacing: -1px; }
  .player-location__address { font-size: 13px; margin: 14px auto 0; }
  .player-stage { flex: 1; min-height: 280px; padding: 45px 22px; }
  .player-toggle { width: 176px; }
  .player-toggle__pause-icon { transform: scale(.8); }
  .player-reactions { margin-top: 10px; gap: 10px; }
  .reaction-button { font-size: 12px; min-height: 54px; padding: 12px; gap: 8px; }
  .player-footer { margin: 28px 0 0; font-size: 11px; }
  .connect-topbar { padding: 24px; }
  .connect-layout { grid-template-columns: minmax(0,1fr); gap: 28px; max-width: 520px; padding: 12px 24px 40px; min-height: auto; }
  .connect-intro h1 { font-size: 36px; letter-spacing: -1.2px; margin: 12px 0; }
  .connect-intro > p { font-size: 14px; }
  .connect-steps { display: none; }
  .connect-card { padding: 28px; border-radius: 24px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
  .connect-layout { gap: 32px; padding: 30px 32px 60px; grid-template-columns: minmax(0,1fr) minmax(0,380px); }
  .connect-intro h1 { font-size: 38px; }
  .connect-card { padding: 28px; }
  .player-surface { gap: 30px; }
}
@media (max-width: 520px) {
  .appearance-dialog { padding: 22px; width: calc(100% - 28px); border-radius: 24px; max-height: calc(100svh - 28px); }
  .appearance-heading { gap: 12px; padding-bottom: 18px; }
  .appearance-heading h2 { font-size: 21px; }
  .appearance-content { grid-template-columns: minmax(0,1fr); gap: 18px; padding: 22px 0; }
  .appearance-description p { margin: 10px 0 5px; font-size: 16px; }
  .appearance-description br, .appearance-description small { display: none; }
  .theme-option { min-height: 68px; }
}
@media (max-width: 360px) {
  .player-screen { padding: 20px 16px; }
  .status-pill { max-width: 84px; font-size: 10px; }
  .brand-lockup__wordmark { font-size: 19px; }
  .brand-lockup svg { width: 25px; height: 25px; }
  .connect-layout { padding-inline: 16px; }
  .connect-card { padding: 22px; }
  .code-slots { gap: 5px; }
  .code-slot { height: 46px; font-size: 21px; }
}
@media (max-height: 600px) and (min-width: 761px) {
  .player-topbar { margin-bottom: 0; }
  .player-stage { min-height: 235px; }
  .player-toggle { width: 170px; }
  .player-footer { margin-top: 12px; }
  .connect-layout { padding-top: 10px; padding-bottom: 30px; }
}
@keyframes pending-spin { to { transform: rotate(345deg); } }
@media (prefers-reduced-motion: reduce) { *, *:before, *:after { animation: none !important; transition: none !important; } }
