﻿@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-Thin.otf") format("opentype");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
#sidebar-block-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #333;
}
@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-SemiBold.otf") format("opentype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
.checkpoint {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
#bpmInput {
  padding: 0.5rem;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
  margin-left: auto;
}

#bpmInput:focus {
  outline: none;
  border-color: #333;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}
@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-ExtraBold.otf") format("opentype");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Spartan MB";
  src: url("assets/fonts/spartan-mb/SpartanMB-Black.otf") format("opentype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* {
  -webkit-user-select: none; /* Chrome, Safari, and Capacitor (iOS) */
  user-select: none;
  
  /* Disables the "copy/paste" context menu on iOS */
  -webkit-touch-callout: none; 
}

/* Re-enable selection for specific elements like inputs or text areas */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
}
.glow {
  position: absolute;
  bottom: -50%;
  left: -0%;
  width: 200%;
  height: 100%;
  background: linear-gradient(0deg, #ff523d, transparent);
  filter: blur(10px);
  opacity: 0;
  z-index: -1;
}

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Dice and Grid */
  --dice-size-base: 68px;
  --dice-size: var(--dice-size-base);
  --grid-rows: 4;
  --grid-columns: 4;

  /* Dice Face Colors */
  --face-1-color: #ff523d;
  --face-2-color: #ff7966;
  --face-3-color: #ff9f91;
  --face-4-color: #ffc6bd;
  --face-5-color: #ffe2dc;
  --face-6-color: #fff7f5;

  /* Dot Colors */
  --dot-color: black;
  --dot-hit-color: white;
  --block-inactive-color: #808080;
  --hold-note-active-15-color: #ff523d;
  --hold-note-active-2-color: #ff7966;
  --hold-note-active-3-color: #ff9f91;
  --hold-note-active-4-color: #ffc6bd;
}
/* Classes for dice faces */
.die-face-1 {
  background-color: var(--face-1-color) !important;
}

.die-face-2 {
  background-color: var(--face-2-color) !important;
}

.die-face-3 {
  background-color: var(--face-3-color) !important;
}

.die-face-4 {
  background-color: var(--face-4-color) !important;
}

.die-face-5 {
  background-color: var(--face-5-color) !important;
}

.die-face-6 {
  background-color: var(--face-6-color) !important;
}

/* ============================================
   RESET AND BASE STYLES
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-size: 16px;
}

.tooltip-icon {
  color: #555;
  font-size: 1rem;
  cursor: help;
}

.tooltip-text {
  text-align: center;
  position: absolute;
  left: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  background-color: white;
  transform: translateY(80%);

  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
  width: max-content;
  max-width: min(260px, 80vw);
  white-space: normal;
  overflow-wrap: anywhere;
  opacity: 0; /* hidden by default */
  pointer-events: none; /* avoids blocking hover */
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 100;
}

.tooltip:hover .tooltip-text,
.tooltip:focus-within .tooltip-text,
.tooltip.is-open .tooltip-text {
  opacity: 1;
  transform: translateY(-20);
  pointer-events: auto;
}
.tooltip {
  display: flex; /* flex container */
  align-items: center; /* vertically center items */
  justify-content: flex-start; /* left-align children */
  position: relative; /* for the tooltip positioning */
  gap: 0.5rem; /* space between text and icon */
  overflow: visible;
  cursor: default; /* indicate non-clickable */
}

body {
  margin: 0;
  touch-action: manipulation;
  min-height: -webkit-fill-available;
  overflow: hidden;
  font-family: "Spartan MB", sans-serif;
  font-weight: 500;
  font-optical-sizing: auto;
  font-style: normal;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.64), transparent 34%),
    linear-gradient(145deg, #ff6b57 0%, #ff523d 44%, #ff725f 100%);
  height: 100dvh;
  display: flex;
  justify-items: center;
  align-items: center;
}

#page {
  display: flex;
  flex-direction: row;
  z-index: 10;
  pointer-events: auto;
  align-items: center;
  width: 100%;
  justify-content: center;
  overflow: visible;
  position: relative;
  min-height: 100dvh;
}

img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* ============================================
   DICE CONTAINER AND ITEMS
   ============================================ */
.dice-container {
  --grid-hit-overflow-pad: calc(var(--dice-size, 80px) * 0.09);
  --grid-loop-bracket-pad: calc(var(--dice-size, 80px) * 0.01);
  --grid-visible-max-height: calc(
    (var(--dice-size, 80px) * 4) + (var(--dice-size, 80px) * 0.06 * 8)
  );
  display: grid;
  grid-template-columns: repeat(var(--grid-rows), auto);
  grid-template-rows: repeat(var(--grid-columns), auto);
  grid-auto-flow: row;
  width: fit-content;
  max-width: min(100vw - 20px, 100%);
  padding-top: calc(var(--dice-size, 80px) * 0.08);
  padding-bottom: var(--grid-hit-overflow-pad);
  padding-left: calc(var(--grid-loop-bracket-pad) + (var(--dice-size, 80px) * 0.08));
  padding-right: calc(var(--grid-loop-bracket-pad) + (var(--dice-size, 80px) * 0.08));
  max-height: calc(
    var(--grid-visible-max-height) + var(--grid-hit-overflow-pad) + 1px
  );
  overflow-y: auto;
  overflow-x: auto;
  scroll-behavior: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  pointer-events: auto;

  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE 10+ */
  transform: height 0.3s ease;
}

.dice-container::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.item {
  position: relative;
  pointer-events: auto !important;
  z-index: 1;
  cursor: grab;
  border-radius: 13%;
  width: calc(var(--dice-size, 80px));
  height: calc(var(--dice-size, 80px));
  overflow: hidden !important;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.2s;
  contain: layout style;
  transform-origin: center;
  margin: calc(var(--dice-size, 80px) * 0.06);
  will-change: transform;
}

.item.hold-note {
  background: var(--block-inactive-color, darkgray) !important;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--dice-size, 80px) * 0.12);
}

