:root {
  color-scheme: dark;
  --bg: #14161a;
  --bg-deep: #0e1013;
  --panel: #1c1f25;
  --panel-hi: #252932;
  --panel-hover: #2c313c;
  --line: #343944;
  --line-soft: rgba(255, 255, 255, 0.075);
  --fg: #e8eaed;
  --muted: #9aa0aa;
  --muted-deep: #747b86;
  --accent: #e5a00d;
  --accent-hi: #f7b82d;
  --accent-soft: rgba(229, 160, 13, 0.15);
  --green: #4caf82;
  --green-soft: rgba(76, 175, 130, 0.14);
  --red: #e05252;
  --red-soft: rgba(224, 82, 82, 0.14);
  --blue: #5a9fe8;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.26);
  --radius-lg: 22px;
  --radius-md: 15px;
  --radius-sm: 11px;
  --tap: 48px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% -15%, rgba(229, 160, 13, 0.11), transparent 34rem),
    var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
summary,
input[type="range"] {
  touch-action: manipulation;
}

button {
  border: 0;
}

button:not(:disabled),
summary,
input[type="range"] {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button,
input,
select,
summary {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 0.45rem;
  font-size: 0.88rem;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--accent);
  color: #151515;
  font-weight: 750;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow {
  margin-bottom: 0.24rem;
  color: var(--accent);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.2;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(229, 160, 13, 0.4);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(229, 160, 13, 0.18), rgba(229, 160, 13, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-mark img {
  width: 29px;
  height: 29px;
  object-fit: contain;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(20, 22, 26, 0.9);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.brand-lockup,
.header-actions {
  display: flex;
  align-items: center;
}

.brand-lockup {
  min-width: 0;
  gap: 12px;
}

.header-actions {
  flex: 0 0 auto;
  gap: 9px;
}

.icon-button,
.small-button,
.primary-button,
.danger-button,
.login-submit {
  min-height: var(--tap);
  border-radius: 12px;
  font-weight: 750;
  transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.icon-button {
  display: inline-grid;
  width: var(--tap);
  min-width: var(--tap);
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 1.38rem;
}

.icon-button:hover,
.small-button:hover {
  border-color: #4a505d;
  background: var(--panel-hi);
  color: var(--fg);
}

.icon-button:active,
.small-button:active,
.primary-button:active,
.danger-button:active,
.login-submit:active {
  transform: scale(0.97);
}

.install-button {
  color: var(--accent);
}

.status-pill,
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-deep);
  box-shadow: 0 0 0 4px rgba(154, 160, 170, 0.08);
}

.is-online .status-dot,
.status-pill.is-online .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

.is-offline .status-dot,
.is-error .status-dot,
.status-pill.is-offline .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.is-checking .status-dot,
.status-pill.is-checking .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: soft-pulse 1.5s ease-in-out infinite;
}

.offline-banner {
  position: sticky;
  z-index: 25;
  top: 70px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px max(18px, env(safe-area-inset-right)) 9px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(224, 82, 82, 0.25);
  background: rgba(73, 27, 30, 0.96);
  color: #ffd6d6;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
}

.offline-banner:not([hidden]) {
  display: flex;
}

.dashboard-shell {
  width: min(1380px, 100%);
  margin: 0 auto;
  padding: 22px max(18px, env(safe-area-inset-right)) max(42px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.status-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 86px;
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.025), transparent), var(--panel);
  box-shadow: 0 9px 28px rgba(0, 0, 0, 0.08);
}

.status-card-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-hi);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.status-card-copy {
  min-width: 0;
}

.status-label,
.status-detail,
.status-value {
  overflow: hidden;
  margin-bottom: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-value {
  color: var(--fg);
  font-size: 0.94rem;
  font-weight: 740;
}

.status-detail {
  margin-top: 2px;
  color: var(--muted-deep);
  font-size: 0.72rem;
}

.status-card.is-online .status-card-icon {
  border-color: rgba(76, 175, 130, 0.27);
  background: var(--green-soft);
  color: #a5e4c8;
}

.status-card.is-offline .status-card-icon,
.status-card.is-error .status-card-icon {
  border-color: rgba(224, 82, 82, 0.25);
  background: var(--red-soft);
  color: #ffbaba;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(350px, 0.82fr);
  align-items: start;
  gap: 18px;
}

.primary-column,
.control-column {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.conversation-panel,
.screen-panel,
.remote-panel,
.playback-panel,
.quick-panel {
  padding: 20px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 17px;
}

.compact-heading {
  margin-bottom: 14px;
}

.mode-pill {
  min-width: 66px;
  justify-content: center;
  color: var(--muted);
}

.mode-pill.is-listening {
  border-color: rgba(224, 82, 82, 0.35);
  background: var(--red-soft);
  color: #ffc2c2;
}

.mode-pill.is-sending {
  border-color: rgba(229, 160, 13, 0.35);
  background: var(--accent-soft);
  color: #ffd77b;
}

.conversation-log {
  display: flex;
  min-height: 230px;
  max-height: 390px;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 4px 6px 8px 2px;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) transparent;
}

.empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted-deep);
  text-align: center;
}

