:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-subtle: #f6f7f8;
  --surface-hover: #f1f2f3;
  --ink: #0f0f0f;
  --muted: #606060;
  --faint: #8b8b8b;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --accent: #b4232a;
  --accent-hover: #991f25;
  --accent-ink: #ffffff;
  --blue: #065fd4;
  --success: #16803c;
  --danger: #c0182f;
  --shadow-soft: 0 1px 2px rgba(15, 15, 15, 0.08), 0 8px 24px rgba(15, 15, 15, 0.08);
  --modal-backdrop: rgba(0, 0, 0, 0.48);
  --modal-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --input-bg: #ffffff;
  --input-border: #cccccc;
  --chip-bg: #f2f2f2;
  --chip-hover: #e7e7e7;
  --chip-active-bg: #0f0f0f;
  --chip-active-ink: #ffffff;
  --thumbnail-bg: #080808;
  --highlight-bg: #fff5f5;
  --highlight-ring: #efb1b7;
  --avatar-start: #7d4bdb;
  --avatar-end: #1f8a70;
  --piano-key-white: #fffaf0;
  --piano-key-black: #111111;
  --radius: 8px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #0f0f0f;
  --surface-raised: #212121;
  --surface-subtle: #181818;
  --surface-hover: #2b2b2b;
  --ink: #f1f1f1;
  --muted: #aaaaaa;
  --faint: #7b7b7b;
  --line: #303030;
  --line-strong: #3f3f3f;
  --accent: #ff6b73;
  --accent-hover: #ff7d84;
  --accent-ink: #160406;
  --blue: #8ab4f8;
  --success: #81c995;
  --danger: #ff6b80;
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.32);
  --modal-backdrop: rgba(0, 0, 0, 0.72);
  --modal-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
  --topbar-bg: rgba(15, 15, 15, 0.94);
  --input-bg: #121212;
  --input-border: #3f3f3f;
  --chip-bg: #272727;
  --chip-hover: #3a3a3a;
  --chip-active-bg: #f1f1f1;
  --chip-active-ink: #0f0f0f;
  --thumbnail-bg: #000000;
  --highlight-bg: #2d181b;
  --highlight-ring: #8f414a;
  --avatar-start: #9475ff;
  --avatar-end: #4ab89f;
  --piano-key-white: #f7efe3;
  --piano-key-black: #050505;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0f;
    --surface: #0f0f0f;
    --surface-raised: #212121;
    --surface-subtle: #181818;
    --surface-hover: #2b2b2b;
    --ink: #f1f1f1;
    --muted: #aaaaaa;
    --faint: #7b7b7b;
    --line: #303030;
    --line-strong: #3f3f3f;
    --accent: #ff6b73;
    --accent-hover: #ff7d84;
    --accent-ink: #160406;
    --blue: #8ab4f8;
    --success: #81c995;
    --danger: #ff6b80;
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.32);
    --modal-backdrop: rgba(0, 0, 0, 0.72);
    --modal-shadow: 0 24px 80px rgba(0, 0, 0, 0.62);
    --topbar-bg: rgba(15, 15, 15, 0.94);
    --input-bg: #121212;
    --input-border: #3f3f3f;
    --chip-bg: #272727;
    --chip-hover: #3a3a3a;
    --chip-active-bg: #f1f1f1;
    --chip-active-ink: #0f0f0f;
    --thumbnail-bg: #000000;
    --highlight-bg: #2d181b;
    --highlight-ring: #8f414a;
    --avatar-start: #9475ff;
    --avatar-end: #4ab89f;
    --piano-key-white: #f7efe3;
    --piano-key-black: #050505;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    Roboto,
    Arial,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body.modal-open {
  overflow: hidden;
}

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

button,
a,
input,
select,
textarea {
  outline-color: var(--blue);
}

