:root {
  --bg: #F4F0E7;
  --fg: #28231F;
  --fg-muted: #9CA3AF;
  --primary: #70401F;
  --primary-fg: #FFFFFF;
  --secondary: #F2E2B8;
  --secondary-fg: #28231F;
  --accent: #D9A520;
  --border: #C8B99F;
  --shadow: rgba(40, 35, 31, 0.14);
  --font-base: 18px;
  --font-large: 28px;
  --space: 1rem;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Minion Pro', 'Minion', 'Georgia', 'Times New Roman', 'Iowan Old Style', 'Palatino Linotype', serif;
  font-size: var(--font-base);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-weight: 700;
}

.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;
}

/* Header / top navigation */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem var(--space);
  background: #5B351F;
  color: var(--primary-fg);
  box-shadow: 0 2px 6px var(--shadow);
}

.app-logo {
  display: block;
  flex: 1;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  color: var(--primary-fg);
  font-family: inherit;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0 0.5rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: var(--primary-fg);
}

.admin-link:hover,
.admin-link:focus {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
}

.app-logo span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-badge {
  display: block;
  margin-top: 0.15rem;
  color: #F2E2B8;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  color: var(--primary-fg);
  padding: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 52px;
  min-height: 52px;
  touch-action: manipulation;
  transition: background 0.15s ease, transform 0.05s ease;
}

@media (hover: hover) {
  .nav-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.45);
  }
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.55);
  border-color: #fff;
}

.nav-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.nav-btn:active {
  transform: scale(0.96);
}

.nav-icon {
  width: 28px;
  height: 28px;
}

.setlist-menu {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 24;
  display: grid;
  width: min(calc(100% - 2rem), 520px);
  max-height: 65vh;
  overflow-y: auto;
  transform: translateX(-50%);
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 0 0 14px 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(40, 35, 31, 0.25);
}

.setlist-menu button {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.setlist-menu button:last-child {
  border-bottom: 0;
}

.setlist-menu button:hover,
.setlist-menu button:focus-visible,
.setlist-menu button.active {
  background: var(--secondary);
  outline: none;
}

#main {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-title {
  margin: 0.5rem 0 1.25rem;
  font-size: 1.6rem;
  color: var(--primary);
  text-align: center;
}

/* Number list and yvirlit */
.number-list,
.results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.number-list,
.results {
  gap: 0.5rem;
}

.number-list .result-item,
.results .result-item {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
}

.number-list .result-number,
.results .result-number {
  order: 2;
  min-width: auto;
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--fg);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 0;
}

.number-list .result-text,
.results .result-text {
  order: 1;
}

.number-list .result-title,
.results .result-title {
  font-size: 1rem;
  font-weight: 600;
}

.number-list .result-meta,
.results .result-meta {
  display: none;
}

.result-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1rem 1.25rem;
  font-size: 1.25rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-decoration: none;
  color: var(--fg);
  box-shadow: 0 2px 6px var(--shadow);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}

.result-item:hover,
.result-item:focus {
  border-color: var(--primary);
  background: #FFF8E7;
  outline: none;
}

.result-item:active {
  transform: scale(0.99);
}

.result-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.result-number {
  flex: 0 0 auto;
  min-width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 800;
  font-size: 1.4rem;
  border-radius: 12px;
}

.result-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-title {
  display: block;
  font-weight: 700;
  margin-bottom: 0.25rem;
  font-size: 1.35rem;
}

.result-meta {
  display: block;
  font-size: 0.95rem;
  color: #6B4C35;
}

/* Search overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.search-overlay.hidden {
  display: none;
}

.search-overlay-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem var(--space);
  background: #5B351F;
  box-shadow: 0 2px 6px var(--shadow);
}

#search-input {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.25rem;
  font-size: 1.3rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--fg);
}

.search-overlay-header .nav-btn {
  min-width: 52px;
  min-height: 52px;
  padding: 0.5rem;
}

#close-search {
  background: #B3261E;
  border-color: #FFFFFF;
  color: #FFFFFF;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

#close-search:hover,
#close-search:focus-visible {
  background: #8F1D17;
}

#search-input:focus {
  outline: 3px solid var(--accent);
  border-color: var(--primary-fg);
}

.search-hint {
  max-width: 780px;
  margin: 0.5rem auto 0;
  padding: 0 var(--space);
  font-size: 0.95rem;
  color: #6B4C35;
  text-align: center;
}

.search-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--space);
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
}

/* Song view */
#song-view {
  display: none;
  flex-direction: column;
  height: calc(100vh - 100px);
  height: calc(100dvh - 100px);
  min-height: 0;
  touch-action: pan-y;
}