.item.hold-note.hold-note-active {
  background: var(
    --hold-active-color,
    var(--hold-note-active-2-color, #ffa84d)
  ) !important;
}

/* Removed hover for mobile app */
/* .item:hover {
  background-color: var(
    --hover-face-color,
    var(--block-inactive-color, darkgray)
  );
} */

/* Removed hover for mobile app */
/* .item.hold-note:hover, */
.item.hold-note.hold-hover {
  background: var(
    --hold-active-color,
    var(--hold-note-active-2-color, #ffa84d)
  ) !important;
}

.item.dotted-quarter-note {
  border-radius: 12px;
  padding: calc(var(--dice-size, 80px) * 0.025);
  background: transparent !important;
}

.dotted-quarter-layout {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: calc(var(--dice-size, 80px) * 0.04);
}

.dq-segment {
  height: 100%;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.22s ease, opacity 0.22s ease;
}

.dq-main {
  flex: 2;
  background: var(--block-inactive-color, darkgray);
}

.dq-tail {
  flex: 1;
  min-width: calc(var(--dice-size, 80px) * 0.42);
  background: var(--face-2-color, #70b8fe);
  opacity: 1;
}

.dq-segment.dq-muted {
  opacity: 0.45;
}

/* Removed hover for mobile app */
/* .item.dotted-quarter-note:hover .dq-main {
  background: var(--face-1-color, #fb6354);
}

.item.dotted-quarter-note:hover .dq-tail {
  background: var(--face-2-color, #70b8fe);
} */

.item.dotted-quarter-note.dq-main-active .dq-main {
  background: var(--face-1-color, #fb6354);
}

.item.dotted-quarter-note.dq-tail-active .dq-tail {
  background: var(--face-2-color, #70b8fe);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.item.dotted-quarter-note .dot {
  background-color: rgba(255, 255, 255, 0.95);
}

.item.split-note {
  border-radius: 12px;
  overflow: visible !important;
}

.item.split-note .judgement {
  width: max-content;
  min-width: 100%;
  white-space: nowrap;
}

.item.split-note.split-eighth {
  background: var(--block-inactive-color, darkgray) !important;
}

.item.split-note.split-sixteenth {
  background: var(--block-inactive-color, darkgray) !important;
}

.item.split-note.split-note-active.split-eighth {
  background: var(--face-2-color, #70b8fe) !important;
}

.item.split-note.split-note-active.split-sixteenth {
  background: var(--face-4-color, #c739ff) !important;
}

.item.split-note.split-muted {
  opacity: 0.5;
}

.hold-continuation {
  height: calc(var(--dice-size, 80px));
  border-radius: 12px;
  background: var(--block-inactive-color, darkgray);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 calc(var(--dice-size, 80px) * 0.12);
  margin: calc(var(--dice-size, 80px) * 0.06);
  pointer-events: none;
  transition: background-color 0.22s ease;
}

.hold-continuation.hold-note-active {
  background: var(
    --hold-active-color,
    var(--hold-note-active-2-color, #ffa84d)
  );
}

.hold-continuation.hold-hover {
  background: var(
    --hold-active-color,
    var(--hold-note-active-2-color, #ffa84d)
  );
}

.hold-fill-track {
  position: relative;
  width: 100%;
  height: calc(var(--dice-size, 80px) * 0.18);
  background: var(--dot-color, #000000);
  border-radius: 999px;
  overflow: hidden;
}

.hold-fill-progress {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  transform: scaleX(0);
  background: var(--dot-hit-color, #ffffff);
  border-radius: 999px;
}

.hold-fill-progress.hold-manual-fill {
  background: var(--dot-hit-color, #ffffff);
}

.hold-fill-progress.hold-final-black {
  background: var(--dot-hit-color, #ffffff);
}

.item-inactive {
  background-color: var(--block-inactive-color) !important;
}

.die-wrapper {
  overflow: visible !important;
  position: relative;
  z-index: 2;
  contain: layout;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--dice-size, 80px) * 0.08);
  padding-bottom: calc(var(--dice-size, 80px) * 0.06);
}

.assessment-progress {
  width: calc(100% - (var(--dice-size, 80px) * 0.12));
  min-height: 7px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}

.assessment-progress-segment {
  height: 7px;
  border-radius: 999px;
  background: rgba(42, 32, 29, 0.12);
  transform: scaleX(1);
  transform-origin: center;
  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.assessment-progress-segment.is-filled {
  background: linear-gradient(180deg, #ff8a79 0%, #ff523d 100%);
  box-shadow: 0 0 10px rgba(255, 82, 61, 0.28);
}

.assessment-hit-flash .assessment-progress-segment.is-filled {
  box-shadow: 0 0 12px rgba(61, 214, 122, 0.35);
}

.item.assessment-hit-flash {
  box-shadow:
    0 0 0 2px rgba(61, 214, 122, 0.95),
    0 0 22px rgba(61, 214, 122, 0.42);
}

.item.assessment-miss-flash {
  box-shadow:
    0 0 0 2px rgba(255, 89, 94, 0.92),
    0 0 22px rgba(255, 89, 94, 0.38);
}

.dot.assessment-pop {
  animation: assessmentDotPop 240ms cubic-bezier(0.22, 1.3, 0.36, 1);
}
.dot-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid darkgray;
  background-color: #eee;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.dot-checkbox:checked {
  background-color: #fb6354;
  border-color: #c74e42;
}

/* ============================================
   DICE FACES
   ============================================ */
.first-face {
  display: flex;
  justify-content: center;
  align-items: center;
}

.second-face {
  display: flex;
  justify-content: center;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

.third-face {
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

.third-face .column {
  overflow: visible;
  display: flex;
  flex-direction: row;
  gap: calc(var(--dice-size, 80px) * 0.15);
  justify-content: center;
}

.fourth-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

.fourth-face .column {
  overflow: visible;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: calc(var(--dice-size, 80px) * 0.15);
  justify-content: space-between;
}

.fifth-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--dice-size, 80px);
  height: var(--dice-size, 80px);
  gap: calc(var(--dice-size, 80px) * 0.075);
}

.fifth-face .row-1 {
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.fifth-face .row-2 {
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: calc(var(--dice-size, 80px) * 0.3);
}

.fifth-face .row-3 {
  overflow: visible;
  display: flex;
  flex-direction: row;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

.sixth-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: var(--dice-size, 80px);
  height: var(--dice-size, 80px);
  gap: calc(var(--dice-size, 80px) * 0.075);
}

.sixth-face .row-1,
.sixth-face .row-2 {
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

.sixth-face .row-3 {
  overflow: visible;
  display: flex;
  flex-direction: row;
  gap: calc(var(--dice-size, 80px) * 0.15);
}

/* ============================================
   DOTS
   ============================================ */
.dot {
  display: block;
  width: calc(var(--dice-size, 80px) * 0.15);
  height: calc(var(--dice-size, 80px) * 0.15);
  border-radius: 50%;
  flex-shrink: 0;
  flex-grow: 0;
  background-color: var(--dot-color, black);
}
.dot-onboarding {
  display: block;
  width: calc(var(--dice-size, 80px) * 0.15);
  height: calc(var(--dice-size, 80px) * 0.15);
  border-radius: 50%;
  flex-shrink: 0;
  flex-grow: 0;
  background-color: black !important;
}

.music-symbols-enabled #dice-container .item .dot,
.music-symbols-enabled #sidebar-wrapper .dice-preview .item .dot,
.music-symbols-enabled #block-selection-modal .dice-preview .item .dot {
  opacity: 0 !important;
}

.music-symbols-enabled #dice-container .item .dot.hit,
.music-symbols-enabled #sidebar-wrapper .dice-preview .item .dot.hit,
.music-symbols-enabled #block-selection-modal .dice-preview .item .dot.hit {
  animation: none !important;
}

.music-symbol-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.music-symbol-number {
  position: absolute;
  top: 8%;
  left: 56%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-color, #111);

  pointer-events: none;
}

.music-symbol-overlay.hold-symbol-left {
  justify-content: flex-start !important;
  padding-left: 0 !important;
}

.music-symbol-overlay.hold-symbol-left img,
.music-symbol-overlay.hold-symbol-left svg {
  width: calc(var(--dice-size, 80px) * 0.9) !important;
  max-width: calc(var(--dice-size, 80px) * 0.9);
  flex: 0 0 auto;
}

.music-symbol-overlay img,
.music-symbol-overlay svg {
  width: 90%;
  height: 40%;
  object-fit: scale-down;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.music-symbol-overlay .music-notehead {
  transition: fill 0.2s ease, fill-opacity 0.2s ease, stroke-opacity 0.2s ease;
  transform-box: fill-box;
  transform-origin: center center;
  vector-effect: non-scaling-stroke;
  will-change: transform;
  backface-visibility: hidden;
}

.music-symbols-enabled #dice-container .item.hold-note .hold-fill-track,
.music-symbols-enabled
  #sidebar-wrapper
  .dice-preview
  .item.hold-note
  .hold-fill-track,
.music-symbols-enabled
  #block-selection-modal
  .dice-preview
  .item.hold-note
  .hold-fill-track {
  display: none !important;
}

.music-symbols-enabled #dice-container .item.hold-note .music-symbol-overlay,
.music-symbols-enabled
  #sidebar-wrapper
  .dice-preview
  .item.hold-note
  .music-symbol-overlay,
.music-symbols-enabled
  #block-selection-modal
  .dice-preview
  .item.hold-note
  .music-symbol-overlay {
  justify-content: flex-start;
  padding-left: calc(var(--dice-size, 80px) * 0.25);
}

.dot.hit {
  animation: dot-hit 0.3s ease-out forwards;
}

.dot.silent {
  opacity: 0.2;
}

.silent .hit {
  animation: silent-hit 0.3s ease-out forwards !important;
}

/* ============================================
   CONTAINER BACKGROUND
   ============================================ */
#container-bg {
  display: flex;
  flex-direction: column;
  margin-top: 60px;
  padding: 2.8rem 2.5rem 2.8rem;
  border-radius: clamp(15px, 3vw, 28.8px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 244, 241, 0.98));
  width: var(--dice-size) * var(--grid-columns);
  max-height: (var(--dice-size, 80px) * 4) + (var(--dice-size, 80px) * 0.06 * 8);
  z-index: -1;
  pointer-events: none;

  contain: layout; /* Changed from 'paint' */
  overflow: visible;
  /* Smooth transition for size changes */
  transition: padding 0.3s ease, border-radius 0.3s ease;
  box-shadow:
    0 26px 70px rgba(100, 22, 11, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.72);
}

#container-bg h2{
  align-self: center;
  font-weight: bold;
  font-size:  clamp(1.5rem, 5vw, 2.5rem);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
/* ============================================
   MODERN SIDEBARS (General & Project)
   ============================================ */
.settings-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  z-index: 4000;
  padding: 0;
  transition: opacity 0.3s ease;
}

.settings-wrapper.hidden {
  display: none !important;
}

#countdown .active {
  background-color: black !important;
}
.settings {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0;
}

.setting-section {
  width: 100%;
  border-bottom: #eee 1px solid;
  font-size: 1.1rem;
  font-weight: 700;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.close-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px 8px;
  transition: color 0.15s ease;
}

/* ============================================
   FORM CONTROLS
   ============================================ */
.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input-wrapper .dot-color-picker,
.color-input-wrapper #block-color-picker {
  width: 40px;
  height: 30px;
  border: none;
  background: none;
  cursor: pointer;
}

.color-preview {
  font-size: 14px;
  color: #333;
}

.combobox-wrapper {
  display: flex;
  width: 100%;
  overflow: visible;
  align-items: center;
  justify-content: space-between;
}

.combobox-wrapper p {
  margin: 0;
  font-weight: 500;
  font-size: 1rem;
}

.combobox {
  width: 100%;
  padding: 0.6rem 1rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.combobox:focus {
  outline: none;
  border-color: #f85c48;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
}

.settings-drawer {
  width: 100%;
  border: 1px solid #ececec;
  border-radius: 12px;
  background: #f8f9fb;
}

.settings-drawer-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0.8rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.settings-drawer-summary::-webkit-details-marker {
  display: none;
}

.settings-drawer-copy {
  min-width: 0;
}

.settings-drawer-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  color: #333;
}

.settings-drawer-subtitle {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: #7b7f86;
}

.settings-drawer-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.settings-drawer-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.settings-drawer-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.settings-drawer-summary svg.fa-solid {
  color: #666;
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.settings-drawer[open] .settings-drawer-summary svg.fa-solid {
  transform: rotate(180deg);
}

.settings-drawer-body {
  padding: 0.2rem 0.8rem 0.8rem;
}

.block-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.block-color-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 10px;
  border: 1px solid #ededed;
  background: #fff;
}

.block-color-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.block-color-swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.block-color-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4a4a4a;
}

.form-group .block-color-item .compact-color-input {
  width: 2rem;
  height: 1.5rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: none;
}

.form-group
  .block-color-item
  .compact-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-group .block-color-item .compact-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.form-group .block-color-item .compact-color-input::-moz-color-swatch {
  border: none;
  border-radius: 6px;
}

@media (max-width: 520px) {
  .block-color-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   BPM BUTTON & CHIPS
   ============================================ */
.bpm-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.bpm-chip {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #555;
}

.bpm-chip:active {
  transform: translateY(0);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 15px;
  border-radius: 50px !important;
  background: #d3d3d3;
  outline: none;
 
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fb6354;
  cursor: pointer;
}

.slider::-moz-range-thumb {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #fb6354;
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  margin: 0 10px;
  cursor: pointer;
}

.switch input {
  transform: scale(1);
}

/* ============================================
   KEYBIND CONTROLS
   ============================================ */
.keybind-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #ccc;
  width: 100%;
  border-radius: 6px;
  background: #f9f9f9;
}

.keybind-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.keybind-tag {
  background: #f87867;
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.keybind-tag button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

#add-keybind-btn {
  padding: 6px 12px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  background: #f85c48;
  color: white;
  cursor: pointer;
}

#cancel-btn {
  margin-top: 10px;
  padding: 6px 12px;
  background: #ccc;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#offset-wizard-modal {
  z-index: 5000;
}

.wizard-title {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  letter-spacing: 0.24em;
  font-weight: 700;
}

.wizard-main p {
  margin: 0;
  opacity: 0.85;
  font-size: clamp(1.05rem, 2.6vw, 1.45rem);
  line-height: 1.4;
  max-width: min(70ch, 86vw);
}

.wizard-status {
  margin-top: 0.5rem;
  font-size: clamp(1.1rem, 2.6vw, 1.6rem);
  font-weight: 700;
}

.wizard-meter {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: clamp(12px, 3vh, 24px) 0;
}

.wizard-icon {
  width: clamp(7.5rem, 34vw, 12rem);
  height: auto;
  max-width: 75%;
  display: block;
}

.wizard-tap-btn {
  font-size: clamp(1.6rem, 5.6vw, 2.6rem);
  padding: 1.4rem 4.2rem;
  height: auto;
  min-width: min(620px, 92vw);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.wizard-tap-btn.is-hidden {
  display: none;
}

.wizard-status {
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  font-weight: 600;
  min-height: 1.6em;
}

.wizard-bottom {
  width: min(520px, 92vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wizard-hidden {
  display: none !important;
}

.wizard-finish {
  position: absolute;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.wizard-finish-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.wizard-check {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid #f85c48;
  color: #f85c48;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
}

.wizard-finish-title {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  font-weight: 700;
}

.wizard-finish-text {
  margin: 0;
  opacity: 0.8;
  font-size: clamp(1rem, 2.4vw, 1.3rem);
  max-width: min(60ch, 82vw);
}

.wizard-link-btn {
  background: none;
  border: none;
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: #111;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.wizard-link-btn.secondary {
  color: #f85c48;
}

#keybind-modal {
  z-index: 5000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--modal-bg);
  padding: 20px 30px;
  border-radius: 10px;
  text-align: center;
  color: var(--text-color);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn,
.bb-button {
  font-family: "Spartan MB", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.3s ease;
}

button,
.bb-button,
.small-btn {
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

button:focus-visible,
.bb-button:focus-visible,
.small-btn:focus-visible {
  outline: 2px solid #ff523d;
  outline-offset: 2px;
}

.bb-button {
  width: fit-content;
  padding: .5rem;
  background: #ff523d;
  color: #fff;
  border-radius: clamp(0.3rem, 0.5vw, 0.45rem);
  box-shadow:
    0 clamp(2px, 0.4vw, 3.6px) clamp(3px, 0.6vw, 5.4px) rgba(88, 18, 9, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: clamp(12px, 1.5vw, 16px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.pattern-file-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.pattern-file-actions .bb-button {
  flex: 1 1 220px;
  width: 100%;
  min-width: 180px;
}

.auth-modal {
  z-index: 10000;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.auth-content {
  width: min(520px, calc(100vw - 28px));
  max-height: min(92vh, 720px);
  border-radius: 14px;
  padding: 1.25rem;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.auth-brand-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(255, 82, 61, 0.18);
}

.auth-brand h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.auth-brand p {
  margin: 0.25rem 0 0;
  color: #666;
  font-size: 0.9rem;
  line-height: 1.35;
}

.auth-mark {
  flex: 0 0 auto;
  transform: scale(0.86);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-section-title {
  color: #ff523d;
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-form select {
  width: 100%;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.auth-actions .bb-button {
  min-width: 0;
  width: 100%;
}

.auth-status {
  color: #666;
  font-weight: 700;
  font-size: 0.88rem;
  min-height: 1.2em;
}

.auth-status[data-tone="ok"],
.online-cadence-status[data-tone="ok"] {
  color: #2f7d32;
}

.auth-status[data-tone="error"],
.online-cadence-status[data-tone="error"] {
  color: #b3261e;
}

.auth-mini-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 1.2rem;
  color: #666;
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-mini-row .wizard-link-btn {
  padding: 0;
  min-width: 0;
  color: #f85c48;
}

.online-cadence-panel {
  border: 1px solid #e4e4e4;
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.online-cadence-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.online-cadence-header label {
  margin-bottom: 0.2rem;
}

.cadence-library-modal {
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 !important;
  z-index: 4050;
}

.cadence-library-sheet {
  width: min(760px, 100vw);
  max-width: 100vw;
  max-height: min(78dvh, 720px);
  border-radius: 26px 26px 0 0;
  background: var(--modal-bg);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 -16px 40px rgba(37, 28, 26, 0.22);
  animation: cadenceSheetIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.cadence-library-sheet-handle {
  width: 54px;
  height: 5px;
  border-radius: 999px;
  background: rgba(37, 28, 26, 0.15);
  margin: 0.85rem auto 0.25rem;
}

.cadence-library-sheet .online-cadence-panel {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0.9rem 1rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
  min-height: 240px;
}

.online-cadence-header p,
.online-cadence-status,
.online-cadence-desc,
.online-cadence-meta {
  font-size: 0.85rem;
  line-height: 1.35;
}

.online-cadence-header p {
  margin: 0;
  color: #666;
}

.online-cadence-status {
  color: #666;
}

.online-cadence-status[data-tone="ok"] {
  color: #2f7d32;
}

.online-cadence-status[data-tone="error"] {
  color: #b3261e;
}

.online-cadence-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.online-cadence-section {
  display: grid;
  gap: 0.55rem;
}

.online-cadence-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: #1f1f1f;
}

.online-cadence-section-title strong {
  font-size: 0.95rem;
}

.online-cadence-section-title span {
  border: 1px solid #eeeeee;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: #ffffff;
  color: #666666;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.online-cadence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.online-cadence-card {
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #ffffff;
  padding: 0.72rem;
  display: grid;
  gap: 0.4rem;
  text-align: left;
  color: #222;
  min-height: 150px;
  align-content: start;
  cursor: pointer;
}

.online-cadence-card:active {
  transform: scale(0.99);
}

.online-cadence-group,
.online-cadence-admin-actions {
  color: #666;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.online-cadence-title {
  font-weight: 800;
  font-size: 0.95rem;
}

.online-cadence-meta {
  color: #f85c48;
  font-weight: 700;
}

.online-cadence-desc {
  color: #666;
}

.online-cadence-preview {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow: hidden;
  padding: 0.18rem 0;
}

.cadence-preview-block {
  width: 22px;
  height: 34px;
  flex: 0 0 22px;
  border: 1px solid #1f1f1f;
  border-radius: 5px;
  background: #f5f5f5;
  display: grid;
  place-items: center;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  padding: 3px;
}

.cadence-preview-block[data-value="1"] {
  background: var(--face-1-color, #fb6354);
}

.cadence-preview-block[data-value="2"] {
  background: var(--face-2-color, #ffd000);
}

.cadence-preview-block[data-value="3"] {
  background: var(--face-3-color, #70b8fe);
}

.cadence-preview-block[data-value="4"] {
  background: var(--face-4-color, #7fe2c0);
}

.cadence-preview-block[data-value="5"] {
  background: var(--face-5-color, #d79bff);
}

.cadence-preview-block[data-value="6"] {
  background: var(--face-6-color, #ffb36b);
}

.cadence-preview-block.is-hold {
  width: 38px;
  flex-basis: 38px;
}

.cadence-preview-block.is-split {
  width: 14px;
  flex-basis: 14px;
}

.cadence-preview-block i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #1f1f1f;
}

.cadence-preview-block i.is-silent {
  background: transparent;
  border: 1px solid rgba(31, 31, 31, 0.5);
}

.cadence-preview-more {
  color: #666;
  font-weight: 900;
  line-height: 1;
}

.online-library-folder {
  border: 1px solid rgba(31, 31, 31, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(36, 15, 12, 0.08);
}

.online-library-folder[open] {
  border-color: rgba(255, 82, 61, 0.14);
}

.online-library-folder-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
}

.online-library-folder-summary::-webkit-details-marker {
  display: none;
}

.online-library-folder-main {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.online-library-folder-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ff6b54 0%, #ff523d 100%);
  color: #fff;
  box-shadow: 0 12px 22px rgba(255, 82, 61, 0.22);
  flex: 0 0 42px;
}

.online-library-folder-copy {
  min-width: 0;
  display: grid;
  gap: 0.16rem;
}

.online-library-folder-copy strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.online-library-folder-copy span {
  color: #7a605a;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.online-library-folder-chevron {
  color: #8c6f69;
  transition: transform 0.2s ease;
}

.online-library-folder[open] .online-library-folder-chevron {
  transform: rotate(90deg);
}

.online-library-folder-body {
  border-top: 1px solid rgba(31, 31, 31, 0.06);
  padding: 0.2rem 0.75rem 0.75rem;
  display: grid;
  gap: 0.55rem;
}

.online-library-item {
  border: 1px solid rgba(31, 31, 31, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 248, 246, 0.98));
  padding: 0.8rem 0.85rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  text-align: left;
  color: #251c1a;
  cursor: pointer;
}

.online-library-item:active {
  transform: scale(0.992);
}

.online-library-item-copy {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.online-library-item-instrument {
  font-weight: 900;
  font-size: 0.96rem;
  line-height: 1.12;
}

.online-library-item-title {
  color: #ff523d;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.online-library-item-meta,
.online-library-item-desc {
  color: #7b625c;
  font-size: 0.74rem;
  line-height: 1.3;
}

.online-library-item-trail {
  color: #8b6c65;
  display: grid;
  justify-items: end;
  gap: 0.35rem;
}

.online-library-item-trail .online-cadence-preview {
  justify-content: flex-end;
  min-height: 38px;
  max-width: 112px;
}

.cadence-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cadence-admin-panel .form-group {
  padding: 0;
}

.guide-card-visual {
  width: min(100%, 320px);
  margin: 0 auto;
}

@media (max-width: 520px) {
  .auth-actions,
  .cadence-admin-grid {
    grid-template-columns: 1fr;
  }
}

/* Removed hover for mobile app (already has :active) */
/* .bb-button:hover {
  transform: scale(1.1);
  box-shadow: 0 clamp(3px, 0.6vw, 5.4px) clamp(5px, 1vw, 9px) rgba(0, 0, 0, 0.3);
} */

.bb-button:active {
  transform: scale(0.95);
  box-shadow: 0 clamp(1px, 0.2vw, 1.8px) clamp(2px, 0.5vw, 4.5px)
    rgba(0, 0, 0, 0.25);
}

/* ============================================
   UI COMPONENTS
   ============================================ */
.dice-ui {
  display: flex;
  flex-direction: row;
  gap: 1rem;
  justify-content: center;
 
  position: relative;
}

#bpm-ui {
  width: clamp(60px, 8vw, 80px);
  height: clamp(2rem, 3vw, 2.7rem);
  border: 1px solid #ccc;
  border-radius: clamp(0.3rem, 0.5vw, 0.45rem);
  text-align: center;
  font-size: clamp(12px, 1.5vw, 16px);
}

.title-row {
  display: flex;
  width: 100%;
  max-width: calc(
    var(--dice-size, 80px) * var(--grid-rows) +
      (var(--dice-size, 80px) * 0.06 * var(--grid-rows) * 2)
  );
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}

.quarter-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: start;
  width: 90%;
  height: 100%;
}

.quarter-wrapper p {
  position: relative;
}

.quarter-wrapper svg {
  height: auto;
  width: 0.6rem;
  margin: 0.6rem;
}

.row,
.quarter-wrapper,
svg {
  margin: 0;
  padding: 0;
}

#quarter-p {
  font-weight: 600;
  opacity: 0.9;
  margin: none;
  font-size: 1.3rem;
}

/* ============================================
   COUNTDOWN
   ============================================ */
#countdown {
  margin-left: 1rem;
  width: fit-content;
  display: inline-flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-right: calc((var(--dice-size, 80px) * 0.06));
}

#countdown .dot {
  height: 0.8rem;
  width: 0.8rem;
  border-radius: 50%;
  background-color: rgba(169, 169, 169, 0.5);
}

#restDotInputs {
  height: fit-content;
  padding-top: 1rem;
  padding-bottom: 1rem;
  align-items: center;
  width: 200px;
  gap: 1rem;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: relative;
  display: flex;
  overflow: hidden;
  align-items: stretch;
  justify-content: flex-end;
  width: 0;
  height: 100%;
  background: transparent;
  max-width: 620px;
  z-index: 100;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.open-side {
  width: min(560px, 36vw);
}

#sidebar-wrapper {
  display: flex;
  transition: opacity 0.15s ease;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  width: 100%;
  height: 10%;
  padding: 0;
  gap: 0;
  opacity: 1;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-left: none;
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar:not(.open-side) #sidebar-wrapper {
  opacity: 0;
}

#sidebar-wrapper .sidebar-header {
  padding: 1.25rem 1.5rem;
  position: relative;
  justify-content: center;
  align-items: center;
}

#sidebar-wrapper .sidebar-content {
  padding: 1.4rem 1.5rem 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#sidebar-wrapper .sidebar-main-stack {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.9rem;
}

#sidebar-wrapper .sidebar-section-title {
  margin-top: 0.15rem;
  margin-bottom: 0;
  font-size: 1rem;
  letter-spacing: 0.01em;
}

#sidebar-wrapper #sidebar-block-title {
  margin: 0 auto;
  width: 100%;
  text-align: center;
  padding: 0 2.2rem;
}

#sidebar-wrapper .form-group {
  margin-bottom: 0;
  gap: 0.6rem;
  align-items: center;
  text-align: center;
}

#sidebar-wrapper .form-group > label {
  color: #555;
  font-weight: 600;
  font-size: 0.9rem;
}

#sidebar-wrapper .sidebar-combobox {
  width: 100%;
  max-width: 360px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f3f3f4;
  text-align: center;
  text-align-last: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  line-height: 1.2;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#sidebar-wrapper .sidebar-combobox option {
  text-align: center;
}

#sidebar-wrapper .sidebar-combobox:active {
  border-color: transparent;
  background: #eeeeef;
}

#sidebar-wrapper .sidebar-combobox:focus {
  outline: none;
  border-color: transparent;
  background: #ececed;
  box-shadow: 0 0 0 2px rgba(248, 92, 72, 0.14);
}

#sidebar-wrapper .dice-preview {
  min-height: calc(var(--dice-size, 80px) * 1.35);
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7f7f8 0%, #f2f2f3 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sidebar-wrapper .dice-preview .item {
  margin: 0;
  pointer-events: none;
}

#sidebar-wrapper .rest-modal {
  width: 100%;
  max-width: 360px;
  border: none;
  border-radius: 12px;
  background: transparent;
  padding: 0;
  margin: 0 auto;
}

#sidebar-wrapper #restDotInputs {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem 0;
}

#sidebar-wrapper .note-settings-drawer {
  margin-top: 0;
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #f2f2f4;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

#sidebar-wrapper .note-settings-summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: #333;
}

#sidebar-wrapper .note-settings-summary::-webkit-details-marker {
  display: none;
}

#sidebar-wrapper .note-settings-summary svg.fa-solid {
  transition: transform 0.2s ease;
}

#sidebar-wrapper
  .note-settings-drawer[open]
  .note-settings-summary
  svg.fa-solid {
  transform: rotate(180deg);
}

#sidebar-wrapper .note-settings-body {
  padding: 0.15rem 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#sidebar-wrapper .checkpoint {
  border: none;
  border-radius: 12px;
  background: transparent;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.4rem;
  transition: background-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: 100%;
  text-align: center;
}

#sidebar-wrapper .checkpoint:active {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

#sidebar-wrapper .checkpoint:focus-within {
  box-shadow: 0 0 0 3px rgba(248, 92, 72, 0.12);
}

#sidebar-wrapper .checkpoint-bpm {
  flex-direction: column;
  align-items: center;
}

