:root {
  color-scheme: dark;
  --bg: #07120f;
  --surface: #10231c;
  --surface-strong: #17352a;
  --surface-soft: rgba(16, 35, 28, 0.86);
  --text: #f3fbf7;
  --muted: #a9c2b8;
  --accent: #52d273;
  --accent-strong: #8df0a0;
  --accent-soft: rgba(82, 210, 115, 0.16);
  --danger-soft: rgba(255, 196, 87, 0.14);
  --border: rgba(243, 251, 247, 0.12);
  --shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.28);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7faf4;
  --surface: #ffffff;
  --surface-strong: #dfe8dc;
  --surface-soft: rgba(255, 255, 255, 0.94);
  --text: #10140f;
  --muted: #465246;
  --accent: #0a7a34;
  --accent-strong: #005f28;
  --accent-soft: rgba(10, 122, 52, 0.14);
  --danger-soft: rgba(134, 82, 0, 0.12);
  --border: rgba(16, 20, 15, 0.18);
  --shadow: 0 1rem 2.2rem rgba(17, 27, 17, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(82, 210, 115, 0.13), transparent 34rem),
    linear-gradient(160deg, rgba(23, 53, 42, 0.38), transparent 44rem),
    var(--bg);
  color: var(--text);
}

:root[data-theme="light"] body,
body.theme-light {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(247, 250, 244, 0.96)),
    var(--bg);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 1rem;
  padding: 1.25rem;
}

.performance-shell {
  grid-template-rows: auto 1fr auto;
}

.screen {
  width: min(100%, 68rem);
  margin: 0 auto;
  display: none;
  align-self: center;
}

.screen.is-active {
  display: block;
}

.screen-centered {
  max-width: 34rem;
  text-align: center;
}

.panel {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: var(--shadow);
}

.panel.narrow {
  width: min(100%, 32rem);
  margin: 0 auto;
}

.hero-panel {
  align-content: center;
}

.brand-stack {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 2rem 0;
}

.brand-line,
.screen-header {
  display: flex;
  align-items: center;
}

.screen-header {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.brand-line {
  gap: 0.75rem;
  color: var(--text);
  font-weight: 400;
}

.brand-line small {
  display: block;
  max-width: 12rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 210, 115, 0.45);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 400;
}

.brand-mark.small {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.95rem;
}

.avatar {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-strong);
  background-position: center;
  background-size: cover;
  color: var(--accent-strong);
  font-size: 0.85rem;
  font-weight: 400;
}

.avatar.has-image {
  color: transparent;
}

.home-user {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.user-greeting {
  max-width: 11rem;
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 1;
}

h2 {
  font-size: 1.15rem;
}

.intro,
.hint,
.app-status {
  color: var(--muted);
  line-height: 1.5;
}

.hint {
  font-size: 0.9rem;
}

.app-status {
  width: min(100%, 68rem);
  margin: 0 auto;
  font-size: 0.8rem;
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.actions.vertical {
  display: grid;
}

.compact-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.button {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(243, 251, 247, 0.05);
  color: var(--text);
  text-decoration: none;
}

.theme-toggle {
  min-height: 2.4rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.86rem;
  font-weight: 400;
  white-space: nowrap;
}

.button-compact {
  min-height: 2.35rem;
  min-width: 2.35rem;
  padding: 0.4rem 0.65rem;
}

.button-primary {
  border-color: rgba(82, 210, 115, 0.5);
  background: var(--accent);
  color: #06100d;
  font-weight: 400;
}

body.theme-light .button {
  background: #ffffff;
  color: #10140f;
}

:root[data-theme="light"] .button-primary,
body.theme-light .button-primary {
  background: var(--accent);
  color: #ffffff;
}

.button-ghost {
  background: transparent;
}

.button-danger {
  border-color: rgba(255, 196, 87, 0.38);
  background: rgba(255, 196, 87, 0.12);
  color: #ffd48a;
}

:root[data-theme="light"] .button-danger {
  color: #633b00;
}

body.theme-light .button-ghost {
  background: transparent;
}

body.theme-light .panel,
body.theme-light .list-item,
body.theme-light .notice,
body.theme-light .cult-card,
body.theme-light .role-card,
body.theme-light .info-grid > div {
  background-color: #ffffff;
}

.icon-button {
  min-width: 3rem;
  padding-inline: 0.5rem;
  font-weight: 400;
}

.performance-header .icon-button {
  width: auto;
}

.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 1.75rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid rgba(82, 210, 115, 0.35);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 400;
}

.check-list,
.list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
}

