/* VJ Standalone — UI CSS */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100dvh;
  overflow: hidden; background: #000;
  font-family: system-ui, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* --- Canvas container (aspect ratio constrained) --- */
#container {
  width: 100%; height: 100%;
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}
#container canvas {
  position: absolute;
  top: 0; left: 0;
  display: block;
}

/* --- Text overlay (same as output.html) --- */
#text-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 110;
}
#text-overlay canvas {
  display: block;
  mix-blend-mode: normal;
}

/* --- Tap-to-start overlay --- */
#start-overlay {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  color: #fff;
  gap: 16px;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  transition: opacity 0.4s;
}
#start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
#start-overlay h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}
#start-overlay p {
  font-size: 0.9rem;
  opacity: 0.6;
}
.start-links {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.start-links button {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.6);
  font-size: 0.75rem;
  padding: 4px 14px;
  border-radius: 14px;
  cursor: pointer;
}
.start-links button:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}
.start-links .hidden { display: none; }
.start-ring {
  width: 100px; height: 100px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: start-drift 12s ease-in-out infinite, pulse-ring 2s ease-in-out infinite;
}
.start-ring::after {
  content: '';
  width: 40px; height: 40px;
  background: #fff;
  border-radius: 50%;
}
@keyframes pulse-ring {
  0%, 100% { transform: scale(1); border-color: rgba(255,255,255,0.3); }
  50% { transform: scale(1.08); border-color: rgba(255,255,255,0.6); }
}
@keyframes start-drift {
  0%   { translate: 0 0; }
  15%  { translate: 30vw -25vh; }
  35%  { translate: -25vw -15vh; }
  55%  { translate: 20vw 20vh; }
  75%  { translate: -30vw 10vh; }
  90%  { translate: 15vw -20vh; }
  100% { translate: 0 0; }
}

/* --- Safe area padding for landscape notch --- */
:root {
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --pad-left: max(20px, calc(var(--safe-left) + 8px));
  --pad-right: max(20px, calc(var(--safe-right) + 8px));
  --pad-bottom: max(4px, var(--safe-bottom));
}

/* --- Mini bar (bottom, scrollable) --- */
#minibar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(48px + var(--pad-bottom));
  padding-bottom: var(--pad-bottom);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: var(--pad-left);
  padding-right: var(--pad-right);
  z-index: 200;
  color: rgba(255,255,255,0.4);
  font-size: 13px;
  font-family: 'SF Mono', 'Menlo', monospace;
  transition: opacity 0.3s;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#minibar::-webkit-scrollbar { display: none; }
#minibar.hidden {
  opacity: 0;
  pointer-events: none;
}
.minibar-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}
#minibar .bpm-display {
  font-size: 18px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  min-width: 40px;
  text-align: center;
  flex-shrink: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#minibar .bpm-display.manual {
  color: #ff8800;
}
#minibar button {
  background: rgba(255,255,255,0.06);
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
#minibar button:active {
  background: rgba(255,255,255,0.3);
}
#minibar button.active {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
/* Media toggle buttons (Vid/Img/Scratch) */
#minibar button.media-toggle {
  padding: 6px 8px;
  font-size: 11px;
}
#minibar button.media-toggle.hidden {
  display: none;
}
#minibar button.media-toggle.active {
  background: rgba(255,255,255,0.06);
}
#btn-scratch.active {
  background: rgba(255,100,50,0.6) !important;
}
#btn-rotate:active, #btn-help:active {
  background: rgba(255,255,255,0.25);
}

/* --- Feedback indicator (bottom-right, above minibar) --- */
#feedback-indicator {
  position: fixed;
  bottom: calc(56px + var(--pad-bottom));
  right: 12px;
  left: auto; top: auto;
  transform: none;
  font: 0.75rem 'SF Mono', SFMono-Regular, 'Cascadia Code', monospace;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em;
  text-transform: lowercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
  z-index: 210;
  opacity: 0;
  transition: opacity 0.3s;
}
#feedback-indicator.show { opacity: 1; }

/* --- Preset name (bottom-right, above feedback) --- */
#preset-name {
  position: fixed;
  bottom: calc(72px + var(--pad-bottom));
  right: 12px;
  left: auto; top: auto;
  transform: none;
  font: 0.75rem 'SF Mono', SFMono-Regular, 'Cascadia Code', monospace;
  color: rgba(255,255,255,0.6);
  letter-spacing: 0.05em;
  text-transform: lowercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  text-align: right;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
}
#preset-name.show { opacity: 1; }