#song-view.active {
  display: flex;
}

.song-content {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: 0 2px 8px var(--shadow);
  min-height: 0;
}

.song-header-line {
  flex: 0 0 auto;
  margin-bottom: 0.75rem;
}

.song-lyrics {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  padding-bottom: 4.5rem;
  line-height: 1.85;
  transition: font-size 0.15s ease;
  touch-action: pan-y;
}

.song-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  margin-bottom: 0.75rem;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  flex: 0 0 auto;
}

.song-title-line {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.song-number-inline {
  flex: 0 0 auto;
  color: var(--fg);
  font-weight: 700;
  font-size: 1.5rem;
  white-space: nowrap;
}

.song-title-inline {
  margin: 0;
  min-width: 0;
  font-size: 1.5rem;
  color: var(--fg);
  line-height: 1.3;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.has-chord .song-header-line {
  padding-right: 4.5rem;
}

.start-chord {
  position: absolute;
  top: 0.85rem;
  right: 1.25rem;
  z-index: 4;
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
}

.people-btn {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--secondary);
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.05s ease;
}

.people-btn:hover,
.people-btn:focus {
  background: var(--primary);
  color: var(--primary-fg);
  outline: none;
}

.people-btn:active {
  transform: scale(0.95);
}

.people-icon {
  width: 26px;
  height: 26px;
}

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space);
}

.info-modal.hidden {
  display: none;
}

.info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(62, 39, 35, 0.55);
  cursor: pointer;
}

.info-content {
  position: relative;
  background: var(--bg);
  color: var(--fg);
  border: 3px solid var(--primary);
  border-radius: 18px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(62, 39, 35, 0.35);
  padding: 1.5rem;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.info-header h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.5rem;
}

.info-close {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 2.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.25rem;
}

.info-close:hover,
.info-close:focus {
  color: var(--accent);
  outline: none;
}

.info-content p {
  white-space: pre-wrap;
  font-size: 1.2rem;
  line-height: 1.8;
  margin: 1rem 0 0;
}

.song-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.65rem 1rem;
  margin: 0;
  font-size: 1.15rem;
}

.song-details dt {
  color: var(--primary);
  font-weight: 700;
}

.song-details dd {
  margin: 0;
}

.home-screen-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.home-screen-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 35, 31, 0.62);
}

.home-screen-content {
  position: relative;
  width: min(100%, 560px);
  padding: 1.5rem;
  border: 3px solid var(--primary);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 38px rgba(40, 35, 31, 0.35);
}

.home-screen-content h2 {
  margin: 0 0 1rem;
  color: var(--primary);
  font-size: 1.5rem;
}

.home-screen-content ol {
  margin: 0;
  padding-left: 1.5rem;
}

.home-screen-content li,
.home-screen-content p {
  margin-bottom: 0.85rem;
  font-size: 1.1rem;
  line-height: 1.55;
}

.home-screen-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.song-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  position: sticky;
  top: 72px;
  z-index: 10;
  box-shadow: 0 2px 8px var(--shadow);
}

.font-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 220px;
}

.font-control label {
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
  color: var(--primary);
}

#font-slider {
  flex: 1;
  min-width: 120px;
  height: 24px;
}

#font-value {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  min-width: 2ch;
  color: var(--primary);
}

.section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed var(--border);
}

.section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-label {
  margin: 0 0 0.75rem 0;
  font-size: 1.1em;
  font-weight: 700;
  color: var(--primary);
  text-transform: capitalize;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  min-height: 52px;
  transition: transform 0.05s ease, background 0.15s ease;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
  background: #8B4E1E;
  outline: none;
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-fg);
  border-color: var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background: #EBD491;
  outline: none;
}

.status {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 1.2rem;
  color: #6B4C35;
}

.hidden {
  display: none !important;
}