.empty-state p {
  max-width: 260px;
  margin-bottom: 0;
  font-size: 0.87rem;
}

.empty-state-icon {
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 3rem;
  line-height: 0.7;
  opacity: 0.65;
}

.conversation-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  animation: entry-in 180ms ease both;
}

.conversation-entry.reply-entry {
  padding-left: 22px;
}

.entry-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-hi);
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 850;
}

.command-entry .entry-avatar {
  border-color: rgba(229, 160, 13, 0.25);
  background: var(--accent-soft);
  color: #ffd574;
}

.reply-entry .entry-avatar {
  border-color: rgba(76, 175, 130, 0.22);
  background: var(--green-soft);
  color: #9fe0c2;
}

.error-entry .entry-avatar {
  border-color: rgba(224, 82, 82, 0.25);
  background: var(--red-soft);
  color: #ffbaba;
}

.entry-bubble {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 5px 14px 14px 14px;
  background: var(--panel-hi);
}

.reply-entry .entry-bubble {
  border-radius: 14px 5px 14px 14px;
  background: rgba(37, 41, 50, 0.72);
}

.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
  color: var(--muted-deep);
  font-size: 0.67rem;
  font-weight: 700;
}

.entry-bubble p {
  overflow-wrap: anywhere;
  margin-bottom: 0;
  color: var(--fg);
  font-size: 0.9rem;
}

.voice-progress {
  align-items: center;
  gap: 12px;
  min-height: 60px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(224, 82, 82, 0.28);
  border-radius: var(--radius-sm);
  background: var(--red-soft);
}

.voice-progress:not([hidden]) {
  display: flex;
}

.voice-progress > div {
  display: grid;
  min-width: 0;
  flex: 1;
}

.voice-progress strong {
  color: #ffc5c5;
  font-size: 0.86rem;
}

.voice-progress span:not(.listening-pulse) {
  color: #d7a4a4;
  font-size: 0.72rem;
}

.listening-pulse {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(224, 82, 82, 0.45);
  animation: recording-pulse 1.35s ease-out infinite;
}

.voice-timer {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.command-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.talk-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(76, 175, 130, 0.28);
  border-radius: 14px;
  background: var(--green-soft);
  color: #a8e7cc;
  font-size: 0.84rem;
  font-weight: 800;
}

.talk-button:hover {
  border-color: rgba(76, 175, 130, 0.48);
  background: rgba(76, 175, 130, 0.2);
}

.talk-button.is-recording {
  border-color: rgba(224, 82, 82, 0.42);
  background: var(--red-soft);
  color: #ffc2c2;
}

.talk-button.is-uploading {
  border-color: rgba(229, 160, 13, 0.4);
  background: var(--accent-soft);
  color: #ffd77b;
}

.microphone-icon {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.microphone-icon::before {
  position: absolute;
  right: -5px;
  bottom: -5px;
  left: -5px;
  height: 9px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 9px 9px;
  content: "";
}

.microphone-icon::after {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  content: "";
  transform: translateX(-50%);
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  min-width: 0;
  min-height: 52px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-hi);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.command-form:focus-within {
  border-color: rgba(229, 160, 13, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.command-form input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 0 13px;
  border: 0;
  background: transparent;
  color: var(--fg);
  font-size: 0.92rem;
}

.command-form input::placeholder,
.login-form input::placeholder,
.settings-form input::placeholder {
  color: var(--muted-deep);
}

.command-form input:focus-visible {
  outline: 0;
}

.send-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  justify-self: end;
  margin-right: 6px;
  border-radius: 11px;
  background: var(--accent);
  color: #17130a;
  font-size: 1.24rem;
  font-weight: 900;
}

.send-button:hover {
  background: var(--accent-hi);
}

.form-feedback {
  min-height: 20px;
  margin: 8px 2px -3px;
  color: var(--muted);
  font-size: 0.76rem;
}

.form-feedback.is-error {
  color: #ffabab;
}

.form-feedback.is-success {
  color: #9fdfc1;
}

.screen-heading {
  align-items: center;
}

.screen-actions,
.switch-control {
  display: flex;
  align-items: center;
}

.screen-actions {
  gap: 10px;
}

.small-button {
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 0.78rem;
}

.switch-control {
  min-height: 44px;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.switch-control input,
.check-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.switch-track,
.check-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  transition: background-color 150ms ease, border-color 150ms ease;
}

.switch-track span,
.check-switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 170ms ease, background-color 170ms ease;
}

