:root {
  --bg: #f5f1ff;
  --shell-top-pad: 18px;
  --surface: #ffffff;
  --soft: #faf8ff;
  --chat: #f1ecff;
  --ink: #151224;
  --muted: #6f6a80;
  --line: #e8e0f7;
  --green: #9438ff;
  --green-dark: #7224f5;
  --green-soft: #f2e9ff;
  --yellow: #f5c851;
  --blue: #6d4ce8;
  --red: #d7373f;
  --touch-green: #20d99b;
  --touch-green-soft: rgba(32, 217, 155, 0.16);
  --touch-green-light: rgba(32, 217, 155, 0.07);
  --shadow: 0 18px 44px rgba(74, 35, 143, 0.1);
  --radius: 8px;
  --app-header-height: 72px;
  --tab-bar-height: 76px;
  --top-chrome-offset: 0px;
  --top-chrome-visible-height: 148px;
  --top-chrome-total-height: 148px;
  --speech-tools-height: 148px;
  --location-tools-height: 122px;
  --library-tools-height: 60px;
  --premium-monologue-tools-height: 126px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(148, 56, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf9ff 0%, var(--bg) 46%, #ffffff 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

/* Keep long mobile lists cheap to paint without changing their layout. */
.teacher-card,
.location-card,
.routine-item,
.library-book-card,
.game-card,
.music-category-card,
.music-browser-track {
  content-visibility: auto;
  contain-intrinsic-size: auto 96px;
}

@media (pointer: coarse) {
  button,
  a,
  .user-pill,
  .tab-button,
  .music-browser-track {
    touch-action: manipulation;
  }
}

/* Admin feed must hand scrolling back to the page at its top/bottom edge. */
.admin-shell {
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

.admin-shell main,
.admin-chat-dashboard {
  min-height: 0;
  overflow: visible;
}

.admin-feed {
  cursor: default;
}

.admin-feed .update-bubble {
  touch-action: pan-y;
}

.admin-feed.is-feed-scrolling .update-bubble,
.admin-feed.is-feed-scrolling .update-bubble.is-touching {
  transform: none;
  box-shadow: none;
  -webkit-user-select: none;
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark-theme contrast polish: audition feed, navigation icons and hidden text. */
html[data-theme="dark"] .public-updates.chat-layout,
html[data-theme="dark"] .public-updates .chat-phone,
html[data-theme="dark"] .public-updates .chat-feed {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #050506 !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates .chat-phone {
  box-shadow: inset 0 0 0 1px #17171c, 0 14px 32px rgba(0, 0, 0, 0.38) !important;
}

html[data-theme="dark"] .public-updates .chat-header {
  color: #ffffff !important;
  border-bottom: 1px solid #292930 !important;
  background: #09090b !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates .chat-header strong {
  color: #ffffff !important;
}

html[data-theme="dark"] .public-updates .chat-header span {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] .public-updates .chat-header .avatar {
  color: #050506 !important;
  border-color: #ffd95a !important;
  background: linear-gradient(145deg, #ffd95a, #f2c230) !important;
}

html[data-theme="dark"] :is(.updates-back-toggle, .updates-fullscreen-toggle) {
  color: #ffffff !important;
  border: 1px solid #292930 !important;
  background: #111114 !important;
}

html[data-theme="dark"] :is(.updates-back-icon, .fullscreen-icon) {
  fill: none !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .public-updates .update-bubble,
html[data-theme="dark"] .public-updates .update-bubble.incoming,
html[data-theme="dark"] .public-updates .update-bubble.admin {
  color: #ffffff !important;
  border: 1px solid #292930 !important;
  background: #111114 !important;
  background-image: none !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34) !important;
}

html[data-theme="dark"] .public-updates .update-bubble.admin {
  border-color: rgba(139, 44, 245, 0.62) !important;
  background: #17171c !important;
}

html[data-theme="dark"] .public-updates .update-bubble :is(h3, strong, b) {
  color: #ffffff !important;
}

html[data-theme="dark"] .public-updates .update-bubble :is(p, .message-meta, .message-meta span) {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] .public-updates :is(.post-media-frame, .post-media-gallery .post-media-frame) {
  overflow: hidden;
  border: 2px solid #292930 !important;
  background: #17171c !important;
  box-shadow: inset 0 0 0 1px #050506 !important;
}

html[data-theme="dark"] .public-updates :is(.post-media, .post-media-frame img.post-media) {
  border: 0 !important;
  background: #17171c !important;
}

html[data-theme="dark"] .public-updates .post-media-frame:focus-visible {
  outline: 2px solid #a83cff !important;
  outline-offset: 2px;
}

html[data-theme="dark"] .public-updates .post-media-frame.error::after {
  color: #ffffff !important;
  background: #17171c !important;
}

html[data-theme="dark"] :is(.update-date-separator, .scroll-date-indicator) {
  color: #b8b8c0 !important;
  border-color: #292930 !important;
  background: #17171c !important;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .public-updates :is(.reaction-summary, .reaction-picker, .unread-message-tag) {
  color: #ffffff !important;
  border-color: #3a126f !important;
  background: #17171c !important;
}

html[data-theme="dark"] .tab-bar .tab-button {
  color: #ffffff !important;
  opacity: 1 !important;
}

html[data-theme="dark"] .tab-bar .tab-button .ui-icon {
  color: #a83cff !important;
  fill: none !important;
  stroke: #a83cff !important;
  stroke-width: 2.35 !important;
  opacity: 1 !important;
  filter: drop-shadow(0 0 5px rgba(168, 60, 255, 0.18));
}

html[data-theme="dark"] .tab-bar .tab-button:nth-child(even) .ui-icon {
  color: #ffd95a !important;
  stroke: #ffd95a !important;
  filter: drop-shadow(0 0 5px rgba(242, 194, 48, 0.16));
}

html[data-theme="dark"] .tab-bar .tab-button.active .ui-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
  filter: none;
}

html[data-theme="dark"] :is(
  .drawer-icon, .library-back-button svg, .settings-close svg,
  .settings-section-back svg, .location-filter-icon, .music-now-icon,
  .image-viewer-back-icon
) {
  opacity: 1 !important;
  visibility: visible !important;
}

html[data-theme="dark"] :is(
  .profile-details strong, .profile-stats strong, .settings-protected-fields strong,
  .library-book-card strong, .location-card strong, .speech-card strong,
  .routine-card strong, .teacher-card strong, .game-card strong,
  .monologue-card h3, .music-browser-track-copy strong
) {
  color: #ffffff !important;
  opacity: 1 !important;
}

html[data-theme="dark"] :is(
  .profile-details span, .settings-protected-fields span, .library-book-card p,
  .location-card p, .speech-card p, .routine-card p, .teacher-card p,
  .game-card p, .music-browser-track-copy span, .music-browser-track-copy small
) {
  color: #b8b8c0 !important;
  opacity: 1 !important;
}

html[data-theme="dark"] :is(a, button, [role="button"]) {
  -webkit-tap-highlight-color: rgba(168, 60, 255, 0.16);
}

@media (max-width: 520px) {
  html[data-theme="dark"] .public-updates .chat-feed {
    padding-inline: 10px;
  }

  html[data-theme="dark"] .public-updates .update-bubble {
    width: min(94%, 620px);
  }

  html[data-theme="dark"] .tab-bar .tab-button {
    gap: 4px;
    overflow: visible;
  }

  html[data-theme="dark"] .tab-bar .tab-button .ui-icon {
    flex: 0 0 21px;
    width: 21px;
    height: 21px;
  }
}

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

button,
a,
.user-pill,
.update-bubble,
.teacher-card,
.location-card,
.routine-item,
.music-file-card,
.music-status,
.volume-control,
.admin-panel,
.admin-preview {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 90ms ease,
    border-color 90ms ease,
    background-color 90ms ease;
}

input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
  touch-action: auto;
}

button {
  border: 0;
  cursor: pointer;
}

button:active,
button.is-touching,
a:active,
a.is-touching,
.user-pill.is-touching,
.update-bubble.is-touching,
.teacher-card.is-touching,
.location-card.is-touching,
.routine-item.is-touching,
.music-status.is-touching,
.volume-control.is-touching,
.admin-panel.is-touching,
.admin-preview.is-touching {
  transform: translateY(1px) scale(0.985);
  box-shadow:
    0 0 0 3px var(--touch-green-soft),
    inset 0 0 0 999px var(--touch-green-light);
}

button:disabled,
button:disabled:active,
button:disabled.is-touching {
  transform: none;
  filter: none;
}

input:active,
input.is-touching,
select:active,
select.is-touching,
textarea:active,
textarea.is-touching,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(32, 217, 155, 0.42);
  box-shadow: 0 0 0 3px var(--touch-green-soft);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--touch-green-soft);
  outline-offset: 2px;
}

.app-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.initial-loader {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.initial-loader-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(280px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-weight: 950;
}

.initial-loader-ring {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(114, 36, 245, 0.16);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  gap: 24px;
  place-items: center;
  padding: 18px;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(430px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.guest-updates-gate {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 42px 24px;
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink);
  background: var(--surface);
}

.guest-updates-gate-icon { font-size: 2.2rem; }
.guest-updates-gate h2 { margin: 0; font-size: 1.3rem; }
.guest-updates-gate p { max-width: 34rem; margin: 0; color: var(--muted); line-height: 1.55; }
.guest-updates-gate .primary-button { width: min(100%, 280px); margin-top: 8px; }


.auth-tabs {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.auth-tab {
  min-height: 40px;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  font-weight: 850;
}

.auth-tab.active {
  color: #ffffff;
  background: var(--green-dark);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-row {
  display: flex;
  justify-content: flex-end;
  margin-top: -7px;
}

.forgot-password-button {
  min-height: 30px;
  padding: 0;
  color: #7b25f6;
  background: transparent;
  font-size: 0.86rem;
  font-weight: 900;
}

.forgot-password-button:hover,
.forgot-password-button:focus-visible {
  color: #5d16d4;
}

.reset-copy {
  display: grid;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid rgba(114, 36, 245, 0.14);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(135deg, rgba(114, 36, 245, 0.08), rgba(32, 217, 155, 0.08));
}

.reset-copy strong {
  font-size: 1.02rem;
}

.reset-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.35;
}

.auth-reset-actions {
  display: flex;
  justify-content: center;
  margin-top: -2px;
}

.auth-back-login {
  min-height: 32px;
  padding-inline: 8px;
  color: #7b25f6;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.google-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #ffffff;
  font-weight: 850;
}

.auth-message {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-message.success {
  color: var(--green-dark);
}

.auth-message.error {
  color: var(--red);
}

.auth-message.loading::before {
  content: "";
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(114, 36, 245, 0.18);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.auth-footer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.auth-about-toggle { min-height: 20px; padding: 0; color: var(--muted); background: transparent; font-size: .9rem; font-weight: 700; text-align: right; }
.auth-about-toggle:hover, .auth-about-toggle[aria-expanded="true"] { color: var(--green-dark); }
.auth-about-panel { width: min(900px, 100%); padding: clamp(20px, 4vw, 32px); border: 1px solid var(--line); border-radius: 22px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.auth-about-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.auth-about-head p, .auth-about-head h2 { margin: 0; }
.auth-about-head > div > p { color: var(--green-dark); font-size: .76rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.auth-about-head h2 { margin-top: 3px; }
.auth-about-head button { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; color: var(--ink); background: var(--soft); }
.auth-about-panel > p { color: var(--muted); line-height: 1.65; }
.auth-about-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.auth-about-grid section { padding: 16px; border-radius: 16px; background: var(--soft); }
.auth-about-grid h3 { margin: 0 0 6px; font-size: 1rem; }
.auth-about-grid p { margin: 0; color: var(--muted); line-height: 1.55; }
.auth-about-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 16px; }
.auth-about-links a { color: var(--green-dark); font-weight: 800; }

@media (max-width: 680px) {
  .auth-about-grid { grid-template-columns: 1fr; }
}

.music-now-add.is-favorite { color: #ff304f !important; }
.music-now-add.is-favorite .music-now-icon { color: #ff304f !important; }
.music-now-add.is-favorite .music-now-icon path { fill: currentColor !important; stroke: currentColor !important; }

.network-banner {
  position: fixed;
  left: 50%;
  top: 10px;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 9px;
  width: max-content;
  max-width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(114, 36, 245, 0.16);
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(74, 35, 143, 0.14);
  font-size: 0.88rem;
  font-weight: 900;
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}

.network-banner.hidden {
  display: none;
}

.network-banner.error {
  color: var(--red);
  border-color: rgba(215, 55, 63, 0.16);
}

.network-banner.loading {
  width: 42px;
  max-width: 42px;
  min-height: 42px;
  justify-content: center;
  padding: 0;
}

.network-banner.loading #networkBannerText {
  display: none;
}

.network-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(114, 36, 245, 0.18);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.network-banner.error .network-spinner {
  display: none;
}

.auth-helper {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
}

.otp-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.otp-actions .auth-helper {
  grid-column: 1 / -1;
  margin: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 4px 6px 4px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 850;
}

.user-pill.guest-signup {
  gap: 7px;
  padding-left: 5px;
  cursor: pointer;
}

.user-pill.guest-signup::before {
  content: "AR";
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  position: relative;
  left: -2px;
  color: #ffffff;
  background: var(--green-dark);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1;
  text-indent: 1px;
}

.unread-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--red);
  box-shadow: var(--shadow);
}

.unread-alert.hidden {
  display: none;
}

.unread-alert-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  min-width: 0;
  padding: 0 10px;
  border-radius: var(--radius);
  color: #ffffff;
  background: transparent;
  font-weight: 900;
  text-align: left;
}

.unread-alert-main strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--red);
  background: #ffffff;
}

.unread-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffffff;
}

.notification-enable {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--red);
  background: #ffffff;
  font-weight: 900;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(12, 27, 23, 0.35);
}

.side-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  width: min(380px, 92vw);
  grid-template-rows: auto auto 1fr auto;
  align-content: stretch;
  gap: 8px;
  overflow: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 18px 0 40px rgba(14, 34, 29, 0.16);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head h2 {
  font-size: 1.35rem;
}

.drawer-head-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.drawer-theme-toggle {
  display: grid;
  width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--green-dark);
  background: var(--soft);
  box-shadow: none;
}

.drawer-theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-theme-toggle .theme-sun,
html[data-theme="dark"] .drawer-theme-toggle .theme-moon {
  display: none;
}

html[data-theme="dark"] .drawer-theme-toggle .theme-sun {
  display: block;
}

.drawer-close {
  width: 38px;
  min-height: 38px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--soft);
  font-size: 1.6rem;
  line-height: 1;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0b14;
  --surface: #191620;
  --soft: #211d2a;
  --chat: #181421;
  --ink: #f5f1ff;
  --muted: #b9b1c8;
  --line: #373043;
  --green-soft: #2b1c3d;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #100d18 0%, #0d0b14 55%, #15101d 100%);
}

html[data-theme="dark"] .side-drawer,
html[data-theme="dark"] .app-header,
html[data-theme="dark"] .tab-bar,
html[data-theme="dark"] .speech-sticky-tools,
html[data-theme="dark"] .location-sticky-tools,
html[data-theme="dark"] .library-search-shell {
  background: #15121d;
}

html[data-theme="dark"] .speech-sticky-tools,
html[data-theme="dark"] .location-sticky-tools,
html[data-theme="dark"] .library-search-shell {
  box-shadow: 0 0 0 100vmax #15121d, 0 8px 18px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .drawer-nav button,
html[data-theme="dark"] .drawer-close,
html[data-theme="dark"] .drawer-theme-toggle,
html[data-theme="dark"] .speech-card,
html[data-theme="dark"] .location-card,
html[data-theme="dark"] .location-filter-panel,
html[data-theme="dark"] .library-book-card,
html[data-theme="dark"] .library-search-box input,
html[data-theme="dark"] .location-search-box input {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.drawer-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.drawer-nav button,
.drawer-logout,
.drawer-settings {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 850;
}

.drawer-nav button {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
}

.drawer-nav button span {
  min-width: 0;
}

.drawer-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--green-dark);
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-nav button.active {
  color: #ffffff;
  background: var(--green-dark);
}

.drawer-nav button.active .drawer-icon {
  stroke: #ffffff;
}

.drawer-nav .drawer-location-link {
  display: flex;
  width: 100%;
  padding-right: 12px;
}

.directory-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

.directory-card strong {
  color: var(--ink);
}

.directory-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.directory-card a {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.drawer-logout {
  align-self: end;
  margin-top: auto;
  color: #ffffff;
  background: var(--red);
}

.drawer-settings {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface);
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(10, 18, 16, 0.42);
  backdrop-filter: blur(4px);
}

.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 40;
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(31, 12, 74, 0.28);
  transform: translate(-50%, -50%);
}

.settings-panel.hidden,
.settings-backdrop.hidden { display: none; }

.settings-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.settings-head h2 { margin: 0; }
.settings-close { display: grid; width: 36px; min-height: 46px; place-items: center; padding: 0; border: 0; border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; }
.settings-close svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2.35; stroke-linecap: round; stroke-linejoin: round; }
.settings-form { display: grid; gap: 14px; }
.settings-form.hidden,
.settings-options.hidden,
.settings-delete-confirm.hidden { display: none; }
.settings-options { display: grid; gap: 10px; }
.settings-option { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--surface); text-align: left; }
.settings-option > span:nth-child(2) { display: grid; gap: 3px; }
.settings-option small { color: var(--muted); font-weight: 700; }
.settings-option-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--green-dark); background: var(--soft); font-size: 1.15rem; }
.settings-option-danger { color: var(--red); }
.settings-option-danger .settings-option-icon { color: var(--red); background: rgba(211, 62, 71, .1); }
.settings-section-back { justify-self: start; padding: 7px 0; color: var(--green-dark); background: transparent; font-weight: 850; }
.settings-delete-confirm { display: grid; gap: 14px; }
.account-delete-page-head { display: flex; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.account-delete-page-head h3 { margin: 0; font-size: 1.35rem; }
.account-delete-page-head .settings-section-back { display: grid; flex: 0 0 36px; width: 36px; min-height: 46px; place-items: center; padding: 0; border: 0; border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; }
.account-delete-page-head .settings-section-back svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 2.35; stroke-linecap: round; stroke-linejoin: round; }
.account-delete-intro { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 14px; border: 1px solid rgba(211, 62, 71, .2); border-radius: 15px; background: rgba(211, 62, 71, .07); }
.account-delete-intro-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; color: #fff; background: var(--red); font-size: 1.25rem; font-weight: 950; }
.account-delete-intro div { display: grid; gap: 4px; }
.account-delete-intro p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.account-delete-types { display: grid; gap: 9px; margin: 0; padding: 0; border: 0; }
.account-delete-types legend { margin-bottom: 9px; color: var(--ink); font-size: .92rem; font-weight: 900; }
.account-delete-choice { display: flex !important; flex-direction: column; align-items: flex-start; gap: 9px !important; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 5px 15px rgba(31, 12, 74, .04); transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.account-delete-choice:has(input:checked) { border-color: var(--green-dark); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(126, 42, 245, .08); }
.account-delete-choice input { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; accent-color: var(--green-dark); }
.account-delete-choice span { display: grid; gap: 3px; }
.account-delete-choice strong { color: var(--ink); }
.account-delete-choice small { color: var(--muted); font-weight: 650; }
.settings-delete-confirm select,
.settings-delete-confirm textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); }
#settingsTemporaryDurationWrap.hidden { display: none !important; }
.settings-delete-confirm textarea { resize: vertical; }
.account-delete-confirm-check { display: flex !important; align-items: flex-start; gap: 9px !important; }
.account-delete-confirm-check input { flex: 0 0 auto; width: 19px; height: 19px; margin-top: 2px; accent-color: var(--red); }
.account-delete-warning { display: grid; gap: 3px; padding: 12px 13px; border-left: 4px solid var(--red); border-radius: 10px; color: var(--ink); background: rgba(211, 62, 71, .07); }
.account-delete-warning span { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.account-delete-submit-bar { position: sticky; bottom: 0; z-index: 2; padding: 10px 0 max(2px, env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--surface) 25%); }
.account-delete-submit-bar .settings-delete-final { width: 100%; box-shadow: 0 10px 24px rgba(211, 62, 71, .2); }
.settings-delete-confirm h3,
.settings-delete-confirm p { margin: 0; }
.settings-delete-confirm > p { color: var(--muted); }
.settings-delete-confirm label { display: grid; gap: 7px; color: var(--ink); font-weight: 800; }
.settings-delete-confirm input { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); }
.settings-delete-final { min-height: 46px; border-radius: 12px; color: #fff; background: var(--red); font-weight: 900; }
.settings-delete-final:disabled { opacity: .48; cursor: not-allowed; }
.settings-form label { display: grid; gap: 7px; color: var(--ink); font-weight: 850; }
.settings-form input,
.settings-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); }
.settings-form textarea { resize: vertical; min-height: 96px; }
.settings-protected-fields { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); }
.settings-protected-fields p { display: grid; gap: 3px; margin: 0; padding: 10px 12px; background: var(--surface); }
.settings-protected-fields span { color: var(--muted); font-size: .76rem; font-weight: 800; }
.settings-protected-fields strong { overflow-wrap: anywhere; }
.settings-note { margin: -4px 0 0; color: var(--muted); font-size: .78rem; }
.settings-message { margin: 0; padding: 9px 11px; border-radius: 10px; background: var(--soft); font-weight: 800; }
.settings-message.success { color: var(--green-dark); }
.settings-message.error { color: var(--red); }
.settings-save { min-height: 46px; }

body.settings-modal-open { overflow: hidden; }

html[data-theme="dark"] :is(.drawer-settings, .settings-panel, .settings-option, .settings-form input, .settings-form textarea, .settings-delete-confirm input, .settings-protected-fields p) {
  color: #f1e6c9;
  border-color: rgba(212, 175, 55, .18);
  background: #252525;
}
html[data-theme="dark"] :is(.account-delete-choice, .settings-delete-confirm select, .settings-delete-confirm textarea) { color: #f1e6c9; border-color: rgba(212, 175, 55, .18); background: #252525; }

@media (max-width: 600px) {
  .settings-close { width: 34px; min-height: 44px; }
  .account-delete-page-head .settings-section-back { flex-basis: 34px; width: 34px; min-height: 44px; }
  .settings-panel.delete-page-active { top: 0; left: 0; width: 100%; height: 100dvh; max-height: none; padding: max(10px, env(safe-area-inset-top)) 16px 0; border: 0; border-radius: 0; transform: none; overscroll-behavior: contain; }
  .settings-panel.delete-page-active > .settings-head { display: none; }
  .settings-panel.delete-page-active .settings-delete-confirm { gap: 16px; min-height: 100%; padding-bottom: 0; }
  .settings-panel.delete-page-active .account-delete-page-head { position: sticky; top: calc(-1 * max(10px, env(safe-area-inset-top))); z-index: 3; margin: 0 -16px; padding: max(10px, env(safe-area-inset-top)) 16px 11px; background: var(--surface); }
  .settings-panel.delete-page-active textarea { min-height: 108px; }
}

.profile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(10, 18, 16, 0.34);
  backdrop-filter: blur(4px);
}

