:root { color-scheme: dark; }
/* ...existing styles... */
html, body { height: 100%; margin: 0; background: #0b0b0b; font-family: "Noto Sans", system-ui, sans-serif; overscroll-behavior-y: contain; touch-action: pan-y; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
/* allow selection / default context behavior inside text fields */
input, textarea, select, button { -webkit-user-select: text; user-select: text; }
#app { position: fixed; inset: 0; display: grid; grid-template-rows: 1fr auto; }
#viz { width: 100vw; height: 100vh; display: block; }

/* new: centered app header with subtle bubble glitch */
.appHeader {
  position: fixed;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 70;
  pointer-events: none;
  font-family: "Noto Sans", system-ui, sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #e9e9ea;
  letter-spacing: 0.6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.02);
  display: inline-block;
  text-align: center;
  -webkit-user-select: none;
  user-select: none;
}

/* subtle bubble behind text */
.appHeader::before {
  content: "";
  position: absolute;
  inset: -6px;
  left: 50%;
  transform: translateX(-50%) scale(0.98);
  width: calc(100% + 12px);
  height: 100%;
  background: radial-gradient(ellipse at 30% 40%, rgba(255,255,255,0.03), rgba(255,255,255,0.00) 40%);
  border-radius: 999px;
  filter: blur(6px);
  z-index: -1;
  transition: transform 0.35s ease;
}

/* glitch bubble micro-animation — very discreet */
.appHeader::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -22%;
  width: 10px;
  height: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255,255,255,0.02);
  z-index: -2;
  animation: bubbleGlitch 3.8s ease-in-out infinite;
  opacity: 0.9;
}

/* small text fragment glitch using clipped moving layers */
.appHeader {
  position: relative;
}
.appHeader span{ /* not used by markup but safe if added later */ }

/* keyframes for tiny bubble movement and micro glitch */
@keyframes bubbleGlitch {
  0% { transform: translateY(0) scale(1); opacity: 0.95; }
  25% { transform: translateY(-2px) scale(1.08); opacity: 0.7; }
  50% { transform: translateY(0) scale(0.96); opacity: 0.9; }
  75% { transform: translateY(2px) scale(1.04); opacity: 0.75; }
  100% { transform: translateY(0) scale(1); opacity: 0.95; }
}

/* micro text glitch using pseudo elements (very subtle) */
.appHeader {
  position: relative;
}
.appHeader::after, .appHeader::before { will-change: transform, opacity; }

/* responsive tweak */
@media (max-width: 420px) {
  .appHeader { top: 8px; font-size: 14px; padding: 6px 10px; }
  .appHeader::after { right: -14%; width: 8px; height: 8px; top: -28%; }
}

#ui { position: fixed; inset-inline: 0; bottom: 0; padding: 12px; background: rgba(0,0,0,0.55); backdrop-filter: blur(8px); border-top: 1px solid rgba(255,255,255,0.06); display:flex; flex-direction:column; gap:8px; box-sizing:border-box; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.row.compact { margin-top: 8px; }
button, .file > span { appearance: none; border: 1px solid rgba(255,255,255,0.14); background: #111; color: #eee; padding: 0; border-radius: 10px; font-weight: 600; width: 52px; height: 52px; min-width: 52px; display: inline-flex; align-items: center; justify-content: center; }
button i, .file > span i { font-size: 18px; line-height: 1; display: inline-block; width: auto; text-align: center; }
/* ensure consistent touch target when using icons */
button, .file > span {
    min-height: 44px;
    min-width: 100px; /* reduced to avoid overflow on mobile */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto; /* allow buttons to shrink/wrap */
}

/* New: make the file label an icon-only square button and hide the native file input */
.file input[type="file"] {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: 0;
}

/* make only the .file span compact and square (icon-only) */
.file > span {
  min-width: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 600;
}

/* ensure icon size fits nicely */
.file > span i { font-size: 18px; line-height: 1; width: auto; }

/* keep other buttons flexible but avoid layout jump; smaller baseline min-width */
button {
  min-width: 72px;
}
/* status/info line removed */

.label { font-size: 12px; color: #c3c7cd; }
#settingsBtn { appearance: none; border: 1px solid rgba(255,255,255,0.12); background:#111; color:#ddd; padding:10px 12px; border-radius:10px; font-size:18px; margin-left: auto; }
#settingsModal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.5); z-index: 60; padding: 20px; }
#settingsModal[aria-hidden="false"] { display: flex; }
.modalContent { width: 100%; max-width: 420px; background: #070707; border-radius: 12px; padding: 14px; box-shadow: 0 8px 30px rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.04); color: #e6e6e6; }
.modalContent input[type="range"] { width: 100%; margin-top: 8px; }
.modalContent h3 { margin: 0 0 10px 0; font-size: 16px; }
.setting { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 14px; }
.setting label { display:flex; align-items:center; gap:8px; }
@media (max-width: 420px) {
  #ui { padding: 10px; }
  .row { gap: 6px; }
  button, .file > span { min-width: 52px; width: 52px; height: 52px; padding: 0; font-size: 13px; }
  .row.compact { align-items: center; }
  #status { font-size: 12px; }
}
/* new footer style */
#footer { font-size: 12px; color: #bfc4c9; margin-top: 6px; text-align: center; }
#footer a { color: #e6e6e6; text-decoration: underline; text-decoration-thickness: 1px; }

#recBtn i { color: #e74c3c; } /* idle / stopped icon is red */
/* when actively recording make icon light on a red background for clear contrast */
#recBtn.recording { background: #e74c3c; border-color: rgba(231,76,60,0.9); }
#recBtn.recording i { color: #fff; }