.switch-control input:checked + .switch-track,
.check-row input:checked + .check-switch {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.switch-control input:checked + .switch-track span,
.check-row input:checked + .check-switch span {
  background: var(--accent);
  transform: translateX(18px);
}

.switch-control input:focus-visible + .switch-track,
.check-row input:focus-visible + .check-switch {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.screen-frame {
  position: relative;
  display: grid;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  place-items: center;
  border: 1px solid #323740;
  border-radius: 14px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.025), transparent 45%),
    var(--bg-deep);
  isolation: isolate;
}

.screen-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.screen-placeholder,
.screen-loading {
  display: grid;
  place-items: center;
  color: var(--muted-deep);
  text-align: center;
}

.screen-placeholder {
  gap: 5px;
}

.screen-placeholder strong {
  color: var(--muted);
  font-size: 0.86rem;
}

.screen-placeholder span:last-child {
  font-size: 0.73rem;
}

.screen-placeholder-icon {
  display: grid;
  width: 50px;
  height: 36px;
  margin-bottom: 5px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 7px;
  font-size: 0.66rem;
  font-weight: 900;
}

.screen-loading {
  position: absolute;
  z-index: 3;
  inset: 0;
  gap: 9px;
  align-content: center;
  background: rgba(14, 16, 19, 0.82);
  color: var(--muted);
  font-size: 0.75rem;
}

.spinner {
  display: inline-block;
  width: 25px;
  height: 25px;
  border: 3px solid rgba(229, 160, 13, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.panel-footnote {
  margin: 9px 2px -2px;
  color: var(--muted-deep);
  font-size: 0.7rem;
}

.panel-footnote.is-error {
  color: var(--red);
}

.install-hint {
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid rgba(229, 160, 13, 0.3);
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, var(--accent-soft), rgba(229, 160, 13, 0.035));
}

.install-hint:not([hidden]) {
  display: flex;
}

.install-hint-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: #17130a;
  font-size: 1.35rem;
  font-weight: 500;
}

.install-hint div {
  min-width: 0;
  flex: 1;
}

.install-hint h2 {
  margin-bottom: 3px;
  font-size: 0.9rem;
}

.install-hint p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.subtle-button {
  border-color: transparent;
  background: transparent;
}

.remote-layout {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 92px;
  align-items: center;
  gap: 14px;
}

.dpad {
  display: grid;
  width: min(280px, 100%);
  aspect-ratio: 1;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  justify-self: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--panel-hi) 0 32%, transparent 33%),
    linear-gradient(145deg, #2b303a, #20242b);
  box-shadow: inset 5px 5px 14px rgba(255, 255, 255, 0.025), inset -8px -8px 20px rgba(0, 0, 0, 0.2), 0 16px 34px rgba(0, 0, 0, 0.2);
}

.dpad-button {
  display: grid;
  min-width: var(--tap);
  min-height: var(--tap);
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.08rem;
  transition: background-color 120ms ease, color 120ms ease, transform 80ms ease;
}

.dpad-button:hover {
  background: rgba(255, 255, 255, 0.055);
  color: var(--fg);
}

.dpad-button:active {
  background: rgba(229, 160, 13, 0.13);
  color: var(--accent-hi);
  transform: scale(0.93);
}

.dpad-up {
  grid-area: 1 / 2;
}

.dpad-left {
  grid-area: 2 / 1;
}

.dpad-ok {
  grid-area: 2 / 2;
  border: 1px solid rgba(229, 160, 13, 0.45);
  background: var(--accent);
  color: #17130a;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 6px 20px rgba(229, 160, 13, 0.15);
}

.dpad-ok:hover,
.dpad-ok:active {
  background: var(--accent-hi);
  color: #17130a;
}

.dpad-right {
  grid-area: 2 / 3;
}

.dpad-down {
  grid-area: 3 / 2;
}

.remote-shortcuts {
  display: grid;
  gap: 9px;
}