.profile-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  gap: 12px;
  overflow: hidden;
  padding: 0 18px 18px;
  border: 1px solid rgba(232, 224, 247, 0.95);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(31, 12, 74, 0.28);
  transform: translate(-50%, -50%);
}

.profile-panel.hidden,
.profile-backdrop.hidden {
  display: none;
}

.profile-cover {
  height: 108px;
  margin: 0 -18px;
  background:
    radial-gradient(circle at 18% 18%, rgba(32, 217, 155, 0.34), transparent 30%),
    linear-gradient(135deg, #a548ff, #7224f5);
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(18, 10, 36, 0.34);
  font-size: 1.2rem;
  line-height: 1;
}

.profile-avatar {
  display: grid;
  width: 92px;
  height: 92px;
  margin-top: -58px;
  place-items: center;
  border: 5px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green-dark);
  box-shadow: 0 14px 30px rgba(31, 12, 74, 0.18);
  font-size: 1.55rem;
  font-weight: 950;
}

.profile-panel h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

.profile-username {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 850;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 14px;
  background: var(--soft);
}

.profile-stats span,
.profile-details div {
  display: grid;
  gap: 2px;
}

.profile-stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.profile-stats strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.profile-details {
  display: grid;
  gap: 8px;
}

.profile-details div {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.profile-details span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.profile-details strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.95rem;
}

.profile-logout {
  min-height: 44px;
  border-radius: 12px;
  color: #ffffff;
  background: var(--red);
  font-weight: 900;
}

.app-header,
.tab-bar,
.screen-title,
.brand-row,
.chat-header,
.composer-head,
.routine-item-head {
  display: flex;
  align-items: center;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 38;
  justify-content: space-between;
  gap: 14px;
  margin-top: calc(-1 * var(--shell-top-pad));
  margin-bottom: 0;
  padding: calc(var(--shell-top-pad) + 8px) 0 7px;
  background: #fbf9ff;
  border: 0;
  box-shadow: 0 0 0 100vmax #fbf9ff;
  clip-path: inset(0 -100vmax);
  backdrop-filter: none;
  transform: translate3d(0, var(--top-chrome-offset), 0);
  backface-visibility: hidden;
  will-change: transform;
  transition:
    opacity 140ms ease,
    visibility 140ms ease;
}

.hamburger-button {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hamburger-button span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: var(--green-dark);
}

.brand-row {
  gap: 12px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  font-weight: 900;
}

.brand-mark {
  position: relative;
  width: 48px;
  height: 48px;
  overflow: hidden;
  background: var(--yellow);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.brand-mark img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: contain;
  object-position: center;
  background: #000;
}

.avatar {
  width: 42px;
  height: 42px;
  background: var(--green-soft);
  color: var(--green-dark);
}

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

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

h2 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 4vw, 2.15rem);
  line-height: 1.08;
}

h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.tiny-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.tab-bar {
  position: sticky;
  top: var(--app-header-height);
  z-index: 37;
  gap: 14px;
  margin-bottom: 24px;
  padding: 7px 2px 11px;
  overflow-x: auto;
  border: 0;
  border-radius: 0;
  background: #fbf9ff;
  box-shadow: 0 0 0 100vmax #fbf9ff;
  clip-path: inset(0 -100vmax);
  backdrop-filter: none;
  scrollbar-width: none;
  transform: translate3d(0, var(--top-chrome-offset), 0);
  backface-visibility: hidden;
  transition:
    opacity 140ms ease,
    visibility 140ms ease;
}

/* Header and four tabs read as one surface while retaining separate sticky
   behavior: the header may leave, but the labelled tabs never do. */
body:not(.updates-view-active) .app-header,
body:not(.updates-view-active) .tab-bar {
  background-color: #fbf9ff;
}