.qr-section {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
}

.qr-section img {
  max-width: 240px;
  width: 100%;
  height: auto;
  border: 2px solid var(--border);
  border-radius: 12px;
}

@media (max-width: 480px) {
  .app-logo {
    padding: 0 0.2rem;
    font-size: 1.05rem;
  }

  .app-logo span {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .song-header-line {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .song-title-line {
    gap: 0.5rem;
  }

  .song-number-inline,
  .song-title-inline {
    font-size: 1.25rem;
  }

  .people-btn {
    width: 46px;
    height: 46px;
  }
}

@media (max-width: 360px) {
  :root {
    --font-base: 16px;
  }

  .app-header {
    padding: 0.5rem;
  }

  .app-logo {
    font-size: 1rem;
  }

  .nav-btn {
    min-width: 48px;
    min-height: 48px;
    padding: 0.5rem;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
  }

  .search-overlay-header {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .search-overlay-header #search-input {
    font-size: 1.05rem;
    padding: 0.75rem 1rem;
  }

  .search-overlay-header .nav-btn {
    min-width: 50px;
    min-height: 50px;
  }
}

/* Admin styles */

/* ---- Tablet / iPad adjustments for songbook ---- */

@media (min-width: 768px) {
  :root {
    --font-base: 18px;
  }

  .app-header {
    padding: 0.75rem 1.5rem;
  }

  .app-logo {
    font-size: 1.3rem;
  }

  .nav-btn {
    min-width: 52px;
    min-height: 52px;
  }

  .nav-icon {
    width: 26px;
    height: 26px;
  }

  .song-number-inline,
  .song-title-inline {
    font-size: 1.4rem;
  }

  .song-lyrics {
    font-size: 1.15rem;
    line-height: 1.9;
  }

  .btn {
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    min-height: 56px;
  }

  .search-overlay-header #search-input {
    font-size: 1.15rem;
    padding: 1rem 1.25rem;
  }

  .admin-main {
    max-width: 1000px;
    padding: 2.5rem 3rem 5rem;
  }

  .admin-section {
    padding: 3rem;
  }

  .admin-section h2 {
    font-size: 1.8rem;
  }

  .admin-tabs a,
  .admin-tabs button {
    font-size: 1.15rem;
    padding: 0.85rem 1.5rem;
  }

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

  .admin-section input[type="text"],
  .admin-section input[type="number"],
  .admin-section input[type="password"],
  .admin-section input[type="search"],
  .admin-section select,
  .admin-section textarea {
    font-size: 1.1rem;
    padding: 0.85rem 1rem;
  }
}

@media (min-width: 1024px) {
  :root {
    --font-base: 19px;
  }

  .module-main {
    max-width: 900px;
  }

  .admin-main {
    max-width: 1100px;
  }

  .song-lyrics {
    font-size: 1.25rem;
    line-height: 2;
  }
}

.admin-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 2rem 5rem;
}

.login-container {
  max-width: 480px;
  margin: 3rem auto 0;
  padding: 0 1rem;
}

.login-container .admin-main {
  max-width: 100%;
  padding: 0;
}

.login-container .admin-section {
  padding: 2rem;
}

.login-container .admin-header {
  background: none;
  box-shadow: none;
  padding: 0 0 1.5rem;
  margin-bottom: 1.5rem;
}

.login-container .admin-title h1,
.login-container .admin-header h1 {
  color: var(--primary);
}

.admin-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--primary);
}

.admin-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.admin-title h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
}

.admin-title p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--fg-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-form .admin-buttons {
  justify-content: flex-end;
}

.admin-header h1 {
  margin: 0;
  color: #fff;
  font-size: 1.6rem;
}

.back-link {
  padding: 0.7rem 1rem;
  font-size: 1rem;
  text-decoration: none;
}

.admin-header-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-header-actions .btn {
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: transparent;
  color: #fff;
}

.admin-header-actions .btn:hover,
.admin-header-actions .btn:focus {
  background: #fff;
  color: var(--primary);
}

.admin-header-actions .btn-danger {
  background: #B3261E;
  border-color: #B3261E;
  color: #fff;
}

.admin-header-actions .btn-danger:hover,
.admin-header-actions .btn-danger:focus {
  background: #8F1D17;
  border-color: #8F1D17;
  color: #fff;
}