.check-list {
  list-style: none;
}

.check-list li,
.list-item,
.notice {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(243, 251, 247, 0.04);
}

.check-list li {
  padding: 0.8rem 1rem;
}

.check-list li::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.65rem;
  border-radius: 50%;
  background: var(--accent);
}

.notice {
  padding: 1rem;
  background: var(--danger-soft);
  color: var(--muted);
}

.auth-message {
  white-space: pre-line;
}

.offline-warning {
  color: var(--text);
  font-weight: 400;
}

.info-grid,
.home-grid {
  display: grid;
  gap: 1rem;
}

.home-dashboard {
  display: grid;
  gap: 1rem;
}

.home-hero {
  display: grid;
  gap: 0.45rem;
  padding: 0.3rem 0 0.2rem;
  text-align: center;
}

.home-hero h1 {
  font-size: clamp(2rem, 9vw, 3.1rem);
}

.rehearsal-card {
  position: relative;
  overflow: hidden;
  gap: 1.1rem;
  background:
    linear-gradient(135deg, rgba(82, 210, 115, 0.18), rgba(16, 35, 28, 0.96)),
    var(--surface);
}

.card-icon {
  width: 3.2rem;
  height: 3.2rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 210, 115, 0.42);
  border-radius: 8px;
  background: rgba(82, 210, 115, 0.14);
  color: var(--accent-strong);
  font-size: 1.7rem;
}

.home-section {
  display: grid;
  gap: 0.75rem;
}

.cult-card-list {
  display: grid;
  gap: 0.7rem;
}

.cult-card,
.role-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(243, 251, 247, 0.04);
}

.cult-card {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.cult-card strong {
  font-size: 1.05rem;
}

.cult-card span,
.role-card {
  color: var(--muted);
}

.role-card {
  padding: 0.95rem 1rem;
  color: var(--text);
  font-weight: 400;
}

.home-actions {
  display: grid;
  gap: 0.7rem;
}

.home-actions .button {
  min-height: 3.2rem;
  justify-content: flex-start;
  padding-inline: 1rem;
  text-align: left;
}

.info-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.info-grid > div {
  display: grid;
  gap: 0.3rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(243, 251, 247, 0.04);
}

.label {
  color: var(--muted);
  font-size: 0.78rem;
}

.form {
  display: grid;
  gap: 1rem;
}

.form label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(7, 18, 15, 0.8);
  color: var(--text);
}

:root[data-theme="light"] .form input,
:root[data-theme="light"] .form select,
:root[data-theme="light"] .form textarea,
:root[data-theme="light"] .search-form input,
body.theme-light .form input,
body.theme-light .form select,
body.theme-light .form textarea,
body.theme-light .search-form input {
  background: #ffffff;
  color: #10140f;
}

.form textarea {
  min-height: 18rem;
  resize: vertical;
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.search-form {
  display: grid;
  gap: 0.45rem;
}

.search-form label {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-form input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 0.9rem;
  background: rgba(7, 18, 15, 0.8);
  color: var(--text);
}

.home-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
}

.home-grid .hero-panel {
  grid-row: span 2;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
}

.list-item span {
  color: var(--muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.song-card {
  color: var(--text);
  text-decoration: none;
}

.song-card .button {
  align-self: center;
  flex: 0 0 auto;
}

.song-card-content,
.song-link span {
  min-width: 0;
  display: grid;
  gap: 0.2rem;
}

.song-card small,
.song-link small {
  color: var(--muted);
}

.song-card-title,
.song-card-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-card-title {
  color: var(--text);
}

.song-card-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.song-link {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text);
  text-decoration: none;
}

.song-list .list-item {
  min-height: 4rem;
  padding: 0.65rem 0.8rem;
}

.song-list .song-card {
  align-items: center;
}

.song-list .song-link {
  overflow: hidden;
}

.cult-song-card {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
}

.song-position {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent-strong);
  font-weight: 400;
}

.order-controls {
  display: flex;
  gap: 0.35rem;
}

.order-button {
  min-width: 2.65rem;
  min-height: 2.65rem;
  padding: 0;
  font-size: 1.15rem;
}

.order-button:disabled {
  opacity: 0.38;
}

.official-list-picker {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.5rem;
}

.official-list-picker select {
  min-width: 0;
  min-height: 2.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: rgba(7, 18, 15, 0.8);
  color: var(--text);
}