#sidebar-wrapper .checkpoint-bpm > div {
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
}

#sidebar-wrapper .form-check-input {
  margin: 0;
  flex: 0 0 auto;
}

#sidebar-wrapper .form-check-label {
  color: #555;
  font-weight: 600;
  line-height: 1.15;
}

#sidebar-wrapper .dot-checkbox {
  width: 2rem;
  height: 2rem;
  border: 2px solid darkgray;
  background-color: transparent;
}

#sidebar-wrapper .dot-checkbox:checked {
  background-color: #fb6354;
  border-color: #c74e42;
}

#sidebar-wrapper #bpmInput {
  width: 100%;
  margin-left: 0;
  margin-top: 0.45rem;
}

#sidebar-wrapper .checkpoint-bpm .bpm-chips {
  width: 100%;
  justify-content: center;
  gap: 0.45rem;
}

#sidebar-wrapper .checkpoint-bpm .bpm-chip {
  flex: 0 0 auto;
  min-width: 62px;
}

#close-side-button {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 0;
}
#delete-side-button {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 0;
}

/* ============================================
   CAT AND JUDGEMENT
   ============================================ */
.cat {
  position: relative;
  display: flex;

  margin-top: clamp(12px, 2vw, 21.6px);
  align-items: center;
  justify-content: flex-end;
  z-index: 1000;
}