.admin-header-actions .logout-btn {
  padding: 0.45rem 0.75rem;
  font-size: 1.3rem;
  min-width: 44px;
  min-height: 44px;
  line-height: 1;
}

.admin-tabs {
  position: sticky;
  top: 72px;
  z-index: 15;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tabs a,
.admin-tabs button {
  flex: 0 0 auto;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.admin-tabs a:hover,
.admin-tabs a:focus-visible,
.admin-tabs button:hover,
.admin-tabs button:focus-visible {
  border-color: var(--primary);
  outline: none;
}

.admin-tabs .active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}

.admin-section {
  scroll-margin-top: 150px;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.admin-section h2 {
  margin: 0 0 1rem;
  color: var(--primary);
  font-size: 1.55rem;
}

.admin-section label {
  display: block;
  margin-bottom: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

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

.checkbox-group,
.filter-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-start;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #FFFEFB;
}

.checkbox-group-label,
.filter-checkbox-label {
  width: 100%;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--fg);
}

.checkbox-group .checkbox-label,
.filter-checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 400;
  cursor: pointer;
  font-size: 1rem;
  white-space: nowrap;
}

.checkbox-group input[type="checkbox"],
.filter-checkbox-group input[type="checkbox"] {
  width: 1.3rem;
  height: 1.3rem;
  cursor: pointer;
}

.filter-checkbox-group {
  gap: 0.4rem 0.75rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
}

.filter-checkbox-group label {
  font-size: 0.95rem;
}

.multi-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.multi-select-label {
  font-weight: 700;
  color: var(--primary);
}

.multi-select-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #FFFEFB;
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
}

.multi-select-toggle::after {
  content: '▾';
  margin-left: 0.5rem;
  font-size: 0.9rem;
}

.multi-select.open .multi-select-toggle::after {
  content: '▴';
}

.multi-select-options {
  display: none;
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  right: 0;
  z-index: 100;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #FFFEFB;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 220px;
  overflow-y: auto;
}

.multi-select.open .multi-select-options {
  display: flex;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
  transition: background 0.15s;
}

.multi-select-option:hover {
  background: #f5f0eb;
}

.multi-select-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.multi-select-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border: 2px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: #fff;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.multi-select-option input[type="checkbox"]:checked + .multi-select-check {
  background: var(--primary);
  border-color: var(--primary);
}

.multi-select-option input[type="checkbox"]:checked + .multi-select-check::after {
  content: '✓';
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.settings-group {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  background: #FFFEFB;
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.settings-heading h3 {
  margin: 0;
  font-size: 1.25rem;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-row input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 1rem;
}

.settings-remove {
  padding: 0.4rem 0.7rem;
  font-size: 1.1rem;
  line-height: 1;
}

.admin-section input[type="text"],
.admin-section input[type="number"],
.admin-section input[type="password"],
.admin-section input[type="search"],
.admin-section select,
.admin-section textarea {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #FFFEFB;
  color: var(--fg);
  font: inherit;
  font-size: 1.05rem;
}

.admin-section input:focus,
.admin-section input[type="password"]:focus,
.admin-section select:focus,
.admin-section textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(217, 165, 32, 0.35);
}

.setlist-search-row-inputs {
  display: flex;
  gap: 0.5rem;
}

.setlist-search-row-inputs input {
  flex: 1;
  margin-top: 0;
}

.setlist-search-row-inputs .btn {
  white-space: nowrap;
}

.setlist-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 1rem 0;
  align-items: flex-start;
}

.setlist-filters select {
  flex: 0 0 180px;
  min-width: 180px;
  min-height: 52px;
  margin-top: 0;
}

.filter-checkbox-group {
  flex: 1 1 100%;
  min-width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  align-items: center;
}

.filter-checkbox-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  background: #F8F5EE;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

.filter-checkbox-group input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
}