button {
  cursor: pointer;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

.topbar-row {
  display: grid;
  grid-template-columns: max-content minmax(360px, 760px) max-content;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1880px, 100%);
  min-height: 62px;
  margin: 0 auto;
  padding: 10px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.brand strong {
  color: var(--ink);
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
  max-width: 260px;
  overflow-wrap: anywhere;
}

.brand small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-raised));
  box-shadow:
    inset 0 0 0 1px var(--line-strong),
    0 1px 3px rgba(15, 15, 15, 0.12);
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  content: "";
}

.brand-mark::before {
  top: 8px;
  left: 8px;
  width: 20px;
  height: 20px;
  background:
    linear-gradient(90deg, var(--ink) 0 2px, transparent 2px 18px, var(--ink) 18px 20px),
    linear-gradient(180deg, transparent 0 3px, var(--line-strong) 3px 5px, transparent 5px 10px, var(--line-strong) 10px 12px, transparent 12px 17px, var(--line-strong) 17px 19px, transparent 19px 20px);
}

.brand-mark::after {
  right: 8px;
  bottom: 8px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid var(--accent);
}

.search-area {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 188px);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  justify-self: center;
}

.search-box {
  display: block;
  width: 100%;
  min-width: 0;
}

.search-box input,
.header-instrument-field select {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 0 18px;
}

.header-instrument-field {
  display: block;
  min-width: 0;
}

.header-instrument-field select {
  border-radius: 999px;
  background: var(--chip-bg);
  padding: 0 34px 0 13px;
  font-size: 0.86rem;
  font-weight: 850;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box input:focus,
.header-instrument-field select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 16%, transparent);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.header-link {
  color: var(--blue);
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.header-link:hover {
  text-decoration: underline;
}

.add-video-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.feed-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(1880px, 100%);
  margin: 0 auto;
  overflow-x: auto;
  padding: 0 24px 12px;
  scrollbar-width: thin;
}

.header-button,
.add-button,
.primary-button,
.segment,
.status-button,
.nav-button,
.icon-button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.header-button,
.status-button,
.nav-button,
.icon-button {
  background: var(--chip-bg);
  color: var(--ink);
}

.header-button:hover,
.status-button:hover,
.nav-button:hover,
.icon-button:hover {
  background: var(--chip-hover);
}

.header-button,
.add-button {
  padding: 0 14px;
  white-space: nowrap;
}

.theme-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  min-width: 38px;
  width: 38px;
  padding: 0;
  font-size: 1.08rem;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.add-button,
.primary-button {
  background: var(--accent);
  color: var(--accent-ink);
}

.add-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-inline: 14px 16px;
}

.add-button::before {
  content: "+";
  font-size: 1.15rem;
  line-height: 1;
}

.add-button:hover,
.primary-button:hover {
  background: var(--accent-hover);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  padding: 0 14px;
}

.nav-button span {
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
}

.nav-button strong {
  display: inline-grid;
  min-width: 23px;
  height: 23px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: inherit;
  font-size: 0.75rem;
}

.nav-button.is-active {
  background: var(--chip-active-bg);
  color: var(--chip-active-ink);
}

.nav-button.is-active strong {
  background: color-mix(in srgb, var(--chip-active-ink) 18%, transparent);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 150px;
  min-height: 36px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.86rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-pill:hover {
  background: var(--chip-hover);
}

.feed-shell {
  width: min(1880px, 100%);
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.feed-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.feed-kicker {
  display: inline-flex;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.feed-heading h1 {
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1.15;
}

.feed-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.35;
}

.instrument-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}

.instrument-button,
.instrument-choice {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.05);
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease,
    box-shadow 140ms ease;
}

.instrument-button:hover,
.instrument-choice:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.instrument-button.is-active,
.instrument-choice:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-raised));
  color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.instrument-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}

.instrument-panel {
  width: min(100%, 520px);
}

.feed-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.tool-explainer {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.filter-menu {
  position: relative;
  margin-left: auto;
}

.management-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-subtle);
  padding: 12px;
}

.filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 220px;
  max-width: calc(100vw - 28px);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  padding: 10px;
  box-shadow: var(--shadow-soft);
}

