:root {
  --bg: #f7f9f8;
  --surface: #ffffff;
  --surface-soft: #f2f6f5;
  --surface-teal: #d9f2ef;
  --border: #dde4e2;
  --border-strong: #c9d3d0;
  --text: #111817;
  --muted: #687370;
  --accent: #00796f;
  --accent-dark: #005b53;
  --accent-soft: #d7f1ee;
  --shadow: 0 8px 24px rgba(17, 24, 23, 0.06);
  --shadow-soft: 0 2px 10px rgba(17, 24, 23, 0.04);
  --cell: #ffffff;
  --on: var(--accent);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.menu-button {
  width: 46px;
  height: 46px;
  display: none;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.menu-button span {
  width: 22px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: var(--text);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  font-weight: 900;
}

.eyebrow {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  overflow: hidden;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-button,
.secondary-button,
.secondary-link,
.icon-button {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
  font-weight: 780;
  box-shadow: var(--shadow-soft);
}

.header-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 0 18px;
  font-size: 14px;
}

.icon-header-button {
  width: 48px;
  height: 48px;
  min-height: 48px;
  justify-content: center;
  border-radius: 999px;
  padding: 0;
}

.icon-header-button.is-active {
  border-color: rgba(0, 121, 111, 0.32);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.icon-header-button.is-active .header-icon {
  color: var(--accent-dark);
}

.header-icon {
  width: 22px;
  height: 22px;
  color: var(--text);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pad-icon {
  width: 23px;
  height: 23px;
}

.account-shell {
  position: relative;
}

.account-button {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--text);
  background: #cfecea;
  box-shadow: var(--shadow-soft);
  font-weight: 900;
}

.account-button.is-guest {
  width: auto;
  min-width: 82px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--accent);
}

.account-button.is-pro {
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 25;
  width: 270px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-menu[hidden] {
  display: none;
}

.account-menu-header {
  display: grid;
  gap: 3px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.account-menu-header strong {
  font-size: 14px;
}

.account-menu-header span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-header em {
  width: max-content;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.account-menu button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.account-menu button:hover {
  background: var(--surface-soft);
}

.app-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
  gap: 30px;
  max-width: 1580px;
  margin: 0 auto;
  padding: 26px 30px;
}

.sidebar {
  position: sticky;
  top: 102px;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 4px;
}

.sidebar-section,
.pattern-card,
.pattern-visual-card,
.practice-tip,
.custom-player {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.sidebar-section {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.sidebar-heading h2 {
  color: #3d4543;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.sidebar-heading span,
.genre-item strong {
  min-width: 46px;
  border-radius: 999px;
  padding: 5px 9px;
  color: #3f4946;
  background: #edf1ef;
  font-size: 12px;
  font-weight: 850;
  text-align: center;
}

.sidebar-search {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
}

.sidebar-search::placeholder {
  color: #7b8582;
}

.nav-list {
  display: grid;
  gap: 8px;
  max-height: min(780px, calc(100vh - 260px));
  overflow: auto;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-size: 15px;
  font-weight: 620;
}

.pattern-item {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 38px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
}

.pattern-item.is-active {
  font-weight: 500;
}

.nav-item span:first-child:not(.dropdown-chevron) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.genre-dropdown {
  display: grid;
  gap: 6px;
}

.dropdown-chevron {
  width: 24px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
  text-align: center;
  transition: transform 0.18s ease;
}

.genre-dropdown.is-open .dropdown-chevron {
  color: #ffffff;
  transform: rotate(90deg);
}

.genre-pattern-list {
  display: grid;
  gap: 4px;
  padding: 4px 0 8px 34px;
  border-left: 1px solid var(--border);
  margin-left: 22px;
}

.pattern-status {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #87908d;
  background: transparent;
  font-size: 15px;
  font-weight: 900;
}

.pattern-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.pattern-status.is-completed {
  color: #ffffff;
  background: var(--accent);
}

.pattern-status.is-favorite {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 13px;
}

.pattern-item.is-locked {
  color: #737d7a;
}

.pattern-status.is-pro {
  width: auto;
  min-width: 34px;
  height: 22px;
  padding: 0 8px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.nav-item.is-active {
  border-color: transparent;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #008f83);
  box-shadow: 0 8px 18px rgba(0, 121, 111, 0.18);
}

.nav-item.is-active .dropdown-chevron,
.nav-item.is-active .pattern-status.is-empty {
  color: #ffffff;
}

.pattern-item.is-active .pattern-status.is-completed,
.pattern-item.is-active .pattern-status.is-favorite {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.pattern-item.is-active .pattern-status.is-pro {
  color: var(--accent-dark);
  background: #ffffff;
}

.nav-item.is-active strong {
  color: var(--accent-dark);
  background: #ffffff;
}

.secondary-link {
  min-height: 44px;
  border-radius: 12px;
  color: var(--accent-dark);
  background: var(--surface);
  font-size: 14px;
}

.secondary-link::after {
  content: "⌄";
  margin-left: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  font-size: 18px;
}

.icon-button:disabled,
.secondary-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.practice-area {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.pad-page[hidden],
#practice-content[hidden] {
  display: none;
}

.pad-page {
  display: grid;
  gap: 18px;
}

.pad-page-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(180px, 260px);
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.pad-page-header h2 {
  margin-bottom: 6px;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.pad-page-header p:last-child {
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.pad-back-button {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  font-size: 30px;
  line-height: 1;
}

.pad-volume-control {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pad-volume-control input {
  width: 100%;
  accent-color: var(--accent);
}

.touch-pad-grid {
  --pad-gap: clamp(10px, 1.8vw, 18px);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--pad-gap);
  width: min(860px, 100%);
  justify-self: center;
  border: 1px solid rgba(17, 24, 23, 0.08);
  border-radius: 28px;
  padding: clamp(14px, 2.4vw, 28px);
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 121, 111, 0.08), transparent 36%),
    var(--surface);
  box-shadow: 0 24px 70px rgba(17, 24, 23, 0.12);
  touch-action: manipulation;
  user-select: none;
}

.touch-pad {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(5px, 0.8vw, 8px);
  border: 1px solid var(--border-strong);
  border-radius: clamp(16px, 2vw, 24px);
  padding: clamp(8px, 1.4vw, 16px);
  color: #2f3b38;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 246, 245, 0.96)),
    var(--surface);
  box-shadow:
    inset 0 -6px 14px rgba(17, 24, 23, 0.04),
    0 10px 24px rgba(17, 24, 23, 0.08);
  text-align: center;
  transition:
    background 0.08s ease,
    border-color 0.08s ease,
    box-shadow 0.08s ease,
    color 0.08s ease,
    transform 0.08s ease;
}

.touch-pad strong {
  font-size: clamp(20px, 4vw, 36px);
  line-height: 1;
  font-weight: 950;
}

.touch-pad span {
  max-width: 100%;
  color: var(--muted);
  font-size: clamp(9px, 1.4vw, 13px);
  font-weight: 780;
  line-height: 1.15;
}

.touch-pad.is-playing,
.touch-pad:active {
  border-color: rgba(0, 121, 111, 0.45);
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow:
    0 0 0 6px rgba(0, 121, 111, 0.12),
    0 16px 34px rgba(0, 121, 111, 0.22);
  transform: scale(0.985);
}

.touch-pad.is-playing span,
.touch-pad:active span {
  color: rgba(255, 255, 255, 0.82);
}

.practice-toolbar {
  display: none;
}

.pattern-card {
  display: grid;
  gap: 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.pattern-card-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.pattern-kicker {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 900;
}

.pattern-title-group {
  min-width: 0;
}

.pattern-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pattern-card h2 {
  max-width: 980px;
  font-size: clamp(36px, 4.2vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.pattern-title-actions {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.complete-button,
.favorite-button {
  flex: 0 0 auto;
  width: clamp(42px, 3.4vw, 52px);
  height: clamp(42px, 3.4vw, 52px);
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.complete-button:hover,
.favorite-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.complete-button svg,
.favorite-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.favorite-button svg {
  width: 25px;
  height: 25px;
  stroke-width: 2.1;
}

.complete-button.is-completed {
  border-color: var(--accent);
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow: 0 10px 22px rgba(0, 121, 111, 0.2);
}

.favorite-button.is-favorite {
  border-color: rgba(0, 121, 111, 0.5);
  color: var(--accent-dark);
  background: var(--accent-soft);
  box-shadow: 0 10px 22px rgba(0, 121, 111, 0.14);
}

.favorite-button.is-favorite svg {
  fill: currentColor;
}

.complete-button:disabled,
.favorite-button:disabled {
  cursor: default;
  opacity: 0.42;
  transform: none;
}

.pattern-meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.display-options,
.pattern-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.pattern-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assist-chip,
.toggle-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 16px;
  color: #303837;
  background: var(--surface);
  font-size: 14px;
  font-weight: 760;
  box-shadow: var(--shadow-soft);
}

button.assist-chip {
  border-color: var(--border);
}

.assist-chip > span:first-child {
  color: var(--accent-dark);
  font-weight: 900;
}

.assist-chip.is-active {
  border-color: #9fd9d4;
  color: var(--text);
  background: var(--accent-soft);
}

.assist-chip.is-pro {
  border-color: #9fd9d4;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.assist-chip.is-pro > span:first-child {
  font-size: 11px;
  letter-spacing: 0.04em;
}

.check-dot {
  width: 20px;
  height: 20px;
  display: none;
  place-items: center;
  border-radius: 999px;
  color: #ffffff !important;
  background: var(--accent);
  font-size: 12px;
}

.assist-chip.is-active .check-dot {
  display: grid;
}

.icon-control {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.icon-control svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-control.is-active {
  border-color: #9fd9d4;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.icon-control:disabled {
  cursor: default;
  opacity: 0.38;
}

.nav-icon-button svg {
  fill: currentColor;
}

.secondary-button {
  min-height: 42px;
  border-radius: 999px;
  padding: 0 16px;
  font-size: 14px;
}

.primary-action {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow: 0 12px 22px rgba(0, 121, 111, 0.18);
  font-weight: 850;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.locked-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.locked-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.locked-card h3 {
  margin-bottom: 5px;
  font-size: 20px;
}

.locked-card p {
  max-width: 620px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.custom-player {
  display: grid;
  grid-template-columns: minmax(420px, auto) minmax(360px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 20px 24px;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.player-action {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #515b58;
  font-size: 13px;
  font-weight: 680;
}

.player-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.play-button {
  width: 78px;
  height: 78px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009385);
  box-shadow: 0 14px 28px rgba(0, 121, 111, 0.22);
}

.play-button svg {
  width: 34px;
  height: 34px;
  display: block;
  margin: auto;
  fill: currentColor;
}

.round-action-button,
.loop-button,
.tempo-button,
.volume-button {
  width: 58px;
  height: 58px;
  color: #202726;
}

.loop-button svg,
.tempo-button svg,
.volume-button svg,
.round-action-button svg {
  width: 25px;
  height: 25px;
  display: block;
  margin: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loop-button.is-active,
.tempo-button.is-active,
.volume-button[aria-expanded="true"] {
  border-color: #a4dcd7;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.tempo-panel {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: center;
  gap: 22px;
  min-height: 96px;
  padding-left: 28px;
  border-left: 1px solid var(--border);
}

.tempo-control {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 4px 10px;
  width: min(100%, 450px);
}

.control-label {
  grid-column: 1 / -1;
  color: var(--text);
  font-size: 16px;
  font-weight: 820;
  text-align: left;
}

.tempo-number {
  font-size: 26px;
  line-height: 1;
}

.tempo-value {
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.tempo-slider-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 32px minmax(120px, 1fr) 32px;
  align-items: center;
  gap: 10px;
}

.round-mini-button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font-size: 20px;
  line-height: 1;
}

.tempo-slider,
.volume-slider {
  width: 100%;
  accent-color: var(--accent);
}

.tempo-scale {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  color: #808986;
  font-size: 12px;
}

.tempo-scale span:nth-child(2) {
  text-align: center;
}

.tempo-scale span:nth-child(3) {
  text-align: right;
}

.tap-tempo {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 20px;
  color: var(--text);
  background: var(--surface);
  font-weight: 780;
}

.volume-control {
  position: relative;
}

.volume-popover {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  z-index: 8;
  width: 170px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}

.volume-control.is-open .volume-popover {
  opacity: 1;
  pointer-events: auto;
}

#open-layout,
.player-time {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.pattern-visual-card {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.pattern-visual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pattern-visual-header h3 {
  font-size: 17px;
  font-weight: 820;
}

.view-toggle {
  flex: 0 0 auto;
}

.visual-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.beats-grid.steps-view {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 22px;
}

.beats-grid.steps-view.is-grid-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr)) clamp(18px, 1.8vw, 34px) repeat(4, minmax(0, 1fr));
  column-gap: clamp(10px, 0.8vw, 16px);
  row-gap: clamp(22px, 2vw, 34px);
}

.figure-card {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 14px;
  min-width: 0;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface);
}

.is-grid-8 .figure-card {
  min-height: clamp(134px, 10.8vw, 190px);
  padding: clamp(9px, 0.85vw, 16px);
  gap: clamp(8px, 0.7vw, 12px);
}

@media (min-width: 981px) {
  .is-grid-8 .figure-card:nth-child(5),
  .is-grid-8 .figure-card:nth-child(13) {
    grid-column: 6;
  }
}

.figure-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 20px;
  font-weight: 900;
}

.is-grid-8 .figure-index {
  width: clamp(26px, 1.8vw, 36px);
  height: clamp(26px, 1.8vw, 36px);
  font-size: clamp(14px, 1.1vw, 20px);
}

.step.is-active {
  outline: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 121, 111, 0.12);
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 38px);
  grid-template-rows: repeat(4, 38px);
  gap: 9px;
}

.is-grid-8 .mini-grid {
  grid-template-columns: repeat(4, clamp(15px, 1.05vw, 24px));
  grid-template-rows: repeat(4, clamp(15px, 1.05vw, 24px));
  gap: clamp(4px, 0.32vw, 6px);
}

.pad-cell {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1.5px solid #b9c0bd;
  border-radius: clamp(7px, 0.55vw, 12px);
  background: var(--cell);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.pad-cell.is-on {
  border-color: var(--accent);
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, 0.08);
}

.practice-tip {
  position: relative;
  min-height: 104px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 150px;
  align-items: center;
  gap: 18px;
  padding: 20px 28px;
  overflow: hidden;
  color: #485350;
  font-size: 15px;
  line-height: 1.5;
}

.practice-tip::before {
  content: "💡";
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  font-size: 24px;
}

.practice-tip::after {
  content: "";
  width: 112px;
  height: 76px;
  justify-self: end;
  border: 3px solid #0c8c80;
  border-radius: 12px;
  background:
    linear-gradient(#0c8c80 0 0) 18px 16px / 14px 14px no-repeat,
    linear-gradient(#0c8c80 0 0) 42px 16px / 14px 14px no-repeat,
    linear-gradient(#0c8c80 0 0) 66px 16px / 14px 14px no-repeat,
    linear-gradient(#0c8c80 0 0) 18px 40px / 14px 14px no-repeat,
    linear-gradient(#0c8c80 0 0) 42px 40px / 14px 14px no-repeat,
    linear-gradient(#0c8c80 0 0) 66px 40px / 14px 14px no-repeat;
  opacity: 0.75;
  transform: rotate(-12deg);
}

.practice-tip strong {
  display: block;
  margin-bottom: 2px;
  color: var(--accent-dark);
}

.legal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 4px 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.legal-footer button {
  border: 0;
  padding: 4px 0;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.legal-footer button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal[hidden] {
  display: none;
}

.onboarding-modal[hidden] {
  display: none;
}

.onboarding-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.2vw, 28px);
  overflow: auto;
  background: rgba(247, 249, 248, 0.94);
  backdrop-filter: blur(18px);
}

.onboarding-panel {
  width: min(480px, calc(100vw - 24px));
  height: min(900px, calc(100dvh - 24px));
  overflow: hidden;
  border: 1px solid rgba(17, 24, 23, 0.1);
  border-radius: clamp(22px, 3vw, 34px);
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(17, 24, 23, 0.18);
  display: flex;
  flex-direction: column;
}

.onboarding-topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 8px;
}

.onboarding-help-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 720;
}

.onboarding-help-icon {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--text);
}

.onboarding-help-icon svg {
  width: 25px;
  height: 25px;
}

.onboarding-skip {
  border: 0;
  padding: 8px 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 660;
  cursor: pointer;
}

.onboarding-skip:hover {
  color: var(--text);
}

.onboarding-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.onboarding-track {
  min-height: 100%;
  display: flex;
  align-items: flex-start;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

.onboarding-slide {
  flex: 0 0 100%;
  min-height: 100%;
  padding: 8px 28px 20px;
  display: flex;
  flex-direction: column;
}

.onboarding-step-pill {
  align-self: center;
  border-radius: 999px;
  padding: 7px 20px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 16px;
  font-weight: 820;
  letter-spacing: 0.02em;
}

.onboarding-slide h3 {
  margin: 18px auto 0;
  max-width: 11ch;
  color: var(--text);
  text-align: center;
  font-size: clamp(36px, 7.8vw, 48px);
  line-height: 1.05;
  font-weight: 880;
  letter-spacing: 0;
}

.onboarding-subtitle {
  max-width: 30ch;
  margin: 14px auto 0;
  color: var(--muted);
  text-align: center;
  font-size: clamp(16px, 3.8vw, 19px);
  line-height: 1.48;
  font-weight: 560;
}

.onboarding-media {
  width: 100%;
  margin: 18px auto 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(223, 243, 240, 0.45), rgba(255, 255, 255, 0));
}

.onboarding-media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  user-select: none;
  -webkit-user-drag: none;
}

.onboarding-info-card,
.onboarding-row {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(17, 24, 23, 0.06);
}

.onboarding-info-card {
  padding: 20px;
}

.onboarding-info-card--download {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.onboarding-info-body {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.onboarding-info-icon {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
}

.onboarding-info-icon svg {
  width: 31px;
  height: 31px;
}

.onboarding-info-card p,
.onboarding-row p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 560;
}

.onboarding-download-button {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid rgba(20, 118, 111, 0.45);
  border-radius: 999px;
  padding: 0 24px;
  color: var(--accent-dark);
  background: #ffffff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 820;
}

.onboarding-download-button:hover {
  background: var(--accent-soft);
}

.onboarding-download-button svg {
  width: 20px;
  height: 20px;
}

.onboarding-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onboarding-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}

.onboarding-row strong {
  font-weight: 820;
}

.onboarding-row--purple .onboarding-info-icon {
  color: #7350d7;
  background: #eee8ff;
}

.onboarding-row--purple strong {
  color: #7350d7;
}

.onboarding-row--green .onboarding-info-icon {
  color: var(--accent);
  background: var(--accent-soft);
}

.onboarding-row--green strong {
  color: var(--accent-dark);
}

.onboarding-row--orange .onboarding-info-icon {
  color: #d87900;
  background: #fff1db;
}

.onboarding-row--orange strong {
  color: #d87900;
}

.onboarding-footer {
  flex: 0 0 auto;
  padding: 14px 28px 24px;
  background: linear-gradient(0deg, #ffffff 72%, rgba(255, 255, 255, 0));
}

.onboarding-cta {
  width: 100%;
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 20px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow: 0 16px 28px -18px rgba(0, 121, 111, 0.75);
  font: inherit;
  font-size: 20px;
  font-weight: 860;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    filter 0.16s ease;
}

.onboarding-cta:hover {
  filter: brightness(0.98);
  box-shadow: 0 18px 34px -18px rgba(0, 121, 111, 0.9);
}

.onboarding-cta:active {
  transform: translateY(1px);
}

.onboarding-cta svg {
  width: 22px;
  height: 22px;
}

.onboarding-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.onboarding-dot {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #d5d9d7;
  cursor: pointer;
  transition:
    width 0.24s ease,
    background 0.24s ease;
}

.onboarding-dot.is-active {
  width: 28px;
  background: var(--accent);
}

.onboarding-dot:focus-visible {
  outline: 3px solid rgba(0, 121, 111, 0.45);
  outline-offset: 4px;
}

@media (max-width: 640px) {
  .onboarding-modal {
    padding: 0;
  }

  .onboarding-panel {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 420px) {
  .onboarding-topbar {
    padding: 18px 20px 6px;
  }

  .onboarding-slide {
    padding: 6px 20px 18px;
  }

  .onboarding-footer {
    padding: 12px 20px 18px;
  }

  .onboarding-slide h3 {
    font-size: clamp(34px, 11vw, 44px);
  }

  .onboarding-info-card {
    padding: 16px;
  }

  .onboarding-info-body,
  .onboarding-row {
    gap: 14px;
  }

  .onboarding-info-icon {
    width: 52px;
    height: 52px;
  }

  .onboarding-info-card p,
  .onboarding-row p {
    font-size: 14px;
  }
}

.completion-toast {
  position: fixed;
  top: 96px;
  right: 28px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid rgba(0, 121, 111, 0.2);
  border-radius: 16px;
  padding: 14px 18px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  box-shadow: 0 18px 38px rgba(17, 24, 23, 0.16);
  font-size: 14px;
  font-weight: 820;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(16px, -8px, 0) scale(0.98);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.completion-toast.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
  background: rgba(17, 24, 23, 0.38);
}

.modal-backdrop {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(700px, 100%);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 20px;
  background: var(--surface);
  box-shadow: 0 28px 90px rgba(17, 24, 23, 0.22);
  scrollbar-gutter: stable;
}

.modal-header {
  position: sticky;
  top: -20px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  margin-bottom: 16px;
  background: var(--surface);
}

.modal-kicker {
  margin-bottom: 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-panel {
  width: min(460px, 100%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  margin-bottom: 18px;
  background: var(--surface-soft);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 820;
}

.auth-tab.is-active {
  color: var(--accent-dark);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

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

.auth-helper {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-helper.is-confirmation {
  margin: 0;
}

.auth-confirmation-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid rgba(0, 121, 111, 0.22);
  border-radius: 18px;
  padding: 16px;
  color: #33413e;
  background: #f0fbf9;
  box-shadow: var(--shadow-soft);
}

.auth-confirmation-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 20px;
  font-weight: 950;
}

.auth-confirmation-card h3 {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1.2;
}

.auth-confirmation-card p {
  margin: 0;
}

.auth-confirmation-card strong {
  color: var(--text);
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #36413e;
  font-size: 13px;
  font-weight: 820;
}

.auth-form label.is-hidden {
  display: none;
}

.auth-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  font-size: 15px;
}

.auth-link {
  justify-self: start;
  border: 0;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.auth-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-link-centered {
  justify-self: center;
  margin-top: 2px;
}

.auth-error {
  min-height: 18px;
  color: #9f2f24;
  font-size: 13px;
  font-weight: 700;
}

.auth-error.is-info {
  color: var(--accent-dark);
}

.pro-panel {
  width: min(760px, 100%);
}

.pro-plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pro-plan-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.pro-plan-card.is-featured {
  border-color: #9fd9d4;
  background: linear-gradient(180deg, #f3fffd, #ffffff);
}

.pro-plan-card p {
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pro-plan-card strong {
  font-size: clamp(34px, 4vw, 46px);
  line-height: 1;
}

.pro-plan-card strong span {
  color: var(--muted);
  font-size: 16px;
}

.pro-plan-card small {
  min-height: 42px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.billing-disclosure {
  margin-top: 16px;
  border: 1px solid rgba(20, 118, 111, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 13px;
  line-height: 1.5;
}

.billing-disclosure button {
  border: 0;
  padding: 0 0 0 8px;
  color: var(--accent-dark);
  background: transparent;
  font: inherit;
  font-weight: 840;
  cursor: pointer;
}

.billing-disclosure button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-panel {
  width: min(820px, 100%);
}

.settings-panel {
  width: min(680px, 100%);
}

.legal-panel {
  width: min(860px, 100%);
}

.legal-tabs {
  position: sticky;
  top: 66px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 14px;
  margin-bottom: 14px;
  background: var(--surface);
}

.legal-tabs button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.legal-tabs button.is-active {
  border-color: rgba(20, 118, 111, 0.32);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.legal-document {
  display: grid;
  gap: 16px;
}

.legal-updated {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.legal-summary {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--text);
  background: #ffffff;
  font-size: 15px;
  line-height: 1.5;
  font-weight: 650;
}

.legal-note {
  border: 1px solid rgba(216, 121, 0, 0.22);
  border-radius: 16px;
  padding: 12px 14px;
  color: #6b4a10;
  background: #fff6e8;
  font-size: 13px;
  line-height: 1.45;
}

.legal-note strong {
  color: #503500;
}

.legal-document section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.legal-document h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.legal-document p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.legal-document p:last-child {
  margin-bottom: 0;
}

.help-panel {
  width: min(760px, 100%);
}

.account-content {
  display: grid;
  gap: 16px;
}

.help-content {
  display: grid;
  gap: 18px;
}

.help-figure {
  aspect-ratio: 2 / 1;
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-soft);
  box-shadow: var(--shadow-soft);
}

.help-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.help-copy {
  display: grid;
  gap: 12px;
  color: #33413e;
  font-size: 15px;
  line-height: 1.62;
}

.help-info-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.help-info-card h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 15px;
  line-height: 1.2;
}

.help-copy p {
  margin: 0;
}

.help-download-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(0, 121, 111, 0.24);
  border-radius: 18px;
  padding: 16px;
  background: #f0fbf9;
  box-shadow: var(--shadow-soft);
}

.help-download-card h3 {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 18px;
  line-height: 1.2;
}

.download-button {
  justify-self: start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 0 18px;
  color: #ffffff;
  background: var(--accent);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(20, 118, 111, 0.24);
}

.download-button:hover {
  background: var(--accent-dark);
}

.download-button span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  line-height: 1;
}

.settings-content {
  display: grid;
  gap: 14px;
}

.settings-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.settings-card h3 {
  font-size: 18px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.segmented-control button.is-active {
  color: var(--accent-dark);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  border: 1px solid #e8eeec;
  border-radius: 14px;
  padding: 10px 12px;
  background: #ffffff;
  color: #33413e;
  font-weight: 800;
}

.settings-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.settings-slider {
  display: grid;
  gap: 10px;
}

.settings-slider span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #33413e;
  font-size: 14px;
  font-weight: 800;
}

.settings-slider strong {
  color: var(--accent-dark);
}

.settings-slider input {
  width: 100%;
  accent-color: var(--accent);
}

.account-summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-soft);
}

.account-avatar-large {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent), #009083);
  font-weight: 950;
}

.account-summary-card h3 {
  margin-bottom: 2px;
  font-size: 20px;
}

.account-summary-card p {
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-pill {
  border-radius: 999px;
  padding: 8px 12px;
  color: #485350;
  background: #e8eeec;
  font-size: 13px;
  font-weight: 900;
}

.plan-pill.is-pro {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

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

.progress-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-info-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.account-info-card p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-info-card strong {
  font-size: 26px;
  line-height: 1.05;
}

.account-info-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.account-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.account-form-card {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.account-form-card h3 {
  margin-bottom: 4px;
  font-size: 20px;
}

.account-form-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.account-section-label {
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.account-form-card label {
  display: grid;
  gap: 8px;
  color: #34403d;
  font-size: 14px;
  font-weight: 850;
}

.account-form-card input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 14px 16px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 750;
}

.danger-card {
  border-color: #efc9c1;
  background: #fff8f6;
}

.danger-button {
  justify-self: start;
  border: 1px solid #d64a35;
  border-radius: 999px;
  padding: 12px 18px;
  color: #9b2b1d;
  background: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.danger-button:hover {
  background: #fff0ec;
}

.genre-progress-list {
  display: grid;
  gap: 10px;
}

.genre-progress-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 220px) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #e7ecea;
  border-radius: 16px;
  padding: 12px;
  background: #ffffff;
}

.genre-progress-row strong {
  display: block;
  margin-bottom: 3px;
  font-size: 15px;
}

.genre-progress-row span,
.genre-progress-row em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
}

.genre-progress-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f0;
}

.genre-progress-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #20a096);
}

.layout-floating[hidden] {
  display: none;
}

.layout-floating {
  position: fixed;
  inset: 0;
  z-index: 24;
  pointer-events: none;
}

.layout-floating-panel {
  position: fixed;
  top: 112px;
  right: 22px;
  width: min(300px, calc(100vw - 28px));
  border: 1px solid rgba(16, 45, 41, 0.12);
  border-radius: 20px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(17, 24, 23, 0.18);
  pointer-events: auto;
  touch-action: none;
}

.layout-floating-panel.is-dragging {
  box-shadow: 0 26px 70px rgba(17, 24, 23, 0.24);
  transform: scale(1.01);
}

.layout-floating-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 4px 10px;
  cursor: grab;
  user-select: none;
}

.layout-floating-panel.is-dragging .layout-floating-header {
  cursor: grabbing;
}

.layout-floating-header h2 {
  font-size: 16px;
  line-height: 1.1;
}

.layout-floating-header .modal-kicker {
  margin-bottom: 2px;
  font-size: 10px;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.layout-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  color: #33413e;
  background: var(--surface-soft);
  font-size: 8.5px;
  font-weight: 720;
  line-height: 1.08;
  overflow: hidden;
  text-align: center;
  word-break: break-word;
}

.layout-cell.is-active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 121, 111, 0.14);
}

.empty-state {
  padding: 20px;
  color: var(--muted);
}

@media (max-width: 1280px) {
  .app-layout {
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 22px;
  }

  .custom-player {
    grid-template-columns: minmax(390px, auto) minmax(320px, 1fr);
    gap: 20px;
  }

  .tempo-panel {
    padding-left: 22px;
  }

  .player-actions {
    gap: 14px;
  }

  .play-button {
    width: 68px;
    height: 68px;
  }

  .round-action-button,
  .loop-button,
  .tempo-button,
  .volume-button {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
  }

  .sidebar-section {
    padding: 14px;
  }

  .nav-item {
    font-size: 13px;
  }

  .pattern-card h2 {
    font-size: 34px;
  }

  .pattern-title-row {
    align-items: flex-start;
  }

  .pattern-card-header {
    grid-template-columns: 1fr;
  }

  .pattern-meta-row {
    grid-template-columns: 1fr;
  }

  .display-options {
    justify-content: start;
  }

  .custom-player {
    grid-template-columns: 1fr;
  }

  .tempo-panel {
    padding-top: 18px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .beats-grid.steps-view {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    gap: 12px;
  }

  .beats-grid.steps-view.is-grid-8 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 24px;
  }

  .figure-card {
    min-height: 128px;
    padding: 10px;
  }

  .is-grid-8 .figure-card {
    min-height: 142px;
  }

  .mini-grid {
    grid-template-columns: repeat(4, clamp(20px, 2.4vw, 30px));
    grid-template-rows: repeat(4, clamp(20px, 2.4vw, 30px));
    gap: clamp(5px, 0.7vw, 8px);
  }

  .is-grid-8 .mini-grid {
    grid-template-columns: repeat(4, clamp(15px, 2vw, 22px));
    grid-template-rows: repeat(4, clamp(15px, 2vw, 22px));
    gap: 4px;
  }
}

@media (min-width: 981px) {
  .custom-player {
    grid-auto-flow: column;
  }

  .player-actions,
  .tempo-panel {
    align-self: center;
  }
}

@media (max-width: 760px) {
  .app-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .menu-button {
    display: grid;
  }

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

  .sidebar {
    position: fixed;
    inset: 76px auto 0 0;
    z-index: 20;
    width: min(360px, calc(100vw - 28px));
    max-height: none;
    padding: 14px;
    border-right: 1px solid var(--border);
    background: var(--bg);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .beats-grid.steps-view {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .beats-grid.steps-view.is-grid-8 {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .pad-page-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .pad-volume-control {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .modal {
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100dvh - 20px);
    border-radius: 18px;
    padding: 16px;
  }

  .modal-header {
    top: -16px;
    padding-top: 16px;
  }

  .app-header {
    padding: 12px 14px;
  }

  .account-menu {
    right: -8px;
    width: min(270px, calc(100vw - 24px));
  }

  .header-button:not(.icon-header-button) {
    display: none;
  }

  .icon-header-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
  }

  .header-icon {
    width: 20px;
    height: 20px;
  }

  .app-layout {
    padding: 16px;
  }

  .pad-page {
    gap: 14px;
  }

  .pad-page-header {
    gap: 12px;
    border-radius: 18px;
    padding: 14px;
  }

  .pad-page-header h2 {
    font-size: 30px;
  }

  .pad-page-header p:last-child {
    font-size: 13px;
  }

  .pad-back-button {
    width: 42px;
    height: 42px;
  }

  .touch-pad-grid {
    gap: 9px;
    border-radius: 22px;
    padding: 12px;
  }

  .touch-pad {
    border-radius: 14px;
    padding: 7px;
  }

  .touch-pad strong {
    font-size: clamp(18px, 7.2vw, 28px);
  }

  .touch-pad span {
    display: none;
  }

  .pattern-card h2 {
    font-size: 34px;
  }

  .pattern-title-row {
    gap: 10px;
  }

  .pattern-title-actions {
    gap: 8px;
  }

  .complete-button,
  .favorite-button {
    width: 42px;
    height: 42px;
    margin-top: 1px;
  }

  .locked-card {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .pro-plans {
    grid-template-columns: 1fr;
  }

  .billing-disclosure button {
    display: inline-block;
    padding: 4px 8px 0 0;
  }

  .legal-tabs {
    top: 58px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 10px;
  }

  .legal-tabs button {
    flex: 0 0 auto;
  }

  .account-summary-card,
  .account-grid,
  .progress-overview {
    grid-template-columns: 1fr;
  }

  .help-content {
    grid-template-columns: 1fr;
  }

  .help-figure {
    aspect-ratio: 1.25 / 1;
  }

  .help-copy {
    font-size: 14px;
  }

  .genre-progress-row {
    grid-template-columns: 1fr;
  }

  .account-actions-row {
    justify-content: stretch;
  }

  .account-actions-row button {
    width: 100%;
  }

  .completion-toast {
    top: auto;
    right: auto;
    bottom: 22px;
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 32px);
    text-align: center;
    transform: translate3d(-50%, 18px, 0) scale(0.98);
  }

  .completion-toast.is-visible {
    transform: translate3d(-50%, 0, 0) scale(1);
  }

  .custom-player {
    padding: 18px;
  }

  .player-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }

  .play-button {
    width: 64px;
    height: 64px;
  }

  .round-action-button,
  .loop-button,
  .tempo-button,
  .volume-button {
    width: 48px;
    height: 48px;
  }

  .tempo-panel {
    grid-template-columns: 1fr;
  }

  .layout-floating-panel {
    top: 88px;
    right: 12px;
    width: min(268px, calc(100vw - 24px));
  }

  .layout-cell {
    border-radius: 10px;
    font-size: 8px;
  }

  .beats-grid.steps-view {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .beats-grid.steps-view.is-grid-8 {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .practice-tip {
    grid-template-columns: auto 1fr;
  }

  .practice-tip::after {
    display: none;
  }
}