.filter-checkbox-label {
  width: 100%;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.lyrics-input {
  min-height: 360px;
  resize: vertical;
  line-height: 1.6;
}

.bulk-input {
  margin-top: 1rem;
  min-height: 430px;
}

.admin-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.admin-buttons .btn {
  min-width: 160px;
}

.admin-status:not(:empty) {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  font-weight: 700;
}

.admin-status.success {
  background: #E6F4EA;
  color: #176B2C;
  border: 1px solid #8AC89A;
}

.admin-status.error {
  background: #FBE9E7;
  color: #A11F19;
  border: 1px solid #E2A09B;
}

.help-text {
  color: #5B5048;
  margin-top: -0.25rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.bulk-help {
  margin: 1rem 0;
}

.bulk-help summary {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}

.help-example {
  background: #F8F5EE;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  color: var(--fg);
  overflow-x: auto;
  white-space: pre-wrap;
}

.file-picker {
  display: inline-block;
  padding: 0.8rem 1rem;
  border: 2px dashed var(--primary);
  border-radius: 10px;
  background: #F8F5EE;
  cursor: pointer;
}

.file-picker input {
  display: block;
  margin-top: 0.6rem;
  color: var(--fg);
}

.file-editor {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #F8F5EE;
}

.file-editor h3 {
  margin: 0 0 1rem;
  color: var(--primary);
}

.file-lyrics-input {
  min-height: 240px;
  resize: vertical;
}

.preview-area {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--border);
  justify-content: center;
}

.preview-size-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex: 0 0 100%;
  flex-wrap: wrap;
}

.preview-size-controls .btn {
  min-height: 48px;
  min-width: 64px;
  padding: 0.5rem 1.2rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.preview-size-value {
  font-weight: 600;
  font-size: 1.1rem;
  min-width: 170px;
  text-align: center;
}

.app-preview-card {
  min-width: 0;
  width: 390px;
  max-width: 100%;
  height: 780px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0;
  border: 4px solid #333;
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 4px 20px var(--shadow);
  position: relative;
}

.app-preview-card::before {
  content: '';
  display: block;
  width: 120px;
  height: 22px;
  background: #333;
  border-radius: 0 0 14px 14px;
  margin: 0 auto;
}

.app-preview-heading {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 1.25rem;
  padding: 0.75rem 1rem 0;
}

.app-preview-meta {
  margin: 0.5rem 1rem 0.75rem;
  color: #5B5048;
  font-size: 0.95rem;
}

.app-preview-lyrics {
  line-height: 1.85;
  padding: 0 1rem 2rem;
  overflow-y: auto;
}

.app-preview-lyrics .section {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

.qr-admin-section code {
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: #EEE8DD;
}

.qr-admin-section h3 {
  margin: 0 0 0.5rem;
  color: var(--primary);
  font-size: 1.35rem;
}

.settings-divider {
  border: 0;
  border-top: 2px solid var(--border);
  margin: 2rem 0 1.5rem;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0 1rem;
}

.font-size-control input[type="range"] {
  flex: 1;
  max-width: 300px;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 4px;
  outline: none;
}

.font-size-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.font-size-control input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.font-size-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  min-width: 60px;
}

.disabled-link {
  cursor: not-allowed;
  opacity: 0.45;
}

.musician-form {
  display: flex;
  align-items: end;
  gap: 1.5rem;
  flex-wrap: wrap;
  max-width: 100%;
  margin-bottom: 1rem;
}

.musician-form label {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.musician-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.musician-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #F8F5EE;
  flex-wrap: wrap;
}

.musician-info {
  flex: 1 1 240px;
  min-width: 0;
}

.musician-info strong {
  font-size: 1.15rem;
  display: block;
}

.musician-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.musician-actions .btn {
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  min-width: auto;
  min-height: 44px;
  white-space: nowrap;
}

.admin-song-list {
  display: grid;
  gap: 0.5rem;
  max-height: 620px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.admin-song-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #F8F5EE;
}

.admin-song-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-song-number {
  text-align: right;
  font-weight: 700;
}

.admin-song-actions .btn {
  min-height: 42px;
  padding: 0.45rem 0.9rem;
  font-size: 1rem;
  white-space: nowrap;
}

.edit-song-form {
  scroll-margin-top: 150px;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 3px solid var(--primary);
}

.suggest-duration-btn {
  margin-top: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.9rem;
  min-height: 40px;
}

.edit-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.edit-form-heading h3 {
  margin: 0;
  color: var(--primary);
  font-size: 1.35rem;
}

.btn-danger {
  background: #B3261E;
  border-color: #B3261E;
  color: #fff;
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: #8F1D17;
  border-color: #8F1D17;
}

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

.admin-setlist-list {
  display: grid;
  gap: 0.65rem;
}

.admin-setlist-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #F8F5EE;
}