body:not(.updates-view-active) .app-header {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

body:not(.updates-view-active) .tab-bar {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

body.top-chrome-hidden .tab-bar {
  transform: translate3d(0, var(--top-chrome-offset), 0);
}

body:not(.top-chrome-hidden) .app-header {
  box-shadow:
    0 8px 20px rgba(74, 35, 143, 0.1),
    0 0 0 100vmax #fbf9ff;
}

.app-shell > main {
  margin-top: 0;
  transition: none;
}

body.drawer-open .app-shell > main,
body.profile-modal-open .app-shell > main,
body.image-viewer-open .app-shell > main,
body.practice-modal-open .app-shell > main,
body.library-view-active .app-shell > main,
body.updates-fullscreen-active .app-shell > main {
  margin-top: 0;
}

body.drawer-open .app-header,
body.drawer-open .tab-bar,
body.profile-modal-open .app-header,
body.profile-modal-open .tab-bar,
body.image-viewer-open .app-header,
body.image-viewer-open .tab-bar,
body.practice-modal-open .app-header,
body.practice-modal-open .tab-bar {
  transform: translateY(-16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 176px;
  min-height: 58px;
  padding: 0 22px;
  border: 0;
  border-radius: 17px;
  color: #2d2940;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 30px rgba(80, 43, 150, 0.1);
  font-size: 1rem;
  font-weight: 900;
  white-space: nowrap;
}

.ui-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fill-icon {
  fill: currentColor;
  stroke: none;
}

.tab-button .ui-icon {
  width: 26px;
  height: 26px;
  color: var(--green-dark);
}

.tab-button.active {
  color: #ffffff;
  background: linear-gradient(135deg, #a548ff, #7224f5);
  box-shadow: 0 16px 34px rgba(114, 36, 245, 0.24);
}

.tab-button.active .ui-icon {
  color: #ffffff;
}

.admin-chip,
.admin-link-button,
.status-badge,
.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 40px;
  border-radius: var(--radius);
  font-weight: 850;
}

.admin-chip,
.admin-link-button,
.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.admin-chip,
.admin-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #a548ff, #bc52f2);
  box-shadow: 0 10px 24px rgba(148, 56, 255, 0.2);
}

.secondary-button,
.danger-button,
.text-button {
  padding: 0 14px;
}

.danger-button {
  color: #ffffff;
  background: var(--red);
}

.text-button {
  color: var(--green-dark);
  background: transparent;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.82rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

body.updates-view-active {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.updates-view-active .app-shell:not(.admin-shell) {
  position: fixed;
  inset: 0;
  width: min(1180px, 100%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding-top: calc(var(--shell-top-pad) + var(--top-chrome-total-height) + 4px);
  overflow: hidden;
}

body.updates-view-active .app-header,
body.updates-view-active .unread-alert,
body.updates-view-active .tab-bar {
  flex: 0 0 auto;
}

body.updates-view-active .tab-bar {
  position: sticky;
  top: var(--app-header-height);
}

body.updates-view-active main,
body.updates-view-active .view[data-view="updates"].active,
body.updates-view-active .public-updates,
body.updates-view-active .public-updates .chat-phone {
  min-height: 0;
}

body.updates-view-active main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
}

body.updates-view-active .view[data-view="updates"].active {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  height: 100%;
}

body.updates-view-active .public-updates {
  flex: 1 1 auto;
  height: 100%;
}

body.updates-view-active .public-updates .chat-phone {
  display: flex;
  flex-direction: column;
  height: 100%;
}

body.updates-view-active .public-updates .chat-feed {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}

body.library-view-active .app-header,
body.library-view-active .tab-bar {
  display: none;
}

body.updates-fullscreen-active {
  overflow: hidden;
}

body.updates-fullscreen-active .public-updates {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  background: var(--green-soft);
}

body.updates-fullscreen-active .public-updates .chat-phone {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body.updates-fullscreen-active .public-updates .chat-feed {
  max-height: none;
}

.screen-title {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}

.screen-title .tiny-label {
  color: var(--green-dark);
  font-size: 0.9rem;
}

[data-view="monologue"] .screen-title {
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

[data-view="learn"] .screen-title {
  align-items: flex-end;
  margin-bottom: 10px;
}

[data-view="learn"] .learn-layout {
  gap: 10px;
}

[data-view="routine"] .screen-title {
  align-items: flex-start;
  gap: 8px;
  margin-top: -4px;
  margin-bottom: 12px;
}

[data-view="routine"] .screen-title .secondary-button {
  margin-top: -2px;
}

[data-view="diction"] .screen-title,
[data-view="tongue"] .screen-title {
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.routine-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.routine-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.86rem;
  font-weight: 900;
}

.routine-mode-pill .legacy-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  font-size: 1.05rem;
  line-height: 1;
}

.chat-layout,
.monologue-layout,
.routine-layout,
.learn-layout,
.library-grid,
.location-layout {
  display: grid;
  gap: 16px;
}

.chat-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.public-updates {
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}

.monologue-layout,
.learn-layout {
  grid-template-columns: 330px minmax(0, 1fr);
}

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

.speech-practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.speech-search-shell {
  margin-bottom: 3px;
}

body.speech-view-active .app-shell:not(.admin-shell) {
  padding-top: 0;
}

body.locations-view-active .app-shell:not(.admin-shell) {
  padding-top: 0;
}

body.library-view-active .app-shell:not(.admin-shell) {
  padding-top: 0;
}

body.library-view-active [data-view="library"].active {
  padding-top: calc(var(--library-tools-height) + 6px);
}

body.library-view-active [data-view="library"] > .library-search-shell {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 1200;
  width: min(calc(100% - 36px), 1144px);
  margin: 0;
  transform: translateX(-50%);
}

@media (max-width: 620px) {
  body.library-view-active [data-view="library"] > .library-search-shell {
    width: calc(100% - 24px);
  }
}

/* Dark-mode readability guard and Routine surface corrections. */
html[data-theme="dark"] body :is(
  p,
  span,
  label,
  small,
  li,
  dt,
  dd,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  strong
) {
  color: #f7f3ea;
}

html[data-theme="dark"] body :is(
  .tiny-label,
  .screen-title .tiny-label,
  .music-file-label,
  .speech-card .tiny-label,
  .premium-monologue-card-meta span
) {
  color: #e3bc55;
}

html[data-theme="dark"] :is(
  .music-controls,
  .music-controls button,
  .music-controls .primary-button,
  .music-controls .secondary-button,
  .routine-mini-player,
  .music-status,
  .volume-control,
  .music-status strong,
  .music-file-card,
  .voice-studio > section,
  .voice-studio > div:not(.practice-timer-panel)
) {
  color: #ffffff !important;
  border-color: rgba(212, 175, 55, 0.2) !important;
  background: #1b1b1b !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34) !important;
}

html[data-theme="dark"] .music-controls button {
  background: linear-gradient(145deg, #292929, #202020) !important;
}

html[data-theme="dark"] :is(
  #musicStatusText,
  .music-status-label,
  .music-status strong,
  .volume-head,
  .volume-head > span,
  .volume-head strong,
  .music-controls button,
  .routine-mini-button
) {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(
  .music-controls button::before,
  .music-status-label::before,
  .routine-mini-toggle,
  .routine-mini-icon
) {
  color: #e3bc55 !important;
}

html[data-theme="dark"] :is(.primary-button, .primary-button *, .drawer-nav button.active, .drawer-nav button.active *, .tab-button.active, .tab-button.active *) {
  color: #17120a !important;
}

html[data-theme="dark"] :is(
  .status-badge,
  .notification-enable,
  .library-book-count,
  .monologue-meta span,
  .performance-notes span,
  .speech-step-row span
) {
  border-color: rgba(212, 175, 55, 0.22) !important;
  background: #292929 !important;
}

/* Cinematic black-and-gold theme. These overrides intentionally live at the
   end of the stylesheet so the light theme remains unchanged and dark mode
   consistently wins over legacy component-specific purple declarations. */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171717;
  --surface: #1e1e1e;
  --soft: #2a2a2a;
  --chat: #171717;
  --ink: #ffffff;
  --muted: #b9b09e;
  --line: #3a3429;
  --green: #e8bd54;
  --green-dark: #d4af37;
  --green-soft: rgba(212, 175, 55, 0.14);
  --yellow: #d4af37;
  --blue: #d4af37;
  --touch-green: #d4af37;
  --touch-green-soft: rgba(212, 175, 55, 0.2);
  --touch-green-light: rgba(212, 175, 55, 0.08);
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] body {
  color: #ffffff;
  background:
    radial-gradient(circle at 85% 0%, rgba(212, 175, 55, 0.09), transparent 25%),
    linear-gradient(180deg, #1b1b1b 0%, #171614 50%, #141414 100%);
}

html[data-theme="dark"] :is(
  .app-header,
  .tab-bar,
  .side-drawer,
  .speech-sticky-tools,
  .location-sticky-tools,
  .library-search-shell,
  .auth-card,
  .login-card,
  .composer-card,
  .chat-phone,
  .admin-panel,
  .admin-preview,
  .control-panel,
  .monologue-card,
  .voice-studio,
  .routine-card,
  .learn-note,
  .teacher-card,
  .speech-card,
  .location-card,
  .location-filter-panel,
  .library-book-card,
  .directory-card,
  .profile-panel
) {
  color: #ffffff;
  border-color: #3a3429;
  background: #1e1e1e;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] :is(
  [class$="-card"],
  .update-bubble,
  .routine-item,
  .music-file-card,
  .music-category-card,
  .music-browser-track,
  .empty-state,
  .location-results-area
) {
  color: #ffffff;
  border-color: #3a3429;
  background-color: #1e1e1e;
}

html[data-theme="dark"] :is(.speech-sticky-tools, .location-sticky-tools, .library-search-shell) {
  background: #101010;
  box-shadow: 0 0 0 100vmax #101010, 0 8px 20px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] :is(
  input,
  select,
  textarea,
  .library-search-box input,
  .location-search-box input,
  .city-picker-toggle,
  .teacher-filter select,
  .speech-language-filter select
) {
  color: #ffffff;
  border-color: #40382b;
  background: #151515;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #908879;
}

html[data-theme="dark"] :is(h1, h2, h3, h4, strong, .screen-title, .music-file-head) {
  color: #ffffff;
}

html[data-theme="dark"] :is(p, small, .location-summary, .music-track-hint) {
  border-color: #3a3429;
}

html[data-theme="dark"] :is(.tiny-label, .speech-card .tiny-label, .music-file-label) {
  color: #d4af37;
}

html[data-theme="dark"] :is(.drawer-nav button, .drawer-close, .drawer-theme-toggle, .filter-toggle) {
  color: #f1e6c9;
  border-color: #40382b;
  background: #252525;
}

html[data-theme="dark"] :is(.secondary-button, .ghost-button, .city-picker-toggle, .music-picker-open) {
  color: #f1e6c9;
  border-color: #40382b;
  background: #2a2a2a;
}

html[data-theme="dark"] :is(.drawer-icon, .location-filter-icon, .library-back-button svg) {
  color: #d4af37;
  stroke: #d4af37;
}

html[data-theme="dark"] :is(.primary-button, .drawer-nav button.active, .tab-button.active, .location-search-button) {
  color: #111111;
  border-color: #e2ba54;
  background: linear-gradient(135deg, #f1cf78, #d4af37);
  box-shadow: 0 10px 24px rgba(212, 175, 55, 0.2);
}

html[data-theme="dark"] .tab-button:not(.active) {
  color: #f1e6c9;
  background: #1e1e1e;
}

html[data-theme="dark"] .speech-card-main {
  color: #ffffff;
  border-color: rgba(212, 175, 55, 0.55);
  background:
    radial-gradient(circle at 82% 16%, rgba(212, 175, 55, 0.14), transparent 30%),
    linear-gradient(145deg, #2a241a 0%, #171717 70%);
}

html[data-theme="dark"] :is(.library-search-icon, .games-search-icon) {
  border-color: #d4af37;
}

html[data-theme="dark"] :is(.library-search-icon, .games-search-icon)::after {
  background: #d4af37;
}

html[data-theme="dark"] :is(a, .library-book-actions a, .location-card a) {
  color: #e9c76e;
}

html[data-theme="dark"] .drawer-backdrop {
  background: rgba(0, 0, 0, 0.68);
}

html[data-theme="dark"] :focus-visible {
  outline-color: rgba(212, 175, 55, 0.7);
}

body.locations-view-active [data-view="locations"].active {
  padding-top: calc(var(--location-tools-height) + 6px);
}

.location-sticky-tools {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 1200;
  width: min(calc(100% - 36px), 1144px);
  padding: max(5px, env(safe-area-inset-top)) 0 3px;
  background: #fbf9ff;
  box-shadow: 0 0 0 100vmax #fbf9ff, 0 8px 18px rgba(55, 29, 120, 0.06);
  clip-path: inset(0 -100vmax 0);
  transform: translateX(-50%);
}

.location-sticky-tools .location-search-shell {
  grid-template-columns: 36px 44px minmax(0, 1fr);
  align-items: start;
  margin-bottom: 3px;
}

.location-sticky-tools .screen-title.location-fixed-title {
  margin: 0;
  padding: 0;
}

.location-sticky-tools .location-filter-panel {
  position: relative;
  top: auto;
  max-height: min(52vh, 390px);
  margin-top: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.locations-view-active [data-view="locations"] > .location-layout {
  grid-template-columns: minmax(0, 1fr);
}

.location-fixed-title .tiny-label {
  margin: 0 0 1px;
}

.location-fixed-title h2 {
  margin: 0;
  line-height: 1.12;
}

@media (max-width: 620px) {
  .location-sticky-tools {
    width: calc(100% - 24px);
  }
}

body.speech-view-active .app-shell:not(.admin-shell) > .app-header,
body.speech-view-active .app-shell:not(.admin-shell) > .tab-bar,
body.locations-view-active .app-shell:not(.admin-shell) > .app-header,
body.locations-view-active .app-shell:not(.admin-shell) > .tab-bar {
  display: none;
}

.speech-sticky-tools {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 1200;
  width: min(calc(100% - 36px), 1144px);
  margin: 0;
  padding: max(5px, env(safe-area-inset-top)) 0 1px;
  background: #fbf9ff;
  box-shadow: 0 0 0 100vmax #fbf9ff, 0 8px 18px rgba(55, 29, 120, 0.06);
  clip-path: inset(0 -100vmax 0);
  transform: translateX(-50%);
}

body.speech-view-active [data-view="diction"].active,
body.speech-view-active [data-view="tongue"].active {
  padding-top: calc(var(--speech-tools-height) + 12px);
}

body.speech-view-active [data-view="diction"].active > .speech-practice-grid,
body.speech-view-active [data-view="tongue"].active > .speech-practice-grid {
  margin-top: 3px;
}

.speech-sticky-tools .library-search-shell {
  position: relative;
  top: auto;
  z-index: auto;
  padding: 0;
  background: transparent;
  box-shadow: none;
  clip-path: none;
}

.speech-language-row {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
}

.speech-sticky-tools .screen-title.speech-fixed-title {
  min-width: 0;
  margin: 0;
  padding: 0;
}

.speech-fixed-title .tiny-label {
  margin: 0 0 1px;
}

.speech-fixed-title h2 {
  margin: 0;
  line-height: 1.1;
}

.speech-language-filter {
  display: grid;
  align-self: flex-start;
  flex: 0 0 auto;
  width: 145px;
  gap: 2px;
  text-align: right;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.speech-language-filter select {
  order: 1;
}

.speech-language-filter > span {
  order: 2;
  padding-right: 2px;
}

.speech-language-filter select {
  width: 100%;
  min-height: 40px;
  padding: 0 38px 0 14px;
  border: 1px solid rgba(122, 34, 244, 0.16);
  border-radius: 13px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(55, 29, 120, 0.06);
  font-weight: 850;
}

@media (max-width: 620px) {
  .speech-sticky-tools {
    width: calc(100% - 24px);
  }
}

.speech-filter-empty {
  grid-column: 1 / -1;
}

.speech-card {
  display: grid;
  gap: 10px;
  min-height: 154px;
  padding: 18px;
  border: 1px solid rgba(232, 224, 247, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(80, 43, 150, 0.08);
}

.speech-card-main {
  grid-column: 1 / -1;
  min-height: 180px;
  color: #ffffff;
  background:
    radial-gradient(circle at 82% 16%, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(135deg, #8c28ff 0%, #5f21dd 100%);
  border-color: rgba(255, 255, 255, 0.2);
}

.speech-card .tiny-label {
  margin: 0;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.speech-card-main .tiny-label,
.speech-card-main p {
  color: rgba(255, 255, 255, 0.78);
}

.speech-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  line-height: 1.16;
}

.speech-card-main h3 {
  color: #ffffff;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.speech-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.speech-step-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.speech-step-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.82rem;
  font-weight: 900;
}

.twister-line {
  letter-spacing: 0;
}

.location-layout {
  grid-template-columns: 270px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.chat-phone,
.admin-panel,
.admin-preview,
.control-panel,
.monologue-card,
.voice-studio,
.routine-card,
.login-card,
.composer-card,
.learn-note,
.teacher-card,
.location-filter-panel,
.location-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-phone {
  position: relative;
  overflow: hidden;
  min-height: 640px;
}

.chat-header {
  gap: 12px;
  padding: 14px;
  color: #ffffff;
  background: var(--green-dark);
}

.chat-header span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
}

.chat-header > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.public-updates .chat-header {
  align-items: flex-start;
  padding: 10px 14px 7px;
}

.public-updates .chat-header .avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  font-size: 0.92rem;
}

.public-updates .chat-header .avatar + div {
  min-width: 0;
  flex: 1;
}

.updates-back-toggle {
  display: none;
  flex: 0 0 38px;
  width: 38px;
  min-height: 38px;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

body.updates-fullscreen-active .updates-back-toggle {
  display: inline-grid;
}

.updates-back-toggle:active,
.updates-back-toggle.is-touching {
  transform: scale(0.96);
}

.updates-back-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-updates .chat-header strong {
  display: block;
  line-height: 1.05;
  transform: translateY(-2px);
}

.public-updates .chat-header span {
  margin-top: 1px;
  font-size: 0.8rem;
}

.updates-fullscreen-toggle {
  display: inline-grid;
  flex: 0 0 40px;
  width: 40px;
  min-height: 40px;
  place-items: center;
  margin-left: auto;
  padding: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.updates-fullscreen-toggle:active,
.updates-fullscreen-toggle.is-touching {
  transform: scale(0.96);
}

.fullscreen-icon {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-close-icon {
  display: none;
}

body.updates-fullscreen-active .fullscreen-open-icon {
  display: none;
}

body.updates-fullscreen-active .fullscreen-close-icon {
  display: block;
}

.public-updates .chat-feed {
  padding-top: 6px;
}

.scroll-date-indicator {
  position: absolute;
  left: 50%;
  top: 64px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: min(78%, 300px);
  min-height: 30px;
  padding: 5px 13px;
  border: 1px solid rgba(114, 36, 245, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(31, 55, 48, 0.14);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.15;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.scroll-date-indicator.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.chat-feed {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 584px;
  max-height: 72vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px;
  background:
    linear-gradient(rgba(232, 240, 220, 0.92), rgba(232, 240, 220, 0.92)),
    radial-gradient(circle at 20px 20px, rgba(7, 94, 84, 0.1) 0 2px, transparent 3px);
  background-size: auto, 34px 34px;
}

.update-date-separator {
  justify-self: center;
  width: max-content;
  max-width: min(80%, 320px);
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-block: -6px;
  padding: 3px 11px;
  border: 1px solid rgba(114, 36, 245, 0.16);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  box-shadow: 0 5px 12px rgba(31, 55, 48, 0.09);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.15;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.update-date-separator + .update-bubble {
  margin-top: -4px;
}

.update-bubble {
  position: relative;
  width: min(620px, 92%);
  max-width: 100%;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(31, 55, 48, 0.08);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.update-bubble.has-reactions {
  margin-bottom: 16px;
}

.update-bubble.reaction-open {
  z-index: 4;
}

.update-bubble.incoming {
  justify-self: start;
  border-top-left-radius: 4px;
  background: #ffffff;
}

.update-bubble.admin {
  justify-self: end;
  background: var(--green-soft);
}

.update-bubble.pending-upload {
  width: min(360px, 92%);
  padding: 10px;
}

.pending-media-preview {
  display: grid;
  align-items: center;
  gap: 10px;
  grid-template-columns: 64px minmax(0, 1fr);
}

.pending-media-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 12, 74, 0.1);
}

.pending-media-thumb img,
.pending-media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pending-media-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pending-media-copy strong,
.pending-media-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-media-copy strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.pending-media-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-message-tools {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.delete-message-button {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
}

.update-bubble.unread-message {
  border: 2px solid rgba(185, 67, 59, 0.55);
}

.update-bubble.opened-message {
  z-index: 1;
  box-shadow:
    0 0 28px rgba(148, 56, 255, 0.2),
    0 14px 28px rgba(31, 55, 48, 0.16);
  animation: updateGlowFlash 1.8s ease-out both;
  will-change: box-shadow, background-color;
}

.update-bubble.opened-message::before {
  content: "";
  position: absolute;
  inset: -12px;
  z-index: -1;
  border-radius: calc(var(--radius) + 14px);
  background:
    radial-gradient(circle at 50% 42%, rgba(148, 56, 255, 0.28), transparent 64%),
    radial-gradient(circle at 50% 62%, rgba(32, 217, 155, 0.18), transparent 70%);
  opacity: 0;
  animation: updateAuraFlash 1.8s ease-out both;
  pointer-events: none;
  will-change: opacity, transform;
}

.update-bubble:focus {
  outline: none;
}

@keyframes updateGlowFlash {
  0% {
    background-color: #ffffff;
    box-shadow:
      0 0 20px rgba(148, 56, 255, 0.24),
      0 0 18px rgba(32, 217, 155, 0.14),
      0 14px 28px rgba(31, 55, 48, 0.16);
  }
  38% {
    background-color: #fbf7ff;
    box-shadow:
      0 0 42px rgba(148, 56, 255, 0.38),
      0 0 28px rgba(32, 217, 155, 0.2),
      0 18px 34px rgba(31, 55, 48, 0.18);
  }
  72% {
    background-color: #ffffff;
    box-shadow:
      0 0 24px rgba(148, 56, 255, 0.18),
      0 0 18px rgba(32, 217, 155, 0.1),
      0 14px 28px rgba(31, 55, 48, 0.14);
  }
  100% {
    box-shadow:
      0 0 0 rgba(148, 56, 255, 0),
      0 8px 20px rgba(31, 55, 48, 0.08);
  }
}

@keyframes updateAuraFlash {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }
  32% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.03);
  }
}

.update-bubble.media-only-load-failed {
  display: none;
}

.unread-message-tag {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 24px;
  margin-bottom: 8px;
  padding: 0 9px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
}

.update-bubble h3 {
  margin-bottom: 8px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.update-bubble p {
  max-width: 100%;
  min-width: 0;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-width: 100%;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.message-meta span {
  max-width: 100%;
  min-width: 0;
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-meta .admin-sent-check {
  padding-right: 9px;
  color: #1687ff;
  background: rgba(255, 255, 255, 0.84);
  font-size: 0.86rem;
  letter-spacing: -2px;
}

.admin-upload-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
}

.admin-upload-state.error {
  color: var(--red);
}

.upload-ring {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(114, 36, 245, 0.24);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

.admin-upload-state.error .upload-ring {
  border-color: rgba(215, 55, 63, 0.18);
  border-top-color: var(--red);
}

.reaction-picker {
  position: fixed;
  left: var(--reaction-picker-x, 50vw);
  top: var(--reaction-picker-y, 120px);
  z-index: 5;
  display: grid;
  gap: 4px;
  max-width: calc(100vw - 18px);
  padding: 6px;
  transform: translate(-50%, calc(-100% - 12px));
  border: 1px solid rgba(7, 94, 84, 0.12);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 55, 48, 0.22);
}

.reaction-picker-row {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: max-content;
}

.reaction-picker button {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 999px;
  background: transparent;
  font-size: 1.52rem;
  transition:
    transform 160ms ease,
    background 160ms ease;
}

.reaction-picker .reaction-custom-button {
  background: #edf2f0;
  color: var(--muted);
  font-size: 1.72rem;
  font-weight: 850;
}

.reaction-picker button:hover,
.reaction-picker button:focus-visible,
.reaction-picker button.active {
  background: var(--green-soft);
  transform: translateY(-3px);
}

.reaction-picker.custom-open {
  border-radius: 22px;
}

.custom-reaction-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto;
  gap: 6px;
  padding: 3px;
}

.custom-reaction-input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 1.05rem;
}

.custom-reaction-form button {
  width: auto;
  min-width: 44px;
  height: 36px;
  padding: 0 10px;
  color: #ffffff;
  background: var(--green);
  font-size: 0.82rem;
}

.reaction-summary {
  position: absolute;
  right: 10px;
  bottom: -14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(7, 94, 84, 0.14);
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(31, 55, 48, 0.18);
  font-weight: 900;
}

.update-bubble.incoming .reaction-summary {
  right: auto;
  left: 10px;
}

.reaction-summary.active {
  border-color: var(--green-dark);
  color: var(--green-dark);
}

.reaction-summary-emojis {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.reaction-summary strong {
  font-size: 0.78rem;
}

.post-media {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: 330px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  object-fit: cover;
  background: #dce7e2;
  -webkit-touch-callout: none;
  user-select: none;
}

.post-media-frame img.post-media {
  -webkit-user-drag: none;
  pointer-events: none;
}

.post-media-frame {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 160px;
  margin-bottom: 10px;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #eeeaf8;
  text-align: left;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: manipulation;
  transition: none;
}

.post-media-frame:active,
.post-media-frame.is-touching,
.post-media-frame:focus {
  transform: none;
  box-shadow: none;
  filter: none;
}

.post-media-frame:focus-visible {
  outline: 2px solid rgba(148, 56, 255, 0.24);
  outline-offset: 2px;
}

.post-media-frame .post-media {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  opacity: 0;
  transition: opacity 180ms ease;
}

.post-media-thumb-preview {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
  opacity: 0.9;
  filter: blur(10px) saturate(1.04);
  transform: scale(1.04);
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.post-media-frame.loaded .post-media {
  opacity: 1;
}

.post-media-frame.loaded .post-media-thumb-preview {
  opacity: 0;
}

.post-media-frame.loaded .media-loading-ring,
.post-media-frame.error .media-loading-ring {
  display: none;
}

.post-media-frame.error::after {
  content: "Image load nahi hui";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--red);
  background: #fff6f6;
  font-weight: 900;
}

.media-loading-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 3px solid rgba(114, 36, 245, 0.2);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
  transform: translate(-50%, -50%);
}

.post-media-frame[data-action="open-image-viewer"] {
  cursor: zoom-in;
}

.post-media-gallery {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 100%;
  min-width: 0;
  margin-bottom: 10px;
}

.post-media-gallery .post-media-frame,
.post-media-gallery .post-media {
  height: 180px;
  max-height: none;
}

.post-media-gallery .post-media {
  object-fit: cover;
}

.post-media-gallery .post-media-frame:only-child {
  grid-column: 1 / -1;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 0;
  background: #050507;
}

.image-viewer.hidden {
  display: none;
}

.image-viewer-stage {
  display: grid;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}

.image-viewer img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 0;
  object-fit: contain;
  object-position: center center;
  box-shadow: none;
}

.image-viewer.loading img {
  opacity: 0.2;
}

.image-viewer-loader {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 101;
  display: none;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.22);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 800ms linear infinite;
  transform: translate(-50%, -50%);
}

.image-viewer.loading .image-viewer-loader {
  display: block;
}

.image-viewer-back {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  top: max(12px, env(safe-area-inset-top));
  z-index: 101;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.image-viewer-back-icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.image-viewer-open {
  overflow: hidden;
}

.media-load-card {
  display: grid;
  align-items: center;
  gap: 10px;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  width: 100%;
  min-height: 68px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid rgba(114, 36, 245, 0.14);
  border-radius: var(--radius);
  color: var(--ink);
  background: linear-gradient(135deg, #ffffff, #f8f4ff);
  box-shadow: 0 8px 20px rgba(74, 35, 143, 0.08);
  text-align: left;
}

.media-load-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 950;
}

.media-load-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.media-load-copy strong,
.media-load-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-load-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.media-load-action {
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 950;
}

.admin-panel {
  align-self: start;
  padding: 14px;
}

.admin-shell {
  width: min(1040px, 100%);
}

.admin-dashboard {
  display: grid;
  gap: 16px;
  grid-template-columns: 360px minmax(0, 1fr);
}

.admin-chat-dashboard {
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}

.admin-preview {
  overflow: hidden;
}

.admin-chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr) auto;
}

.admin-feed {
  min-height: 440px;
  max-height: 58vh;
}

.chat-lock-button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: var(--radius);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 850;
}

.instagram-import-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
}

.instagram-import-head,
.instagram-import-form,
.instagram-approval-actions,
.instagram-approval-meta {
  display: flex;
  align-items: center;
}

.instagram-import-head {
  justify-content: space-between;
  gap: 10px;
}

.instagram-import-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.instagram-import-head strong {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.15;
}

.instagram-import-head span,
.instagram-approval-meta span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.instagram-scan-button,
.instagram-add-button,
.instagram-approval-actions button,
.instagram-approval-actions a,
.instagram-profile-pill button {
  min-height: 34px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.instagram-scan-button,
.instagram-add-button,
.instagram-approval-actions button[data-ig-approve] {
  color: #ffffff;
  background: #0f9f6e;
}

.instagram-scan-button {
  min-width: 66px;
}

.instagram-import-form {
  gap: 8px;
}

.instagram-import-form input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.instagram-import-form input:disabled,
.instagram-import-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.game-upload-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-feature-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fff;
  scrollbar-width: none;
}

.admin-feature-tabs button {
  min-width: 130px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: var(--soft);
  font-weight: 850;
  cursor: pointer;
}

.admin-feature-tabs button.active {
  border-color: var(--green);
  color: #fff;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
}

.admin-upload-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fff;
}

.admin-upload-panel > div,
.admin-media-upload-form,
.admin-media-upload-form label {
  display: grid;
  gap: 7px;
}

.admin-upload-panel > div span,
.admin-media-upload-form label span,
.admin-upload-status {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.admin-media-upload-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-media-upload-form textarea,
.admin-media-upload-form button,
.admin-upload-status {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 620px) {
  .admin-feature-tabs {
    display: flex;
  }

  .admin-media-upload-form {
    grid-template-columns: 1fr;
  }
}

.game-upload-panel > div,
.game-upload-form,
.game-upload-form label {
  display: grid;
  gap: 6px;
}

.game-upload-panel > div span,
.game-upload-form label span,
.game-upload-status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.game-upload-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.game-upload-form input {
  width: 100%;
  min-width: 0;
}

.game-upload-form .primary-button,
.game-upload-status {
  grid-column: 1 / -1;
  margin: 0;
}

@media (max-width: 620px) {
  .game-upload-form {
    grid-template-columns: 1fr;
  }
}

.instagram-profile-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.instagram-profile-strip::-webkit-scrollbar {
  display: none;
}

.instagram-profile-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(15, 159, 110, 0.18);
  border-radius: 999px;
  background: #ffffff;
}

.instagram-profile-pill button {
  min-height: 32px;
  border-radius: 0;
  color: var(--green-dark);
  background: transparent;
}

.instagram-profile-pill button:first-child {
  padding: 0 10px;
}

.instagram-profile-pill button:last-child {
  width: 34px;
  padding: 0;
  border-left: 1px solid rgba(15, 159, 110, 0.14);
  color: var(--red);
}

.instagram-approval-list {
  display: grid;
  gap: 8px;
}

.instagram-approval-card {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(16, 24, 40, 0.1);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
  cursor: pointer;
}

.instagram-approval-card:hover {
  border-color: rgba(15, 159, 110, 0.3);
  box-shadow: 0 12px 28px rgba(15, 159, 110, 0.12);
}

.instagram-approval-media {
  position: relative;
  overflow: hidden;
  width: 86px;
  height: 86px;
  border-radius: 8px;
  background: #111827;
}

.instagram-approval-media img,
.instagram-approval-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.instagram-approval-media > span:not(.instagram-media-count) {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #ffffff;
  font-weight: 950;
}

.instagram-media-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(17, 24, 39, 0.78);
  font-size: 0.76rem;
  font-weight: 950;
}

.instagram-approval-copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.instagram-approval-meta {
  justify-content: space-between;
  gap: 8px;
}

.instagram-approval-meta strong {
  min-width: 0;
  color: var(--ink);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.instagram-approval-copy p {
  display: -webkit-box;
  margin: 0;
  color: #344054;
  font-size: 0.84rem;
  font-weight: 760;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.instagram-approval-actions {
  flex-wrap: wrap;
  gap: 7px;
}

.instagram-approval-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  color: #175cd3;
  background: rgba(23, 92, 211, 0.08);
}

.instagram-approval-actions button {
  padding: 0 10px;
}

.instagram-approval-actions button[data-ig-reject] {
  color: var(--red);
  background: rgba(215, 55, 63, 0.1);
}

.instagram-empty {
  min-height: 38px;
  padding: 10px;
  border: 1px dashed rgba(16, 24, 40, 0.16);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  font-size: 0.82rem;
  font-weight: 850;
}

.whatsapp-composer {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: #f2f4f7;
}

.composer-row {
  display: grid;
  align-items: center;
  gap: 9px;
  grid-template-columns: 42px minmax(0, 1fr) 56px;
}

.whatsapp-composer.has-media .composer-row {
  grid-template-columns: 62px minmax(0, 1fr) 56px;
}

.whatsapp-composer.has-media .plus-button {
  display: none;
}

.plus-button,
.send-button {
  min-height: 42px;
  border-radius: 999px;
  font-weight: 900;
}

.plus-button {
  width: 42px;
  padding: 0;
  color: #ffffff;
  background: var(--green-dark);
  font-size: 1.35rem;
  line-height: 1;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  position: relative;
  width: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  color: #ffffff;
  background: #12b76a;
  box-shadow: 0 12px 26px rgba(18, 183, 106, 0.24);
  font-size: 1.35rem;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.send-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

.send-button.sending .send-spinner {
  display: inline-block;
}

.send-button.sending .send-label {
  display: none;
}

.send-count {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: #101828;
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1;
}

.send-count.hidden {
  display: none;
}

.composer-status {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.82rem;
  font-weight: 900;
}

.composer-status.hidden {
  display: none;
}

.composer-status.sending::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-right: 7px;
  border: 2px solid rgba(114, 36, 245, 0.24);
  border-top-color: var(--green-dark);
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

.composer-status.success {
  color: #08785e;
  background: rgba(32, 217, 155, 0.14);
}

.composer-status.error {
  color: var(--red);
  background: rgba(215, 55, 63, 0.1);
}

.hd-upload-toggle {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 56, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.hd-upload-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

.hd-upload-toggle:has(input:checked) {
  color: var(--green-dark);
  background: var(--green-soft);
}

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

#messageInput {
  min-height: 54px;
  max-height: 120px;
  padding: 14px 18px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(232, 224, 247, 0.8);
  font-size: 1rem;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}

.attachment-menu {
  position: absolute;
  left: 12px;
  bottom: 66px;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.attachment-menu button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--soft);
  font-weight: 850;
  text-align: left;
}

.selected-attachment {
  position: relative;
  display: block;
  width: 62px;
  height: 58px;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

.attachment-strip {
  width: 100%;
  height: 100%;
}

.attachment-thumb {
  position: relative;
  width: 62px;
  height: 58px;
  overflow: hidden;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(31, 12, 74, 0.12);
}

.attachment-thumb img,
.attachment-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-edit {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(16, 24, 40, 0.62);
  font-size: 0.88rem;
  font-weight: 950;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(2px);
}

.attachment-total {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  color: #ffffff;
  background: #101828;
  font-size: 0.78rem;
  font-weight: 950;
}

.selected-attachment .text-button {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 2;
  width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(16, 24, 40, 0.78);
  font-size: 0.72rem;
}

#attachmentLabel {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.attachment-menu.hidden,
.selected-attachment.hidden {
  display: none;
}

.login-card,
.composer-card,
.control-panel,
.voice-studio,
.learn-note {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--green);
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: var(--green);
}

.volume-control {
  gap: 10px;
  min-height: 74px;
}

.volume-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.volume-head > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.volume-head > span::before {
  content: "\1F50A";
  font-size: 1.25rem;
}

.volume-head strong {
  min-width: 56px;
  text-align: right;
  color: var(--green-dark);
  font-size: 0.94rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.volume-control input[type="range"] {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green-dark), #bc52f2);
}

.volume-control input[type="range"]::-webkit-slider-thumb {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #9438ff;
  box-shadow: 0 8px 18px rgba(114, 36, 245, 0.26);
  appearance: none;
}

.volume-control input[type="range"]::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #9438ff;
  box-shadow: 0 8px 18px rgba(114, 36, 245, 0.26);
}

input:disabled,
select:disabled,
textarea:disabled {
  color: var(--muted);
  background: #eef4f1;
  cursor: not-allowed;
}

.form-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.monologue-card {
  min-height: 520px;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(247, 250, 248, 0.96)),
    radial-gradient(circle at 94% 8%, rgba(245, 200, 81, 0.25), transparent 28%);
}

.monologue-card h3 {
  margin-bottom: 16px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.monologue-card p {
  color: #263530;
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.75;
  white-space: pre-wrap;
}

.monologue-meta,
.performance-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.performance-notes {
  margin-top: 22px;
  margin-bottom: 0;
}

.monologue-meta span,
.performance-notes span,
.routine-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.routine-list {
  display: grid;
  gap: 12px;
}

.routine-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.routine-card.done {
  border-color: rgba(15, 123, 95, 0.45);
  background: #f5fffb;
}

.routine-item-head {
  justify-content: space-between;
  gap: 12px;
}

.routine-item-head div {
  min-width: 0;
}

.routine-card h3 {
  margin-bottom: 4px;
}

.routine-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.routine-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.voice-studio {
  align-self: start;
  position: static;
  gap: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.music-file-card,
.music-status,
.volume-control {
  padding: 18px;
  border: 1px solid rgba(232, 224, 247, 0.86);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 32px rgba(80, 43, 150, 0.08);
}

.music-file-card {
  position: relative;
  display: grid;
  gap: 13px;
  overflow: hidden;
  padding: 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(148, 56, 255, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 247, 255, 0.96) 100%);
  box-shadow:
    0 18px 38px rgba(80, 43, 150, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.music-file-card > * {
  position: relative;
  z-index: 1;
}

.music-file-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.music-file-label {
  display: block;
  color: #2d2940;
  font-size: 1.02rem;
  font-weight: 950;
  line-height: 1.12;
}

.music-file-subtitle {
  display: block;
  margin-top: 4px;
  color: #7b728d;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
}

.music-file-count {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  border: 1px solid rgba(122, 34, 244, 0.14);
  border-radius: 999px;
  color: #6f22dc;
  background: rgba(242, 233, 255, 0.92);
  font-size: 0.76rem;
  font-weight: 950;
  white-space: nowrap;
}

.music-file-count.is-empty {
  color: #a72a38;
  background: #fff1f3;
  border-color: rgba(215, 55, 63, 0.18);
}

.music-select-row {
  position: relative;
  display: block;
}

.music-search-row {
  position: relative;
  display: block;
}

.music-search-row input {
  min-height: 44px;
  padding: 0 15px 0 43px;
  border: 1px solid rgba(232, 224, 247, 0.92);
  border-radius: 16px;
  color: #20172f;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.96rem;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.music-search-row input::placeholder {
  color: #80758f;
  font-weight: 800;
}

.music-search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 16px;
  height: 16px;
  border: 2px solid #7a22f4;
  border-radius: 50%;
  transform: translateY(-55%);
  pointer-events: none;
}

.music-search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #7a22f4;
  transform: rotate(45deg);
}

.music-search-results {
  display: grid;
  max-height: 246px;
  overflow: auto;
  gap: 3px;
  margin-top: -3px;
  padding: 7px;
  border: 1px solid rgba(226, 215, 247, 0.94);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 14px 28px rgba(80, 43, 150, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.music-search-results.hidden {
  display: none;
}

.music-search-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 6px 7px;
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.music-search-result:active,
.music-search-result:focus-visible {
  background: rgba(242, 233, 255, 0.98);
}

.music-search-result-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(135deg, #7a22f4, #20d99b);
  font-size: 1.2rem;
  font-weight: 900;
}

.music-search-result-icon.has-cover {
  color: transparent;
  background-position: center;
  background-size: cover;
}

.music-search-result-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.music-search-result-copy strong,
.music-search-result-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-search-result-copy strong {
  font-size: 0.92rem;
  font-weight: 900;
}

.music-search-result-copy small {
  color: #766d84;
  font-size: 0.74rem;
  font-weight: 780;
}

.music-search-result-more {
  display: block;
  padding: 4px 8px 2px;
  color: #7a22f4;
  font-size: 0.72rem;
  font-weight: 900;
}

.music-select-row::before {
  content: none;
  position: absolute;
  left: 22px;
  top: 50%;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--green-dark);
  font-size: 1.8rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.music-picker-open {
  display: grid;
  width: 100%;
  min-height: 74px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(226, 215, 247, 0.94);
  border-radius: 18px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 239, 255, 0.96));
  text-align: left;
  box-shadow:
    0 12px 24px rgba(80, 43, 150, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.music-picker-note {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #7a22f4, #20d99b);
  font-size: 1.55rem;
  font-weight: 900;
  box-shadow: 0 10px 18px rgba(122, 34, 244, 0.2);
}

.music-picker-note.has-cover {
  color: transparent;
  background-position: center;
  background-size: cover;
}

.music-picker-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.music-picker-copy strong {
  overflow: hidden;
  font-size: 1.08rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-picker-copy small {
  overflow: hidden;
  color: #7a7285;
  font-size: 0.78rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-picker-chevron {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  color: #7a22f4;
  background: rgba(242, 233, 255, 0.92);
  font-size: 1.7rem;
  font-weight: 900;
}

.music-file-card select {
  min-height: 66px;
  padding-left: 64px;
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  font-size: 1.1rem;
  font-weight: 900;
}

.music-file-card .music-track-select-hidden {
  display: none;
}

.music-file-card::after {
  content: none;
}

.music-track-hint {
  display: inline-flex;
  width: fit-content;
  min-height: 27px;
  align-items: center;
  padding: 0 11px;
  border-radius: 999px;
  color: #6f22dc;
  background: rgba(240, 231, 255, 0.92);
  font-size: 0.78rem;
  font-weight: 950;
}

.music-track-hint.is-empty {
  color: #b72035;
  background: #fff0f2;
}

.music-browser {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  overflow: hidden;
  padding: 10px 18px 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(148, 56, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf9ff 0%, var(--bg) 46%, #ffffff 100%);
}

.music-browser.hidden {
  display: none;
}

body.music-browser-open {
  overflow: hidden;
}

.music-browser-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.music-browser-top h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.22rem, 4vw, 1.85rem);
  line-height: 1.1;
}

.music-browser-top .tiny-label {
  margin-bottom: 3px;
  color: var(--green-dark);
  font-size: 0.72rem;
}

.music-browser-close {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(80, 43, 150, 0.12);
  font-size: 2.18rem;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

.music-browser-close span {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  line-height: 1;
  transform: translateY(-2px);
}

.music-browser-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 96px;
  margin: 0 -18px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(232, 224, 247, 0.92);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -16px 42px rgba(80, 43, 150, 0.12);
  backdrop-filter: blur(18px);
  cursor: pointer;
}

.music-browser-cover,
.music-browser-art {
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #ffffff;
  background: linear-gradient(135deg, #20d99b, #7a22f4);
}

.music-browser-cover {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  font-size: 1.55rem;
}

.music-browser-player-main,
.music-browser-track-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.music-browser-player-main {
  gap: 8px;
}

.music-browser-player-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.music-browser-player small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  text-transform: uppercase;
}

.music-browser-player strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser-player-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser-progress-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.music-browser-progress-row > span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 950;
  text-align: center;
}

.music-browser-progress {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(123, 44, 255, 0.12);
  cursor: pointer;
  touch-action: none;
}

.music-browser-progress::before {
  content: "";
  position: absolute;
  inset: -12px 0;
}

.music-browser-progress span {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20d99b, #7b2cff);
  transition: width 180ms ease;
}

.music-browser-progress span::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(122, 34, 244, 0.16);
  transform: translateY(-50%);
}

.music-browser-player-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.music-browser-control {
  display: grid;
  width: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  color: #5f22d9;
  background: rgba(242, 233, 255, 0.92);
  box-shadow: 0 8px 18px rgba(114, 36, 245, 0.12);
  font-size: 0.76rem;
  font-weight: 950;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.music-browser-control:disabled {
  opacity: 0.42;
  box-shadow: none;
}

.music-browser-control:not(:disabled):active {
  transform: scale(0.94);
  background: rgba(225, 207, 255, 0.98);
}

.music-browser-control-main {
  width: 52px;
  min-height: 52px;
  color: #ffffff;
  background: linear-gradient(135deg, #9438ff, #7224f5);
  box-shadow: 0 12px 24px rgba(114, 36, 245, 0.3);
  font-size: 1rem;
}

.music-browser-control-main #musicBrowserPlayIcon {
  display: grid;
  place-items: center;
}

.music-browser-control-main .music-now-icon {
  width: 1.55rem;
  height: 1.55rem;
}

.music-browser-control-main:disabled {
  opacity: 0.48;
}

.music-browser-search {
  position: relative;
  display: block;
  color: var(--ink);
  margin-top: -2px;
}

.music-browser-search input {
  min-height: 42px;
  padding: 0 14px 0 42px;
  border: 0;
  border-radius: 12px;
  color: #34323c;
  background: #ffffff;
  font-size: 0.9rem;
  font-weight: 760;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.17);
}

.music-browser-search input::placeholder {
  color: #77727f;
}

.music-browser-search .music-search-icon {
  left: 16px;
  width: 15px;
  height: 15px;
  border-color: #77727f;
}

.music-browser-search .music-search-icon::after {
  background: #77727f;
}

.music-browser-search::after,
.music-browser-search::before {
  content: none;
}

.music-browser-body {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 14px;
  scrollbar-width: none;
}

.music-browser-body::-webkit-scrollbar {
  display: none;
}

.music-now-playing {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto auto auto auto;
  gap: 17px;
  overflow-y: auto;
  padding: max(18px, env(safe-area-inset-top, 0px)) 24px calc(18px + env(safe-area-inset-bottom, 0px));
  color: #ffffff;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.13), transparent 34%),
    linear-gradient(180deg, #6b675c 0%, #4b493f 30%, #20201d 76%, #111111 100%);
  scrollbar-width: none;
}

.music-now-playing::-webkit-scrollbar {
  display: none;
}

.music-now-playing.hidden {
  display: none;
}

.music-now-top {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.music-now-top div {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 3px;
  text-align: center;
}

.music-now-top small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.music-now-top strong {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-now-close,
.music-now-menu {
  display: grid;
  width: 46px;
  min-height: 46px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-now-icon {
  display: block;
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  overflow: visible;
}

.music-now-playing svg [stroke] {
  stroke-width: 2.35;
}

.music-now-close .music-now-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.music-now-menu .music-now-icon {
  width: 1.55rem;
  height: 1.55rem;
}

.music-now-cover {
  align-self: center;
  justify-self: center;
  display: grid;
  width: min(82vw, 512px);
  max-height: min(52vh, 512px);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  color: #ffffff;
  background:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.2), transparent 26%),
    linear-gradient(135deg, #5d5545, #2a2822 58%, #111111);
  background-position: center;
  background-size: cover;
  box-shadow: 0 22px 55px rgba(0, 0, 0, 0.38);
}

.music-now-cover.has-cover {
  background-color: #161616;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.music-now-cover span {
  display: grid;
  width: 42%;
  height: 42%;
  place-items: center;
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.22);
  font-size: clamp(4rem, 16vw, 8rem);
  backdrop-filter: blur(10px);
}

.music-now-cover.has-cover span {
  display: none;
}

.music-browser-cover.has-cover,
.music-browser-art.has-cover {
  background-position: center;
  background-size: cover;
}

.music-browser-cover.has-cover span,
.music-browser-art.has-cover span {
  display: none;
}

.music-now-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.music-now-copy h3 {
  margin: 0 0 6px;
  overflow: hidden;
  color: #ffffff;
  font-size: clamp(1.32rem, 5.7vw, 2.15rem);
  font-weight: 700;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-now-copy p {
  margin: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.64);
  font-size: clamp(0.88rem, 3.1vw, 1.02rem);
  font-weight: 450;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-now-add {
  display: grid;
  width: 46px;
  min-height: 46px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-now-add .music-now-icon {
  width: 1.85rem;
  height: 1.85rem;
}

.music-now-progress {
  display: grid;
  gap: 8px;
}

.music-now-progress-track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  cursor: pointer;
  touch-action: none;
}

.music-now-progress-track::before {
  content: "";
  position: absolute;
  inset: -14px 0;
}

.music-now-progress-track span {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #ffffff;
  transition: width 180ms ease;
}

.music-now-progress-track span::after {
  content: "";
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16);
  opacity: 1;
  transform: translateY(-50%) scale(1);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.music-now-progress-track:hover span::after,
.music-now-progress-track:focus-visible span::after,
.music-now-progress-track.is-seeking span::after {
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18);
}

.music-now-time {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  font-weight: 500;
}

.music-now-controls {
  display: grid;
  grid-template-columns: 38px 48px 72px 48px 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.music-now-controls button {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  transition: transform 160ms ease, opacity 160ms ease;
}

.music-now-controls button:disabled {
  opacity: 0.38;
}

.music-now-controls button:not(:disabled):active {
  transform: scale(0.94);
}

.music-now-side {
  width: 38px;
  min-height: 38px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.62rem;
  font-weight: 500;
}

.music-now-side .music-now-icon,
.music-now-main-control .music-now-icon,
.music-now-actions .music-now-icon {
  filter: none;
}

.music-now-controls svg [stroke] {
  stroke-width: 2.45;
}

.music-now-actions svg [stroke] {
  stroke-width: 2.25;
}

.music-now-side.is-active {
  color: #1ed760;
}

.music-now-main-control {
  width: 48px;
  min-height: 48px;
  font-size: 2.08rem;
  font-weight: 600;
}

.music-now-play {
  width: 72px;
  min-height: 72px;
  border-radius: 999px !important;
  color: #101010 !important;
  background: #ffffff !important;
  font-size: 2rem;
  font-weight: 650;
}

.music-now-play span {
  display: grid;
  place-items: center;
}

.music-now-play .music-now-icon {
  width: 1.85rem;
  height: 1.85rem;
}

.music-now-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 18px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.55rem;
  font-weight: 500;
}

.music-now-actions span {
  display: grid;
  width: 40px;
  min-height: 40px;
  align-items: center;
}

.music-now-actions span:nth-child(2) {
  justify-self: center;
}

.music-now-actions span:nth-child(3) {
  justify-self: end;
}

.music-category-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
  padding-bottom: 0;
}

.music-browser.music-category-detail .music-category-list {
  display: none;
}

.music-category-list::-webkit-scrollbar {
  display: none;
}

.music-category-list button {
  position: relative;
  display: grid;
  min-height: 112px;
  align-content: start;
  gap: 6px;
  overflow: hidden;
  padding: 16px 15px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(148, 56, 255, 0.96), rgba(114, 36, 245, 0.88));
  font-weight: 900;
  text-align: left;
  isolation: isolate;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
}

.music-category-list button::before {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -34px;
  width: 112px;
  height: 112px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.18);
  transform: rotate(-12deg);
  z-index: -1;
}

.music-category-list button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: transparent;
  transition: background 160ms ease;
}

.music-category-list button:active {
  transform: scale(0.985);
}

.music-category-list button.active {
  filter: none;
  box-shadow: none;
  transform: translateY(-1px);
}

.music-category-list button.active::after {
  background: rgba(255, 255, 255, 0.18);
}

.music-category-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.45rem;
  line-height: 1;
  box-shadow: none;
}

.music-category-name {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #ffffff;
  font-size: clamp(0.96rem, 3.6vw, 1.18rem);
  line-height: 1.12;
}

.music-category-list small {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.68rem;
  font-weight: 900;
}

.music-category-empty {
  grid-column: 1 / -1;
  padding: 14px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.music-browser-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow: visible;
  padding-bottom: 4px;
}

.music-browser-list-head {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 4px 2px 8px;
  color: var(--ink);
}

.music-browser-list-head button {
  display: grid;
  width: 48px;
  min-height: 48px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #171321;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(80, 43, 150, 0.12);
  font-size: 1.55rem;
  font-weight: 950;
}

.music-browser-list-head div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.music-browser-list-head small {
  color: #6c23de;
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.music-browser-list-head strong {
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.22rem, 5vw, 1.8rem);
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser-list-head span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.music-browser .empty-state {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: none;
}

.music-browser .empty-state strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.music-browser .empty-state span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.music-browser-track {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(80, 43, 150, 0.1);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.music-browser-track.selected {
  background: rgba(242, 233, 255, 0.92);
}

.music-browser-track.playing {
  background: linear-gradient(135deg, rgba(242, 233, 255, 0.96), rgba(230, 255, 246, 0.96));
  box-shadow: 0 14px 30px rgba(114, 36, 245, 0.16);
}

.music-browser-track:active {
  transform: scale(0.985);
  background: rgba(235, 225, 255, 0.96);
}

.music-browser-art {
  width: 54px;
  height: 54px;
  font-size: 1.45rem;
}

.music-browser-track-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.98rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser-track-copy span,
.music-browser-track-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser-track-status {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: #6c23de;
}

.music-browser-track-status span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: #181818;
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 950;
}

.music-browser-track-status small {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
  white-space: nowrap;
}

.music-browser {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  color: #ffffff;
  background: #000000;
}

.music-browser-top {
  min-height: 76px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #191919;
  background: #000000;
}

.music-browser-top h2 {
  color: #ffffff;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
}

.music-browser-top .tiny-label {
  color: rgba(255, 255, 255, 0.54);
}

.music-browser-close {
  border: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-browser-search {
  margin: 0;
  padding: 12px 24px;
  background: #000000;
}

.music-browser-search input {
  min-height: 44px;
  color: #ffffff;
  background: #181818;
  box-shadow: none;
}

.music-browser-search input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.music-browser-search .music-search-icon {
  left: 40px;
  border-color: rgba(255, 255, 255, 0.62);
}

.music-browser-search .music-search-icon::after {
  background: rgba(255, 255, 255, 0.62);
}

.music-browser-body {
  gap: 12px;
  padding: 12px 24px 110px;
  background: #000000;
}

.music-category-list {
  gap: 10px;
}

.music-category-list button {
  min-height: 104px;
  border-radius: 14px;
  background: #181818;
  box-shadow: none;
}

.music-category-list button:nth-child(n) {
  background: linear-gradient(135deg, #181818, #242424);
}

.music-category-list button.active,
.music-category-list button:active {
  background: linear-gradient(135deg, #262626, #333333);
  box-shadow: none;
}

.music-category-icon {
  background: rgba(255, 255, 255, 0.12);
}

.music-category-list small {
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.1);
}

.music-browser.music-category-detail {
  grid-template-rows: minmax(0, 1fr) auto;
}

.music-browser.music-category-detail .music-browser-top,
.music-browser.music-category-detail .music-browser-search {
  display: none;
}

.music-browser.music-category-detail .music-browser-body {
  position: relative;
  gap: 0;
  padding: 0 24px 116px;
}

.music-browser.music-category-detail .music-browser-list {
  gap: 0;
  padding: 0;
}

.music-browser-list-head {
  position: sticky;
  top: 0;
  z-index: 4;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 86px;
  margin: 0 -24px 8px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #191919;
  color: #ffffff;
  background: #000000;
}

.music-browser-list-head button {
  width: 48px;
  min-height: 48px;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-size: 2.7rem;
  font-weight: 900;
}

.music-browser-list-head .music-list-back {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.music-browser-list-head div {
  justify-items: center;
  text-align: center;
}

.music-browser-list-head strong {
  color: #ffffff;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
}

.music-browser-list-head small {
  display: none;
}

.music-browser-list-head .music-list-back span {
  position: relative;
  display: block;
  width: 25px;
  height: 20px;
  font-size: 0;
  line-height: 0;
}

.music-browser-list-head .music-list-back span::before,
.music-browser-list-head .music-list-back span::after {
  content: "";
  position: absolute;
  display: block;
  background: #ffffff;
}

.music-browser-list-head .music-list-back span::before {
  top: 50%;
  right: 0;
  width: 23px;
  height: 3px;
  border-radius: 999px;
  transform: translateY(-50%);
}

.music-browser-list-head .music-list-back span::after {
  left: 1px;
  top: 50%;
  width: 13px;
  height: 13px;
  border-radius: 3px 0 0 0;
  border-left: 3px solid #ffffff;
  border-top: 3px solid #ffffff;
  background: transparent;
  transform: translateY(-50%) rotate(-45deg);
  transform-origin: center;
}

.music-browser.music-category-detail .music-browser-list::after {
  content: none;
}

.music-browser-track {
  grid-template-columns: 74px minmax(0, 1fr) 34px;
  gap: 14px;
  padding: 12px 0;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-browser-track.selected,
.music-browser-track.playing,
.music-browser-track:active {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.music-browser-track.playing .music-browser-track-copy strong {
  color: #ffffff;
}

.music-browser-art {
  width: 62px;
  height: 62px;
  border-radius: 5px;
  color: #ffffff;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.22), transparent 25%),
    linear-gradient(135deg, #292929, #464646);
  font-size: 1.45rem;
}

.music-browser-track-copy {
  gap: 2px;
}

.music-browser-track-copy strong {
  color: #ffffff;
  font-size: clamp(1.03rem, 4vw, 1.24rem);
  font-weight: 900;
  line-height: 1.16;
}

.music-browser-track-copy span {
  color: rgba(255, 255, 255, 0.62);
  font-size: clamp(0.88rem, 3.5vw, 1rem);
  font-weight: 760;
}

.music-browser.music-category-detail .music-browser-track-copy small {
  display: none;
}

.music-browser-track-status {
  justify-items: end;
}

.music-browser-track-status span {
  width: 28px;
  height: 44px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  box-shadow: none;
  font-size: 2rem;
  line-height: 1;
}

.music-browser-track-status small {
  display: none;
}

.music-browser-player {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 88px;
  margin: 0;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #2a2a2a;
  color: #ffffff;
  background: #202020;
  box-shadow: none;
  backdrop-filter: none;
}

.music-browser-cover {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: linear-gradient(135deg, #3b3b3b, #111111);
}

.music-browser-player small,
.music-browser-progress-row,
.music-browser-control:not(.music-browser-control-main) {
  display: none;
}

.music-browser-player strong {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
}

.music-browser-player-copy > span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.88rem;
}

.music-browser-control-main {
  width: 54px;
  min-height: 54px;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-size: 1.8rem;
}

.music-browser-control-main .music-now-icon {
  width: 1.62rem;
  height: 1.62rem;
}

.music-browser-control-main:not(:disabled):active {
  background: transparent;
}

.music-now-playing {
  color: #ffffff;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, 0.13), transparent 34%),
    linear-gradient(180deg, #6b675c 0%, #4b493f 30%, #20201d 76%, #111111 100%);
}

.music-now-cover {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 24%),
    linear-gradient(135deg, #3a3a3a, #111111);
}

/* Restore original black music app theme */
.music-browser {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0;
  padding: 0;
  color: #ffffff;
  background: #000000;
}

.music-browser-top {
  min-height: 76px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #191919;
  background: #000000;
  backdrop-filter: none;
}

.music-browser-top h2 {
  color: #ffffff;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
}

.music-browser-top .tiny-label {
  color: rgba(255, 255, 255, 0.54);
}

.music-browser-close {
  border: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-browser-search {
  margin: 0;
  padding: 12px 24px;
  background: #000000;
}

.music-browser-search input {
  min-height: 44px;
  color: #ffffff;
  background: #181818;
  box-shadow: none;
}

.music-browser-search input::placeholder {
  color: rgba(255, 255, 255, 0.58);
}

.music-browser-search .music-search-icon {
  left: 40px;
  border-color: rgba(255, 255, 255, 0.62);
}

.music-browser-search .music-search-icon::after {
  background: rgba(255, 255, 255, 0.62);
}

.music-browser-body {
  gap: 12px;
  padding: 12px 24px 110px;
  background: #000000;
}

.music-category-list {
  gap: 10px;
}

.music-category-list button,
.music-category-list button:nth-child(n) {
  min-height: 104px;
  border-radius: 14px;
  background: linear-gradient(135deg, #181818, #242424);
  box-shadow: none;
  filter: none;
}

.music-category-list button.active,
.music-category-list button:active {
  background: linear-gradient(135deg, #262626, #333333);
  box-shadow: none;
  filter: none;
}

.music-category-icon {
  background: rgba(255, 255, 255, 0.12);
}

.music-category-list small {
  color: rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.1);
}

.music-browser.music-category-detail {
  grid-template-rows: minmax(0, 1fr) auto;
}

.music-browser.music-category-detail .music-browser-top,
.music-browser.music-category-detail .music-browser-search {
  display: none;
}

.music-browser.music-category-detail .music-browser-body {
  position: relative;
  gap: 0;
  padding: 0 24px 116px;
}

.music-browser.music-category-detail .music-browser-list {
  gap: 0;
  padding: 0;
}

.music-browser-list-head {
  position: sticky;
  top: 0;
  z-index: 4;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 86px;
  margin: 0 -24px 8px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid #191919;
  color: #ffffff;
  background: #000000;
  box-shadow: none;
}

.music-browser-list-head button,
.music-browser-list-head strong {
  color: #ffffff;
}

.music-browser-list-head strong {
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  font-weight: 900;
}

.music-browser-track {
  grid-template-columns: 74px minmax(0, 1fr) 34px;
  gap: 14px;
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.music-browser-track.selected,
.music-browser-track.playing,
.music-browser-track:active {
  background: transparent;
  box-shadow: none;
  transform: none;
}

.music-browser-track.playing .music-browser-track-copy strong,
.music-browser-track-copy strong {
  color: #ffffff;
  font-size: clamp(1.03rem, 4vw, 1.24rem);
  font-weight: 900;
  line-height: 1.16;
}

.music-browser-track-copy span {
  color: rgba(255, 255, 255, 0.62);
  font-size: clamp(0.88rem, 3.5vw, 1rem);
  font-weight: 760;
}

.music-browser-art {
  width: 62px;
  height: 62px;
  border-radius: 5px;
  color: #ffffff;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.22), transparent 25%),
    linear-gradient(135deg, #292929, #464646);
  font-size: 1.45rem;
}

.music-browser-track-status span {
  width: 28px;
  height: 44px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  box-shadow: none;
  font-size: 2rem;
  line-height: 1;
}

.music-browser-player {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 88px;
  margin: 0;
  padding: 9px 16px calc(9px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #2a2a2a;
  color: #ffffff;
  background: #202020;
  box-shadow: none;
  backdrop-filter: none;
}

.music-browser-cover {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  background: linear-gradient(135deg, #3b3b3b, #111111);
}

.music-browser-player strong {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
}

.music-browser-player-copy > span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.88rem;
}

.music-browser-control-main {
  width: 54px;
  min-height: 54px;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-size: 1.8rem;
}

.music-browser-control-main:not(:disabled):active {
  background: transparent;
}

.music-now-playing {
  color: #ffffff;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.08), transparent 30%),
    linear-gradient(180deg, #2a2a2a 0%, #111111 42%, #000000 100%);
}

.music-now-cover {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.2), transparent 24%),
    linear-gradient(135deg, #3a3a3a, #111111);
}

@media (max-width: 620px) {
  .music-browser {
    gap: 8px;
    padding: 10px 14px 0;
  }

  .music-now-playing {
    grid-template-rows: auto minmax(210px, 0.98fr) auto auto auto auto;
    gap: 16px;
    padding: max(14px, env(safe-area-inset-top, 0px)) 22px calc(22px + env(safe-area-inset-bottom, 0px));
  }

  .music-now-cover {
    width: min(82vw, 512px);
    max-height: min(52vh, 512px);
  }

  .music-now-controls {
    grid-template-columns: 36px 46px 68px 46px 36px;
    gap: 10px;
  }

  .music-now-play {
    width: 68px;
    min-height: 68px;
  }

  .music-browser-player {
    grid-template-columns: auto minmax(0, 1fr);
    margin-inline: -14px;
    padding-inline: 14px;
  }

  .music-browser-player-controls {
    grid-column: 1 / -1;
    justify-content: center;
    margin-top: 2px;
  }

  .music-browser-track {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}

@media (max-width: 380px) {
  .music-category-list {
    gap: 8px;
  }

  .music-category-list button {
    min-height: 104px;
    padding: 13px 12px;
  }

  .music-category-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    font-size: 1.28rem;
  }
}

@media (max-width: 620px) {
  .music-browser {
    gap: 0;
    padding: 0;
  }

  .music-browser-top {
    padding: 16px 22px 10px;
  }

  .music-browser-search {
    padding: 10px 22px;
  }

  .music-browser-search .music-search-icon {
    left: 38px;
  }

  .music-browser-body {
    padding: 10px 22px 108px;
  }

  .music-browser.music-category-detail .music-browser-body {
    padding: 0 24px 112px;
  }

  .music-browser-list-head {
    margin-inline: -24px;
    padding: 16px 24px 11px;
  }

  .music-browser-track {
    grid-template-columns: 74px minmax(0, 1fr) 30px;
    padding: 12px 0;
  }

  .music-browser-player {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    margin: 0;
    padding: 9px 16px calc(9px + env(safe-area-inset-bottom, 0px));
  }

  .music-browser-player-controls {
    grid-column: auto;
    justify-content: end;
    margin-top: 0;
  }
}

.learn-note {
  align-self: start;
  position: sticky;
  top: 84px;
}

.learn-note p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

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

[data-view="library"] .library-title-block {
  justify-content: space-between;
  align-items: end;
  margin: 8px 0 12px;
}

.library-search-shell {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 28;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
  padding: 7px 0;
  background: #fbf9ff;
  box-shadow: 0 0 0 100vmax #fbf9ff;
  clip-path: inset(0 -100vmax);
  transition: top 80ms linear;
}

body.drawer-open .library-search-shell,
body.profile-modal-open .library-search-shell,
body.image-viewer-open .library-search-shell,
body.practice-modal-open .library-search-shell {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.library-back-button {
  display: grid;
  width: 36px;
  min-height: 46px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: #171321;
  background: transparent;
  box-shadow: none;
}

.library-back-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.library-search-box {
  position: relative;
  display: block;
}

.library-search-box input {
  min-height: 46px;
  padding: 0 44px 0 15px;
  border: 1px solid rgba(122, 34, 244, 0.14);
  outline: 0;
  border-radius: 14px;
  color: #171321;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(55, 29, 120, 0.07);
  font-size: 0.94rem;
  font-weight: 850;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.library-search-box input:focus {
  border-color: rgba(122, 34, 244, 0.28);
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(55, 29, 120, 0.1);
}

.library-search-box input:active {
  transform: scale(0.997);
}

.library-search-box input::placeholder {
  color: #80758f;
  font-weight: 800;
}

.library-search-icon {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 16px;
  height: 16px;
  border: 2px solid #7a22f4;
  border-radius: 50%;
  transform: translateY(-55%);
  pointer-events: none;
}

.library-search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #7a22f4;
  transform: rotate(45deg);
}

.library-book-count {
  display: flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 12px;
  border-radius: 999px;
  color: #7024dd;
  background: #f0e7ff;
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}

.library-grid .empty-state {
  grid-column: 1 / -1;
}

.library-card {
  display: grid;
  gap: 9px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 32px rgba(80, 43, 150, 0.08);
}

.library-card > span {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background: var(--green-dark);
  font-weight: 950;
}

.library-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.library-book-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  padding: 14px;
  border: 1px solid rgba(115, 74, 224, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 18px 34px rgba(55, 29, 120, 0.08);
}

.library-cover {
  width: 100%;
  height: 100%;
  min-height: 152px;
  max-height: 188px;
  object-fit: cover;
  border-radius: 12px;
  background: #f2ecff;
  box-shadow: 0 10px 22px rgba(44, 24, 102, 0.14);
}

.library-book-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.library-book-tag {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  color: #7024dd;
  background: #f0e7ff;
  font-size: 0.75rem;
  font-weight: 950;
}

.library-book-body h3 {
  margin-bottom: 0;
  color: #141221;
  line-height: 1.15;
}

.library-book-body p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.library-author {
  color: #3a2f58;
  font-weight: 850;
}

.library-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.library-book-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, #7a22f4, #a334ef);
  font-size: 0.82rem;
  font-weight: 950;
  text-decoration: none;
}

.library-book-actions a:nth-child(2) {
  color: #251342;
  background: #f2ecff;
  border: 1px solid rgba(122, 34, 244, 0.18);
}

.teacher-filter {
  width: min(260px, 100%);
}

.teacher-filter select {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 12px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 900;
}

[data-view="locations"] .screen-title {
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.location-search-shell {
  display: grid;
  gap: 8px;
  grid-template-columns: 44px minmax(0, 1fr);
  margin-bottom: 8px;
}

.location-search-box {
  position: relative;
}

.location-search-box input {
  padding-right: 50px;
}

.location-search-button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--green-dark);
  background: transparent;
  box-shadow: none;
}

.search-icon {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  border: 2px solid #7a22f4;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: #7a22f4;
  transform: rotate(45deg);
  transform-origin: left center;
}

.filter-toggle {
  position: relative;
  display: grid;
  width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.location-filter-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--green-dark);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition:
    opacity 160ms ease,
    transform 180ms ease,
    stroke 180ms ease;
}

.filter-toggle.active .location-filter-icon {
  opacity: 0;
  transform: scale(0.82);
}

.filter-toggle.active {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.filter-toggle::before,
.filter-toggle::after {
  content: "";
  position: absolute;
  width: 21px;
  height: 2.5px;
  border-radius: 999px;
  background: #ffffff;
  opacity: 0;
  transform: scale(0.7);
  transition:
    opacity 160ms ease,
    transform 180ms ease;
}

.filter-toggle.active::before {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.filter-toggle.active::after {
  opacity: 1;
  transform: rotate(-45deg) scale(1);
}

.location-filter-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.location-filter-panel.hidden {
  display: none;
}

.city-picker {
  position: relative;
  display: grid;
  gap: 8px;
}

.city-picker-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
  text-align: left;
}

.city-picker-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--green-dark);
  border-bottom: 2px solid var(--green-dark);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.city-picker-toggle.open .city-picker-chevron {
  transform: rotate(225deg) translate(-2px, -1px);
}

.city-filter-list {
  display: grid;
  gap: 8px;
  max-height: 236px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(74, 35, 143, 0.12);
}

.city-filter-list.hidden {
  display: none;
}

.city-filter-list button {
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--soft);
  font-weight: 850;
  text-align: left;
}

.city-filter-list button.active {
  color: #ffffff;
  background: var(--green-dark);
}

.location-results-area {
  display: grid;
  gap: 12px;
}

.location-summary {
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 850;
}

.location-results {
  display: grid;
  gap: 12px;
}

.location-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.location-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.location-initial {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--yellow);
  font-weight: 900;
}

.location-kind {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 5px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.location-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.48;
}

.location-card .location-address {
  color: var(--ink);
  font-weight: 850;
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 0.84rem;
  font-weight: 850;
  text-decoration: none;
}

.location-actions a:nth-child(2) {
  color: var(--ink);
  background: var(--yellow);
}

.teacher-list {
  display: grid;
  gap: 14px;
}

.teacher-card {
  overflow: hidden;
}

.teacher-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  color: #ffffff;
  background: var(--green-dark);
}

.teacher-initial {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--yellow);
  font-weight: 900;
}

.teacher-card-head h3 {
  margin-bottom: 4px;
}

.teacher-card-head span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.9rem;
}

.teacher-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.teacher-body p {
  margin-bottom: 0;
  color: #24352f;
  line-height: 1.58;
}

.concept-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.concept-block {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--soft);
}

.concept-block strong {
  display: block;
  margin-bottom: 5px;
}

.skill-list,
.practice-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-list span,
.practice-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.82rem;
  font-weight: 850;
}

.practice-strip span {
  color: var(--blue);
  background: #e6eef9;
}

.teacher-books {
  display: grid;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 70, 61, 0.12);
}

.teacher-books > strong {
  color: #141221;
  font-size: 0.94rem;
}

.teacher-book-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.teacher-book-links a {
  display: inline-grid;
  gap: 1px;
  min-height: 42px;
  padding: 7px 11px;
  border: 1px solid rgba(122, 34, 244, 0.16);
  border-radius: 12px;
  color: #2d184d;
  background: #fbf8ff;
  text-decoration: none;
}

.teacher-book-links a span {
  font-size: 0.84rem;
  font-weight: 950;
}

.teacher-book-links a small {
  color: #7a22f4;
  font-size: 0.72rem;
  font-weight: 900;
}

.music-controls {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 32px rgba(80, 43, 150, 0.08);
}

.music-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 78px;
  padding: 0 22px;
  border: 1px solid rgba(232, 224, 247, 0.9);
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(80, 43, 150, 0.06);
  font-size: 1.02rem;
}

.music-controls .primary-button,
.music-controls .secondary-button {
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(80, 43, 150, 0.06);
}

.music-controls .danger-button {
  color: var(--red);
  background: #ffffff;
}

.music-controls button::before {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--green-dark);
  font-size: 1.55rem;
}

#playTanpura::before {
  content: "\1FA95";
}

#playSargam::before {
  content: "\1F3B5";
}

#playCustomMusic::before {
  content: "\266B";
}

#stopMusic::before {
  content: "\25A0";
  color: #ffffff;
  font-size: 1rem;
}

.music-controls .danger-button::before {
  color: #ffffff;
  border-radius: 999px;
  background: var(--red);
}

.routine-mini-player {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: 0;
  min-height: 78px;
  padding: 0 10px 0 22px;
  border: 1px solid rgba(232, 224, 247, 0.9);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(80, 43, 150, 0.06);
}

.music-controls .routine-mini-button {
  display: grid;
  width: 100%;
  height: 50px;
  min-height: 50px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: #2f184d;
  background: transparent;
  box-shadow: none;
  font-size: 1rem;
}

.music-controls .routine-mini-button::before {
  content: none;
}

.music-controls .routine-mini-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.music-controls .routine-mini-toggle {
  width: 100%;
  height: 54px;
  color: #7a22f4;
  background: transparent;
  box-shadow: none;
}

.routine-mini-icon,
.routine-mini-toggle .music-now-icon {
  width: 26px;
  height: 26px;
}

.routine-mini-toggle .music-now-icon {
  width: 32px;
  height: 32px;
}

.practice-timer-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 24px;
  min-height: 330px;
  overflow: hidden;
  padding: 34px 30px;
  border: 0;
  border-radius: 22px;
  color: #ffffff;
  background:
    radial-gradient(circle at 76% 42%, rgba(255, 255, 255, 0.2), transparent 18%),
    linear-gradient(145deg, #7b22ef 0%, #43218f 55%, #2f156d 100%);
  box-shadow:
    0 24px 52px rgba(91, 20, 212, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.practice-timer-panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  right: 56px;
  top: 18px;
  width: 216px;
  height: 216px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #ffffff 0 41%, transparent 42%),
    conic-gradient(from 8deg, #ffffff 0 38deg, rgba(255, 255, 255, 0.16) 38deg 255deg, #b34dff 255deg 328deg, rgba(255, 255, 255, 0.18) 328deg 360deg);
  box-shadow:
    0 0 0 18px rgba(255, 255, 255, 0.05),
    0 20px 50px rgba(31, 12, 74, 0.3);
}

.practice-timer-panel::after {
  content: none;
  position: absolute;
  z-index: 0;
  right: 143px;
  top: 130px;
  width: 0;
  height: 0;
  border-top: 24px solid transparent;
  border-bottom: 24px solid transparent;
  border-left: 38px solid #8730ff;
  filter: drop-shadow(0 8px 18px rgba(31, 12, 74, 0.28));
}

.practice-timer-dial {
  position: absolute;
  z-index: 2;
  top: 70px;
  right: 108px;
  display: grid;
  width: 112px;
  height: 112px;
  min-height: 0;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #5b14d4;
  background: #ffffff;
  box-shadow:
    0 18px 42px rgba(31, 12, 74, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.practice-timer-dial .dial-play {
  width: 0;
  height: 0;
  margin-left: 7px;
  border-top: 24px solid transparent;
  border-bottom: 24px solid transparent;
  border-left: 38px solid currentColor;
  filter: drop-shadow(0 8px 16px rgba(91, 20, 212, 0.22));
}

.practice-timer-dial .dial-stop {
  display: none;
  position: relative;
  width: 38px;
  height: 46px;
  background: transparent;
  box-shadow: none;
}

.practice-timer-dial .dial-stop::before,
.practice-timer-dial .dial-stop::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 11px;
  border-radius: 999px;
  background: currentColor;
}

.practice-timer-dial .dial-stop::before {
  left: 5px;
}

.practice-timer-dial .dial-stop::after {
  right: 5px;
}

.practice-timer-panel.timer-running .practice-timer-dial .dial-play {
  display: none;
}

.practice-timer-panel.timer-running .practice-timer-dial .dial-stop {
  display: block;
}

.practice-timer-head,
.practice-timer-controls {
  display: grid;
  gap: 10px;
}

.practice-timer-head {
  position: relative;
  z-index: 1;
  width: min(56%, 360px);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.practice-timer-head > div {
  display: grid;
  gap: 6px;
}

.practice-timer-head .tiny-label {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.82rem;
}

.practice-timer-panel .practice-time-trigger {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 30px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 900;
}

.practice-timer-panel .practice-time-trigger::before {
  content: "\23F1";
  font-size: 0.95rem;
  line-height: 1;
}

.practice-timer-head strong {
  min-width: 0;
  padding: 0;
  text-align: left;
  color: #ffffff;
  background: transparent;
  text-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  font-size: 5.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
}

.practice-timer-controls {
  position: relative;
  z-index: 1;
  margin-top: auto;
  align-items: end;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.practice-timer-panel button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 72px;
  border-radius: 16px;
  font-size: 1.15rem;
}

.practice-timer-panel .practice-timer-dial {
  display: grid;
  width: 112px;
  height: 112px;
  min-height: 0;
  gap: 0;
  padding: 0;
  border-radius: 999px;
}

.practice-timer-controls button:first-child::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid currentColor;
  font-size: 0;
}

.practice-timer-panel.timer-running .practice-timer-controls button:first-child::before {
  width: 16px;
  height: 18px;
  border: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, currentColor 0 36%, transparent 36% 64%, currentColor 64% 100%);
}

.practice-timer-controls button:last-child::before {
  content: "\21BB";
  font-size: 1.28rem;
}

.practice-timer-panel .practice-time-trigger {
  min-height: 30px;
}

body.practice-modal-open {
  overflow: hidden;
}

body.profile-modal-open {
  overflow: hidden;
}

.practice-time-popover {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  padding: 18px;
}

.practice-time-popover.hidden {
  display: none;
}

.practice-time-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(251, 249, 255, 0.98), rgba(238, 247, 240, 0.98)),
    linear-gradient(135deg, rgba(114, 36, 245, 0.12), rgba(20, 184, 129, 0.1));
  backdrop-filter: blur(10px);
  animation: practiceBackdropIn 180ms ease-out;
}

.practice-time-window {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(378px, 100%);
  gap: 13px;
  padding: 22px;
  border: 1px solid rgba(148, 56, 255, 0.18);
  border-radius: 24px;
  color: var(--ink);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbf9ff 56%, #f1ecff 100%),
    #ffffff;
  box-shadow:
    0 28px 80px rgba(91, 20, 212, 0.2),
    0 12px 36px rgba(31, 55, 48, 0.12);
  animation: practiceWindowIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.practice-time-window .practice-time-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(148, 56, 255, 0.16);
  border-radius: 999px;
  color: #7224f5;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(91, 20, 212, 0.1);
}

.practice-time-window .tiny-label {
  margin-bottom: 0;
  padding-right: 42px;
  color: #7224f5;
}

.practice-time-window h3 {
  margin-bottom: 0;
  padding-right: 42px;
  color: var(--ink);
  font-size: 1.35rem;
}

.practice-time-window label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
}

.practice-time-window input {
  min-height: 56px;
  border: 1px solid rgba(148, 56, 255, 0.22);
  border-radius: 16px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(232, 224, 247, 0.6);
  font-size: 1.35rem;
  font-weight: 950;
}

.practice-time-presets {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.practice-time-presets button {
  min-height: 38px;
  border: 1px solid rgba(148, 56, 255, 0.16);
  border-radius: 999px;
  color: #7224f5;
  background: rgba(255, 255, 255, 0.86);
  font-weight: 900;
}

.practice-time-window .primary-button {
  min-height: 48px;
  border-radius: 16px;
}

@keyframes practiceBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes practiceWindowIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.practice-timer-panel label {
  min-width: 0;
  color: rgba(255, 255, 255, 0.78);
}

.practice-timer-panel input {
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.music-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  color: var(--green-dark);
  font-weight: 900;
}

.music-status-label {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.music-status-label::before {
  content: "\266B";
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--green-dark);
  font-size: 1.5rem;
}

.music-status strong {
  flex: 0 0 auto;
  padding: 8px 16px;
  border: 1px solid rgba(148, 56, 255, 0.22);
  border-radius: 999px;
  color: var(--green-dark);
  background: #ffffff;
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.empty-state {
  padding: 18px;
  border: 1px dashed rgba(7, 94, 84, 0.35);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.side-drawer [data-location-open],
.drawer-nav [data-location-open],
.side-drawer [data-location-target],
.drawer-nav [data-location-target] {
  justify-content: flex-start !important;
}

.side-drawer [data-location-open]::before,
.side-drawer [data-location-open]::after,
.drawer-nav [data-location-open]::before,
.drawer-nav [data-location-open]::after,
.side-drawer [data-location-target]::before,
.side-drawer [data-location-target]::after,
.drawer-nav [data-location-target]::before,
.drawer-nav [data-location-target]::after,
.drawer-directory [data-location-open]::before,
.drawer-directory [data-location-open]::after,
.directory-toggle::before,
.directory-toggle::after {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  content: none !important;
}

@media (max-width: 920px) {
  .chat-layout,
  .monologue-layout,
  .routine-layout,
  .learn-layout,
  .location-layout,
  .admin-dashboard {
    grid-template-columns: 1fr;
  }

  .chat-phone {
    min-height: 560px;
  }

  .chat-feed {
    min-height: 500px;
  }

  .voice-studio,
  .learn-note,
  .location-filter-panel {
    position: static;
  }
}

@media (max-width: 620px) {
  :root {
    --shell-top-pad: 8px;
  }

  .app-shell {
    padding: 8px 12px 12px;
  }

  .screen-title {
    align-items: stretch;
    flex-direction: column;
  }

  [data-view="monologue"] .screen-title {
    align-items: stretch;
    gap: 10px;
    margin-bottom: 10px;
  }

  [data-view="library"] .library-title-block {
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
  }

  [data-view="learn"] .screen-title {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
  }

  [data-view="diction"] .screen-title,
  [data-view="tongue"] .screen-title {
    margin-bottom: 10px;
  }

  .speech-practice-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .speech-card {
    min-height: 0;
    padding: 16px;
    border-radius: 16px;
  }

  .speech-card-main {
    min-height: 164px;
  }

  [data-view="learn"] .screen-title > div {
    width: 100%;
  }

  .teacher-filter {
    width: 100%;
  }

  .teacher-filter select {
    width: 100%;
  }

  .app-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
  }

  .app-header > .brand-row {
    justify-self: center;
    min-width: 0;
    gap: 8px;
  }

  .app-header > .brand-row .brand-mark {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
  }

  .app-header > .brand-row h1 {
    font-size: 1.02rem;
    line-height: 1.12;
  }

  .app-header > .brand-row .tiny-label {
    margin-bottom: 2px;
    font-size: 0.66rem;
  }

  .admin-shell .app-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .admin-shell .app-header > .brand-row {
    justify-self: stretch;
    gap: 12px;
    padding: 2px 0;
  }

  .admin-shell .app-header > .brand-row > div:last-child {
    min-width: 0;
  }

  .admin-shell .app-header > .brand-row .brand-mark {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
  }

  .admin-shell .app-header > .brand-row h1 {
    font-size: 1.42rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
  }

  .admin-shell .app-header > .brand-row .tiny-label {
    margin-bottom: 4px;
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .admin-shell .admin-link-button {
    min-height: 48px;
    padding: 0 16px;
    font-size: 1rem;
  }

  .instagram-import-panel {
    padding: 9px;
  }

  .instagram-import-head {
    align-items: flex-start;
  }

  .instagram-import-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px;
  }

  .instagram-add-button {
    min-width: 66px;
    padding: 0 10px;
  }

  .instagram-approval-card {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 9px;
  }

  .instagram-approval-media {
    width: 74px;
    height: 74px;
  }

  .instagram-approval-actions {
    gap: 6px;
  }

  .instagram-approval-actions button,
  .instagram-approval-actions a {
    min-height: 32px;
    padding: 0 9px;
  }

  .hamburger-button {
    justify-self: start;
  }

  .admin-chip,
  .admin-link-button,
  .screen-title .secondary-button {
    width: 100%;
  }

  .user-pill {
    display: grid;
    justify-self: end;
    width: 44px;
    min-height: 44px;
    place-items: center;
    padding: 0;
  }

  .user-pill::before {
    content: attr(data-initial);
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 999px;
    color: #ffffff;
    background: var(--green-dark);
    font-weight: 900;
  }

  .user-pill #userNameLabel,
  .user-pill #logoutUser {
    display: none;
  }

  .unread-alert {
    align-items: stretch;
    flex-direction: column;
  }

  .unread-alert-main,
  .notification-enable {
    width: 100%;
  }

  .otp-actions {
    grid-template-columns: 1fr;
  }

  .tab-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    top: var(--app-header-height);
    margin-bottom: 14px;
    padding: 4px 0 8px;
    overflow: visible;
    background: #fbf9ff;
  }

  .tab-button {
    min-width: 0;
    min-height: 46px;
    padding: 0 4px;
    border-radius: 14px;
    gap: 4px;
    font-size: 0.68rem;
    line-height: 1.12;
    white-space: normal;
  }

  .tab-button .ui-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.35;
  }

  .tab-button[data-view-target="monologue"] {
    font-size: 0.66rem;
  }

  .chat-feed {
    max-height: none;
  }

  .update-bubble {
    width: 96%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .monologue-card {
    min-height: 420px;
    padding: 18px;
  }

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

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

  .library-search-shell {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 7px;
    margin-bottom: 7px;
  }

  .library-back-button {
    width: 34px;
    min-height: 44px;
  }

  .library-search-box input {
    font-size: 0.9rem;
  }

  .library-book-count {
    width: fit-content;
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  .library-book-card {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }

  .library-cover {
    min-height: 122px;
    max-height: 148px;
    border-radius: 10px;
  }

  .library-book-body {
    gap: 6px;
  }

  .library-book-body h3 {
    font-size: 1rem;
  }

  .library-book-body p {
    font-size: 0.86rem;
  }

  .library-book-actions a {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.76rem;
  }

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

  .music-controls button {
    min-height: 72px;
    padding: 0 14px;
    font-size: 0.96rem;
  }

  .routine-mini-player {
    min-height: 72px;
    gap: 0;
    padding: 0 8px 0 20px;
  }

  .music-controls .routine-mini-button {
    width: 100%;
    height: 46px;
    min-height: 46px;
  }

  .music-controls .routine-mini-toggle {
    width: 100%;
    height: 50px;
  }

  .routine-mini-icon {
    width: 24px;
    height: 24px;
  }

  .routine-mini-toggle .music-now-icon {
    width: 30px;
    height: 30px;
  }

  .music-file-card {
    gap: 11px;
    padding: 14px;
    border-radius: 20px;
  }

  .music-file-head {
    align-items: center;
  }

  .music-file-subtitle {
    margin-top: 3px;
  }

  .music-file-count {
    min-height: 26px;
    padding: 0 9px;
    font-size: 0.72rem;
  }

  .music-search-row input {
    min-height: 42px;
    border-radius: 15px;
  }

  .music-picker-open {
    min-height: 70px;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 17px;
  }

  .music-picker-note {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .music-picker-chevron {
    width: 31px;
    height: 31px;
    font-size: 1.55rem;
  }

  .practice-timer-panel {
    min-height: 236px;
    gap: 16px;
    padding: 26px 20px 18px;
    border-radius: 18px;
  }

  .practice-timer-panel::before {
    right: 20px;
    top: 18px;
    width: 132px;
    height: 132px;
    box-shadow:
      0 0 0 10px rgba(255, 255, 255, 0.05),
      0 18px 38px rgba(31, 12, 74, 0.25);
  }

  .practice-timer-panel::after {
    right: 74px;
    top: 98px;
    border-top-width: 16px;
    border-bottom-width: 16px;
    border-left-width: 26px;
  }

  .practice-timer-controls {
    grid-template-columns: 1fr 1fr;
  }

  .practice-timer-controls label {
    grid-column: 1 / -1;
  }

  .practice-timer-head strong {
    min-width: 0;
    font-size: 3.45rem;
  }

  .practice-timer-head {
    width: 58%;
  }

  .practice-timer-panel button {
    min-height: 58px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .practice-timer-panel .practice-timer-dial {
    top: 49px;
    right: 51px;
    width: 70px;
    height: 70px;
    min-height: 0;
    border-radius: 999px;
  }

  .practice-timer-dial .dial-play {
    margin-left: 4px;
    border-top-width: 16px;
    border-bottom-width: 16px;
    border-left-width: 25px;
  }

  .practice-timer-dial .dial-stop {
    width: 24px;
    height: 30px;
  }

  .practice-timer-dial .dial-stop::before,
  .practice-timer-dial .dial-stop::after {
    width: 7px;
  }

  .practice-timer-dial .dial-stop::before {
    left: 3px;
  }

  .practice-timer-dial .dial-stop::after {
    right: 3px;
  }

  .teacher-card-head {
    align-items: flex-start;
  }

  .composer-row {
    grid-template-columns: 42px minmax(0, 1fr) 56px;
  }

  .whatsapp-composer.has-media .composer-row {
    grid-template-columns: 62px minmax(0, 1fr) 56px;
  }

  .send-button {
    width: 54px;
    min-width: 54px;
    min-height: 54px;
    padding: 0;
  }
}

@media (max-width: 380px) {
  .tab-bar {
    gap: 6px;
    margin-bottom: 8px;
  }

  .tab-button {
    min-height: 44px;
    padding: 0 3px;
    border-radius: 13px;
    font-size: 0.62rem;
  }

  .tab-button[data-view-target="monologue"] {
    font-size: 0.61rem;
  }

  .reaction-picker button {
    width: 38px;
    height: 38px;
    font-size: 1.34rem;
  }

  .reaction-picker .reaction-custom-button {
    font-size: 1.5rem;
  }

  .practice-timer-panel {
    min-height: 228px;
    padding: 24px 16px 16px;
  }

  .practice-timer-panel::before {
    right: 14px;
    top: 18px;
    width: 118px;
    height: 118px;
  }

  .practice-timer-panel .practice-timer-dial {
    top: 45px;
    right: 41px;
    width: 64px;
    height: 64px;
  }

  .practice-timer-dial .dial-play {
    margin-left: 4px;
    border-top-width: 14px;
    border-bottom-width: 14px;
    border-left-width: 22px;
  }

  .practice-timer-dial .dial-stop {
    width: 22px;
    height: 28px;
  }

  .practice-timer-dial .dial-stop::before,
  .practice-timer-dial .dial-stop::after {
    width: 6px;
  }

  .practice-timer-panel::after {
    right: 62px;
    top: 95px;
  }

  .practice-timer-head strong {
    font-size: 3.1rem;
  }
}

/* Colorful cards on the original black music theme */
.music-category-list button:nth-child(12n + 1) {
  background: linear-gradient(135deg, #7b2cff, #20d99b);
}

.music-category-list button:nth-child(12n + 2) {
  background: linear-gradient(135deg, #119f91, #16d0b7);
}

.music-category-list button:nth-child(12n + 3) {
  background: linear-gradient(135deg, #df3d8f, #ff7b91);
}

.music-category-list button:nth-child(12n + 4) {
  background: linear-gradient(135deg, #e54c37, #ff9d3d);
}

.music-category-list button:nth-child(12n + 5) {
  background: linear-gradient(135deg, #0d9fd1, #16c3e9);
}

.music-category-list button:nth-child(12n + 6) {
  background: linear-gradient(135deg, #9a3df5, #bd55ff);
}

.music-category-list button:nth-child(12n + 7) {
  background: linear-gradient(135deg, #f2a71b, #ffd34d);
}

.music-category-list button:nth-child(12n + 8) {
  background: linear-gradient(135deg, #101820, #284451);
}

.music-category-list button:nth-child(12n + 9) {
  background: linear-gradient(135deg, #4252d8, #8858f5);
}

.music-category-list button:nth-child(12n + 10) {
  background: linear-gradient(135deg, #006c7d, #1197a9);
}

.music-category-list button:nth-child(12n + 11) {
  background: linear-gradient(135deg, #e75b3f, #ff365f);
}

.music-category-list button:nth-child(12n + 12) {
  background: linear-gradient(135deg, #2d6cdf, #54d0ff);
}

.music-category-list button.active,
.music-category-list button:active {
  filter: saturate(1.12) brightness(1.04);
}

/* Compact music browser top spacing */
.music-browser-top {
  min-height: 62px;
  padding: 10px 24px 6px;
}

.music-browser-top .tiny-label {
  margin-bottom: 1px;
}

.music-browser-search {
  padding: 6px 24px 8px;
}

.music-browser-search input {
  min-height: 42px;
}

.music-browser-search .music-search-icon {
  left: 40px;
}

.music-browser-body {
  padding-top: 6px;
}

@media (max-width: 620px) {
  .music-browser-top {
    min-height: 58px;
    padding: 8px 22px 5px;
  }

  .music-browser-search {
    padding: 5px 22px 7px;
  }

  .music-browser-search .music-search-icon {
    left: 38px;
  }

  .music-browser-body {
    padding-top: 6px;
  }
}

/* Compact bottom mini music player spacing */
.music-browser-player {
  min-height: 68px;
  padding-top: 8px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}

.music-browser-cover {
  width: 44px;
  height: 44px;
}

@media (max-width: 620px) {
  .music-browser-player {
    min-height: 66px;
    padding: 7px 16px calc(5px + env(safe-area-inset-bottom, 0px));
  }
}

/* Direction-aware music detail header and cleaner song rows */
.music-browser-list-head {
  box-sizing: border-box;
  grid-template-columns: 42px minmax(0, 1fr);
  min-height: 58px;
  max-height: 58px;
  margin: 0 -24px 4px;
  padding: 8px 24px 6px;
  overflow: hidden;
  transition:
    max-height 180ms ease,
    min-height 180ms ease,
    padding 180ms ease,
    margin 180ms ease,
    opacity 150ms ease,
    border-color 150ms ease;
  will-change: max-height, padding, margin;
}

.music-browser-list-head button {
  width: 40px;
  min-height: 40px;
}

.music-browser-list-head strong {
  font-size: clamp(1.18rem, 4.6vw, 1.55rem);
  font-weight: 760;
  line-height: 1.08;
}

.music-browser.music-detail-header-hidden .music-browser-list-head {
  pointer-events: none;
  min-height: 0;
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-bottom-color: transparent;
  opacity: 0;
}

.music-browser.music-category-detail .music-browser-track {
  grid-template-columns: 64px minmax(0, 1fr) 28px;
  gap: 10px;
  padding: 8px 0;
}

.music-browser.music-category-detail .music-browser-art {
  width: 54px;
  height: 54px;
  border-radius: 5px;
  font-size: 1.2rem;
}

.music-browser.music-category-detail .music-browser-track-copy {
  gap: 1px;
}

.music-browser.music-category-detail .music-browser-track-copy strong {
  font-size: clamp(0.95rem, 3.55vw, 1.06rem);
  font-weight: 650;
  line-height: 1.16;
}

.music-browser.music-category-detail .music-browser-track-copy span {
  font-size: clamp(0.76rem, 3vw, 0.88rem);
  font-weight: 460;
  line-height: 1.2;
}

.music-browser.music-category-detail .music-browser-track-status span {
  width: 24px;
  height: 32px;
  font-size: 1.5rem;
}

@media (max-width: 620px) {
  .music-browser-list-head {
    min-height: 56px;
    max-height: 56px;
    padding: 7px 24px 5px;
  }

  .music-browser.music-category-detail .music-browser-track {
    grid-template-columns: 62px minmax(0, 1fr) 26px;
    gap: 9px;
    padding: 8px 0;
  }
}

/* Stabilize detail header and compact category cards */
.music-browser-list-head .music-list-back span {
  width: 20px;
  height: 16px;
}

.music-browser-list-head .music-list-back span::before {
  width: 19px;
  height: 2px;
}

.music-browser-list-head .music-list-back span::after {
  width: 10px;
  height: 10px;
  border-left-width: 2px;
  border-top-width: 2px;
}

.music-category-list {
  gap: 10px;
}

.music-category-list button,
.music-category-list button:nth-child(n) {
  min-height: 88px;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 12px;
}

.music-category-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1.05rem;
}

.music-category-icon.has-image {
  overflow: hidden;
  padding: 0;
}

.music-category-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.music-category-name {
  font-size: clamp(0.84rem, 3.1vw, 0.98rem);
  line-height: 1.1;
}

.music-category-list small {
  min-height: 20px;
  padding: 0 7px;
  font-size: 0.6rem;
}

@media (max-width: 380px) {
  .music-category-list button,
  .music-category-list button:nth-child(n) {
    min-height: 82px;
    padding: 10px 10px;
  }
}

/* Keep all music lists compact, including the list below category cards */
.music-browser .music-browser-list {
  gap: 0;
}

.music-browser .music-browser-track {
  grid-template-columns: 62px minmax(0, 1fr) 26px;
  gap: 9px;
  padding: 8px 0;
}

.music-browser .music-browser-art {
  width: 54px;
  height: 54px;
  border-radius: 5px;
  font-size: 1.2rem;
}

.music-browser .music-browser-track-copy {
  gap: 1px;
}

.music-browser .music-browser-track-copy strong {
  font-size: clamp(0.95rem, 3.55vw, 1.06rem);
  font-weight: 650;
  line-height: 1.16;
}

.music-browser .music-browser-track-copy span {
  font-size: clamp(0.76rem, 3vw, 0.88rem);
  font-weight: 460;
  line-height: 1.2;
}

.music-browser .music-browser-track-status span {
  width: 24px;
  height: 32px;
  font-size: 1.5rem;
}

.music-browser:not(.music-category-detail) .music-browser-list {
  margin-top: 0;
  padding-top: 0;
}

.music-browser:not(.music-category-detail) .music-browser-track {
  margin: 0;
}

/* Final card-tab music header polish */
.music-browser:not(.music-category-detail) .music-browser-top {
  grid-template-columns: 42px minmax(0, 1fr);
  min-height: 58px;
  padding: 8px 24px 6px;
}

.music-browser:not(.music-category-detail) .music-browser-top > div {
  display: grid;
  min-width: 0;
  align-content: center;
}

.music-browser:not(.music-category-detail) .music-browser-top .tiny-label {
  display: none;
}

.music-browser:not(.music-category-detail) .music-browser-top h2 {
  color: #ffffff;
  font-size: clamp(1.18rem, 4.6vw, 1.55rem);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: 0;
}

.music-browser-close {
  width: 40px;
  height: 40px;
  min-height: 40px;
  flex-basis: 40px;
  border: 0;
  border-radius: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-size: 0;
}

.music-browser-close span {
  position: relative;
  display: block;
  width: 20px;
  height: 16px;
  transform: none;
  font-size: 0;
}

.music-browser-close span::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
}

.music-browser-close span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 1px;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(-50%) rotate(-45deg);
}

@media (max-width: 620px) {
  .music-browser:not(.music-category-detail) .music-browser-top {
    min-height: 56px;
    padding: 7px 22px 5px;
  }
}

.music-browser-control-main.is-loading::after,
.music-now-play.is-loading::after,
.routine-mini-toggle.is-loading::after {
  content: "";
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.34);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

.music-browser-track.loading .music-browser-track-status > span {
  display: none;
}

.music-browser-track.loading .music-browser-track-status::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(139, 61, 255, 0.2);
  border-top-color: #8b3dff;
  border-radius: 50%;
  animation: music-track-spin 720ms linear infinite;
}

.music-browser-track.loading .music-browser-track-status small {
  color: #8b3dff;
  font-weight: 700;
}

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

body.playback-priority-active .music-browser-track,
body.playback-priority-active .music-browser-art,
body.playback-priority-active .music-now-playing {
  transition: none !important;
}

.music-now-play.is-loading::after {
  border-color: rgba(16, 16, 16, 0.18);
  border-top-color: #101010;
}

.routine-mini-toggle.is-loading::after {
  border-color: rgba(122, 34, 244, 0.2);
  border-top-color: #7a22f4;
}

.music-browser-control-main.is-loading,
.music-now-play.is-loading,
.routine-mini-toggle.is-loading {
  position: relative;
}

.music-browser-control-main.is-loading #musicBrowserPlayIcon,
.music-now-play.is-loading #nowPlayingPlayIcon,
.routine-mini-toggle.is-loading #routineMusicToggleIcon {
  opacity: 0;
}

.music-browser-control-main.is-loading::after,
.music-now-play.is-loading::after,
.routine-mini-toggle.is-loading::after {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  animation-name: music-spin-centered;
}

@keyframes music-spin-centered {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.phone-input-row {
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}

.phone-input-row select,
.phone-input-row input {
  min-width: 0;
  width: 100%;
}

.phone-input-row select {
  cursor: pointer;
}

/* Fixed, dynamically measured quick-return navigation. The permanent content
   offset prevents coverage and layout jumps while both layers animate only
   with GPU-friendly transforms. */
.app-shell:not(.admin-shell) {
  padding-top: calc(var(--shell-top-pad) + var(--top-chrome-total-height));
}

.app-shell:not(.admin-shell) > .app-header,
.app-shell:not(.admin-shell) > .tab-bar {
  position: fixed;
  left: 50%;
  width: min(calc(100% - 36px), 1144px);
  margin-top: 0;
  transition-property: opacity, visibility;
}

.app-shell:not(.admin-shell) > .app-header {
  top: 0;
  transform: translate3d(-50%, var(--top-chrome-offset), 0);
}

.app-shell:not(.admin-shell) > .tab-bar {
  top: var(--app-header-height);
  transform: translate3d(-50%, var(--top-chrome-offset), 0);
}

.app-shell:not(.admin-shell) > main {
  margin-top: 0;
  transition: none;
}

body.top-chrome-scrolling .app-shell:not(.admin-shell) > .app-header,
body.top-chrome-scrolling .app-shell:not(.admin-shell) > .tab-bar {
  transition: none;
}

body.top-chrome-settling .app-shell:not(.admin-shell) > .app-header,
body.top-chrome-settling .app-shell:not(.admin-shell) > .tab-bar {
  transition: transform 190ms cubic-bezier(0.2, 0, 0, 1);
}

body.drawer-open .app-shell:not(.admin-shell) > .app-header,
body.drawer-open .app-shell:not(.admin-shell) > .tab-bar,
body.profile-modal-open .app-shell:not(.admin-shell) > .app-header,
body.profile-modal-open .app-shell:not(.admin-shell) > .tab-bar,
body.image-viewer-open .app-shell:not(.admin-shell) > .app-header,
body.image-viewer-open .app-shell:not(.admin-shell) > .tab-bar,
body.practice-modal-open .app-shell:not(.admin-shell) > .app-header,
body.practice-modal-open .app-shell:not(.admin-shell) > .tab-bar {
  transform: translate3d(-50%, -16px, 0);
}

@media (max-width: 620px) {
  .app-shell:not(.admin-shell) > .app-header,
  .app-shell:not(.admin-shell) > .tab-bar {
    width: calc(100% - 24px);
  }
}

/* Mobile interaction pass: accessible targets, native momentum, no iOS input
   zoom, and cheaper overlay painting on touch-first devices. */
@media (pointer: coarse) {
  button:not(.music-browser-close):not(.music-browser-control):not(.music-now-close):not(.music-now-menu):not(.music-now-side):not(.music-now-main-control):not(.music-now-play):not(.routine-mini-button),
  [role="button"] {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .chat-feed,
  .side-drawer,
  .profile-panel,
  .music-browser-body,
  .music-now-playing,
  .library-directory-list,
  .music-search-results {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .network-banner,
  .profile-backdrop,
  .image-viewer-back,
  .attachment-count,
  .music-browser-player,
  .music-now-cover span,
  .practice-time-backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* This rule intentionally comes last so legacy `.admin-feed` sizing and the
   generic coarse-pointer `.chat-feed` containment cannot override it. */
.admin-shell .admin-feed {
  height: clamp(320px, 55vh, 620px);
  height: clamp(320px, 55dvh, 620px);
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scroll-behavior: auto;
  scrollbar-gutter: stable;
}

/* Games hub */
.drawer-games-link {
  margin-top: 6px;
  border-top: 1px solid rgba(232, 224, 247, 0.9);
}

[data-view="games"] {
  position: relative;
  overflow: visible;
  padding: 0 clamp(16px, 3vw, 28px) clamp(16px, 3vw, 28px);
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(148, 56, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #fbf9ff 0%, var(--bg) 46%, #ffffff 100%);
  border-color: var(--line);
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

body.games-hub-open {
  overflow: hidden;
}

body.games-hub-open .app-shell:not(.admin-shell) > .app-header,
body.games-hub-open .app-shell:not(.admin-shell) > .tab-bar {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.games-hub-open [data-view="games"] {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.games-title {
  position: sticky;
  z-index: 4;
  top: 0;
  align-items: center;
  margin-right: calc(clamp(16px, 3vw, 28px) * -1);
  margin-bottom: 12px;
  margin-left: calc(clamp(16px, 3vw, 28px) * -1);
  padding: 6px clamp(16px, 3vw, 28px);
  background: rgba(251, 249, 255, 0.94);
  backdrop-filter: blur(14px);
}

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

.games-title p {
  color: #aaa4b8;
}

.games-brand {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 4px;
}

.games-back-button {
  display: grid;
  width: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  flex: 0 0 42px;
  margin-left: -12px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.games-search-box {
  position: relative;
  display: block;
  min-width: 0;
  flex: 1 1 auto;
}

.games-search-box input {
  width: 100%;
  min-height: 46px;
  padding: 0 16px 0 43px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 22px rgba(74, 35, 143, 0.07);
}

.games-search-box input:focus {
  border-color: rgba(114, 36, 245, 0.55);
  box-shadow: 0 0 0 3px rgba(114, 36, 245, 0.11);
}

.games-search-box input::placeholder {
  color: var(--muted);
}

.games-search-icon {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 16px;
  width: 15px;
  height: 15px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.games-search-icon::after {
  position: absolute;
  right: -6px;
  bottom: -4px;
  width: 7px;
  height: 2px;
  border-radius: 99px;
  background: var(--muted);
  content: "";
  transform: rotate(45deg);
}

.games-back-button svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.games-back-button:active {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.96);
}

.games-brand-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.35);
  font-size: 1.55rem;
}

.games-count {
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #c5bfce;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.78rem;
  font-weight: 800;
}

.games-tabs {
  position: sticky;
  z-index: 3;
  top: calc(60px + env(safe-area-inset-top));
  display: flex;
  gap: 30px;
  margin: 0 calc(clamp(16px, 3vw, 28px) * -1) 18px;
  padding: 0 clamp(16px, 3vw, 28px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #8f899a;
  font-size: 0.96rem;
  background: rgba(12, 9, 20, 0.96);
  backdrop-filter: blur(12px);
}

.games-tabs span,
.games-tabs strong {
  position: relative;
  padding: 10px 2px 13px;
}

.games-tabs strong {
  color: #b15cff;
}

.games-tabs strong::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #a855f7;
  content: "";
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  scroll-behavior: smooth;
}

.game-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #181522;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  content-visibility: auto;
  contain-intrinsic-size: 260px 320px;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.game-card-launch {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.game-card-cover {
  position: relative;
  display: grid;
  aspect-ratio: 1 / 1;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(135deg, #6d28d9, #a855f7 55%, #06b6d4);
}

.game-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 240ms ease;
}

.game-card-image.is-broken {
  display: none;
}

.game-card-fallback {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
}

.game-card-play {
  position: relative;
  z-index: 1;
  display: grid;
  width: 52px;
  height: 52px;
  padding-left: 3px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  background: rgba(29, 12, 58, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 180ms ease, transform 180ms ease;
}

.game-card-content {
  position: relative;
  display: block;
  min-height: 72px;
  padding: 12px 38px 12px 14px;
}

.game-card-content strong,
.game-card-content small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card-content strong {
  color: #fff;
  font-size: 1rem;
  line-height: 1.35;
}

.game-card-content small {
  margin-top: 4px;
  color: #aaa4b8;
}

.game-card-menu {
  position: absolute;
  right: 13px;
  top: 15px;
  color: #e8e4ef;
  font-size: 1.55rem;
  line-height: 1;
}

.game-card-launch:hover .game-card-image,
.game-card-launch:focus-visible .game-card-image {
  transform: scale(1.035);
}

.game-card-launch:hover .game-card-play,
.game-card-launch:focus-visible .game-card-play {
  opacity: 1;
  transform: scale(1);
}

.game-card-launch:focus-visible {
  outline: 3px solid #a855f7;
  outline-offset: -3px;
}

.game-card-launch:active {
  opacity: 0.92;
  transform: scale(0.985);
}

@media (hover: hover) {
  .game-card:hover {
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.42);
    transform: translateY(-3px);
  }
}

/* Dark-mode surface cleanup: no light/white containers may leak through from
   legacy component rules. Light mode is unaffected. */
html[data-theme="dark"] :is(
  .initial-loader-card,
  .login-card,
  .auth-card,
  .network-banner,
  .user-pill,
  .notification-enable,
  .unread-alert,
  .profile-panel,
  .profile-card,
  .image-viewer-card,
  .practice-time-modal,
  .reaction-picker,
  .reaction-summary,
  .custom-reaction-form,
  .update-bubble,
  .attachment-card,
  .composer-card,
  .admin-panel,
  .admin-preview,
  .control-panel,
  .monologue-card,
  .routine-card,
  .routine-item,
  .learn-note,
  .teacher-card,
  .library-book-card,
  .speech-card,
  .location-card,
  .location-filter-panel,
  .directory-card,
  .empty-state,
  .music-file-card,
  .music-search-results,
  .music-search-result,
  .music-picker-open,
  .city-filter-list,
  .city-picker-toggle
) {
  color: #fffaf0 !important;
  border-color: rgba(212, 175, 55, 0.2) !important;
  background-color: #1e1e1e !important;
}

html[data-theme="dark"] :is(
  .drawer-nav button:not(.active),
  .secondary-button,
  .ghost-button,
  .filter-toggle,
  .drawer-close,
  .drawer-theme-toggle,
  .routine-mini-button,
  .reaction-button
) {
  color: #f1e6c9 !important;
  border-color: rgba(212, 175, 55, 0.18) !important;
  background: #292929 !important;
}

html[data-theme="dark"] :is(
  input,
  select,
  textarea,
  option,
  .library-search-box input,
  .location-search-box input,
  .music-search-row input
) {
  color: #ffffff !important;
  border-color: rgba(212, 175, 55, 0.25) !important;
  background: #131313 !important;
}

html[data-theme="dark"] :is(.app-shell, main, .view, .location-layout, .library-grid, .speech-practice-grid) {
  background-color: transparent !important;
}

/* Standalone 100+ Premium Monologues view. */
body.premium-monologues-view-active .app-shell:not(.admin-shell) {
  padding-top: 0;
}

body.premium-monologues-view-active .app-shell:not(.admin-shell) > .app-header,
body.premium-monologues-view-active .app-shell:not(.admin-shell) > .tab-bar {
  display: none;
}

body.premium-monologues-view-active [data-view="premium-monologues"].active {
  padding-top: calc(var(--premium-monologue-tools-height) + 5px);
}

.premium-monologue-tools {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 1200;
  width: min(calc(100% - 36px), 1144px);
  padding: max(5px, env(safe-area-inset-top)) 0 3px;
  background: #fbf9ff;
  box-shadow: 0 0 0 100vmax #fbf9ff, 0 8px 18px rgba(55, 29, 120, 0.06);
  clip-path: inset(0 -100vmax 0);
  transform: translateX(-50%);
}

.premium-monologue-tools .premium-monologue-search-shell {
  position: relative;
  top: auto;
  z-index: auto;
  margin: 0 0 4px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  transform: none;
  grid-template-columns: 36px 44px minmax(0, 1fr);
}

.premium-monologue-search-shell .library-search-box {
  position: relative;
}

.premium-search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 1300;
  display: grid;
  max-height: min(54vh, 360px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(122, 34, 244, 0.16);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(55, 29, 120, 0.18);
  overscroll-behavior: contain;
}

.premium-search-suggestions.hidden {
  display: none;
}

.premium-search-suggestion {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 42px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 850;
}

.premium-search-suggestion::before {
  content: "";
  width: 13px;
  height: 13px;
  margin-left: 2px;
  border: 2px solid var(--green-dark);
  border-radius: 50%;
  box-shadow: 6px 6px 0 -5px var(--green-dark);
}

.premium-search-suggestion:is(:hover, :focus-visible) {
  background: var(--green-soft);
}

html[data-theme="dark"] .premium-search-suggestions {
  border-color: rgba(212, 175, 55, 0.24);
  background: #1b1b1b;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .premium-search-suggestion {
  color: #fffaf0;
}

.premium-monologue-title {
  align-items: flex-end;
  margin: 0;
}

.premium-monologue-title :is(.tiny-label, h2) {
  margin-block: 0;
}

.premium-monologue-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: min(100%, 420px);
  margin-top: 6px;
}

.premium-monologue-filters.hidden {
  display: none;
}

.premium-monologue-filters label {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.premium-monologue-filters select {
  width: 100%;
  min-height: 40px;
  padding: 0 34px 0 10px;
  border: 1px solid rgba(122, 34, 244, 0.16);
  border-radius: 11px;
  color: var(--ink);
  background: #ffffff;
  font-size: 0.86rem;
  font-weight: 850;
}

.premium-monologue-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.premium-monologue-card {
  display: grid;
  gap: 9px;
  padding: 17px;
  border: 1px solid rgba(122, 34, 244, 0.14);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(80, 43, 150, 0.08);
}

.premium-monologue-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.premium-monologue-card-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: capitalize;
}

.premium-monologue-card h3,
.premium-monologue-card p {
  margin: 0;
}

.premium-monologue-card p {
  color: var(--muted);
  line-height: 1.58;
}

#monologueText,
.premium-monologue-card p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
}

html[data-theme="dark"] .premium-monologue-tools {
  background: #171717;
  box-shadow: 0 0 0 100vmax #171717, 0 8px 20px rgba(0, 0, 0, 0.36);
}

html[data-theme="dark"] .premium-monologue-card {
  color: #fffaf0;
  border-color: rgba(212, 175, 55, 0.2);
  background: linear-gradient(145deg, #242424, #1b1b1b);
}

html[data-theme="dark"] .premium-monologue-card p {
  color: #c9c1b2;
}

@media (max-width: 620px) {
  .premium-monologue-tools {
    width: calc(100% - 24px);
  }

  .premium-monologue-title {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
  }

  .premium-monologue-title h2 {
    font-size: 1.35rem;
  }

  .premium-monologue-filters {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .premium-monologue-filters label:last-child {
    grid-column: auto;
  }

  .premium-monologue-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.game-player {
  position: fixed;
  z-index: 1500;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #050508;
}

.game-player.hidden {
  display: none;
}

.game-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #050508;
}

.game-player-close {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: calc(env(safe-area-inset-left, 0px) + 10px);
  display: grid;
  width: 42px;
  min-height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 7, 13, 0.78);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.game-player-title {
  position: absolute;
  z-index: 1;
  top: calc(env(safe-area-inset-top, 0px) + 18px);
  left: 64px;
  right: 64px;
  overflow: hidden;
  color: #fff;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 2px 8px #000;
}

body.game-player-open {
  overflow: hidden;
}

@media (max-width: 620px) {
  [data-view="games"] {
    margin-right: -2px;
    margin-left: -2px;
    padding: 0 12px 14px;
    border-radius: 18px;
  }

  .games-title {
    margin: 0 -12px 14px;
    padding: 6px 12px;
  }

  .games-back-button {
    margin-left: -10px;
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
  }

  .game-card {
    border-radius: 13px;
  }

  .game-card-content {
    min-height: 66px;
    padding: 10px 30px 10px 11px;
  }

  .game-card-content strong {
    font-size: 0.92rem;
  }

  .game-card-menu {
    right: 9px;
    top: 12px;
  }

}

@media (hover: none) {
  .game-card-play {
    width: 44px;
    height: 44px;
    opacity: 0.94;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-card-image,
  .game-card-play {
    transition: none;
  }
}

/* Professional music catalogue rows. These final scoped rules intentionally
   leave the existing bottom player dimensions unchanged. */
.music-browser-body {
  padding: 10px 18px 22px;
  scroll-padding-top: 10px;
  scroll-padding-bottom: 96px;
}

.music-browser .music-browser-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
}

.music-browser .music-browser-track,
.music-browser.music-category-detail .music-browser-track {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 38px;
  min-height: 68px;
  gap: 12px;
  margin: 0;
  padding: 5px 4px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, transform 140ms ease;
  content-visibility: auto;
  contain-intrinsic-size: 74px;
}

.music-browser .music-browser-track.selected {
  border-color: transparent;
  background: transparent;
}

.music-browser .music-browser-track.playing {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.music-browser .music-browser-track:active {
  background: transparent;
  transform: scale(0.992);
}

.music-browser .music-browser-art,
.music-browser.music-category-detail .music-browser-art {
  width: 58px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background-color: #292631;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.28);
  font-size: 1.08rem;
}

.music-browser .music-browser-track-copy,
.music-browser.music-category-detail .music-browser-track-copy {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
}

.music-browser .music-browser-track-copy strong,
.music-browser.music-category-detail .music-browser-track-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: clamp(0.96rem, 3.7vw, 1.08rem);
  font-weight: 740;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser .music-browser-track-copy span,
.music-browser.music-category-detail .music-browser-track-copy span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.58);
  font-size: clamp(0.76rem, 3vw, 0.86rem);
  font-weight: 520;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.music-browser .music-browser-track-copy small {
  display: none;
}

.music-browser .music-browser-track-status,
.music-browser.music-category-detail .music-browser-track-status {
  display: grid;
  align-self: stretch;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
}

.music-browser .music-browser-track-status span,
.music-browser.music-category-detail .music-browser-track-status span {
  display: grid;
  width: 38px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  color: inherit;
  background: transparent;
  font-size: 1.65rem;
  line-height: 1;
}

.music-browser .music-browser-track.playing .music-browser-track-status {
  color: #1ed760;
}

.music-browser .music-browser-track.playing .music-browser-track-copy strong {
  color: #1ed760;
}

.music-browser .music-browser-track-status small {
  display: none;
}

@media (hover: hover) {
  .music-browser .music-browser-track:hover {
    border-color: transparent;
    background: transparent;
  }
}

@media (max-width: 620px) {
  .music-browser-body {
    padding: 9px 12px 18px;
  }

  .music-browser .music-browser-list {
    gap: 2px;
  }

  .music-browser .music-browser-track,
  .music-browser.music-category-detail .music-browser-track {
    grid-template-columns: 58px minmax(0, 1fr) 34px;
    min-height: 66px;
    gap: 10px;
    padding: 5px 2px;
    border-radius: 0;
  }

  .music-browser .music-browser-art,
  .music-browser.music-category-detail .music-browser-art {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }
}

/* Final dark-theme polish: explicit readable typography and cinematic depth.
   Kept last so every legacy component remains legible in black/gold mode. */
html[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6, strong, b) {
  color: #fffaf0;
}

html[data-theme="dark"] :is(
  p,
  label,
  small,
  .muted,
  .subtitle,
  .speech-card p,
  .location-card p,
  .teacher-card p,
  .library-book-card p,
  .routine-item p,
  .music-track-hint,
  .music-browser-track-copy small,
  .location-summary
) {
  color: #c9c1b2;
}

html[data-theme="dark"] :is(
  .tiny-label,
  .status-badge,
  .music-file-label,
  .library-book-count,
  .speech-card .tiny-label,
  .screen-title .tiny-label
) {
  color: #e3bc55;
}

html[data-theme="dark"] :is(input, select, textarea, option) {
  color: #fffdf8;
  caret-color: #e3bc55;
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #978f82;
  opacity: 1;
}

html[data-theme="dark"] :is(
  .app-header,
  .tab-bar,
  .side-drawer,
  .speech-sticky-tools,
  .location-sticky-tools,
  .library-search-shell
) {
  border-color: rgba(212, 175, 55, 0.22);
  background:
    linear-gradient(180deg, rgba(30, 30, 30, 0.98), rgba(13, 13, 13, 0.99));
}

html[data-theme="dark"] :is(
  [class$="-card"],
  .update-bubble,
  .routine-item,
  .location-filter-panel,
  .directory-card,
  .learn-note,
  .control-panel
) {
  border-color: rgba(212, 175, 55, 0.18);
  background:
    radial-gradient(circle at 100% 0%, rgba(212, 175, 55, 0.055), transparent 34%),
    linear-gradient(145deg, #222222 0%, #191919 72%);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

html[data-theme="dark"] :is(
  .library-search-box input,
  .location-search-box input,
  .speech-language-filter select,
  .teacher-filter select,
  .city-picker-toggle,
  input,
  select,
  textarea
) {
  border-color: rgba(212, 175, 55, 0.24);
  background: #141414;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 8px 18px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] :is(input, select, textarea):focus {
  border-color: rgba(227, 188, 85, 0.75);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.13);
}

html[data-theme="dark"] :is(.drawer-nav button, .tab-button, .secondary-button, .ghost-button) {
  border: 1px solid rgba(212, 175, 55, 0.15);
  color: #f1e6c9;
  background: linear-gradient(145deg, #292929, #202020);
}

html[data-theme="dark"] :is(.primary-button, .drawer-nav button.active, .tab-button.active) {
  color: #17120a;
  border-color: #edcb73;
  background: linear-gradient(135deg, #f1cf78 0%, #d4af37 58%, #bb8e22 100%);
  box-shadow:
    0 10px 24px rgba(212, 175, 55, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

html[data-theme="dark"] :is(.drawer-nav button, .tab-button, .primary-button, .secondary-button):active {
  transform: scale(0.98);
}

html[data-theme="dark"] :is(a, button, .library-search-icon, .games-search-icon) {
  text-decoration-color: rgba(212, 175, 55, 0.58);
}

html[data-theme="dark"] ::selection {
  color: #111111;
  background: #e3bc55;
}

/* Final monochrome dark theme: black, dark black, bright black and white only. */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #c8c8c8;
  --surface: #171717;
  --soft: #242424;
  --line: #353535;
  --green: #ffffff;
  --green-dark: #ffffff;
  --green-soft: #242424;
  --yellow: #ffffff;
  --yellow-soft: #242424;
  --red: #ffffff;
  --shadow: 0 10px 26px rgba(0, 0, 0, 0.38);
  background: #090909;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell,
html[data-theme="dark"] .auth-screen,
html[data-theme="dark"] [data-view],
html[data-theme="dark"] .music-browser,
html[data-theme="dark"] .game-player,
html[data-theme="dark"] .image-viewer {
  color: #ffffff;
  background-color: #090909;
  background-image: none;
}

html[data-theme="dark"] :is(
  .app-header,
  .tab-bar,
  .side-drawer,
  .profile-panel,
  .settings-panel,
  .speech-sticky-tools,
  .location-sticky-tools,
  .library-search-shell,
  .premium-monologue-tools,
  .games-toolbar,
  .music-browser-header,
  .music-browser-player,
  .bottom-nav
) {
  color: #ffffff !important;
  border-color: #353535 !important;
  background-color: #171717 !important;
  background-image: none !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42) !important;
}

html[data-theme="dark"] :is(
  [class$="-card"],
  .card,
  .panel,
  .update-bubble,
  .routine-item,
  .profile-details > div,
  .profile-stats,
  .settings-option,
  .settings-protected-fields p,
  .account-delete-choice,
  .account-delete-intro,
  .account-delete-warning,
  .music-list-item,
  .music-category,
  .game-card,
  .monologue-card,
  .speech-card,
  .location-card,
  .library-book-card
) {
  color: #ffffff !important;
  border-color: #353535 !important;
  background-color: #171717 !important;
  background-image: none !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] :is(
  input,
  textarea,
  select,
  .library-search-box input,
  .speech-search-shell input,
  .location-search-box input,
  .games-search-box input,
  .music-browser-search input
) {
  color: #ffffff !important;
  caret-color: #ffffff;
  border-color: #353535 !important;
  background-color: #242424 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #a9a9a9 !important;
  opacity: 1;
}

html[data-theme="dark"] :is(
  h1, h2, h3, h4, h5, h6,
  p, span, strong, small, label, legend,
  .tiny-label,
  .screen-title,
  .profile-username,
  .monologue-meta,
  .music-title,
  .music-subtitle
) {
  border-color: #353535;
}

html[data-theme="dark"] :is(
  h1, h2, h3, h4, h5, h6,
  .screen-title,
  .tiny-label,
  .profile-details strong,
  .settings-option strong,
  .account-delete-choice strong
) {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(
  .muted,
  .helper-text,
  .profile-username,
  .profile-details span,
  .settings-option small,
  .settings-note,
  .account-delete-choice small,
  .account-delete-intro p,
  .account-delete-warning span,
  .music-subtitle
) {
  color: #c8c8c8 !important;
}

html[data-theme="dark"] :is(
  button,
  .drawer-nav button,
  .drawer-settings,
  .tab-button,
  .secondary-button,
  .ghost-button,
  .filter-toggle,
  .routine-mini-button,
  .reaction-button,
  .settings-close,
  .settings-section-back
) {
  color: #ffffff !important;
  border-color: #353535 !important;
  background-color: #242424 !important;
  background-image: none !important;
  box-shadow: none;
}

html[data-theme="dark"] :is(
  .primary-button,
  .drawer-nav button.active,
  .tab-button.active,
  button.active,
  .settings-delete-final
) {
  color: #090909 !important;
  border-color: #ffffff !important;
  background: #ffffff !important;
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.1) !important;
}

html[data-theme="dark"] :is(
  svg,
  .drawer-icon,
  .library-back-button svg,
  .settings-close svg,
  .settings-section-back svg,
  .location-filter-icon
) {
  color: currentColor;
  stroke: currentColor;
}

html[data-theme="dark"] :is(
  .brand-mark,
  .avatar,
  .profile-avatar,
  .settings-option-icon,
  .status-badge,
  .library-book-count,
  .monologue-meta span
) {
  color: #ffffff !important;
  border-color: #353535 !important;
  background: #242424 !important;
}

html[data-theme="dark"] :is(.drawer-backdrop, .profile-backdrop, .settings-backdrop) {
  background: rgba(0, 0, 0, 0.78) !important;
}

html[data-theme="dark"] :focus-visible {
  outline: 2px solid #ffffff !important;
  outline-offset: 2px;
}

@media (hover: hover) {
  html[data-theme="dark"] :is(button, .settings-option, [class$="-card"]):hover {
    border-color: #ffffff !important;
    background-color: #242424 !important;
  }
}

@media (hover: hover) {
  html[data-theme="dark"] :is(.drawer-nav button, .tab-button, .secondary-button):hover {
    border-color: rgba(227, 188, 85, 0.45);
    background: #302b21;
  }

  html[data-theme="dark"] :is([class$="-card"], .update-bubble, .routine-item):hover {
    border-color: rgba(227, 188, 85, 0.34);
  }
}

/* Premium purple + gold dark theme (final cascade layer). */
html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #ffffff;
  --muted: #b8b8c0;
  --surface: #111114;
  --soft: #17171c;
  --line: #292930;
  --green: #8b2cf5;
  --green-dark: #8b2cf5;
  --green-soft: #17171c;
  --yellow: #f2c230;
  --yellow-soft: #17171c;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
  background: #050506;
}

html[data-theme="dark"] body {
  min-width: 0;
  overflow-x: hidden;
  color: #ffffff;
  background: #050506 !important;
  font-size: max(15px, 1rem);
  line-height: 1.5;
}

html[data-theme="dark"] :is(.app-shell, .auth-screen, [data-view], .music-browser, .game-player, .image-viewer) {
  color: #ffffff !important;
  background: #050506 !important;
  background-image: none !important;
}

html[data-theme="dark"] :is(.app-header, .tab-bar) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #09090b !important;
  box-shadow: 0 0 0 100vmax #09090b, 0 8px 22px rgba(0, 0, 0, 0.32) !important;
}

html[data-theme="dark"] .brand-mark {
  color: #ffd95a !important;
  border: 1px solid rgba(168, 60, 255, 0.72) !important;
  background: linear-gradient(145deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 8px 20px rgba(139, 44, 245, 0.22) !important;
}

html[data-theme="dark"] .brand-copy .tiny-label {
  color: #f2c230 !important;
}

html[data-theme="dark"] :is(.brand-copy h1, .brand-copy h2) {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(.avatar, #userPill, .profile-avatar) {
  color: #09090b !important;
  border-color: #ffd95a !important;
  background: linear-gradient(145deg, #ffd95a, #f2c230) !important;
  box-shadow: 0 8px 20px rgba(242, 194, 48, 0.18) !important;
}

html[data-theme="dark"] :is(.hamburger-button, .drawer-close, .drawer-theme-toggle, .settings-close, .settings-section-back, .library-back-button) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #111114 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .hamburger-button span {
  background: #ffffff !important;
}

html[data-theme="dark"] .tab-button {
  min-width: 0;
  min-height: 46px;
  color: #ffffff !important;
  border: 1px solid #292930 !important;
  border-radius: 14px !important;
  background: #111114 !important;
  box-shadow: none !important;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

html[data-theme="dark"] .tab-button .ui-icon {
  color: #a83cff !important;
  stroke: #a83cff !important;
}

html[data-theme="dark"] .tab-button:nth-child(even) .ui-icon {
  color: #f2c230 !important;
  stroke: #f2c230 !important;
}

html[data-theme="dark"] .tab-button.active {
  color: #ffffff !important;
  border-color: #a83cff !important;
  background: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 8px 20px rgba(139, 44, 245, 0.22) !important;
}

html[data-theme="dark"] .tab-button.active .ui-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] :is(.side-drawer, .profile-panel, .settings-panel) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #070708 !important;
  background-image: none !important;
  box-shadow: 18px 0 46px rgba(0, 0, 0, 0.56) !important;
}

html[data-theme="dark"] .side-drawer {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html[data-theme="dark"] .drawer-nav button,
html[data-theme="dark"] .drawer-settings {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  color: #ffffff !important;
  border: 1px solid #292930 !important;
  border-radius: 14px !important;
  background: #111114 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .drawer-nav button span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

html[data-theme="dark"] .drawer-nav button .drawer-icon,
html[data-theme="dark"] .drawer-settings .drawer-icon {
  color: #a83cff !important;
  stroke: #a83cff !important;
}

html[data-theme="dark"] .drawer-nav button:nth-child(even) .drawer-icon {
  color: #f2c230 !important;
  stroke: #f2c230 !important;
}

html[data-theme="dark"] .drawer-nav button.active {
  color: #ffffff !important;
  border-color: #a83cff !important;
  background: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 8px 20px rgba(139, 44, 245, 0.18) !important;
}

html[data-theme="dark"] .drawer-nav button.active .drawer-icon {
  color: #ffd95a !important;
  stroke: #ffd95a !important;
}

html[data-theme="dark"] .drawer-logout {
  color: #ffffff !important;
  border: 1px solid #8b2cf5 !important;
  background: #111114 !important;
}

html[data-theme="dark"] :is(
  [class$="-card"], .card, .panel, .update-bubble, .routine-item,
  .profile-details > div, .profile-stats, .settings-option,
  .settings-protected-fields p, .account-delete-choice,
  .account-delete-intro, .account-delete-warning, .location-filter-panel,
  .directory-card, .learn-note, .control-panel
) {
  max-width: 100%;
  min-width: 0;
  color: #ffffff !important;
  border: 1px solid #292930 !important;
  border-radius: clamp(16px, 2vw, 22px) !important;
  background: #111114 !important;
  background-image: none !important;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] :is(h1, h2, h3, h4, h5, h6, strong, b) {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(p, label, small, .muted, .subtitle, .helper-text, .profile-username, .music-track-hint, .location-summary) {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] :is(.tiny-label, .screen-title .tiny-label, .speech-card .tiny-label) {
  color: #a83cff !important;
}

html[data-theme="dark"] :is(.music-file-label, .important-label, .routine-mode-pill) {
  color: #f2c230 !important;
}

html[data-theme="dark"] :is(input, textarea, select, option, .library-search-box input, .location-search-box input, .speech-search-shell input, .games-search-box input, .music-browser-search input) {
  min-width: 0;
  color: #ffffff !important;
  caret-color: #ffd95a !important;
  border: 1px solid #292930 !important;
  border-radius: 14px !important;
  background: #0b0b0e !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(input, textarea)::placeholder {
  color: #85858f !important;
  opacity: 1;
}

html[data-theme="dark"] :is(input, textarea, select):focus {
  border-color: #a83cff !important;
  box-shadow: 0 0 0 3px rgba(139, 44, 245, 0.2) !important;
  outline: none;
}

html[data-theme="dark"] :is(.primary-button, .settings-save, #startPracticeTimer, #applyPracticeTime) {
  min-height: 44px;
  color: #09090b !important;
  border: 1px solid #ffd95a !important;
  border-radius: 16px !important;
  background: linear-gradient(135deg, #ffd95a, #f2c230) !important;
  box-shadow: 0 8px 20px rgba(242, 194, 48, 0.18) !important;
}

html[data-theme="dark"] :is(.secondary-button, .ghost-button, .filter-toggle, #resetPracticeTimer) {
  min-height: 44px;
  color: #ffffff !important;
  border: 1px solid #8b2cf5 !important;
  border-radius: 16px !important;
  background: #111114 !important;
  background-image: none !important;
}

html[data-theme="dark"] :is(button, input, select, textarea):disabled {
  color: #85858f !important;
  border-color: #292930 !important;
  background: #17171c !important;
  opacity: 0.58;
}

html[data-theme="dark"] .practice-timer-panel {
  max-width: 100%;
  overflow: hidden;
  color: #ffffff !important;
  border: 1px solid rgba(168, 60, 255, 0.7) !important;
  border-radius: 22px !important;
  background: linear-gradient(135deg, #4a118b, #241044, #100b1c) !important;
  box-shadow: 0 14px 34px rgba(58, 18, 111, 0.34) !important;
}

html[data-theme="dark"] .practice-timer-panel::before,
html[data-theme="dark"] .practice-timer-panel::after {
  opacity: 0.55;
}

html[data-theme="dark"] .practice-timer-head .tiny-label {
  color: #ffd95a !important;
}

html[data-theme="dark"] .practice-timer-head strong {
  color: #ffffff !important;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .practice-timer-panel .practice-time-trigger {
  color: #ffffff !important;
  border-color: rgba(168, 60, 255, 0.75) !important;
  background: rgba(17, 17, 20, 0.55) !important;
}

html[data-theme="dark"] .practice-timer-dial {
  border-color: #a83cff !important;
  background: conic-gradient(#ffffff 0 12%, #8b2cf5 12% 42%, #3a126f 42% 100%) !important;
  box-shadow: 0 0 0 12px rgba(58, 18, 111, 0.5), 0 14px 30px rgba(0, 0, 0, 0.35) !important;
}

html[data-theme="dark"] .practice-timer-dial .dial-play {
  border-left-color: #f2c230 !important;
}

html[data-theme="dark"] :is(.music-file-card, .music-browser-player, .music-browser-list, .music-category-list) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #111114 !important;
  background-image: none !important;
}

html[data-theme="dark"] .music-file-label,
html[data-theme="dark"] .music-browser-list-head strong {
  color: #f2c230 !important;
}

html[data-theme="dark"] :is(.music-file-count, .music-browser-list-head span) {
  color: #ffffff !important;
  border-color: #a83cff !important;
  background: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
}

html[data-theme="dark"] :is(.music-search-icon, .library-search-icon, .games-search-icon) {
  color: #a83cff !important;
  border-color: #a83cff !important;
}

html[data-theme="dark"] .music-browser-track {
  min-width: 0;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  border-radius: 14px !important;
  background: #17171c !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-browser-track-copy strong {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(.music-browser-track-copy span, .music-browser-track-copy small, .music-browser-track-status small) {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] :is(.music-browser-track.selected, .music-browser-track.playing) {
  border-color: #a83cff !important;
  background: #17171c !important;
  box-shadow: 0 0 0 2px rgba(139, 44, 245, 0.16), 0 8px 20px rgba(139, 44, 245, 0.12) !important;
}

html[data-theme="dark"] :is(.music-browser-control-main, .music-browser-track-status button) {
  color: #ffffff !important;
  border-color: #a83cff !important;
  background: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 7px 18px rgba(139, 44, 245, 0.2) !important;
}

html[data-theme="dark"] :is(.speech-sticky-tools, .location-sticky-tools, .library-search-shell, .premium-monologue-tools, .games-toolbar, .music-browser-top) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #09090b !important;
  background-image: none !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] :is(.status-badge, .library-book-count, .monologue-meta span, .performance-notes span, .routine-pill) {
  color: #ffd95a !important;
  border-color: rgba(242, 194, 48, 0.4) !important;
  background: #17171c !important;
}

html[data-theme="dark"] :is(.settings-option-icon, .account-delete-intro-icon) {
  color: #ffffff !important;
  border-color: #8b2cf5 !important;
  background: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
}

html[data-theme="dark"] .settings-delete-final {
  color: #09090b !important;
  border-color: #ffd95a !important;
  background: linear-gradient(135deg, #ffd95a, #f2c230) !important;
}

html[data-theme="dark"] :is(.drawer-backdrop, .profile-backdrop, .settings-backdrop) {
  background: rgba(5, 5, 6, 0.82) !important;
  backdrop-filter: blur(5px);
}

html[data-theme="dark"] :focus-visible {
  outline: 2px solid #a83cff !important;
  outline-offset: 3px;
}

html[data-theme="dark"] ::selection {
  color: #050506;
  background: #ffd95a;
}

@media (hover: hover) {
  html[data-theme="dark"] :is(.tab-button, .drawer-nav button, .settings-option, .secondary-button):hover {
    border-color: #a83cff !important;
    background: #17171c !important;
    transform: translateY(-1px);
  }
}

@media (max-width: 520px) {
  html[data-theme="dark"] .tab-bar {
    gap: 6px;
  }

  html[data-theme="dark"] .tab-button {
    min-height: 44px;
    padding-inline: 6px;
    font-size: clamp(0.67rem, 2.8vw, 0.78rem);
  }

  html[data-theme="dark"] :is(.practice-timer-panel, .music-file-card, [class$="-card"]) {
    max-width: 100%;
  }

  html[data-theme="dark"] .practice-timer-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme="dark"] *,
  html[data-theme="dark"] *::before,
  html[data-theme="dark"] *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Keep critical contrast fixes last in the stylesheet. */
html[data-theme="dark"] .public-updates :is(.chat-phone, .chat-feed) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #050506 !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates .chat-header {
  color: #ffffff !important;
  border-bottom-color: #292930 !important;
  background: #09090b !important;
}

html[data-theme="dark"] .public-updates :is(.update-bubble, .update-bubble.incoming) {
  color: #ffffff !important;
  border-color: #292930 !important;
  background: #111114 !important;
}

html[data-theme="dark"] .public-updates .update-bubble.admin {
  border-color: rgba(139, 44, 245, 0.62) !important;
  background: #17171c !important;
}

html[data-theme="dark"] .public-updates :is(.post-media-frame, .post-media-gallery .post-media-frame) {
  border: 2px solid #292930 !important;
  background: #17171c !important;
}

html[data-theme="dark"] .public-updates .update-bubble :is(h3, strong) {
  color: #ffffff !important;
}

html[data-theme="dark"] .public-updates .update-bubble :is(p, .message-meta, .message-meta span) {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] .tab-bar .tab-button {
  color: #ffffff !important;
}

html[data-theme="dark"] .tab-bar .tab-button .ui-icon {
  color: #a83cff !important;
  fill: none !important;
  stroke: #a83cff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

html[data-theme="dark"] .tab-bar .tab-button:nth-child(even) .ui-icon {
  color: #ffd95a !important;
  stroke: #ffd95a !important;
}

html[data-theme="dark"] .tab-bar .tab-button.active .ui-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Borderless dark UI requested for cards and options. */
html[data-theme="dark"] :is(
  .tab-button, .drawer-nav button, .drawer-settings, .settings-option,
  .secondary-button, .ghost-button, .filter-toggle, .routine-mini-button,
  .reaction-button, [class$="-card"], .card, .panel, .routine-item,
  .update-bubble, .profile-details > div, .profile-stats,
  .settings-protected-fields p, .account-delete-choice,
  .location-filter-panel, .directory-card, .control-panel
) {
  border-color: transparent !important;
  border-width: 0 !important;
}

html[data-theme="dark"] :is(input, textarea, select) {
  border-color: transparent !important;
}

html[data-theme="dark"] :is(input, textarea, select):focus {
  border-color: #8b2cf5 !important;
}

/* Active top tab always stays purple; its white SVG can never disappear. */
html[data-theme="dark"] .tab-bar .tab-button.active,
html[data-theme="dark"] .tab-bar button.tab-button.active {
  color: #ffffff !important;
  border: 0 !important;
  background-color: #8b2cf5 !important;
  background-image: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 8px 20px rgba(139, 44, 245, 0.24) !important;
}

html[data-theme="dark"] .tab-bar .tab-button.active .ui-icon,
html[data-theme="dark"] .tab-bar .tab-button.active .ui-icon * {
  color: #ffffff !important;
  fill: none !important;
  stroke: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Music Player keeps its original standalone black theme. */
html[data-theme="dark"] .music-browser {
  color: #ffffff !important;
  background: #000000 !important;
  background-image: none !important;
}

html[data-theme="dark"] :is(.music-browser-top, .music-browser-search, .music-browser-body, .music-browser-list, .music-category-list) {
  color: #ffffff !important;
  border-color: #191919 !important;
  background: #000000 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-browser-search input {
  color: #ffffff !important;
  border: 0 !important;
  background: #181818 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-browser-search input::placeholder {
  color: rgba(255, 255, 255, 0.58) !important;
}

html[data-theme="dark"] :is(.music-browser-close, .music-browser-list-head button) {
  color: #ffffff !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-category-list button,
html[data-theme="dark"] .music-category-list button:nth-child(n) {
  color: #ffffff !important;
  border: 0 !important;
  background: #181818 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-category-list button.active {
  color: #ffffff !important;
  background: #292929 !important;
}

html[data-theme="dark"] .music-browser-track,
html[data-theme="dark"] :is(.music-browser-track.selected, .music-browser-track.playing, .music-browser-track:active) {
  color: #ffffff !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
  transform: none;
}

html[data-theme="dark"] .music-browser-track-copy strong {
  color: #ffffff !important;
}

html[data-theme="dark"] :is(.music-browser-track-copy span, .music-browser-track-copy small, .music-browser-player-copy > span) {
  color: rgba(255, 255, 255, 0.62) !important;
}

html[data-theme="dark"] .music-browser-track-status span {
  color: rgba(255, 255, 255, 0.86) !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-browser-player {
  color: #ffffff !important;
  border: 0 !important;
  border-top: 1px solid #2a2a2a !important;
  background: #202020 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .music-browser-control-main,
html[data-theme="dark"] .music-browser-control-main:not(:disabled):active {
  color: #ffffff !important;
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* Dark app surfaces are completely borderless (music player is isolated below). */
html[data-theme="dark"] :is(
  .app-header, .tab-bar, .side-drawer, .drawer-head, .drawer-nav button,
  .drawer-settings, .drawer-logout, .profile-panel, .settings-panel,
  .settings-option, .settings-protected-fields, .settings-protected-fields p,
  .account-delete-choice, .account-delete-intro, .account-delete-warning,
  .speech-sticky-tools, .location-sticky-tools, .library-search-shell,
  .premium-monologue-tools, .games-toolbar, .chat-phone, .chat-header,
  .chat-feed, .update-bubble, .update-date-separator, .scroll-date-indicator,
  .post-media-frame, .post-media, .post-media-gallery, .reaction-summary,
  .reaction-picker, [class$="-card"], .card, .panel, .control-panel,
  .routine-item, .profile-details > div, .profile-stats,
  input, textarea, select, .primary-button, .secondary-button,
  .ghost-button, .filter-toggle, .routine-mini-button, .reaction-button,
  .tab-button, .hamburger-button, .drawer-close, .drawer-theme-toggle,
  .settings-close, .settings-section-back, .library-back-button
) {
  border: 0 !important;
  border-color: transparent !important;
}

html[data-theme="dark"] :is(input, textarea, select):focus {
  border: 0 !important;
  outline: 2px solid #8b2cf5 !important;
  outline-offset: 1px;
}

/* Slightly brighter charcoal surfaces in dark mode; Music Player is excluded. */
html[data-theme="dark"] :is(
  .tab-button:not(.active), .drawer-nav button:not(.active), .drawer-settings,
  .drawer-logout, .settings-option, .settings-protected-fields p,
  .account-delete-choice, .account-delete-intro, .account-delete-warning,
  .profile-details > div, .profile-stats, .routine-item, .update-bubble,
  .speech-card, .location-card, .library-book-card, .teacher-card,
  .game-card, .monologue-card, .premium-monologue-card,
  .control-panel, .location-filter-panel, .directory-card, .learn-note
) {
  background-color: #1c1c21 !important;
}

html[data-theme="dark"] :is(
  .side-drawer, .profile-panel, .settings-panel,
  .speech-sticky-tools, .location-sticky-tools,
  .library-search-shell, .premium-monologue-tools, .games-toolbar
) {
  background-color: #121216 !important;
}

html[data-theme="dark"] :is(input, textarea, select) {
  background-color: #17171c !important;
}

html[data-theme="dark"] .public-updates .update-bubble.admin {
  background-color: #232329 !important;
}

/* Dark audition feed accents. */
html[data-theme="dark"] .public-updates .chat-header {
  color: #ffffff !important;
  background-color: #8b2cf5 !important;
  background-image: linear-gradient(135deg, #8b2cf5, #3a126f) !important;
  box-shadow: 0 8px 22px rgba(139, 44, 245, 0.22) !important;
}

html[data-theme="dark"] .public-updates .update-bubble .message-meta {
  width: fit-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 9px;
  color: #b8b8c0 !important;
  background-color: #232329 !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates .update-bubble .message-meta span {
  color: #b8b8c0 !important;
  background: transparent !important;
}

html[data-theme="dark"] .public-updates .updates-fullscreen-toggle {
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .public-updates .updates-fullscreen-toggle .fullscreen-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .public-updates .updates-back-toggle {
  border: 0 !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .public-updates .updates-back-toggle .updates-back-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

html[data-theme="dark"] .public-updates .chat-feed {
  background-color: #1a1a1f !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates :is(
  .post-media-frame,
  .post-media-frame .post-media,
  .post-media-frame .post-media-thumb-preview,
  .post-media-frame.error::after
) {
  background-color: #232329 !important;
  background-image: none !important;
}

html[data-theme="dark"] .network-banner.loading {
  color: #ffffff !important;
}

/* Music Player: keep colorful category cards and remove square icon plates. */
html[data-theme="dark"] .music-category-list button:nth-child(12n + 1) { background: linear-gradient(135deg, #7b2cff, #20d99b) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 2) { background: linear-gradient(135deg, #119f91, #16d0b7) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 3) { background: linear-gradient(135deg, #df3d8f, #ff7b91) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 4) { background: linear-gradient(135deg, #e54c37, #ff9d3d) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 5) { background: linear-gradient(135deg, #0d9fd1, #16c3e9) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 6) { background: linear-gradient(135deg, #9a3df5, #bd55ff) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 7) { color: #171321 !important; background: linear-gradient(135deg, #f2a71b, #ffd34d) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 8) { background: linear-gradient(135deg, #101820, #284451) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 9) { background: linear-gradient(135deg, #4252d8, #8858f5) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 10) { background: linear-gradient(135deg, #006c7d, #1197a9) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 11) { background: linear-gradient(135deg, #e75b3f, #ff365f) !important; }
html[data-theme="dark"] .music-category-list button:nth-child(12n + 12) { background: linear-gradient(135deg, #2d6cdf, #54d0ff) !important; }

html[data-theme="dark"] :is(
  .music-browser-close,
  .music-browser-list-head button,
  .music-browser-control,
  .music-browser-track-status span,
  .music-now-close,
  .music-now-menu,
  .music-now-side,
  .music-now-main-control,
  .music-now-play,
  .music-now-add
) {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] :is(
  .music-browser-close,
  .music-browser-list-head button,
  .music-browser-control,
  .music-browser-track-status span,
  .music-now-close,
  .music-now-menu,
  .music-now-side,
  .music-now-main-control,
  .music-now-play,
  .music-now-add
) :is(svg, .music-now-icon) {
  color: #ffffff !important;
  fill: currentColor;
  stroke: currentColor;
}

/* Learn Acting: replace remaining white boxes with brighter charcoal surfaces. */
html[data-theme="dark"] [data-view="learn"] :is(
  .learn-note,
  .teacher-card,
  .teacher-card-head,
  .teacher-body,
  .concept-block,
  .skill-list span,
  .practice-strip span,
  .teacher-books,
  .teacher-book-links a
) {
  border: 0 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] [data-view="learn"] .learn-note {
  color: #ffffff !important;
  background-color: #202026 !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-card {
  color: #ffffff !important;
  background-color: #24242b !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-card-head {
  color: #ffffff !important;
  background-color: #2b2b32 !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-body {
  color: #ffffff !important;
  background-color: #24242b !important;
}

html[data-theme="dark"] [data-view="learn"] .concept-block {
  background-color: #2f2f37 !important;
}

html[data-theme="dark"] [data-view="learn"] :is(.skill-list span, .practice-strip span) {
  color: #ffffff !important;
  background-color: #303038 !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-book-links a {
  color: #ffffff !important;
  background-color: #2f2f37 !important;
}

html[data-theme="dark"] [data-view="learn"] :is(
  .learn-note h3,
  .teacher-card-head h3,
  .concept-block strong,
  .teacher-books > strong,
  .teacher-book-links a span
) {
  color: #ffffff !important;
}

html[data-theme="dark"] [data-view="learn"] :is(
  .learn-note p,
  .teacher-body p,
  .concept-block p,
  .teacher-card-head span,
  .teacher-book-links a small
) {
  color: #b8b8c0 !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-initial {
  color: #09090b !important;
  background: linear-gradient(145deg, #ffd95a, #f2c230) !important;
}

html[data-theme="dark"] [data-view="learn"] .teacher-filter select {
  color: #ffffff !important;
  border: 0 !important;
  background-color: #202026 !important;
}

/* Routine music card: bright count badge and clean background-free options/icons. */
html[data-theme="dark"] [data-view="routine"] :is(.music-file-count, .music-track-hint) {
  color: #ffffff !important;
  border: 0 !important;
  background-color: #2b2b32 !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] [data-view="routine"] .music-picker-chevron {
  color: #ffffff !important;
  border: 0 !important;
  background-color: transparent !important;
  background: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] [data-view="routine"] :is(
  .routine-mini-button,
  .routine-mini-toggle,
  #routineMusicPrev,
  #routineMusicToggle,
  #routineMusicNext
) {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  box-shadow: none !important;
}

html[data-theme="dark"] [data-view="routine"] :is(.routine-mini-icon, #routineMusicToggleIcon) {
  color: #ffffff !important;
}


html[data-theme="dark"] .location-actions .location-website-link {
  color: #ffffff !important;
  background-color: #2b2b32 !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates :is(
  .update-bubble,
  .update-bubble.incoming,
  .update-bubble.admin,
  .post-media-frame,
  .post-media-frame .post-media,
  .post-media-frame .post-media-thumb-preview,
  .post-media-frame.error::after
) {
  background-color: #2b2b32 !important;
  background-image: none !important;
}

html[data-theme="dark"] .public-updates .update-bubble.admin {
  background-color: #303038 !important;
}

html[data-theme="dark"] .public-updates :is(
  .update-bubble .message-meta,
  .update-date-separator,
  .scroll-date-indicator
) {
  background-color: #2b2b32 !important;
  background-image: none !important;
}

/* Music favourites: keep the selected heart visible after final theme overrides. */
.music-now-add.is-favorite,
.music-now-add.is-favorite .music-now-icon {
  color: #ff304f !important;
}

.music-now-add.is-favorite .music-now-icon path {
  fill: currentColor !important;
  stroke: currentColor !important;
}

.music-favourites-card .music-category-icon {
  color: #ff304f !important;
}

.music-favourites-card .music-category-heart {
  display: block;
  width: 1.65rem;
  height: 1.65rem;
  overflow: visible;
  color: #ff304f;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}