/* --- Text edit overlay --- */
#text-edit-overlay {
  position: fixed; inset: 0;
  z-index: 400;
  background: rgba(0,0,0,0.05);
  display: none;
  align-items: center;
  justify-content: center;
}
#text-edit-overlay.show {
  display: flex;
}
.text-edit-box {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(20,20,20,0.3);
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
}
.text-edit-box label {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
#text-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 18px;
  font-family: inherit;
  padding: 8px 12px;
  border-radius: 8px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
#text-input:focus {
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.15);
}

/* --- FPS info --- */
#fps-display {
  position: fixed;
  top: 8px;
  left: var(--pad-left);
  color: rgba(255,255,255,0.35);
  font: 11px monospace;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
}
#fps-display.hidden {
  display: none;
}

/* --- Help overlay --- */
#help-overlay {
  position: fixed; inset: 0;
  z-index: 1100;
  background: rgba(0,0,0,0.05);
  color: #eee;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 32px var(--pad-right) 80px var(--pad-left);
  font-family: -apple-system, system-ui, sans-serif;
  line-height: 1.7;
  display: none;
}
#help-overlay.show {
  display: block;
}
.help-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
#help-lang {
  padding: 3px 10px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.05em;
}
#help-lang:active {
  background: rgba(255,255,255,0.25);
}
#help-overlay h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}
#help-overlay .subtitle {
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  margin-bottom: 28px;
}
#help-overlay h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 24px 0 10px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 6px;
}
#help-overlay .row {
  display: flex;
  align-items: baseline;
  padding: 5px 0;
  gap: 12px;
}
#help-overlay .g {
  flex-shrink: 0;
  min-width: 110px;
  font-weight: 600;
  color: #6cf;
  font-size: 0.9rem;
}
#help-overlay .d {
  color: rgba(255,255,255,0.75);
  font-size: 0.9rem;
}
#help-overlay .note {
  margin-top: 20px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
}
#help-close {
  display: inline-block;
  margin-top: 24px;
  padding: 10px 28px;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#help-close:active {
  background: rgba(255,255,255,0.25);
}

/* --- Grid overlay --- */
#grid-overlay {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 33%;
  z-index: 300;
  background: rgba(0,0,0,0.05);
  display: none;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.08);
}
#grid-overlay.show {
  display: block;
}
#grid-float-btns {
  position: absolute;
  top: 6px;
  right: var(--pad-right);
  display: flex;
  gap: 6px;
  z-index: 310;
}
.grid-float-btn {
  width: 32px; height: 32px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  color: rgba(255,255,255,0.6);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.grid-float-btn:active {
  background: rgba(255,255,255,0.25);
}
.grid-float-btn.active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
}

/* --- Scene overlay (top) --- */
#scene-overlay {
  position: fixed;
  bottom: calc(48px + var(--pad-bottom));
  left: 0; right: 0;
  z-index: 300;
  background: rgba(0,0,0,0.05);
  display: none;
  border-top: 1px solid rgba(255,255,255,0.08);
}
#scene-overlay.show {
  display: block;
}

/* --- Scene bar --- */
.scene-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px var(--pad-right) 4px var(--pad-left);
}
.scene-label {
  font: bold 10px 'SF Mono', 'Menlo', monospace;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.08em;
}
#scene-save {
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.5);
  font: bold 10px 'SF Mono', monospace;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#scene-save.active {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
}
#scene-save:active {
  background: rgba(255,255,255,0.2);
}
#scene-slots {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 1;
  min-width: 0;
}
.scene-slot.save-mode {
  border-color: rgba(255,255,255,0.4);
}
.scene-slot {
  width: 36px; height: 28px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.4);
  font: 10px 'SF Mono', monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scene-slot.filled {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.6);
}
.scene-slot:active {
  background: rgba(255,255,255,0.2);
}

/* --- Grid FX section (blend + filter) --- */
.grid-fx-section {
  grid-column: 1 / -1;
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 4px;
}
.grid-fx-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.grid-fx-label {
  font: bold 8px 'SF Mono', monospace;
  color: rgba(255,255,255,0.35);
  min-width: 42px;
  letter-spacing: 0.05em;
}
.grid-fx-btn {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: rgba(255,255,255,0.6);
  font: 8px 'SF Mono', monospace;
  padding: 3px 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.grid-fx-btn:active {
  background: rgba(255,255,255,0.2);
}
.grid-fx-btn.active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
}

/* --- Grid container --- */
#grid-container {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px var(--pad-right) calc(60px + var(--pad-bottom)) var(--pad-left);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 4px;
  align-content: start;
}
.grid-btn {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: rgba(255,255,255,0.6);
  font: 8px 'SF Mono', 'Menlo', monospace;
  padding: 4px 4px;
  min-height: 28px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.grid-btn:active {
  background: rgba(255,255,255,0.2);
}
.grid-btn.active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
}
.grid-tag {
  font-size: 7px;
  opacity: 0.7;
  display: block;
  line-height: 1;
}