.admin-setlist-row .setlist-row-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.6rem 1.2rem;
  flex-wrap: wrap;
}

.setlist-row-toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

.setlist-row-toggle input {
  width: 1.3rem;
  height: 1.3rem;
}

.admin-setlist-row .setlist-row-text,
.setlist-search-row div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.admin-setlist-row small,
.setlist-search-row small {
  color: #5B5048;
}

.setlist-form {
  scroll-margin-top: 150px;
  margin-top: 2rem;
  padding: 1.5rem;
  border: 2px solid var(--primary);
  border-radius: 14px;
  background: #fff;
}

.wizard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.8rem 1.25rem;
  background: #F8F5EE;
  border: 2px solid var(--border);
  border-radius: 12px;
}

#wizard-step-counter {
  color: #5B5048;
  font-weight: 600;
  font-size: 1rem;
}

#wizard-step-title {
  color: var(--primary);
  font-size: 1.3rem;
}

.wizard-step {
  display: block;
  animation: fadeIn 0.2s ease-in;
}

.wizard-step.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
}

.wizard-nav .btn {
  min-width: 180px;
  min-height: 48px;
  font-size: 1.05rem;
}

.wizard-nav .hidden {
  display: none;
}

.setlist-visibility {
  margin: 1.25rem 0;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #F8F5EE;
}

.admin-section .switch-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  font-size: 1.05rem;
  cursor: pointer;
}

.switch-label input {
  width: 22px;
  height: 22px;
  margin: 0;
}

.setlist-users-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.setlist-users-section strong {
  color: var(--primary);
  font-size: 1.1rem;
}

.setlist-users {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.setlist-user-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.setlist-user-check {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  color: var(--fg);
  cursor: pointer;
  font-weight: 700;
}

.setlist-user-role {
  width: auto;
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  margin: 0;
}

.setlist-user-role:disabled {
  opacity: 0.5;
  background: #F0EDE5;
}

.admin-section .setlist-users label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--fg);
  cursor: pointer;
}

.setlist-users input,
.metadata-toggles input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.setlist-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.setlist-builder section {
  min-width: 0;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #F8F5EE;
}

.setlist-builder h4 {
  margin: 0 0 0.75rem;
  color: var(--primary);
  font-size: 1.2rem;
}

.setlist-time-section {
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #F8F5EE;
}

.setlist-time-section strong {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.setlist-time-inputs {
  display: flex;
  align-items: end;
  gap: 1rem;
  flex-wrap: wrap;
}

.setlist-time-inputs label {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  margin-bottom: 0;
}

.setlist-time-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #F8F5EE;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.setlist-target-display {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.05rem;
}

.setlist-total-duration {
  margin: 0.75rem 0;
  font-weight: 700;
  color: var(--primary);
  font-size: 1.05rem;
}

.metadata-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.75rem;
  margin: 1rem 0;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}

.metadata-toggles legend {
  padding: 0 0.35rem;
  color: var(--primary);
  font-weight: 700;
}

.admin-section .metadata-toggles label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  color: var(--fg);
  font-weight: 500;
}

.setlist-search-results,
.setlist-selected-songs {
  display: grid;
  gap: 0.45rem;
  max-height: 520px;
  overflow-y: auto;
}