.filter-panel .compact-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.filter-panel .field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.filter-panel select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border-radius: 999px;
  background: var(--chip-bg);
  padding: 0 30px 0 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.compact-field {
  min-width: min(100%, 210px);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  width: 100%;
}

.admin-user-list {
  display: grid;
  gap: 8px;
  width: 100%;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 10px;
}

.admin-user-row div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.admin-user-row strong,
.admin-user-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row span {
  color: var(--muted);
  font-size: 0.85rem;
}

.status-message {
  min-height: 34px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.status-message:not(:empty) {
  display: inline-flex;
  align-items: center;
  max-width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  padding: 8px 12px;
  box-shadow: var(--shadow-soft);
}

.inline-link {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-decoration: underline;
}

.status-message.is-error {
  color: var(--danger);
}

.status-message.is-success {
  color: var(--success);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 318px), 1fr));
  gap: 34px 18px;
}

.song-card {
  position: relative;
  min-width: 0;
  scroll-margin-top: 128px;
  border-radius: 12px;
  padding: 0;
}

.song-card::before {
  position: absolute;
  inset: -8px;
  z-index: -1;
  border-radius: 16px;
  background: transparent;
  content: "";
  transition:
    background 140ms ease,
    box-shadow 140ms ease;
}

.song-card:hover::before {
  background: var(--surface-subtle);
  box-shadow: var(--shadow-soft);
}

.song-card.is-highlighted::before {
  background: var(--highlight-bg);
  box-shadow: 0 0 0 3px var(--highlight-ring);
}

.delete-song-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: rgba(15, 15, 15, 0.84);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.92;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.delete-song-button:hover {
  background: var(--danger);
  opacity: 1;
}

.video-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: var(--thumbnail-bg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.song-body {
  display: block;
  padding: 12px 2px 0;
}

.song-copy {
  min-width: 0;
}

.song-copy h2 {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.song-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.song-notes {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.song-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.level-badge,
.instrument-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 900;
}

.instrument-badge {
  background: color-mix(in srgb, var(--accent) 12%, var(--chip-bg));
  color: var(--ink);
}

.level-select {
  width: auto;
  min-height: 28px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  padding: 0 28px 0 9px;
  font-size: 0.76rem;
  font-weight: 900;
}

.song-tags a {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.song-tags a:hover {
  text-decoration: underline;
}

.song-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.status-button {
  min-width: 94px;
  border-color: var(--line-strong);
  background: var(--surface-raised);
  padding: 0 12px;
  font-size: 0.82rem;
  box-shadow: 0 1px 2px rgba(15, 15, 15, 0.06);
}

.training-button {
  border-color: color-mix(in srgb, var(--blue) 42%, var(--line));
  background: color-mix(in srgb, var(--blue) 10%, var(--surface-raised));
  color: var(--blue);
}

.training-button:hover {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 18%, var(--surface-raised));
}

.finished-button {
  border-color: color-mix(in srgb, var(--success) 42%, var(--line));
  background: color-mix(in srgb, var(--success) 10%, var(--surface-raised));
  color: var(--success);
}

.finished-button:hover {
  border-color: var(--success);
  background: color-mix(in srgb, var(--success) 18%, var(--surface-raised));
}

.status-button.is-active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--blue) 28%, transparent);
}

.finished-button.is-active {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--success) 28%, transparent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  overflow: auto;
  background: var(--modal-backdrop);
  padding: 76px 16px 24px;
}

.modal-card {
  width: min(100%, 448px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: var(--modal-shadow);
  padding: 18px;
}

.auth-panel.has-save-notice {
  width: min(100%, 780px);
}

.auth-layout {
  display: grid;
  gap: 16px;
}

.auth-panel.has-save-notice .auth-layout {
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 1fr);
  align-items: start;
}

.auth-save-notice {
  display: grid;
  gap: 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface-raised));
  padding: 14px;
}