.remote-shortcut {
  display: grid;
  min-height: 62px;
  place-items: center;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-hi);
  color: var(--muted);
  transition: background-color 120ms ease, border-color 120ms ease, transform 80ms ease;
}

.remote-shortcut span:first-child {
  color: var(--fg);
  font-size: 1.15rem;
}

.remote-shortcut span:last-child {
  font-size: 0.66rem;
  font-weight: 750;
}

.remote-shortcut:hover {
  border-color: #4a505d;
  background: var(--panel-hover);
}

.remote-shortcut:active,
.round-control:active,
.control-chip:active,
.volume-button:active,
.quick-tile:active,
.app-tile:active,
.power-button:active {
  transform: scale(0.95);
}

.transport-row,
.volume-row,
.power-row {
  display: flex;
  align-items: center;
}

.transport-primary {
  justify-content: center;
  gap: 17px;
  padding: 6px 0 15px;
}

.round-control {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 1.35rem;
  transition: transform 90ms ease, background-color 130ms ease, border-color 130ms ease;
}

.round-control:hover {
  border-color: #4a505d;
  background: var(--panel-hover);
}

.primary-control {
  width: 72px;
  height: 72px;
  border-color: var(--accent);
  background: var(--accent);
  color: #17130a;
  font-size: 1.7rem;
  box-shadow: 0 10px 30px rgba(229, 160, 13, 0.18);
}

.primary-control:hover {
  border-color: var(--accent-hi);
  background: var(--accent-hi);
}

.transport-secondary {
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.control-chip {
  display: inline-flex;
  flex: 1 1 70px;
  min-width: 74px;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-hi);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  transition: transform 90ms ease, background-color 130ms ease, border-color 130ms ease;
}

.control-chip:hover,
.control-chip[aria-pressed="true"] {
  border-color: rgba(229, 160, 13, 0.43);
  background: var(--accent-soft);
  color: #ffd77b;
}

.volume-block {
  padding-top: 15px;
}

.volume-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.volume-heading output {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.volume-row {
  gap: 8px;
}

.volume-row input[type="range"] {
  width: 100%;
  min-width: 75px;
  height: var(--tap);
  flex: 1;
  margin: 0;
  background: transparent;
  accent-color: var(--accent);
}

.volume-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: #353a44;
}

.volume-row input[type="range"]::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
  -webkit-appearance: none;
  appearance: none;
}

.volume-row input[type="range"]::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: #353a44;
}

.volume-row input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.volume-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35);
}

.volume-button {
  display: grid;
  width: var(--tap);
  min-width: var(--tap);
  height: var(--tap);
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 1.12rem;
  font-weight: 750;
  transition: transform 90ms ease, background-color 130ms ease, border-color 130ms ease;
}

.volume-button:hover {
  border-color: #4a505d;
  background: var(--panel-hover);
}

.mute-button[aria-pressed="true"] {
  border-color: rgba(224, 82, 82, 0.38);
  background: var(--red-soft);
  color: #ffb7b7;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.quick-tile,
.app-tile {
  display: grid;
  min-width: 0;
  min-height: 78px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-hi);
  color: var(--muted);
  transition: transform 90ms ease, background-color 130ms ease, border-color 130ms ease;
}

.quick-tile:hover,
.app-tile:hover {
  border-color: #4a505d;
  background: var(--panel-hover);
  color: var(--fg);
}

.quick-tile > span:last-child,
.app-tile > span:last-child {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.68rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-monogram,
.app-glyph {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #333844;
  color: var(--fg);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.tile-monogram {
  background: rgba(229, 160, 13, 0.12);
  color: #ffd77b;
}

.app-plex {
  background: #191919;
  color: var(--accent);
}

.app-youtube {
  background: #cf2424;
  color: white;
}

.app-netflix {
  background: #080808;
  color: #e50914;
  font-size: 1.1rem;
}

.app-prime {
  background: #172b3e;
  color: #53b6e8;
}

.app-disney {
  background: #15266d;
  color: #e5eeff;
}

.app-iplayer {
  background: #101010;
  color: #ff5dc8;
}

.app-itv {
  background: #f3b625;
  color: #202025;
}

.app-spotify {
  background: #111;
  color: #1ed760;
  font-size: 1rem;
}

.power-row {
  gap: 9px;
  margin-top: 12px;
}

.power-button {
  display: inline-flex;
  min-height: 52px;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 800;
  transition: transform 90ms ease, background-color 130ms ease, border-color 130ms ease;
}

.wake-button {
  border-color: rgba(76, 175, 130, 0.24);
  background: var(--green-soft);
  color: #a4e3c7;
}

.sleep-button {
  border-color: rgba(90, 159, 232, 0.2);
  background: rgba(90, 159, 232, 0.09);
  color: #b8d8fa;
}

.power-symbol {
  font-size: 1.1rem;
}

.help-panel {
  overflow: hidden;
}

.help-panel summary {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 20px;
  list-style: none;
  user-select: none;
}

.help-panel summary::-webkit-details-marker {
  display: none;
}

.help-panel summary > span:first-child {
  display: grid;
}

.help-panel summary strong {
  font-size: 1rem;
}

.summary-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-hi);
  color: var(--muted);
  font-size: 1.15rem;
  transition: transform 170ms ease;
}