.setlist-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.setlist-search-row .btn {
  min-height: 40px;
  padding: 0.4rem 0.55rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.setlist-selected-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.setlist-position {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

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

.small-action {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #F2E2B8;
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.small-action:disabled {
  cursor: default;
  opacity: 0.35;
}

.small-action.remove {
  background: #FBE9E7;
  color: #A11F19;
}

@media (max-width: 900px) {
  .setlist-builder {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .metadata-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- Tónleikara modul ---- */

.module-body {
  background: var(--bg);
}

.module-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  background: #fff;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 1px 4px var(--shadow);
  min-height: 2.75rem;
}

.module-header h1 {
  font-size: 1.1rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  min-width: 0;
}

.module-header-side {
  font-style: italic;
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.module-prev {
  text-align: right;
}

.module-next {
  text-align: left;
}

@media (max-width: 480px) {
  .module-header {
    grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) auto;
    gap: 0.25rem;
    padding: 0.3rem 0.4rem;
  }
  .module-header h1 {
    font-size: 0.95rem;
  }
  .module-header-side {
    font-size: 0.65rem;
  }
  .back-arrow {
    font-size: 1.2rem;
  }
}

@media (min-width: 768px) {
  .module-header {
    gap: 0.75rem;
    padding: 0.35rem 1rem;
  }
  .module-header h1 {
    font-size: 1.2rem;
  }
  .module-header-side {
    font-size: 0.85rem;
  }
}

.back-arrow {
  font-size: 1.4rem;
  color: var(--primary);
}

.resync-btn {
  color: #22C55E;
  font-size: 1.5rem;
}

.role-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.role-master {
  color: #FFA500;
}

.role-musician {
  color: #0066FF;
}

.icon-btn {
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.metronome-btn {
  color: var(--primary);
  font-size: 1.4rem;
}

.metronome-btn.on {
  color: #fff;
  background: #FF0000;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255, 0, 0, 0.6);
}

.metronome-btn:disabled,
.metronome-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.icon-btn:active {
  transform: scale(0.9);
}

.module-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 4.5rem 1rem 5.5rem;
}

.module-view {
  display: block;
}

.module-message {
  font-size: 1.4rem;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fg-muted);
}

.module-home-list,
.module-song-list {
  display: grid;
  gap: 0.75rem;
}

.module-home-row {
  text-align: left;
  padding: 1rem;
  font-size: 1.1rem;
  touch-action: manipulation;
}

.module-song-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  touch-action: manipulation;
}

.module-song-row.active {
  border-color: var(--primary);
  background: rgba(217, 165, 32, 0.12);
}

.module-song-number {
  color: var(--fg-muted);
  min-width: 2.5rem;
}

.song-info {
  text-align: center;
  padding: 0.5rem 0 1rem;
}

.song-info h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--fg);
}

#view-song {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  padding-top: 3.5rem;
  padding-bottom: 0;
  background: #fff;
}

#view-song #module-song-view {
  flex: 1 1 auto;
  max-height: none;
  margin: 0;
  padding: 2rem 1rem 0.5rem;
  height: 100%;
}

.song-view {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0;
  max-height: calc(100vh - 280px);
  margin-bottom: 0.5rem;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.floating-panels {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  gap: 0.5rem;
}

.floating-panel {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 14px;
  padding: 0.4rem 0.75rem;
  box-shadow: 0 2px 8px var(--shadow);
}

.floating-label {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.panel-btn {
  min-width: 44px;
  min-height: 40px;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: #fff;
  color: var(--primary);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.panel-value {
  min-width: 2.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.song-settings {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border: 2px solid var(--primary);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px var(--shadow);
}

.bpm-flash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  padding: 1.5rem 2.5rem;
  background: #fff;
  border: 3px solid var(--primary);
  border-radius: 20px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: 0 4px 20px var(--shadow);
}

.module-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.25rem;
  padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 2px solid var(--border);
  box-shadow: 0 -2px 8px var(--shadow);
}

.bottom-btn {
  flex: 1 1 auto;
  min-height: 56px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: #fff;
  color: var(--primary);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  touch-action: manipulation;
}

.bottom-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bottom-icon {
  width: 56px;
  height: 56px;
  border: 2px solid var(--primary);
  border-radius: 14px;
  background: #fff;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.bottom-icon.on {
  background: #FF0000;
  color: #fff;
  box-shadow: 0 0 16px rgba(255, 0, 0, 0.7);
}

.bottom-icon:disabled,
.bottom-icon.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: #f0f0f0;
  color: #aaa;
}

.bottom-icon:active {
  transform: scale(0.95);
}

.chord-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  cursor: pointer;
}

body.module-body .module-main {
  padding-bottom: 1rem;
}

#module-song-view {
  max-height: calc(100vh - 180px);
}

.fullscreen-btn {
  font-size: 1.4rem;
}

.fullscreen-lyrics {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.fullscreen-lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  background: #fff;
  z-index: 1;
}