:root[data-theme="light"] .official-list-picker select,
body.theme-light .official-list-picker select {
  background: #ffffff;
  color: #10140f;
}

.current-key-control {
  min-width: 4rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(82, 210, 115, 0.38);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.empty-state {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.song-view {
  align-content: start;
}

.performance-screen {
  width: min(100%, 76rem);
  align-self: stretch;
}

.performance-header {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -0.65rem 0 0.25rem;
  padding: 0.3rem 0;
  background: linear-gradient(180deg, var(--bg) 74%, rgba(7, 18, 15, 0));
}

:root[data-theme="light"] .performance-header,
body.theme-light .performance-header {
  background: linear-gradient(180deg, var(--bg) 78%, rgba(247, 250, 244, 0));
}

.performance-view {
  display: grid;
  gap: 0.45rem;
}

.song-hero {
  display: grid;
  gap: 0.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.song-hero h1 {
  margin-top: 0;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1.08;
}

.song-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.song-meta-line strong {
  color: var(--accent-strong);
}

.cifra-box {
  overflow: auto;
  max-width: 100%;
  min-height: 20rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(7, 18, 15, 0.82);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  white-space: pre-wrap;
}

:root[data-theme="light"] .cifra-box,
body.theme-light .cifra-box {
  background: #ffffff;
  color: var(--text);
}

.cifra-line {
  display: block;
  min-height: 1.55em;
}

.chord {
  color: #ffb35c;
  font-weight: 400;
  text-shadow: none;
}

:root[data-theme="light"] .chord,
body.theme-light .chord {
  color: #b75f00;
  text-shadow: none;
}

.performance-cifra {
  min-height: 76vh;
  padding: 1.25rem;
  line-height: 1.65;
  tab-size: 4;
}

.song-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

body {
  font-weight: 300;
}

body *,
strong,
b,
h1,
h2,
h3,
button,
.button,
.brand-line,
.brand-mark,
.avatar,
.eyebrow,
.role-card,
.song-position,
.current-key-control {
  font-weight: 400;
}

.screen-header {
  min-height: 3.25rem;
}

.brand-line {
  min-width: 0;
  margin-right: auto;
}

.brand-line > div {
  min-width: 0;
}

.brand-line span,
.brand-line small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-header {
  display: flex;
  align-items: center;
}

.home-user {
  max-width: 5.5rem;
  display: grid;
  justify-items: center;
  gap: 0.18rem;
  text-align: center;
}

.home-user .avatar {
  width: 2rem;
  height: 2rem;
  font-size: 0.72rem;
}

.user-greeting {
  max-width: 5.5rem;
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.72rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.app-menu-toggle {
  flex: 0 0 auto;
  min-width: 2.65rem;
  font-size: 1.25rem;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.42);
}

.app-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 90;
  width: min(82vw, 19rem);
  height: 100vh;
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1rem;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
}

.drawer-nav,
.drawer-actions {
  display: grid;
  gap: 0.6rem;
}

.drawer-nav a {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.drawer-actions .button {
  justify-content: flex-start;
}

.home-hero h1 {
  font-size: clamp(1.35rem, 6vw, 1.85rem);
  line-height: 1.08;
  white-space: nowrap;
}

.rehearsal-card {
  padding: 1rem;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 1rem;
  }

  .home-grid,
  .info-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .home-grid .hero-panel {
    grid-row: auto;
  }

  .screen-header,
  .section-head {
    align-items: center;
  }

  .home-header {
    display: flex;
    gap: 0.55rem;
  }

  .home-user {
    width: auto;
    justify-content: center;
  }

  .user-greeting {
    max-width: 5.5rem;
  }

  .section-head {
    display: grid;
  }

  .performance-shell {
    padding: 0.75rem;
  }

  .performance-header {
    display: grid;
    gap: 0.55rem;
  }

  .performance-header .theme-toggle {
    width: fit-content;
  }

  .compact-actions {
    justify-content: stretch;
  }

  .compact-actions .button {
    flex: 1 1 auto;
  }

  .song-card,
  .song-link {
    display: grid;
  }

  .song-list .song-card {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .song-list .song-link {
    display: block;
  }

  .official-list-picker {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  .song-hero {
    grid-template-columns: 1fr;
  }

  .song-hero h1 {
    font-size: 1.45rem;
    line-height: 1.08;
  }

  .performance-cifra {
    min-height: 73vh;
    padding: 1rem;
    line-height: 1.6;
  }
}