.cat img {
  position: relative;
  width: clamp(80px, 15vw, 144px);
  height: auto;
  transform-origin: center bottom;
  user-select: none;
  -webkit-user-drag: none;
}

#cat-row {
  margin-top: 1rem;
  margin-bottom: -2rem;
}

.tap-assessment-panel {
  width: min(520px, calc(100% - 24px));
  margin: clamp(1.2rem, 4vw, 2rem) auto 0;
  display: grid;
  gap: 0.7rem;
}

.tap-mode-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.tap-mode-btn {
  min-height: 42px;
  border: 1px solid rgba(31, 31, 31, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f1f1f;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(36, 15, 12, 0.08);
}

.tap-mode-btn.active,
.tap-mode-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #ff6b54 0%, #ff523d 100%);
  border-color: #ff523d;
  color: #ffffff;
}

.tap-pad {
  position: relative;
  min-height: clamp(132px, 24vw, 180px);
  border: 1px solid rgba(31, 31, 31, 0.1);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 245, 243, 0.98)),
    #ffffff;
  color: #1f1f1f;
  display: grid;
  place-items: center;
  gap: 0.2rem;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  box-shadow: 0 18px 32px rgba(61, 23, 17, 0.12);
}

.tap-pad::after {
  content: "";
  position: absolute;
  inset: auto 18% 18px;
  height: 12px;
  border-radius: 999px;
  background: rgba(31, 31, 31, 0.08);
}

.tap-pad.is-hit {
  animation: tapPadPulse 180ms ease-out;
}

.tap-pad.is-perfect {
  border-color: #2f7d32;
  box-shadow: 0 18px 28px rgba(47, 125, 50, 0.2);
}

.tap-pad.is-good,
.tap-pad.is-ok {
  border-color: #f59d28;
  box-shadow: 0 18px 28px rgba(245, 157, 40, 0.2);
}

.tap-pad.is-miss {
  border-color: #d33b31;
  box-shadow: 0 18px 28px rgba(211, 59, 49, 0.2);
}

#tap-pad-label {
  position: relative;
  z-index: 1;
  margin-top: 1.15rem;
  max-width: 62%;
  text-align: center;
  font-size: clamp(1rem, 2.7vw, 1.35rem);
  font-weight: 900;
  letter-spacing: 0;
}

#tap-pad-sub {
  position: relative;
  z-index: 1;
  color: #686868;
  font-size: 0.83rem;
  font-weight: 750;
}

.tap-sticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.tap-stick {
  position: absolute;
  top: 14px;
  width: 10px;
  height: 88px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2f2623 0%, #15100e 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transform-origin: 50% 10%;
}

.tap-stick-left {
  left: 18px;
  transform: rotate(-54deg);
  animation: tapStickIdleLeft 1.4s ease-in-out infinite;
}

.tap-stick-right {
  right: 18px;
  left: auto;
  transform: rotate(54deg);
  animation: tapStickIdleRight 1.4s ease-in-out infinite;
}

.tap-pad.is-hit[data-stick-side="left"] .tap-stick-left {
  animation: tapStickLeft 180ms ease-out;
}

.tap-pad.is-hit[data-stick-side="right"] .tap-stick-right {
  animation: tapStickRight 180ms ease-out;
}

@keyframes tapPadPulse {
  0% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(4px) scale(0.995);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes assessmentDotPop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.34);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes tapStickLeft {
  0% {
    transform: rotate(-54deg);
  }
  45% {
    transform: translate(24px, 18px) rotate(-16deg);
  }
  100% {
    transform: rotate(-54deg);
  }
}

@keyframes tapStickRight {
  0% {
    transform: rotate(54deg);
  }
  45% {
    transform: translate(-24px, 18px) rotate(16deg);
  }
  100% {
    transform: rotate(54deg);
  }
}

@keyframes tapStickIdleLeft {
  0%,
  100% {
    transform: rotate(-54deg);
  }
  50% {
    transform: translate(6px, 4px) rotate(-47deg);
  }
}

@keyframes tapStickIdleRight {
  0%,
  100% {
    transform: rotate(54deg);
  }
  50% {
    transform: translate(-6px, 4px) rotate(47deg);
  }
}

.judgement {
  position: absolute;
  top: 20%;
  left: 50%;
  width: 100%;
  transform: translate(-50%, -50%);
  opacity: 0;
  font-size: calc(var(--dice-size, 80px) * 0.2);
  font-family: "Spartan MB", sans-serif;
  color: white;
  text-align: center;
  pointer-events: none;
  z-index: 1000;
}

.float-up {
  animation: floatUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================
   BANNER AD PLACEHOLDER
   ============================================ */
#ad-banner-placeholder {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(120px, 12vw, 180px);
  height: clamp(320px, 70dvh, 600px);
  border-radius: 14px;
  border: 2px dashed rgba(0, 0, 0, 0.2);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.03), transparent);
  color: rgba(0, 0, 0, 0.55);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ============================================
   MISC COMPONENTS
   ============================================ */
#line {
  width: 80%;
  height: clamp(2px, 0.4vw, 3.6px);
  border-radius: clamp(5px, 1vw, 9px);
  background-color: black;
  margin: 0 auto;
  position: relative;
}

p {
  font-size: clamp(14px, 2.5vw, 21.6px);
  font-weight: bold;
  text-align: center;
}