.fullscreen-lyrics-header h2 {
  margin: 0;
  font-size: 1.3rem;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.fullscreen-lyrics-view {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.side-settings {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(85%, 320px);
  z-index: 150;
  background: #fff;
  border-left: 2px solid var(--border);
  box-shadow: -4px 0 20px var(--shadow);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.side-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.side-settings-header h3 {
  margin: 0;
  color: var(--primary);
}

.side-settings-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  flex: 1;
}

.side-master-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.side-control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
}

.side-control-row span {
  font-weight: 700;
  color: var(--primary);
}

.side-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.side-nav .btn {
  flex: 1;
}

#side-metronome,
#side-resync {
  display: block;
  width: 100%;
}

.side-role {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* ---- Chord sheet ---- */

.chord-sheet {
  font-family: inherit;
  font-size: 1em;
  line-height: 1.5;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  overflow-x: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chord-section-label {
  font-weight: 700;
  margin: 0.75rem 0 0.25rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.9rem;
  font-family: inherit;
}

.chord-row {
  white-space: pre;
  color: var(--primary);
  font-weight: 700;
  min-height: 1.4em;
}

.lyric-row {
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 0.3rem;
}

/* ---- Admin tonleikari setup ---- */

.tonleikari-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.ton-song-list {
  display: grid;
  gap: 0.4rem;
  max-height: 70vh;
  overflow-y: auto;
}

.ton-song-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.95rem;
}

.ton-song-row:hover {
  border-color: var(--primary);
}

.ton-song-number {
  color: var(--fg-muted);
  min-width: 2rem;
}

.ton-song-badge {
  margin-left: auto;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(217, 165, 32, 0.2);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.ton-edit-form {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}

.ton-lyrics {
  min-height: 420px;
  font-family: 'Courier New', Consolas, monospace;
}

.chord-toolbar {
  margin: 0.75rem 0;
}

.chord-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.chord-btn {
  min-width: 48px;
  padding: 0.4rem 0.6rem;
  font-size: 0.95rem;
}

.setlist-row-module {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.setlist-row-module .btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  min-width: auto;
}

.setlist-module {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #F8F5EE;
}

@media (max-width: 900px) {
  .tonleikari-layout {
    grid-template-columns: 1fr;
  }
}

/* ---- Tablet / iPad adjustments ---- */

@media (min-width: 768px) {
  .module-main {
    max-width: 800px;
    padding: 2rem 2.5rem 5rem;
  }

  .module-header {
    padding: 1rem 2rem;
  }

  .module-header h1 {
    font-size: 1.5rem;
  }

  .module-song-row {
    font-size: 1.2rem;
    padding: 1rem 1.5rem;
  }

  .song-header h2 {
    font-size: 1.5rem;
  }

  .song-nav .btn {
    font-size: 1.25rem;
    padding: 1rem;
  }

  .chord-sheet {
    font-size: 1em;
    line-height: 1.5;
    padding: 0;
  }

  .module-message {
    font-size: 1.6rem;
    padding: 4rem 2rem;
  }

  .module-home-row {
    font-size: 1.25rem;
    padding: 1.25rem 1.5rem;
  }

  .icon-btn {
    font-size: 2rem;
    min-width: 52px;
    min-height: 52px;
  }

  .role-icon {
    font-size: 1.8rem;
  }

  .transpose-controls .btn {
    min-width: 52px;
    min-height: 52px;
    font-size: 1.5rem;
  }

  .transpose-controls span {
    font-size: 1.3rem;
  }
}

@media (min-width: 1024px) {
  .module-main {
    max-width: 900px;
    padding: 2.5rem 3rem 5rem;
  }

  .chord-sheet {
    font-size: 1em;
    line-height: 1.6;
    padding: 0;
  }

  .module-song-row {
    font-size: 1.3rem;
  }

  .song-header h2 {
    font-size: 1.7rem;
  }
}

/* Owner dashboard (eigari) list rows */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.75rem 0;
}
.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.admin-list-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.admin-list-main strong {
  font-size: 1.05rem;
  color: var(--fg);
}
.admin-list-sub {
  font-size: 0.85rem;
  color: #6b655d;
  word-break: break-all;
}
.admin-list-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