/* --- Grid tag filter bar --- */
.grid-tag-bar {
  grid-column: 1 / -1;
  display: flex;
  gap: 4px;
  padding: 4px 0 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 4px;
}
.grid-tag-filter-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  color: rgba(255,255,255,0.5);
  font: 8px 'SF Mono', monospace;
  padding: 3px 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.grid-tag-filter-btn:active {
  background: rgba(255,255,255,0.2);
}
.grid-tag-filter-btn.active {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}

/* --- Grid tag group header --- */
.grid-tag-header {
  grid-column: 1 / -1;
  font: bold 9px 'SF Mono', monospace;
  padding: 6px 0 2px;
  letter-spacing: 0.05em;
}

/* --- Media overlay --- */
#media-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 350;
  background: rgba(0,0,0,0.05);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
#media-overlay.show {
  display: flex;
}
.media-panel {
  margin-bottom: calc(56px + var(--pad-bottom));
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 280px;
  max-width: 360px;
  width: 90%;
}
.media-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font: bold 12px 'SF Mono', monospace;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.08em;
}
.media-header button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  -webkit-tap-highlight-color: transparent;
}
.media-section {
  margin-bottom: 10px;
}
.media-pick-btn {
  width: 100%;
  padding: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.media-pick-btn:active {
  background: rgba(255,255,255,0.2);
}
.media-pick-btn.loaded {
  border-style: solid;
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
}
.media-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.media-controls.hidden {
  display: none;
}
.media-controls button,
.media-controls select {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font: 12px 'SF Mono', monospace;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.media-controls label {
  color: rgba(255,255,255,0.5);
  font: 11px 'SF Mono', monospace;
  display: flex;
  align-items: center;
  gap: 4px;
}
.media-controls select {
  -webkit-appearance: none;
  appearance: none;
}
.media-lock-btn {
  font-size: 14px;
  padding: 4px 8px;
}
.media-lock-btn.active {
  background: rgba(255,255,255,0.15);
}

/* --- Upgrade button --- */
#btn-upgrade {
  background: rgba(255,180,50,0.5);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255,180,50,0.8);
}
#btn-upgrade:active {
  background: rgba(255,180,50,0.7);
}
#btn-upgrade.hidden {
  display: none;
}

/* --- Locked button (Free版) --- */
#minibar button.locked {
  opacity: 0.4;
}

/* --- License section (help overlay) --- */
#license-section {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
#license-status {
  font-size: 0.9rem;
  margin: 8px 0 12px;
}
#license-status.license-active {
  color: rgba(255,255,255,0.7);
}
#license-status.license-free {
  color: rgba(255,255,255,0.5);
}
#license-status.license-error {
  color: rgba(255,100,80,0.9);
}
.license-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.license-input-row.hidden {
  display: none;
}
#license-key-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 14px;
  font-family: 'SF Mono', monospace;
  padding: 8px 12px;
  border-radius: 8px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}
#license-key-input:focus {
  border-color: rgba(255,255,255,0.6);
}
#license-activate {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
#license-activate:active {
  background: rgba(255,255,255,0.3);
}
#license-activate:disabled {
  opacity: 0.5;
}
#license-deactivate {
  background: rgba(255,80,80,0.2);
  border: 1px solid rgba(255,80,80,0.4);
  color: rgba(255,80,80,0.8);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#license-deactivate.hidden {
  display: none;
}
#license-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
#license-key-display.hidden {
  display: none;
}
#license-key-text {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  word-break: break-all;
}
#license-key-copy {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

/* --- BPM Reel Picker --- */
#bpm-reel {
  position: fixed;
  bottom: calc(56px + var(--pad-bottom));
  right: var(--pad-right);
  z-index: 250;
  display: none;
}
#bpm-reel.show {
  display: block;
}
.bpm-reel-mask {
  position: relative;
  width: 80px;
  height: 132px;
  overflow: hidden;
  border-radius: 12px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.15);
}
.bpm-reel-track {
  position: absolute;
  top: 0; left: 0; right: 0;
  will-change: transform;
}
.bpm-reel-highlight {
  position: absolute;
  top: 44px;
  left: 0; right: 0;
  height: 44px;
  background: rgba(255,136,0,0.25);
  border-top: 1px solid rgba(255,136,0,0.5);
  border-bottom: 1px solid rgba(255,136,0,0.5);
  pointer-events: none;
}
.bpm-reel-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: bold 22px 'SF Mono', 'Menlo', monospace;
  color: rgba(255,255,255,0.35);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  transition: color 0.15s;
}
.bpm-reel-item.active {
  color: #ff8800;
  font-size: 24px;
}
#bpm-reel-auto {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: rgba(255,255,255,0.7);
  font: bold 12px 'SF Mono', 'Menlo', monospace;
  letter-spacing: 0.08em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#bpm-reel-auto:active {
  background: rgba(255,255,255,0.25);
}