.footer {
  text-align: center;
  font-size: clamp(0.7rem, 0.8vw, 0.8rem);
  color: #666;
  padding: 10px 0;
  margin-top: 20px;
}

#flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   STATE CLASSES
   ============================================ */
.hidden {
  display: none;
}

.start-pos {
  outline: purple 2px solid;
}

.all-silent {
  opacity: 0.5;
}

.grey {
  background-color: var(--block-inactive-color, darkgray);
}

.inactive {
  background-color: var(--block-inactive-color, darkgray) !important;
}

.bounce-flash {
  animation: bounceFlash 0.2s ease;
}

.flash-now {
  animation: flash 0.3s ease-in;
}
.speed-up {
  background-image: url("assets/imgs/double-arrow-right-svgrepo-com.svg");
  background-repeat: no-repeat;
  background-position: 50% 95%; /* center the image */

  background-size: 40%; /* makes it fit inside the element */
}
.auto-block {
  position: relative;
  background-image: url("your-background.jpg"); /* your main background */
  background-size: cover;
  background-position: center;
}

/* Semi-transparent overlay */
.auto-block::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.2); /* overlay */
  pointer-events: none;
  z-index: 1; /* under the arrow */
  border-radius: 10%;
}

/* Arrow icon on top */
.auto-block::after {
  content: "";
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 20%;
  height: 20%;
  background-color: white; /* fill color */
  mask: url("assets/imgs/robot-solid-full.svg") no-repeat center / contain;
  -webkit-mask: url("assets/imgs/robot-solid-full.svg") no-repeat center /
    contain;
  pointer-events: none;
  z-index: 2;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes shake {
  0% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(2deg);
  }
  50% {
    transform: rotate(0deg);
  }
  75% {
    transform: rotate(-2deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes floatUp {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(1);
  }
  30% {
    transform: translate(-50%, -70%) scale(1);
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -65%) scale(1);
  }
}

@keyframes dot-hit {
  0% {
    transform: scale(1);
    background-color: var(--dot-color, black);
  }
  30% {
    transform: scale(1.25);
    background-color: var(--dot-hit-color, white);
  }
  100% {
    transform: scale(1);
    background-color: var(--dot-hit-color, white);
  }
}
svg {
  overflow: visible !important;
}
@keyframes silent-hit {
  0% {
    transform: scale(1);
    opacity: 0.2;
  }
  30% {
    transform: scale(1.25);
    opacity: 0.5;
  }
  100% {
    transform: scale(1);
    opacity: 0.2;
  }
}

@keyframes die-hit {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounceFlash {
  0% {
    transform: scale(1) translateY(0);
    fill: #1f1f1f;
    filter: brightness(1);
  }
  30% {
    transform: scaleY(1) translateY(3px);
    fill: #fb6354;
    filter: drop-shadow(0 0 6px rgba(251, 99, 84, 0.55));
  }
  60% {
    transform: scaleY(1) translateY(1px);
    fill: #fb6354;
    filter: drop-shadow(0 0 6px rgba(251, 99, 84, 0.35));
  }
  100% {
    transform: scale(1) translateY(0);
    fill: #1f1f1f;
    filter: brightness(1);
  }
}

@keyframes ripple-animation {
  to {
    transform: scale(0.5);
    opacity: 0;
  }
}

@keyframes pop-judgement {
  0% {
    transform: translate(-50%, 28vh) scale(1.5);
    opacity: 0;
  }
  20% {
    transform: translate(-50%, 28vh) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, 28.4vh) scale(1);
    opacity: 0;
  }
}

@keyframes flash {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
  }
}
#rank-letter {
  font-size: 10rem;
}
.slow-down {
  background-image: url("assets/imgs/double-arrow-left-svgrepo-com.svg");
  background-repeat: no-repeat;
  background-position: 50% 95%; /* center the image */

  background-size: 40%; /* makes it fit inside the element */
}

.bpm-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
  justify-content: space-between;
}

.bpm-chip {
  flex: 1;
  padding: 6px 4px;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: #333;
  font-weight: 600;
  text-align: center;
}
.fa-play{
  transform: translateX(.1rem); /* tweak this */
}
.bpm-chip:active {
  background: #f85c48;
  color: white;
  border-color: #f85c48;
}
#title {
  margin-left: calc((var(--dice-size, 80px) * 0.06));
  font-size: 4rem;
  width: 90%;
  overflow: hidden;
}
/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (min-width: 712px) {
  span{
    font-size: 20px;
  }
  .form-group label{
    font-size: 20px;
  }
  .settings-content h3{
    font-size: 24px;
  }
  .form-group label{
    font-size: 20px;
  }
  :root {
    --dice-size-base: 120px !important;
  }
  .quarter-wrapper #quarter-p {
   
    font-size: 1.5rem;
  }
  #cat-row .quarter-wrapper svg{
    height: 1.5rem;
    width: auto;
  }
  svg{
    font-size: 1.5rem;
  }
  .navbar-title{
   font-size: 2rem;
  }
  button .metro-icon-img{
    width: 2rem;
  height: auto;
  }
  .floating-controls .divider {
   height: 3rem;
    margin: 0 2px;
  }
#page .floating-controls {

  
  /* Safe area top + 5px buffer */
  top: 10dvh; 
  gap: 1rem;
 
}

  .floating-controls .bb-button {
    padding: 0 !important;
    min-width: 4rem !important;
    width: 4rem !important;
    height: 4rem !important;
    border-radius: 50% !important;
   
  }
  



 /*  .title-row #title {
    font-size: 3rem;
  } */
  html {
    font-size: 16px;
  }
}
@media (max-width: 1024px) {
  
  #title {
    font-size: 1.8rem;
  }
  .container-bg {
    padding-bottom: 3rem;
  }

  .button-text {
    display: none;
  }

  .quarter-wrapper svg {
    height: 1.3rem;
    width: auto;
  }
  #quarter-p {
    font-size: 1rem;
  }

  .title-row {
    margin-bottom: 1rem;
  }

  #container-bg {
    margin-top: 1rem;
    padding: 2rem 2rem 3rem;
  }

  .bb-button {
    padding: 5px 8px;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw !important;
    height: 0;
    background: transparent;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    max-width: 100vw;
    transition: height 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: none;
    touch-action: pan-y;
  }

  .open-side {
    height: 70dvh;
    width: 100vw !important;
  }

  #sidebar-wrapper {
    border-left: none;
    border-top: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    height: 80%;

    position: absolute;
    bottom: 0;
  }

  #sidebar-wrapper .sidebar-header {
    padding: 1rem 1.25rem;
    position: relative;
    padding-top: 1.7rem;
  }

  #sidebar-wrapper .sidebar-header::before {
    content: "";
    position: absolute;
    top: 0.65rem;
    left: 50%;
    transform: translateX(-50%);
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.15);
  }

  #sidebar-wrapper .sidebar-content {
    padding: 1rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }



  .settings-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .combobox-wrapper {
    display: flex;
    flex-direction: column;
    font-family: sans-serif;
  }
}

@media (max-width: 375px) {
  :root {
    --dice-size-base: 56px;
  }
  .quarter-wrapper svg {
    height: 1rem;
    width: auto;
  }
}

@media (min-width: 1440px) {
  :root {
    --dice-size-base: 80px !important;
  }
  svg
}

/* ============================================
   RESULTS SCREEN
   ============================================ */
#results-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  animation: fadeIn 0.5s forwards;
  pointer-events: auto;
}

#results-screen.hidden {
  display: none !important;
}

.results-content {
  background: white;
  padding: 3rem;
  border-radius: 20px;
  text-align: center;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateY(20px);
  animation: slideUp 0.5s 0.2s forwards;
  opacity: 0;
}

.results-content h2 {
  font-size: 2.5rem;
  margin-bottom: 2rem;
  color: #333;
  font-weight: 800;
}

.rank-display {
  font-size: 8rem;
  font-weight: 900;
  margin: 1rem 0;
  color: #fb6354;
  text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.1);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
  text-align: left;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #eee;
  padding: 0.5rem 0;
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

.stat-value {
  color: #333;
  font-weight: 800;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   PLAY MODE
   ============================================ */
.play-mode .dice-ui,
.play-mode .sidebar {
  display: none !important;
}

.play-mode #dice-container {
  pointer-events: none !important; /* Disable interaction with blocks */
}

#start-prompt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  font-weight: 800;
  color: #333;
  opacity: 0.5;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  animation: pulse 2s infinite;
  text-align: center;
  width: 100%;
  z-index: 2000;
}

@keyframes pulse {
  0% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.7;
  }
  100% {
    opacity: 0.3;
  }
}

.play-mode.playing #start-prompt {
  display: none;
}

/* ============================================
   BOTTOM NAVIGATION BAR
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 3000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #999;
  cursor: pointer;
  transition: color 0.2s ease;
  flex: 1;
  height: 100%;
}

.nav-item svg.fa-solid {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 600;
}

/* Navigation Overlay (Mobile Page Slide) */
.nav-content-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: calc(100dvh - 60px); /* minus bottom nav height */
  background: #f8f9fa; /* Full opaque background for page feel */
  z-index: 2999;
  display: flex;
  flex-direction: column;
  /* Slide in from right effect */
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  opacity: 1; /* Always opaque, handled by transform */
  pointer-events: auto; /* Always interactive */
}

/* Specific class to slide it in */
.nav-content-overlay.visible {
  transform: translateX(0);
}

.nav-content-overlay.hidden {
  /* Can use transform offscreen instead of display none to allow transition out */
  transform: translateX(100%);
  /* display: none;  <-- Don't use this if we want exit animation */
}

#overlay-header {
  display: flex;
  justify-content: center; /* Center title like iOS nav bars */
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

#overlay-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #000;
  font-weight: 600;
}

#close-overlay {
  position: absolute;
  right: 1rem; /* standard "Done" or "Close" button position */
  background: none;
  border: none;
  font-size: 1.2rem;
  color: #007aff; /* iOS blue-ish */
  cursor: pointer;
}

#overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Level List Item (Reused) */
.level-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 16px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.02);
}

.level-info h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.1rem;
  color: #333;
}

.level-info svg.fa-solid {
  margin-right: 0.5rem;
  color: #555;
  font-size: 1.2rem;
}

.level-info p {
  margin: 0;
  font-size: 0.85rem;
  color: #888;
  font-weight: 600;
}

.center-content {
  text-align: center;
  padding: 3rem 1rem;
  color: #555;
}

.center-content h3 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: #333;
}

/* ============================================
   PROJECT MODAL & NEW UI
   ============================================ */
