:root { --app-footer-height: 42px; --app-gutter: clamp(12px, 2vw, 32px); }
html { scroll-padding-top: 78px; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-bottom: var(--app-footer-height); }
.app-topbar {
  position: sticky; top: 0; z-index: 40;
  width: 100%; max-width: none; min-height: 64px; margin: 0;
  padding: 10px var(--app-gutter); gap: 12px;
  border-bottom: 1px solid #34405b; background: #101525ed; backdrop-filter: blur(12px);
}
.app-topbar-start { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.app-topbar-start > .room-switch-link { align-self: center; }
.app-topbar .brand { white-space: nowrap; flex-shrink: 0; }
.app-topbar-about {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 40px;
  padding-inline: 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  text-decoration: none;
}
.app-topbar-about:is(:hover, :focus-visible) {
  background: var(--hover, #ffffff0d);
  color: var(--text);
}
.app-topbar-about[aria-current="page"] {
  color: var(--link, #e7d9ff);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.app-topbar-about:focus-visible {
  outline: 2px solid var(--link, #c2a5f5);
  outline-offset: 2px;
}
.app-topbar nav { min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.app-topbar .button { min-height: 40px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; white-space: nowrap; font-size: 13px; }
.app-topbar .button.discord-link {
  flex: 0 0 38px;
  width: 38px;
  min-height: 38px;
  padding: 0;
  background: #5865f2;
  color: #fff;
}
.app-topbar .discord-link:hover { background: #4752c4; }
.app-topbar .discord-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.account-alert-controls { display: flex; align-items: center; gap: inherit; }
.room-nav-icon { display: none; }
.voice-alert-control { position: relative; }
.app-topbar .account-alert-controls :is(#notify-button, #voice-alert-button) {
  width: var(--room-topbar-control-size, 38px);
  padding-inline: 5px;
  font-size: 16px;
}
.account-alert-controls [data-account-alert-label] { display: none; }
.voice-volume-menu summary { min-height: 38px; justify-content: center; }
.voice-control-group { display: inline-flex; align-items: center; flex: none; }
.app-topbar .voice-control-group :is(#voice-alert-button, .voice-volume-menu > summary) {
  height: var(--room-topbar-control-size, 40px);
  min-height: var(--room-topbar-control-size, 40px);
  width: var(--room-topbar-control-size, 38px);
  padding-block: 0;
}
.voice-control-group #voice-alert-button {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}
.voice-control-group .voice-volume-menu > summary {
  border-inline-start: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
}
.voice-control-group .voice-volume-menu[open] > summary {
  background: color-mix(in srgb, currentColor 8%, var(--panel));
}
.voice-control-group :is(#voice-alert-button, .voice-volume-menu > summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}
.voice-volume-menu > .voice-volume-panel {
  position: absolute; z-index: 20; top: calc(100% + 6px); inset-inline-end: 0;
  width: min(205px, calc(100vw - 24px)); padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 4px 14px #0004;
}
.personal-volume .personal-volume-label { gap: 4px; color: var(--text); font-size: 12px; }
.personal-volume-label > span { display: flex; justify-content: space-between; gap: 8px; }
.personal-volume-label output { font-variant-numeric: tabular-nums; }
.personal-volume input[type="range"] {
  margin: 0; min-height: 24px; padding: 0; background: transparent;
  border: 0; accent-color: var(--accent); cursor: pointer;
}
.voice-repetitions-label { margin-top: 8px; gap: 5px; font-size: 12px; }
.voice-repetitions-label select { padding: 5px 8px; font-size: 13px; }
.voice-repetitions-status:empty { display: none; }
.voice-fallback-preview { min-height: 32px; margin-top: 6px; padding: 4px 8px; }
.app-topbar .voice-fallback-preview { width: 100%; }
.voice-fallback-controls input[type="file"] { min-width: 0; padding: 5px; font-size: 12px; }
[data-personal-fallback-filename] { overflow-wrap: anywhere; }
.personal-volume-error { margin: 3px 0 0; color: var(--danger, #ff9cad); font-size: 11px; }
.account-alert-controls button[data-active="true"] { border-color: #6e9e87; color: #b9f3cd; background: #19332b; }
.voice-alert-status {
  position: absolute; z-index: 1; inset-inline-end: 0; top: calc(100% + 6px);
  width: min(220px, 70vw); padding: 8px 10px; border: 1px solid #46516b;
  border-radius: 8px; background: #171f30; color: #e5ebff; font-size: 12px;
}
.voice-alert-status:empty { display: none; }
.app-main { flex: 1; width: 100%; min-width: 0; max-width: none; margin: 0; padding: 24px var(--app-gutter); }
.save-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.save-notice > span { min-width: 0; overflow-wrap: anywhere; }
.save-notice-close {
  flex: 0 0 30px;
  height: 30px;
  padding: 0;
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.save-notice-close:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.save-notice-close:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.app-main .hero { margin-bottom: 16px; gap: 16px; }
.app-main .hero h1 { font-size: clamp(24px, 2.5vw, 34px); line-height: 1.35; }
.app-main .hero > div { min-width: 0; }
.app-main .view-toolbar { margin-bottom: 16px; }
.app-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: var(--app-footer-height); padding: 0 var(--app-gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #0d1220f5; border-top: 1px solid #303c56; color: #9ca9c5;
  font-size: 11px; backdrop-filter: blur(10px);
}
.app-footer:not(:has(.footer-clock)) { display: grid; grid-template-columns: 1fr auto 1fr; }
.footer-summary, .footer-clock { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.footer-brand { color: #d9e1f3; font-weight: 600; font-size: 11px; letter-spacing: 0.5px; }
.footer-count { padding: 2px 8px; border-radius: 5px; background: #222d45; color: #d8c6f4; }
.footer-hint { text-align: center; font-size: 11px; }
.footer-clock time { color: #f0c975; font-variant-numeric: tabular-nums; font-size: 13px; }
.boss-notices { bottom: calc(var(--app-footer-height) + 12px); }
@media (max-width: 650px) {
  .app-topbar .voice-volume-menu { position: static; }
  .voice-volume-menu > .voice-volume-panel { inset-inline-end: var(--app-gutter); }
}
@media (max-width: 600px) {
  .app-topbar { min-height: 58px; gap: 8px; }
  .app-topbar .brand { font-size: 16px; letter-spacing: 0.3px; }
  .app-topbar-about { min-height: 38px; padding-inline: 6px; font-size: 14px; }
  .app-topbar nav { gap: 6px; }
  .app-topbar nav .outline { display: inline-flex; width: 38px; padding: 6px; }
  .app-topbar .button { font-size: 12px; min-height: 38px; padding: 7px 10px; }
  .app-main { padding-top: 18px; padding-bottom: 18px; }
  .app-main .hero { flex-direction: column; align-items: flex-start; gap: 12px; }
  .app-main .hero h1 { font-size: 24px; }
  .app-main .hero p { font-size: 12px; }
  .app-main .view-toolbar { justify-content: space-between; gap: 8px; }
  .footer-hint { display: none; }
  .footer-summary, .footer-clock { gap: 6px; }
  .footer-clock > span { display: none; }
  .boss-modal .boss-form { padding: 18px; }
}
@media (max-width: 420px) {
  .app-footer .footer-summary { flex-wrap: wrap; gap: 0 6px; }
  .app-footer .privacy-links { flex-basis: 100%; line-height: 1.1; }
}
.room-dashboard-topbar { --room-topbar-control-size: 40px; --room-topbar-tool-gap: 8px; }
.room-topbar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin-inline-start: auto;
}
.room-dashboard-topbar :is(.room-topbar-tools > nav, .header-preferences) { gap: var(--room-topbar-tool-gap); }
.room-dashboard-topbar .header-preferences { flex: none; align-items: center; }
.app-topbar.room-dashboard-topbar :is(
  .app-topbar-start > .button, nav > .button, .voice-alert-control > .button,
  .header-preferences > .theme-toggle, .header-preference > summary
) {
  height: var(--room-topbar-control-size);
  min-height: var(--room-topbar-control-size);
  padding-block: 0;
}
.app-topbar.room-dashboard-topbar :is(
  .room-roster-toggle, .discord-link, .theme-toggle, .voice-alert-control > .button, .voice-volume-menu > summary
) {
  width: var(--room-topbar-control-size);
  padding-inline: 0;
}
.app-topbar.room-dashboard-topbar :is(.discord-link, .theme-toggle) {
  flex-basis: var(--room-topbar-control-size);
}
@media (min-width: 1051px) {
  .room-topbar-tools:has(nav > :not([hidden])) .header-preferences {
    border-inline-start: 1px solid var(--line);
    padding-inline-start: 12px;
  }
}
/* Compact controls keep the room header on one line until the two-row layout. */
@media (max-width: 1480px) {
  .room-dashboard-topbar .room-nav-icon { display: block; }
  .room-dashboard-topbar .room-nav-label { display: none; }
  .room-dashboard-topbar .room-nav-link:has(.room-nav-icon) {
    width: var(--room-topbar-control-size);
    padding-inline: 5px;
  }
  .room-dashboard-topbar .account-menu { max-width: 190px; }
  .app-topbar.room-dashboard-topbar nav .room-nav-link:not(:has(.room-nav-icon)) { width: auto; }
}
@media (max-width: 1050px) {
  .app-topbar.room-dashboard-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }
  .room-dashboard-topbar .app-topbar-start { grid-area: 1 / 1; justify-self: start; }
  .app-topbar.room-dashboard-topbar .account-menu {
    grid-area: 1 / 2;
    justify-self: end;
    max-width: min(210px, 48vw);
    min-width: 0;
    margin: 0;
  }
  .room-dashboard-topbar .room-topbar-tools {
    grid-area: 2 / 1 / 3 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    min-width: 0;
    margin-inline-start: 0;
  }
  .app-topbar.room-dashboard-topbar nav {
    flex: 1 1 auto;
    justify-content: flex-start;
    order: 0;
    margin: 0;
  }
  .app-topbar.room-dashboard-topbar .header-preferences { order: 0; margin-inline-start: auto; }
  .room-dashboard-topbar .voice-alert-control { position: static; }
  .room-dashboard-topbar .voice-alert-status { inset-inline-end: var(--app-gutter); }
}
@media (650px < width <= 1050px) {
  .room-dashboard-topbar .voice-volume-menu > .voice-volume-panel {
    inset-inline-start: calc(-1 * var(--room-topbar-control-size));
    inset-inline-end: auto;
  }
}
@media (max-width: 720px) {
  .room-dashboard-topbar :is(.language-switcher, .time-zone-switcher) summary {
    justify-content: center;
    width: var(--room-topbar-control-size);
    gap: 0;
    padding: 0;
    font-size: 0;
  }
  .room-dashboard-topbar :is(.language-switcher, .time-zone-switcher) summary span { font-size: 14px; }
}
@media (max-width: 520px) {
  .room-dashboard-topbar { --room-topbar-control-size: 36px; --room-topbar-tool-gap: 5px; }
  .room-dashboard-topbar .room-topbar-tools { gap: 6px; }
  .room-dashboard-topbar .app-topbar-start { gap: 6px; }
  .app-topbar.room-dashboard-topbar { grid-template-columns: max-content minmax(0, 1fr); }
  .app-topbar.room-dashboard-topbar .account-menu { max-width: 100%; }
}
@media (max-width: 400px) {
  .room-dashboard-topbar .app-topbar-start .brand { font-size: 14px; }
  .room-dashboard-topbar .account-menu > summary { gap: 4px; padding-inline: 6px; }
}
@media (max-width: 480px) {
  .app-topbar.room-dashboard-topbar { position: relative; }
}
@media (max-width: 360px) {
  .app-topbar-about { padding-inline: 3px; font-size: 13px; }
}