.help-panel[open] .summary-icon {
  transform: rotate(45deg);
}

.help-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 20px;
}

.help-content > div {
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(37, 41, 50, 0.65);
}

.help-content h3 {
  color: var(--accent);
}

.help-content p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.72rem;
}

.help-content p:last-child {
  margin-bottom: 0;
}

.settings-dialog {
  width: min(540px, calc(100% - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.64);
}

.settings-dialog::backdrop {
  background: rgba(4, 5, 7, 0.72);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.settings-form {
  display: grid;
  max-height: inherit;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
}

.dialog-heading {
  border-bottom: 1px solid var(--line-soft);
}

.dialog-actions {
  border-top: 1px solid var(--line-soft);
}

.settings-scroll {
  overflow: auto;
  padding: 18px 20px;
  overscroll-behavior: contain;
}

.settings-form fieldset {
  display: grid;
  gap: 13px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
}

.settings-form fieldset:last-child {
  margin-bottom: 0;
}

.settings-form legend {
  width: 100%;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 700;
}

.field-label input,
.field-label select {
  width: 100%;
  min-height: 50px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-hi);
  color: var(--fg);
  font-size: 0.9rem;
}

.field-label input:focus,
.field-label select:focus {
  border-color: rgba(229, 160, 13, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.check-row {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(37, 41, 50, 0.55);
}

.check-row > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.check-row strong {
  font-size: 0.82rem;
}

.check-row small {
  color: var(--muted-deep);
  font-size: 0.69rem;
}

.settings-form > .form-feedback {
  margin: 0;
  padding: 4px 20px 8px;
}

.primary-button,
.danger-button {
  min-width: 112px;
  padding: 0 17px;
}

.primary-button {
  background: var(--accent);
  color: #17130a;
}

.primary-button:hover {
  background: var(--accent-hi);
}

.danger-button {
  border: 1px solid rgba(224, 82, 82, 0.24);
  background: var(--red-soft);
  color: #ffbcbc;
}

.danger-button:hover {
  border-color: rgba(224, 82, 82, 0.42);
  background: rgba(224, 82, 82, 0.2);
}

.toast-region {
  position: fixed;
  z-index: 100;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(37, 41, 50, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.4);
  color: var(--fg);
  font-size: 0.8rem;
  font-weight: 650;
  animation: toast-in 190ms ease both;
}

.toast.is-error {
  border-color: rgba(224, 82, 82, 0.38);
  color: #ffc0c0;
}

.toast.is-success {
  border-color: rgba(76, 175, 130, 0.34);
  color: #a9e5ca;
}

/* Login */

.login-page {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% -5%, rgba(229, 160, 13, 0.16), transparent 31rem),
    radial-gradient(circle at 105% 95%, rgba(76, 175, 130, 0.06), transparent 27rem),
    var(--bg);
}

.login-shell {
  width: min(440px, 100%);
}

.login-card {
  padding: clamp(24px, 7vw, 38px);
  border: 1px solid var(--line-soft);
  border-radius: 26px;
  background: rgba(28, 31, 37, 0.94);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.42);
}

.login-brand {
  margin-bottom: 28px;
  text-align: center;
}

.large-brand-mark {
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  border-radius: 18px;
}

.large-brand-mark img {
  width: 42px;
  height: 42px;
}

.login-brand h1 {
  margin-bottom: 8px;
  font-size: 1.75rem;
}

.login-brand > p:last-child {
  max-width: 320px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.login-notice,
.login-error {
  margin-bottom: 16px;
  padding: 11px 12px;
  border-radius: 11px;
  font-size: 0.78rem;
}

.login-notice {
  border: 1px solid rgba(76, 175, 130, 0.25);
  background: var(--green-soft);
  color: #a6e2c6;
}

.login-error {
  border: 1px solid rgba(224, 82, 82, 0.3);
  background: var(--red-soft);
  color: #ffbcbc;
}

.login-form {
  display: grid;
  gap: 16px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 68px;
}

.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 58px;
  min-height: 40px;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.password-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
}

.login-submit {
  min-height: 52px;
  margin-top: 3px;
  background: var(--accent);
  color: #17130a;
}

.login-submit:hover {
  background: var(--accent-hi);
}

.login-footnote {
  margin: 23px 0 0;
  padding-top: 19px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-deep);
  font-size: 0.7rem;
  line-height: 1.55;
  text-align: center;
}