/* --- Text Popup (BPM reel style) --- */
#text-popup {
  position: fixed;
  z-index: 250;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
}
#text-popup.show {
  display: flex;
}
.text-popup-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font: bold 12px 'SF Mono', 'Menlo', monospace;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.text-popup-btn:active {
  background: rgba(255,255,255,0.25);
}
.text-popup-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* --- Lock Popup --- */
#lock-popup {
  position: fixed;
  z-index: 250;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
}
#lock-popup.show {
  display: flex;
}
.lock-popup-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font: bold 12px 'SF Mono', 'Menlo', monospace;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.lock-popup-btn:active {
  background: rgba(255,255,255,0.25);
}
.lock-popup-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* --- Aspect popup --- */
#aspect-popup {
  position: fixed;
  z-index: 250;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
}
#aspect-popup.show {
  display: flex;
}
.aspect-popup-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  font: bold 12px 'SF Mono', 'Menlo', monospace;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.aspect-popup-btn:active {
  background: rgba(255,255,255,0.25);
}
.aspect-popup-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}


/* --- Settings popup --- */
#settings-popup {
  position: fixed;
  z-index: 250;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
}
#settings-popup.show {
  display: flex;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-label {
  font: bold 11px 'SF Mono', 'Menlo', monospace;
  color: rgba(255,255,255,0.5);
  min-width: 40px;
}
.settings-options {
  display: flex;
  gap: 4px;
}
.settings-options button {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.6);
  font: 11px 'SF Mono', 'Menlo', monospace;
  padding: 5px 8px;
  border-radius: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.settings-options button:active {
  background: rgba(255,255,255,0.25);
}
.settings-options button.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

/* --- Gesture hint (first launch) --- */
#gesture-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  z-index: 210;
  opacity: 0;
  transition: opacity 0.5s;
  padding: 24px 28px 20px;
  background: rgba(0,0,0,0.85);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  min-width: 240px;
  max-width: 300px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#gesture-hint.show {
  opacity: 1;
}
.hint-title {
  font: bold 0.85rem system-ui;
  color: rgba(255,255,255,0.9);
  text-align: center;
  letter-spacing: 0.06em;
  margin-bottom: 16px;
}
.hint-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  align-items: center;
}
.hint-key {
  font: bold 0.9rem 'SF Mono', monospace;
  color: #6cf;
  text-align: right;
  white-space: nowrap;
}
.hint-val {
  font: 0.85rem system-ui;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
}
.hint-ok {
  display: block;
  margin: 18px auto 0;
  padding: 8px 36px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  color: rgba(255,255,255,0.8);
  font: bold 0.8rem system-ui;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hint-ok:active {
  background: rgba(255,255,255,0.3);
}

/* --- Full mode hint --- */
#full-mode-hint {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.8);
  font: bold 1.2rem system-ui;
  text-shadow: 0 2px 12px rgba(0,0,0,0.8);
  pointer-events: none;
  z-index: 210;
  opacity: 0;
  transition: opacity 0.4s;
}
#full-mode-hint.show {
  opacity: 1;
}

/* --- Bold UI theme --- */
body.ui-bold #minibar { height: calc(56px + var(--pad-bottom)); background: rgba(0,0,0,0.6); }
body.ui-bold #minibar button { font-size: 15px; padding: 8px 14px; color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.12); }
body.ui-bold #minibar button.active { color: #fff; background: rgba(255,255,255,0.25); }
body.ui-bold .bpm-display { font-size: 22px; color: rgba(255,255,255,0.8); }
body.ui-bold .minibar-sep { background: rgba(255,255,255,0.2); }
body.ui-bold #settings-popup,
body.ui-bold #lock-popup,
body.ui-bold #aspect-popup { background: rgba(0,0,0,0.7); border-color: rgba(255,255,255,0.3); }
body.ui-bold .settings-label { font-size: 13px; color: rgba(255,255,255,0.8); }
body.ui-bold .settings-options button { font-size: 13px; padding: 6px 10px; color: rgba(255,255,255,0.8); }
body.ui-bold .settings-options button.active { color: #fff; background: rgba(255,255,255,0.3); }
body.ui-bold .lock-popup-btn { font-size: 13px; }
body.ui-bold #osd-overlay { font-size: 2rem; }