/* Specific override for the project modal wrapper to align left */
/* Specific override for the project modal wrapper to align left */
#project-modal {
  overflow-y: auto;
  justify-content: flex-start; /* Align flex items to start (left) */
  align-items: flex-start;
  padding: 0;
  z-index: 4000; /* Ensure it is above bottom-nav (z-index 3000) */
}

.project-modal-content {
  width: 600px; /* Fixed smaller width */
  max-width: 90vw;
  height: 100dvh; /* Full height sidebar (accounts for browser UI) */
  background: var(--modal-bg);
  backdrop-filter: blur(10px);
  border-radius: 16px 16px 16px 16px; /* Rounded corners only on right */
  padding: 0;
  overflow: hidden; /* Main container hidden, inner form scrolls */
  box-shadow: 5px 0 30px rgba(0, 0, 0, 0.15);
  text-align: left;
  animation: slideInLeft 0.3s ease-out;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: calc(env(safe-area-inset-top, 2rem) + 0.5rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;

  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  flex-shrink: 0; /* Prevent header shrinking */
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: #333;
}

.project-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  flex: 1; /* Push footer to bottom */
  overflow-y: auto; /* Scroll form if too tall */
  min-height: 0; /* Important for flex child scrolling */
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group-inline {
  flex-direction: row !important;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.form-group label {
  font-weight: 600;
  color: #555;

}

.form-group input {
  padding: 0.8rem;
  border: 2px solid #eee;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s;
  font-family: inherit;
}

.form-group input:focus {
  border-color: #f85c48;
  outline: none;
}

.file-upload-area {
  border: 2px dashed #ddd;
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
  background: #fdfdfd;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.file-upload-area.has-audio {
  border-color: #4caf50;
  background: #f1fff3;
}

.file-upload-area.has-audio svg.fa-solid {
  color: #2f7d32;
}

.file-upload-area.has-audio p {
  color: #1f5f29;
  font-weight: 600;
}

.file-upload-area svg.fa-solid {
  font-size: 2rem;
  color: #ccc;
  margin-bottom: 0.5rem;
}

.file-upload-area p {
  margin: 0;
  font-size: 0.9rem;
  color: #666;
  font-weight: normal;
}

.small-btn {
  background: white;
  border: 1px solid #ccc;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  margin-top: 0.5rem;
  transition: all 0.2s;
}

.modal-actions {
  padding: 1.5rem 2rem;
  padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  background: #f8f9fa;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0; /* Prevent footer shrinking */
}

.bb-button.primary {
  background: #f85c48;
  width: 100%;
  height: 3rem;
  font-size: 1.1rem;
}

.bb-button.sec-btn {
  background: #fff;
  color: #333;
  border: 1px solid #ddd;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.divider {
  width: 1px;
  height: 2rem;
  background: #e0e0e0;
  margin: 0 0.5rem;
}

/* Make dice-ui nicer */
.dice-ui {
  transform: translateY(.5rem);
  padding: 0.5rem 1rem;
  gap: 0.8rem;
  width: auto;
  min-width: fit-content;
}

.top-navbar .dice-ui {
  background: none !important;
  backdrop-filter: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 auto !important;
}

.metro-icon-img {
  width: 1.2rem;
  height: 1.2rem;
  filter: grayscale(1) brightness(0.2);
}

[data-theme="dark"] .metro-icon-img {
  filter: grayscale(1) invert(1) brightness(1);
}

.close-button {
  font-size: 1.5rem;
  padding: 0.5rem;
  margin-right: -0.5rem;
}

@media (max-width: 600px) {
  .project-modal-content {
    width: 95%;
  }
}

/* ============================================
   KEYBIND INFO GRID
   ============================================ */
.keybind-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.keybind-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.keybind-row:last-child {
  border-bottom: none;
}

.key-label {
  background: #f0f0f0;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: 600;
  color: #333;
  border: 1px solid #ddd;
}

/* ============================================
   TOP NAVBAR & DARK MODE
   ============================================ */
:root {
  --bg-color: #fff5f2;
  --text-color: #251c1a;
  --navbar-bg: rgba(255, 250, 248, 0.84);
  --modal-bg: rgba(255, 250, 248, 0.96);
  --button-sec-bg: #fff8f6;
  --button-sec-text: #251c1a;
  --panel-bg: #fffdfc;
  --border-color: rgba(76, 37, 31, 0.14);
  --dropdown-bg: #fffaf8;
  --dropdown-hover: #ffe8e1;
  --brand-primary: #ff523d;
  --brand-soft: #ffe3dc;
  --brand-deep: #2a201d;
}

[data-theme="dark"] {
  --bg-color: #130d0b;
  --text-color: #fff4f0;
  --navbar-bg: rgba(26, 17, 14, 0.88);
  --modal-bg: rgba(22, 15, 12, 0.96);
  --button-sec-bg: #261916;
  --button-sec-text: #fff4f0;
  --panel-bg: #1a120f;
  --border-color: rgba(255, 143, 126, 0.2);
  --dropdown-bg: #231714;
  --dropdown-hover: #38211d;

  --block-inactive-color: #444;
  --bb-sec-btn-bg: #261916;
  --bb-sec-btn-border: rgba(255, 143, 126, 0.24);
  --bb-sec-btn-text: #fff4f0;
  --bb-sec-btn-hover-bg: #38211d;
}

body {
  background-color: var(--bg-color) !important;
  color: var(--text-color) !important;
  transition: background-color 0.3s ease, color 0.3s ease;
}

#container-bg {
  background-color: var(--panel-bg);
  color: var(--text-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.title-row h2 {
  color: var(--text-color) !important;
}

.bb-button.sec-btn {
  background: var(--bb-sec-btn-bg, #fff) !important;
  color: var(--bb-sec-btn-text, #333) !important;
  border-color: var(--bb-sec-btn-border, #ddd) !important;
}

.bb-button.active {
  background: #f85c48 !important;
  color: #fff !important;
  border-color: #f85c48 !important;
  box-shadow: 0 0 10px rgba(248, 92, 72, 0.4) !important;
  animation: pulse-border 2s infinite;
}

.bb-button.inactive {
  opacity: 0.6;
  filter: grayscale(0.5);
}

@keyframes pulse-border {
  0% {
    box-shadow: 0 0 0 0 rgba(248, 92, 72, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(248, 92, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(248, 92, 72, 0);
  }
}

.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 60px;
  
  /* Standard flex settings */
  display: flex;
  justify-content: space-between;
  
  /* Align to the bottom so padding pushes content down */
  align-items: flex-end; 
  
  /* Add padding to the top for the notch, and the bottom to center icons in the 60px bar */
  padding-top: env(safe-area-inset-top, 0px); 
  padding-bottom: 15px; /* Adjust this to visually center your 1.4rem icons */
  
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  
  background: var(--navbar-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 3000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
}

.top-navbar .navbar-title {
  font-weight: 800;
  display: flex;
  align-items: center;
  color: var(--text-color);
  margin: 0;
  line-height: 1;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.navbar-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(255, 82, 61, 0.22);
}

.top-navbar .navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.top-navbar .dice-ui.desktop-only {
  flex: 2;
  justify-content: center;
  margin-top: 0;
}

.top-navbar .navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: flex-end;
}

.navbar-left,
.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.navbar-button {
  background: none;
  border: none;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--text-color);
  cursor: pointer;
  transition: transform 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  text-align: center;
  color: var(--text-color);
  width: auto;
}

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 10px;
  background: var(--dropdown-bg);
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  overflow: hidden;
  z-index: 4000;
  flex-direction: column;
  padding: 0.5rem 0;
}

/* Removed hover for mobile app (uses focus-within) */
/* .nav-dropdown:hover .nav-dropdown-menu, */
.nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex;
}

.nav-dropdown-item {
  padding: 12px 20px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
}

.nav-dropdown-item:active {
  background-color: var(--dropdown-hover);
  color: #f85c48;
}
.fa-xmark {
  width: 1rem;
  height: 1rem;
}
@media (max-width: 1024px) {
  .desktop-only {
    display: none !important;
  }

  .top-navbar {
    height: 60px;
    padding-top: calc(env(safe-area-inset-top, 140px) + 1.5rem);
    padding-bottom: 15px;
  }

  .top-navbar .navbar-left {
    flex: 1;
  }

  .top-navbar .navbar-title {
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .top-navbar .navbar-left > .navbar-button {
    display: none;
  }

  .navbar-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .navbar-title {
    font-size: 1rem;
  }

  /* Floating controls for mobile & tablet */
  .floating-controls {
    display: none !important;
  }

  .floating-controls .bb-button {
    padding: 0 !important;
    min-width: 40px;
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    font-size: 1rem;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }

  .floating-controls .divider {
   
    margin: 0 2px;
  }

  #mobile-project-button,
  #cadence-loop-toggle-mobile,
  #listen-mobile,
  #play-mobile {
    display: none !important;
  }

  .tap-mode-bar {
    display: none;
  }

  .tap-assessment-panel {
    width: min(440px, calc(100% - 24px));
    margin-top: 1rem;
  }

  body {
    padding-bottom: 138px;
  }

  #container-bg {
    padding-bottom: 140px;
  }
}

@keyframes cadenceSheetIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.mobile-bottom-dock {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-bottom-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    z-index: 3200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.9rem;
    padding: 0 16px;
    pointer-events: none;
  }

  .mobile-dock-side,
  .mobile-dock-main {
    pointer-events: auto;
  }

  .mobile-dock-side {
    display: grid;
    gap: 0.65rem;
  }

  .mobile-dock-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 999px;
    background: rgba(255, 248, 246, 0.96);
    border: 1px solid rgba(76, 37, 31, 0.08);
    box-shadow: 0 18px 40px rgba(42, 20, 16, 0.18);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .mobile-side-action,
  .mobile-dock-main-btn {
    border: none;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #251c1a;
  }

  .mobile-side-action {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: rgba(255, 250, 248, 0.97);
    border: 1px solid rgba(76, 37, 31, 0.08);
    box-shadow: 0 12px 28px rgba(42, 20, 16, 0.14);
  }

  .mobile-dock-main-btn {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    background: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(76, 37, 31, 0.06);
  }

  .mobile-dock-side-right {
    gap: 0.55rem;
  }

  .mobile-dock-main-btn.active,
  .mobile-dock-main-btn[aria-pressed="true"] {
    background: linear-gradient(180deg, #ff6b54 0%, #ff523d 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(255, 82, 61, 0.24);
  }

  .mobile-dock-play {
    background: linear-gradient(180deg, #ff6b54 0%, #ff523d 100%);
    color: #fff;
    box-shadow: 0 14px 28px rgba(255, 82, 61, 0.24);
  }
}

[data-theme="dark"] .online-library-folder,
[data-theme="dark"] .online-library-item,
[data-theme="dark"] .mobile-side-action,
[data-theme="dark"] .mobile-dock-main,
[data-theme="dark"] .mobile-dock-main-btn,
[data-theme="dark"] .tap-mode-btn,
[data-theme="dark"] .tap-assessment-stats span,
[data-theme="dark"] .tap-pad {
  background: rgba(31, 22, 18, 0.96);
  color: #fff4f0;
  border-color: rgba(255, 143, 126, 0.14);
}

[data-theme="dark"] .online-library-folder-copy span,
[data-theme="dark"] .online-library-item-meta,
[data-theme="dark"] .online-library-item-desc,
[data-theme="dark"] .online-library-folder-chevron {
  color: #d9b0a7;
}

@media (min-width: 1025px) {
  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 399px) {
  .floating-controls .bb-button {
    min-width: 34px;
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }
}

.sidebar .sidebar-wrapper,
#sidebar-wrapper,
.settings-wrapper .project-modal-content,
.results-content,
#restModal {
  background: var(--modal-bg) !important;
  color: var(--text-color) !important;
}

.results-content h2,
.results-content .stat-item {
  color: var(--text-color) !important;
}

.modal-header,
.modal-actions {
  background: var(--dropdown-bg) !important;
  border-color: var(--border-color) !important;
}

/* Mobile Sidebar Overlay */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-nav-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-sidebar {
  position: absolute;
  top: 0;
  left: -300px;
  width: 280px;
  height: 100dvh;
  background: var(--modal-bg);
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
  transition: left 0.3s ease;
  display: flex;
  flex-direction: column;
}

.mobile-nav-overlay.visible .mobile-nav-sidebar {
  left: 0;
}

.mobile-nav-header {
  padding-top: calc(env(safe-area-inset-top) + 1.2rem);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-nav-header h2 {
  margin: 0;
  color: var(--text-color);
  font-size: 1.25rem;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  color: var(--text-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

.mobile-nav-item:active {
  background: var(--dropdown-hover);
  color: #f85c48;
}

/* Extended Dark Mode Elements */
[data-theme="dark"] .dice-ui,
[data-theme="dark"] .floating-controls {
  background: var(--navbar-bg) !important;
}

[data-theme="dark"] .floating-controls .divider {
  background: rgba(255, 255, 255, 0.2);
}

.mobile-nav-item svg.fa-solid {
  font-size: 1.2rem;
  width: 25px;
  text-align: center;
  color: var(--text-color);
  opacity: 0.9;
}

[data-theme="dark"] .mobile-nav-item svg.fa-solid {
  color: var(--text-color);
}

[data-theme="dark"] .sidebar-content.project-form,
[data-theme="dark"] .sidebar-main-stack {
  background: transparent !important;
}

[data-theme="dark"] #sidebar-wrapper .note-settings-drawer {
  background: var(--panel-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}

[data-theme="dark"] #sidebar-wrapper .note-settings-summary {
  color: var(--text-color);
}

[data-theme="dark"] .key-label,
[data-theme="dark"] .keybind-tag,
[data-theme="dark"] input:not([type="checkbox"]):not([type="range"]),
[data-theme="dark"] select.combobox,
[data-theme="dark"] #sidebar-wrapper .sidebar-combobox,
[data-theme="dark"] .dice-preview {
  background: var(--dropdown-bg) !important;
  color: var(--text-color) !important;
  border-color: var(--border-color) !important;
  box-shadow: none;
}

[data-theme="dark"] .modal-header h2,
[data-theme="dark"] .form-group label,
[data-theme="dark"] #sidebar-wrapper .form-group > label,
[data-theme="dark"] .tooltip-text,
[data-theme="dark"] .tooltip label,
[data-theme="dark"] .file-upload-area p,
[data-theme="dark"] .form-check-label,
[data-theme="dark"] #sidebar-wrapper .form-check-label,
[data-theme="dark"] .settings-drawer-title,
[data-theme="dark"] .settings-drawer-subtitle,
[data-theme="dark"] h3.setting-section {
  color: var(--text-color) !important;
}

[data-theme="dark"] .settings-drawer {
  background: var(--panel-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .settings-drawer-summary svg.fa-solid {
  color: var(--text-color);
}

[data-theme="dark"] .settings-drawer-dot {
  border-color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .small-btn {
  background: var(--bb-sec-btn-bg);
  color: var(--text-color);
  border-color: var(--border-color);
}

[data-theme="dark"] .bpm-chip {
  background: var(--bb-sec-btn-bg);
  color: var(--text-color);
  border-color: var(--border-color);
}

[data-theme="dark"] .keybind-row {
  border-color: var(--border-color);
}

[data-theme="dark"] .file-upload-area {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .auth-content {
  background: var(--panel-bg);
  color: var(--text-color);
}

[data-theme="dark"] .auth-brand p,
[data-theme="dark"] .auth-mini-row,
[data-theme="dark"] .auth-status,
[data-theme="dark"] .online-cadence-group,
[data-theme="dark"] .online-cadence-admin-actions {
  color: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] .online-cadence-panel {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .online-cadence-card {
  background: var(--panel-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}

[data-theme="dark"] .online-cadence-section-title {
  color: var(--text-color);
}

[data-theme="dark"] .online-cadence-section-title span {
  background: var(--panel-bg);
  border-color: var(--border-color);
  color: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] .online-cadence-header p,
[data-theme="dark"] .online-cadence-status,
[data-theme="dark"] .online-cadence-desc {
  color: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] .cadence-preview-block {
  border-color: rgba(255, 255, 255, 0.78);
}

[data-theme="dark"] .tap-mode-btn,
[data-theme="dark"] .tap-assessment-stats span {
  background: var(--panel-bg);
  border-color: var(--border-color);
  color: var(--text-color);
}

[data-theme="dark"] .tap-mode-btn.active,
[data-theme="dark"] .tap-mode-btn[aria-pressed="true"] {
  background: var(--text-color);
  border-color: var(--text-color);
  color: var(--panel-bg);
}

[data-theme="dark"] .tap-pad {
  background:
    linear-gradient(180deg, rgba(44, 44, 44, 0.96), rgba(28, 28, 28, 0.98)),
    var(--panel-bg);
  border-color: var(--border-color);
  color: var(--text-color);
  box-shadow: 0 8px 0 rgba(255, 255, 255, 0.22);
}

[data-theme="dark"] #tap-pad-sub,
[data-theme="dark"] .tap-assessment-stats small {
  color: rgba(255, 255, 255, 0.72);
}

[data-theme="dark"] .tap-stick {
  background: var(--text-color);
}

[data-theme="dark"] .bb-button.sec-btn {
  background: var(--bb-sec-btn-bg) !important;
  color: var(--text-color) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28) !important;
}

[data-theme="dark"] .bb-button.sec-btn.active {
  background: #f85c48 !important;
  color: #ffffff !important;
  border-color: #ff8d7f !important;
  box-shadow:
    0 0 0 1px rgba(255, 141, 127, 0.22),
    0 0 14px rgba(248, 92, 72, 0.35) !important;
  opacity: 1 !important;
  filter: none !important;
}

[data-theme="dark"] .bb-button.sec-btn.inactive,
[data-theme="dark"] .bb-button.sec-btn:not(.active) {
  background: #2f2f2f !important;
  color: #f3f3f3 !important;
  border-color: #5a5a5a !important;
  opacity: 1 !important;
  filter: none !important;
}

[data-theme="dark"] .bb-button.sec-btn:hover,
[data-theme="dark"] .bb-button.sec-btn:focus-visible {
  border-color: #7a7a7a !important;
}

[data-theme="dark"] #ad-banner-placeholder {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.7);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
}

[data-theme="dark"] .block-color-item {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .block-color-label {
  color: var(--text-color);
}

[data-theme="dark"] .block-color-swatch {
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .keybind-input-wrapper {
  background: var(--dropdown-bg);
  border-color: var(--border-color);
}

[data-theme="dark"] .keybind-tag {
  background: #f85c48;
  color: #fff;
}

[data-theme="dark"] #add-keybind-btn {
  background: #f85c48;
  color: #fff;
}

/* ============================================
   LOOP BRACKET MARKERS
   ============================================ */
.loop-bracket {
  position: absolute;
  top: calc(var(--dice-size, 80px) * 0.04);
  bottom: calc(var(--dice-size, 80px) * 0.04);
  width: calc(var(--dice-size, 80px) * 0.18);
  min-width: 10px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 10000;
}

/* [ bracket — left side */
.loop-bracket.loop-start {
  left: calc(var(--dice-size, 80px) * -0);
  border-left: 5px solid #000;
  border-top: 5px solid #000;
  border-bottom: 5px solid #000;
  border-right: none;
  border-radius: 4px 0 0 4px;
}

/* ] bracket — right side */
.loop-bracket.loop-end {
  right: calc(var(--dice-size, 80px) * -0.01);
  left: auto;
  border-right: 5px solid #000;
  border-top: 5px solid #000;
  border-bottom: 5px solid #000;
  border-left: none;
  border-radius: 0 4px 4px 0;
}

/* Hide the old bar and dots — no longer needed */
.loop-bracket-bar,
.loop-bracket-dots,
.loop-bracket-dot {
  display: none;
}

/* Repeat count badge (on loop-end) */
.loop-repeat-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #000;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 2001;
}

/* Bracket active state during playback */
.loop-bracket.loop-active {
  border-color: var(--face-3-color, #ffd000) !important;
}
.loop-bracket.loop-active .loop-repeat-badge {
  background: var(--face-3-color, #ffd000) !important;
  color: #000;
}

/* ── Color per loop ── */
.loop-bracket[data-loop-color="0"] {
  border-color: var(--face-1-color, #fb6354);
}
.loop-bracket[data-loop-color="0"] .loop-repeat-badge {
  background: var(--face-1-color, #fb6354);
}
.loop-bracket[data-loop-color="1"] {
  border-color: var(--face-2-color, #70b8fe);
}
.loop-bracket[data-loop-color="1"] .loop-repeat-badge {
  background: var(--face-2-color, #70b8fe);
}
.loop-bracket[data-loop-color="2"] {
  border-color: var(--face-3-color, #ffd000);
}
.loop-bracket[data-loop-color="2"] .loop-repeat-badge {
  background: var(--face-3-color, #ffd000);
  color: #000;
}
.loop-bracket[data-loop-color="3"] {
  border-color: var(--face-6-color, #7fe2c0);
}
.loop-bracket[data-loop-color="3"] .loop-repeat-badge {
  background: var(--face-6-color, #7fe2c0);
  color: #000;
}
.loop-bracket[data-loop-color="4"] {
  border-color: var(--face-5-color, #ffa84d);
}
.loop-bracket[data-loop-color="4"] .loop-repeat-badge {
  background: var(--face-5-color, #ffa84d);
  color: #000;
}
.loop-bracket[data-loop-color="5"] {
  border-color: var(--face-4-color, #c739ff);
}
.loop-bracket[data-loop-color="5"] .loop-repeat-badge {
  background: var(--face-4-color, #c739ff);
}

/* Dark mode adjustments */
[data-theme="dark"] .loop-bracket[data-loop-color="0"] {
  border-color: var(--face-1-color, #fb6354);
}
[data-theme="dark"] .loop-bracket[data-loop-color="1"] {
  border-color: var(--face-2-color, #70b8fe);
}
[data-theme="dark"] .loop-bracket[data-loop-color="2"] {
  border-color: var(--face-3-color, #ffd000);
}
[data-theme="dark"] .loop-bracket[data-loop-color="3"] {
  border-color: var(--face-6-color, #7fe2c0);
}
[data-theme="dark"] .loop-bracket[data-loop-color="4"] {
  border-color: var(--face-5-color, #ffa84d);
}
[data-theme="dark"] .loop-bracket[data-loop-color="5"] {
  border-color: var(--face-4-color, #c739ff);
}
/* Default (no color attr) dark mode */
[data-theme="dark"] .loop-bracket:not([data-loop-color]) {
  border-color: #fff;
}
[data-theme="dark"] .loop-repeat-badge:not([data-loop-color]) {
  background: #fff;
  color: #000;
}

/* ── Music Notation Mode: show repeat signs ── */
body.music-symbols-enabled .loop-bracket {
  border: none !important;
  border-radius: 0;
}

body.music-symbols-enabled .loop-bracket::before {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: calc(var(--dice-size, 80px) * 0.5);
  font-weight: 100;

  pointer-events: none;
}

body.music-symbols-enabled .loop-bracket.loop-start::before {
  content: "𝄆";
  left: 0;
  color: #000;
}

body.music-symbols-enabled .loop-bracket.loop-end::before {
  content: "𝄇";
  right: 0;
  left: auto;
  color: #000;
}

/* Color the repeat signs per loop */
body.music-symbols-enabled .loop-bracket[data-loop-color="0"]::before {
  color: var(--face-1-color, #fb6354);
}
body.music-symbols-enabled .loop-bracket[data-loop-color="1"]::before {
  color: var(--face-2-color, #70b8fe);
}
body.music-symbols-enabled .loop-bracket[data-loop-color="2"]::before {
  color: var(--face-3-color, #ffd000);
}
body.music-symbols-enabled .loop-bracket[data-loop-color="3"]::before {
  color: var(--face-6-color, #7fe2c0);
}
body.music-symbols-enabled .loop-bracket[data-loop-color="4"]::before {
  color: var(--face-5-color, #ffa84d);
}
body.music-symbols-enabled .loop-bracket[data-loop-color="5"]::before {
  color: var(--face-4-color, #c739ff);
}

/* Dark mode notation repeat signs */
[data-theme="dark"] body.music-symbols-enabled .loop-bracket.loop-start::before,
[data-theme="dark"] body.music-symbols-enabled .loop-bracket.loop-end::before {
  color: #fff;
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="0"]::before {
  color: var(--face-1-color, #fb6354);
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="1"]::before {
  color: var(--face-2-color, #70b8fe);
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="2"]::before {
  color: var(--face-3-color, #ffd000);
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="3"]::before {
  color: var(--face-6-color, #7fe2c0);
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="4"]::before {
  color: var(--face-5-color, #ffa84d);
}
[data-theme="dark"]
  body.music-symbols-enabled
  .loop-bracket[data-loop-color="5"]::before {
  color: var(--face-4-color, #c739ff);
}

/* Loop sidebar controls */
.loop-sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0.5rem 0;
}

.loop-repeat-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.loop-repeat-control label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.loop-repeat-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #e0e0e0;
}

.loop-repeat-stepper button {
  width: 36px;
  height: 36px;
  border: none;
  background: #f5f5f5;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease;
  color: #333;
}

.loop-repeat-stepper button:active {
  background: #e0e0e0;
}

.loop-repeat-stepper .loop-repeat-value {
  width: 40px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  border: none;
  background: transparent;
  color: #333;
  pointer-events: none;
}

.loop-delete-btn {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 2px solid #ff4d4d;
  background: transparent;
  color: #ff4d4d;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.loop-delete-btn:active {
  background: #ff4d4d;
  color: #fff;
}

/* Dark mode overrides for loops */
[data-theme="dark"] .loop-repeat-stepper {
  border-color: var(--border-color);
}

[data-theme="dark"] .loop-repeat-stepper button {
  background: var(--dropdown-bg);
  color: var(--text-color);
}

[data-theme="dark"] .loop-repeat-stepper button:active {
  background: var(--border-color);
}

[data-theme="dark"] .loop-repeat-stepper .loop-repeat-value {
  color: var(--text-color);
}

[data-theme="dark"] .loop-repeat-control label {
  color: var(--text-color);
}

/* Loop toggle button in sidebar */
.loop-controls-section {
  width: 100%;
  margin-top: 0.25rem;
}

.loop-toggle-btn {
  width: 100%;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--face-1-color, #fb6354);
  background: transparent;
  color: var(--face-1-color, #fb6354);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.loop-toggle-btn:active {
  background: var(--face-1-color, #fb6354);
  color: #fff;
}

[data-theme="dark"] .loop-toggle-btn {
  border-color: var(--face-1-color, #fb6354);
  color: var(--face-1-color, #fb6354);
}

[data-theme="dark"] .loop-toggle-btn:active {
  background: var(--face-1-color, #fb6354);
  color: #fff;
}

[data-theme="dark"] .loop-delete-btn {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

[data-theme="dark"] .loop-delete-btn:active {
  background: #ff6b6b;
  color: #fff;
}

/* ============================================
   ABOUT MODAL CREDITS
   ============================================ */
.about-credits-wrapper {
  margin-top: 1.5rem;
  text-align: left;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 8px;
}

.about-credits-wrapper::-webkit-scrollbar {
  width: 6px;
}
.about-credits-wrapper::-webkit-scrollbar-track {
  background: transparent;
}
.about-credits-wrapper::-webkit-scrollbar-thumb {
  background: var(--primary-color, #fb6354);
  border-radius: 4px;
}

.credits-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
  margin-top: 1rem;
}

@media (min-width: 500px) {
  .credits-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.credit-card {
  background: var(--surface-color, #f9f9f9);
  border: 1px solid var(--border-color, #eaeaea);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .credit-card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .about-credits-wrapper h4 {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.credit-category {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-color, #fb6354);
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.credit-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-color, #333);
}

.credit-author {
  font-size: 0.85rem;
  color: var(--text-muted, #777);
  font-weight: 500;
}

.credit-link {
  font-size: 0.8rem;
  color: var(--primary-color, #fb6354);
  opacity: 0.9;
  text-decoration: none;
  margin-top: 0.4rem;
  word-break: break-all;
  font-weight: 600;
}

span.credit-link {
  color: var(--text-muted, #888);
}

/* ============================================
   SMALL DEVICE FONT SIZE
   ============================================ */
@media (max-width: 430px) {
  * {
  }
}

/* ============================================
   BLOCK SELECTOR MODAL & TRIGGER
   ============================================ */
.block-selector-trigger {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  gap: 12px;
  padding: 14px 16px;
  min-height: 64px;
  background: var(--bg-color, #fff);
  border: 2px solid #ddd;
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

[data-theme="dark"] .block-selector-trigger {
  background: #333;
  border-color: #555;
}

.block-selector-trigger:hover {
  border-color: #fb6354;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.block-selector-trigger .dice-preview {
  flex: 0 0 auto;
  min-width: 84px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.block-selector-trigger .combo-arrow {
  color: #888;
  font-size: 1.2rem;
}

.block-selector-current-name {
  flex: 1;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-color, #222);
  text-align: left;
}

/* ============================================
   BLOCK SELECTOR MODAL & TRIGGER
   ============================================ */
/* Modal Grid Container */
.block-selection-modal {
  z-index: 5000;
  justify-content: center;
  align-items: center;
  padding: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.block-selection-modal-content {
  width: min(560px, 100%);
  max-width: 560px;
  height: auto;
  max-height: min(88dvh, 760px);
  background: var(--bg-color, #fff);
  border-radius: 28px !important;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(0, 0, 0, 0.06);
  animation: modalPop 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.block-selection-modal-header {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.block-selection-modal-header h2 {
  font-size: clamp(1.15rem, 1rem + 0.9vw, 1.55rem);
}

.block-selection-grid {
  display: flex !important;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  padding: 0 20px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.block-section-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.block-section-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fb6354;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  padding-bottom: 8px;
}

[data-theme="dark"] .block-section-title {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.block-selection-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
  width: 100%;
}

.block-selection-grid-inner.block-selection-grid-holds {
  grid-template-columns: 1fr;
}

.block-selection-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 2px solid rgba(0, 0, 0, 0.06);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
  min-height: 128px;
  min-width: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.block-selection-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  transform: translateY(-2px);
}

.block-selection-btn:active {
  transform: scale(0.98);
}

.block-selection-btn:focus-visible {
  outline: none;
  border-color: rgba(251, 99, 84, 0.8);
  box-shadow: 0 0 0 4px rgba(251, 99, 84, 0.18);
}

[data-theme="dark"] .block-selection-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.block-selection-btn.active {
  border-color: #fb6354;
  background: rgba(251, 99, 84, 0.12);
  box-shadow: 0 10px 18px rgba(251, 99, 84, 0.14);
}

.block-selection-btn .dice-preview {
  margin: 0 !important;
  padding: 0;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 96px;
  overflow: visible;
}

.block-selection-grid-holds .block-selection-btn {
  min-height: 118px;
}

.block-selection-grid-holds .block-selection-btn .dice-preview {
  height: 88px;
}

.block-selection-btn[hidden] {
  display: none !important;
}

[data-theme="dark"] .block-selection-modal-content {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .block-selection-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 768px) {
  .block-selection-modal {
    align-items: flex-end;
    padding: 0;
  }

  .block-selection-modal-content {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, 100dvh);
    border-radius: 26px 26px 0 0 !important;
    animation: blockSelectionSheetIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .block-selection-modal-header {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .block-selection-grid {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .block-selection-grid-inner {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .block-selection-btn .dice-preview {
    height: 84px;
  }
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(18px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes blockSelectionSheetIn {
  0% {
    opacity: 0;
    transform: translateY(28px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