@keyframes soft-pulse {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 1; }
}

@keyframes recording-pulse {
  0% { box-shadow: 0 0 0 0 rgba(224, 82, 82, 0.45); }
  75%, 100% { box-shadow: 0 0 0 11px rgba(224, 82, 82, 0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes entry-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1080px) {
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, 0.9fr);
  }

  .remote-layout {
    grid-template-columns: minmax(190px, 1fr) 82px;
  }
}

@media (max-width: 820px) {
  .dashboard-shell {
    padding-top: 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .primary-column,
  .control-column {
    gap: 14px;
  }

  .control-column {
    grid-row: 2;
  }

  .conversation-panel,
  .screen-panel,
  .remote-panel,
  .playback-panel,
  .quick-panel {
    padding: 18px;
  }

  .remote-layout {
    grid-template-columns: minmax(210px, 1fr) 94px;
  }
}

@media (max-width: 560px) {
  :root {
    --radius-lg: 18px;
  }

  .app-header {
    min-height: 66px;
    padding-bottom: 8px;
  }

  .brand-mark {
    width: 39px;
    height: 39px;
  }

  .brand-lockup {
    gap: 10px;
  }

  .brand-lockup .eyebrow {
    display: none;
  }

  .brand-lockup h1 {
    font-size: 1.04rem;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .status-pill {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    justify-content: center;
    padding: 0;
  }

  .header-actions .status-pill span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .header-actions .icon-button {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .offline-banner {
    top: 66px;
  }

  .dashboard-shell {
    padding-right: max(12px, env(safe-area-inset-right));
    padding-left: max(12px, env(safe-area-inset-left));
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .status-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 8px;
    min-height: 76px;
    padding: 11px;
  }

  .status-card > .status-dot {
    display: none;
  }

  .status-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 0.58rem;
  }

  .status-label {
    font-size: 0.62rem;
  }

  .status-value {
    font-size: 0.79rem;
  }

  .status-detail {
    font-size: 0.62rem;
  }

  .dashboard-grid,
  .primary-column,
  .control-column {
    gap: 12px;
  }

  .conversation-panel,
  .screen-panel,
  .remote-panel,
  .playback-panel,
  .quick-panel {
    padding: 15px;
  }

  .conversation-log {
    min-height: 205px;
    max-height: 330px;
  }

  .conversation-entry.reply-entry {
    padding-left: 8px;
  }

  .command-composer {
    grid-template-columns: 1fr;
  }

  .talk-button {
    width: 100%;
  }

  .screen-heading {
    align-items: flex-start;
  }

  .screen-actions {
    gap: 6px;
  }

  .switch-control > span:first-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .remote-layout {
    grid-template-columns: minmax(190px, 1fr) 76px;
    gap: 9px;
  }

  .remote-shortcut {
    min-height: 55px;
  }

  .quick-grid {
    gap: 7px;
  }

  .quick-tile,
  .app-tile {
    min-height: 72px;
    border-radius: 12px;
  }

  .tile-monogram,
  .app-glyph {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .power-row {
    gap: 7px;
  }

  .help-content {
    grid-template-columns: 1fr;
  }

  .settings-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - env(safe-area-inset-top));
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
  }

  .dialog-actions {
    padding-bottom: max(17px, env(safe-area-inset-bottom));
  }

  .toast-region {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: calc(100% - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right)));
  }
}

@media (max-width: 390px) {
  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-card {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }

  .status-card > .status-dot {
    display: inline-block;
  }

  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-tile,
  .app-tile {
    min-height: 76px;
  }

  .volume-row {
    gap: 5px;
  }

  .volume-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .remote-layout {
    grid-template-columns: 1fr;
  }

  .dpad {
    width: min(245px, 100%);
  }

  .remote-shortcuts {
    grid-template-columns: repeat(3, 1fr);
  }

  .transport-primary {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