.auth-save-notice h3 {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.auth-save-notice p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-save-notice .header-button {
  justify-self: start;
}

.auth-form-column {
  min-width: 0;
}

.modal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  margin-bottom: 16px;
}

.modal-head h2 {
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1.2;
}

.modal-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.icon-button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  font-size: 1rem;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--ink);
}

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

textarea {
  min-height: 84px;
  resize: vertical;
  padding: 10px 11px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--chip-bg);
}

.segment {
  background: transparent;
  color: var(--muted);
}

.segment.is-active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.primary-button {
  min-height: 42px;
  padding: 0 15px;
}

.empty-state {
  display: grid;
  min-height: 320px;
  grid-column: 1 / -1;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface-subtle);
  text-align: center;
  padding: 28px;
}

.empty-state h3 {
  color: var(--ink);
  font-size: 1.08rem;
}

.empty-state p {
  max-width: 460px;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.friend-grid {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 16px;
}

.friend-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  padding: 16px;
}

.friend-card h2 {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.friend-login,
.friend-empty {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.friend-song-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.friend-song-section h3 {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.friend-song-list {
  display: grid;
  gap: 7px;
}

.friend-song-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.friend-song-row:hover {
  background: var(--surface-hover);
}

.friend-song-row strong {
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-song-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.seo-library {
  display: grid;
  grid-column: 1 / -1;
  gap: 12px;
  margin-top: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.seo-library h2 {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.25;
}

.seo-library p {
  max-width: 760px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.seo-library ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.seo-library li {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.seo-library a,
.breadcrumb a,
.lesson-copy a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.seo-library a:hover,
.breadcrumb a:hover,
.lesson-copy a:hover {
  text-decoration: underline;
}

.seo-library span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.lesson-page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px 24px 56px;
}

.simple-topbar-row {
  grid-template-columns: max-content max-content;
}

.breadcrumb {
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.lesson-article {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.lesson-copy {
  display: grid;
  gap: 12px;
}

.lesson-copy h1 {
  color: var(--ink);
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.08;
}

.lesson-copy p {
  color: var(--muted);
  line-height: 1.55;
}

.info-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 26px 24px 64px;
}

.info-article {
  display: grid;
  gap: 22px;
}

.info-article h1 {
  max-width: 820px;
  color: var(--ink);
  font-size: clamp(1.85rem, 4vw, 3rem);
  line-height: 1.08;
}

.info-lede {
  max-width: 780px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.58;
}

.info-section {
  display: grid;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.info-section h2 {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.25;
}

.info-section p,
.info-section li {
  color: var(--muted);
  line-height: 1.55;
}

.info-section ul,
.info-section ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.info-action {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  color: var(--accent-ink);
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .topbar-row {
    grid-template-columns: max-content 1fr;
  }

  .search-area {
    justify-self: stretch;
  }

  .header-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .add-video-hint {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar-row {
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 7px;
    min-height: 0;
    padding: 7px 10px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    width: max-content;
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .brand-mark::before {
    top: 6px;
    left: 6px;
    width: 18px;
    height: 18px;
  }

  .brand-mark::after {
    right: 6px;
    bottom: 6px;
  }

  .brand strong {
    max-width: 240px;
    font-size: 0.98rem;
  }

  .header-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 100%;
    margin-inline: 0;
    overflow-x: auto;
    padding: 0 0 2px;
    scrollbar-width: none;
  }

  .header-actions::-webkit-scrollbar {
    display: none;
  }

  .header-actions > * {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .header-link,
  .header-button,
  .add-button {
    display: inline-flex;
    width: auto;
    min-height: 31px;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.78rem;
  }

  .header-link {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--chip-bg);
    color: var(--ink);
    padding: 0 10px;
    text-decoration: none;
  }

  .header-link:hover {
    background: var(--chip-hover);
    text-decoration: none;
  }

  .theme-button {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: 31px;
    min-width: 31px;
    padding: 0;
    box-shadow: none;
  }

  .theme-button::after {
    content: none;
  }

  #openAddButton {
    order: -4;
    padding-inline: 11px 12px;
    font-size: 0;
  }

  #openAddButton::after {
    content: "Add";
    font-size: 0.78rem;
  }

  #showAuthButton,
  #logoutButton {
    order: -3;
  }

  .theme-button {
    order: -2;
  }

  .header-link {
    order: -1;
  }

  .search-area {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) minmax(124px, 0.36fr);
    gap: 6px;
  }

  .search-box input,
  .header-instrument-field select {
    height: 34px;
    padding-inline: 10px;
    font-size: 0.82rem;
  }

  .header-instrument-field select {
    padding-right: 24px;
  }

  .feed-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    padding: 0 10px 7px;
    scrollbar-width: none;
  }

  .feed-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    justify-content: center;
    gap: 5px;
    min-width: max-content;
    width: auto;
    min-height: 31px;
    padding-inline: 11px;
  }

  .feed-shell {
    padding: 10px 10px 34px;
  }

  .feed-heading {
    display: none;
  }

  .instrument-selector {
    display: flex;
    flex-wrap: nowrap;
    width: calc(100% + 20px);
    margin: 0 -10px 9px;
    overflow-x: auto;
    padding: 0 10px 2px;
    scrollbar-width: none;
  }

  .instrument-selector::-webkit-scrollbar {
    display: none;
  }

  .instrument-selector,
  .instrument-choice-grid {
    gap: 6px;
  }

  .instrument-button {
    flex: 0 0 auto;
    min-height: 31px;
    min-width: max-content;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 0.78rem;
    box-shadow: none;
  }

  .instrument-choice {
    min-height: 42px;
    min-width: 0;
    border-radius: 10px;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .instrument-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
  }

  .instrument-panel {
    width: 100%;
    max-width: calc(100vw - 20px);
  }

  .modal {
    overflow-x: hidden;
    padding: 54px 10px 18px;
  }

  .modal-card {
    width: 100%;
    max-width: calc(100vw - 20px);
    padding: 14px;
  }

  .modal-head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .modal-head h2 {
    font-size: 1.02rem;
  }

  .modal-head p {
    font-size: 0.84rem;
  }

  .feed-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    margin-bottom: 10px;
  }

  .tool-explainer {
    display: none;
  }

  .filter-menu {
    margin-left: 0;
    justify-self: end;
  }

  .filter-panel {
    right: auto;
    left: auto;
    right: 0;
    width: min(240px, calc(100vw - 28px));
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .song-card::before,
  .song-card:hover::before {
    inset: -6px;
  }

  .auth-panel.has-save-notice .auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .brand small,
  .add-video-hint {
    display: none;
  }

  .brand strong {
    max-width: 190px;
    font-size: 0.94rem;
    line-height: 1.05;
  }

  .header-button,
  .add-button,
  .nav-button {
    min-height: 31px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .nav-button {
    padding: 0 10px;
  }

  .nav-button span {
    font-size: 0.68rem;
    white-space: nowrap;
    text-align: center;
  }

  .nav-button strong {
    min-width: 18px;
    height: 18px;
    font-size: 0.62rem;
  }

  .search-area {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .header-instrument-field select {
    height: 34px;
    font-size: 0.78rem;
  }

  .user-pill {
    display: none;
  }

  .song-body {
    padding-top: 8px;
  }

  .song-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
    padding-left: 0;
  }

  .status-button {
    width: 100%;
    min-height: 32px;
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.76rem;
  }

  .admin-user-row,
  .friend-song-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .search-area {
    grid-template-columns: minmax(0, 1fr) 98px;
  }

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

@media (max-width: 820px) {
  .lesson-article {
    grid-template-columns: 1fr;
  }

  .lesson-page {
    padding: 20px 14px 42px;
  }

  .info-page {
    padding: 20px 14px 46px;
  }

  .simple-topbar-row {
    grid-template-columns: 1fr;
  }
}
