* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Mulish", sans-serif;
  background: #000;
  color: #ccc;
  height: 100dvh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  padding: 0 12px max(12px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

/* ===== Header Line 1 ===== */

#header-line1 {
  display: flex;
  align-items: center;
  padding: 10px 0 0;
  gap: 4px;
}

#app-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 20px;
  color: #929690;
  letter-spacing: 1px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#app-title a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

#btn-grid-restart {
  margin-left: 16px;
}

#btn-lyrics, #btn-piano-toggle {
  padding: 0 2px;
  height: 44px;
  border: none;
  background: none;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: manipulation;
  flex-shrink: 0;
}

#btn-grid-restart,
#btn-grid-loop,
#btn-burger {
  padding: 0 6px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: manipulation;
  flex-shrink: 0;
}

#btn-grid-play {
  padding: 0 6px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  touch-action: manipulation;
  flex-shrink: 0;
}

#btn-grid-restart .material-symbols-outlined,
#btn-grid-play .material-symbols-outlined {
  font-variation-settings: 'FILL' 1;
}

#btn-grid-play.active {
  color: #A0A69E;
  border-color: #A0A69E;
}

#btn-grid-loop.active {
  color: #A0A69E;
  border-color: #A0A69E;
}

/* ===== Header Line 2 ===== */

#header-line2 {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 0 0;
}

#title-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

#key-display {
  background: none;
  border: none;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 0 4px;
  height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
  flex-shrink: 0;
}

#song-title {
  flex: 0 1 auto;
  background: none;
  border: none;
  outline: none;
  font-family: "Mulish", sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #fff;
  min-width: 40px;
  height: 44px;
  padding: 0 4px;
}

#song-title::placeholder {
  color: #ccc;
}

#song-title-mirror {
  position: fixed;
  top: -9999px;
  left: -9999px;
  visibility: hidden;
  pointer-events: none;
  white-space: pre;
  font-family: "Mulish", sans-serif;
  font-size: 15px;
  font-weight: 400;
  padding: 0 4px;
}

/* ===== Dirty Indicator ===== */

#dirty-indicator {
  display: none;
  flex-shrink: 0;
  align-items: center;
  background: none;
  border: none;
  color: #ccc;
  font-size: 26px;
  line-height: 1;
  padding: 0 2px 0 2px;
  height: 44px;
  cursor: pointer;
  touch-action: manipulation;
}

#dirty-indicator.visible {
  display: flex;
}

#dirty-menu {
  display: none;
  position: fixed;
  background: #2a2a2a;
  border-radius: 6px;
  padding: 10px 14px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  white-space: nowrap;
}

#dirty-menu.visible {
  display: block;
}

/* ===== Key Picker Overlay ===== */

#key-picker-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
}

#key-picker-overlay.visible {
  display: block;
}

#key-picker-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

#key-picker {
  position: absolute;
  top: 92px;
  left: 10px;
  right: 10px;
  background: #222;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 16px;
  z-index: 101;
}

#key-picker-line1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

#key-root-scroll {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

#key-picker-line2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

#bpm-display {
  width: 52px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  height: 44px;
  padding: 0 4px;
  font-family: "Mulish", sans-serif;
  -moz-appearance: textfield;
  appearance: textfield;
  outline: none;
}

#bpm-display::-webkit-inner-spin-button,
#bpm-display::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

#bpm-display:focus {
  border-color: #A0A69E;
}

#bpm-label {
  color: #ccc;
  font-size: 14px;
  font-weight: 600;
}

#instrument-toggle {
  margin-top: 12px;
}

#arp-toggle {
  margin-top: 4px;
}

/* ===== Grid ===== */

#grid-container {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 max(16px, env(safe-area-inset-bottom));
}

#grid-container::-webkit-scrollbar {
  display: none;
}

.section-block {
  margin-bottom: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.section-header > .section-btn:not(.section-repeat-btn) {
  margin-left: auto;
}

.section-name-select {
  height: 34px;
  padding: 0 8px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #111;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  flex-shrink: 0;
}

.section-name-select:focus,
.section-name-select:focus-visible {
  outline: none;
  border-color: #3b82f6;
  box-shadow: inset 0 0 0 1px #3b82f6;
}

.section-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 0;
  background: none;
  color: #999;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  flex-shrink: 0;
}

.section-btn .material-symbols-outlined {
  font-size: 24px;
}

.grid-line {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}

.grid-cells {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  flex: 1;
}

.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #555;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #222;
  padding: 0 2px;
  height: 44px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.grid-cell.filled {
  color: #ccc;
}

.grid-cell.empty {
  color: #666;
}

.grid-cell.selected {
  border-color: #A0A69E;
  box-shadow: 0 0 10px rgba(126, 184, 218, 0.25);
  color: #fff;
}

.grid-cell.playing {
  border-color: #A0A69E;
  box-shadow: 0 0 8px rgba(126, 184, 218, 0.15);
}

.grid-cell.disabled {
  pointer-events: none;
  opacity: 0.7;
}

.grid-cell.disabled.playing {
  opacity: 1;
}

.cell-more {
  position: absolute;
  right: 0;
  top: -1px;
  bottom: -1px;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
  background: inherit;
  border-radius: 6px;
}

.grid-cell.dragging-cell {
  opacity: 0.85;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

#app.playing .section-header {
  opacity: 0.5;
  pointer-events: none;
}

#app.playing .line-btns {
  pointer-events: none;
}

#app.playing #edit-menu {
  pointer-events: none;
  opacity: 0.5;
}

#app.playing #edit-menu .action-btn:disabled {
  opacity: 1;
}

.line-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.line-btn {
  width: 34px;
  height: 44px;
  border: none;
  border-radius: 0;
  background: none;
  color: #999;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.line-btn .material-symbols-outlined {
  font-size: 24px;
}

.line-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ===== Cell Context Menu ===== */

#cell-context-menu {
  display: none;
  position: fixed;
  background: #2a2a2a;
  border: none;
  border-radius: 6px;
  padding: 2px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  flex-direction: row;
  gap: 6px;
  align-items: center;
}

#cell-context-menu.visible {
  display: flex;
}

#chord-display {
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #ccc;
  padding: 0 6px;
  height: 44px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ctx-menu-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: #ccc;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
  touch-action: manipulation;
}

.ctx-menu-item:active {
  background: #333;
}

.ctx-menu-item .material-symbols-outlined {
  font-size: 32px;
}

.ctx-menu-item svg {
  width: 30px;
  height: 24px;
}

/* ===== Grid Popover ===== */

#grid-popover {
  display: none;
  position: fixed;
  background: #2a2a2a;
  border: none;
  border-radius: 6px;
  padding: 2px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  flex-direction: row;
  gap: 2px;
}

#grid-popover.visible {
  display: flex;
}

.popover-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #ccc;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 4px;
}

.popover-item:active {
  background: #333;
}

.popover-item .material-symbols-outlined {
  font-size: 32px;
}

.popover-item svg {
  width: 30px;
  height: 24px;
}

.popover-item.active {
  color: #A0A69E;
}

.repeat-input {
  width: 44px;
  background: none;
  border: none;
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  height: 44px;
  padding: 0;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}

.repeat-input::-webkit-inner-spin-button,
.repeat-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.section-repeat-btn {
  font-family: "Mulish", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.section-repeat-btn.on {
  color: #A0A69E;
}

/* ===== Drag reorder ===== */

.dragging {
  opacity: 0.2;
}

.drag-ghost {
  border-radius: 8px;
  background: #2a2a2a;
}

/* ===== Edit Menu ===== */

#edit-menu {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#menu-top {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

#btn-place {
  background: #666;
}

#btn-place .material-symbols-outlined {
  font-size: 30px;
  color: #fff;
}

#mode-select {
  flex-shrink: 0;
  height: 44px;
  padding: 0 6px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#note-display {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  min-width: 28px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}

#btn-note-up,
#btn-note-down {
  padding: 0;
  width: 44px;
  flex-shrink: 0;
}

#mode-g-content {
  display: contents;
}

#scale-chords-list {
  display: contents;
}

#mode-a-content,
#mode-s-content {
  display: contents;
}

#suggestions-list {
  display: contents;
}

.scale-chord-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 8px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  min-width: 42px;
}

.scale-chord-chip.selected {
  border-color: #A0A69E;
  background: #2a2a2a;
  color: #fff;
}


#intention-select {
  flex-shrink: 0;
  height: 44px;
  padding: 0 6px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.suggestion-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 8px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  min-width: 42px;
}

.suggestion-chip.selected {
  border-color: #A0A69E;
  background: #2a2a2a;
  color: #fff;
}

/* ===== Toggle Groups ===== */

.toggle-group {
  display: flex;
  gap: 0;
}

.toggle-btn {
  flex: 0 0 auto;
  padding: 0 8px;
  height: 44px;
  position: relative;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  text-align: center;
  min-width: 32px;
  line-height: 1.2;
  touch-action: manipulation;
}

.toggle-btn.active {
  background: #2a2a2a;
  color: #fff;
  border-color: #A0A69E;
}

.toggle-group .toggle-btn {
  border-radius: 0;
  border-left: none;
}

.toggle-group .toggle-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-left: 1px solid #555;
}

.toggle-group .toggle-btn:last-child {
  border-radius: 0 6px 6px 0;
}

.toggle-group .toggle-btn.active {
  border-color: #555;
  background: #3a3a3a;
  color: #fff;
}

/* ===== Toasts (save + audio loading) ===== */
#save-toast,
#audio-loading-toast {
  position: absolute;
  top: 12px;
  left: 12px;
  transform: translateY(-8px);
  background: #3a3a3a;
  border: none;
  border-radius: 6px;
  color: #A0A69E;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
  z-index: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
}
#save-toast.visible,
#audio-loading-toast.visible {
  opacity: 1;
  transform: translateY(0);
}
.loading-dots {
  display: inline-block;
  width: 1.5ch;
  text-align: left;
}

.toggle-group .action-btn {
  border-radius: 0;
  border-left: none;
}

.toggle-group .action-btn:first-child {
  border-radius: 6px 0 0 6px;
  border-left: 1px solid #555;
}

.toggle-group .action-btn:last-child {
  border-radius: 0 6px 6px 0;
}

.toggle-group #note-display {
  border: 1px solid #555;
  border-left: none;
  border-radius: 0;
  background: #2a2a2a;
  padding: 0 8px;
}

.toggle-group #bpm-display {
  border-radius: 0;
  border-left: none;
}



/* ===== Action Buttons ===== */

.action-btn {
  padding: 0 10px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  touch-action: manipulation;
}

.action-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.action-btn:not(:disabled):active {
  background: #2a2a2a;
  color: #fff;
  border-color: #999;
}

/* ===== Burger Menu (full screen) ===== */

#burger-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  z-index: 300;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

#burger-menu.visible {
  display: flex;
}

#burger-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 10px 10px 0;
  max-width: 500px;
  width: 100%;
}

.burger-menu-list {
  display: flex;
  flex-direction: column;
  list-style: none;
  padding: 10px 0;
  gap: 14px;
  max-width: 500px;
  width: 100%;
}

.burger-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: #ccc;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: "Mulish", sans-serif;
}

.burger-menu-item:active {
  background: #1a1a1a;
}

.burger-menu-item:disabled {
  opacity: 0.3;
  cursor: default;
}

.burger-menu-item:disabled .material-symbols-outlined {
  color: #666;
}

.burger-menu-item .material-symbols-outlined {
  font-size: 22px;
  color: #666;
}

#examples-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  margin-top: 6px;
}

#examples-submenu .song-list-item {
  padding: 10px 20px 10px 54px;
  border-bottom: none;
  cursor: pointer;
  color: #ccc;
}

#examples-submenu .song-list-item:active {
  background: #2a2a2a;
}

#examples-submenu .song-list-title {
  font-size: 15px;
  font-weight: 600;
  font-family: "Mulish", sans-serif;
}

.burger-separator {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 20px;
}

.burger-copyright {
  max-width: 500px;
  width: 100%;
  padding: 16px 20px;
  color: #444;
  font-size: 12px;
}

/* ===== Auth Screen (full screen) ===== */

.screen-content {
  max-width: 500px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

#auth-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  z-index: 400;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  user-select: text;
  -webkit-user-select: text;
}

#auth-screen.visible {
  display: flex;
}

#auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#auth-title,
#open-modal-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 20px;
  color: #A0A69E;
  letter-spacing: 1px;
}

.auth-field {
  margin-bottom: 14px;
}

.auth-field label {
  display: block;
  color: #ccc;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-field input {
  width: 100%;
  height: 40px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  padding: 0 10px;
  outline: none;
}

.auth-field input:focus {
  border-color: #A0A69E;
}

#auth-info {
  color: #ccc;
  font-size: 15px;
  line-height: 1.6;
  padding: 10px 0;
}

#auth-info a {
  color: #ccc;
  text-decoration: underline;
}

.auth-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  color: #ccc;
  font-size: 15px;
}

#auth-mailing-field {
  margin-top: 4px;
}

.auth-checkbox input[type="checkbox"] {
  accent-color: #aaa;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

#auth-submit-btn {
  width: 50%;
  height: 44px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 28px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#auth-submit-btn:active {
  background: #3a3a3a;
}

#auth-submit-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.auth-field-error {
  display: block;
  color: #e57373;
  font-size: 13px;
  margin-top: 4px;
}

.auth-field-error:empty {
  display: none;
}

#auth-error {
  color: #e57373;
  font-size: 15px;
  margin-top: 8px;
  min-height: 18px;
}

#auth-sent-msg {
  color: #ccc;
  font-size: 15px;
  margin-top: 12px;
  text-align: center;
}

/* ===== Lyrics View (full screen) ===== */

#lyrics-view {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  z-index: 300;
  flex-direction: column;
  padding: 10px;
}

#lyrics-view.visible {
  display: flex;
}

#lyrics-header {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 8px;
}

#btn-syllable-toggle {
  padding: 0 10px;
  height: 44px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

#btn-syllable-toggle.active {
  color: #A0A69E;
  border-color: #A0A69E;
}

#lyrics-textarea {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-family: "Mulish", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  padding: 12px;
  resize: none;
  outline: none;

}

/* ===== Guide Overlay / Site Overlay (full screen iframe) ===== */

#site-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #1a1a1a;
  z-index: 400;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

#site-overlay.visible {
  display: flex;
}

#site-overlay .guide-header {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}
#site-overlay .guide-header-inner {
  max-width: none;
  padding: 0 12px;
}
#site-overlay .guide-back-link .material-symbols-outlined {
  font-size: 18px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

#site-iframe {
  flex: 1;
  width: 100%;
  border: none;
}

.guide-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #000;
  border-bottom: 1px solid #1e1e1e;
}
.guide-header-inner {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
}
.guide-back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #aaa;
  text-decoration: none;
  font-size: 14px;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: inherit;
}
.guide-back-link:hover { color: #fff; }

/* ===== Open / Examples Modal ===== */

#open-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 350;
}

#open-modal.visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 80px;
}

#open-modal-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

#open-modal-content {
  position: relative;
  z-index: 1;
  background: #222;
  border: 1px solid #555;
  border-radius: 12px;
  max-height: 70vh;
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
}

#open-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #2a2a2a;
}



#open-modal-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  list-style: none;
}

.song-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #2a2a2a;
  cursor: pointer;
}

.song-list-item:active {
  background: #2a2a2a;
}

.song-list-info {
  flex: 1;
  min-width: 0;
}

.song-list-title {
  color: #ccc;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-list-date {
  color: #999;
  font-size: 12px;
  margin-top: 2px;
}

.song-delete-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 6px;
  background: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.song-delete-btn:active {
  color: #e57373;
}

.song-list-empty {
  padding: 30px 16px;
  text-align: center;
  color: #999;
  font-size: 14px;
}


/* ===== Confirm Modal ===== */

#confirm-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
}

#confirm-modal.visible {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

#confirm-modal-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

#confirm-modal-box {
  position: relative;
  z-index: 1;
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 340px;
}

#confirm-modal-msg {
  color: #ccc;
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 16px;
}

#confirm-modal-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.confirm-btn {
  width: 100%;
  height: 40px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #2a2a2a;
  color: #ccc;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.confirm-btn:active {
  background: #333;
}

.confirm-btn.primary {
  background: #A0A69E;
  color: #000;
  border-color: #A0A69E;
}

/* ===== Save-As Modal ===== */

#saveas-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
}

#saveas-modal.visible {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

#saveas-modal-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

#saveas-modal-box {
  position: relative;
  z-index: 1;
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 340px;
}

#saveas-input {
  width: 100%;
  height: 40px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-family: "Mulish", sans-serif;
  font-size: 15px;
  padding: 0 10px;
  outline: none;
  margin-bottom: 12px;
}

#saveas-input:focus {
  border-color: #A0A69E;
}

#saveas-btns {
  display: flex;
  gap: 8px;
}

#saveas-btns .confirm-btn {
  flex: 1;
}

/* ===== Suggested Song Modal ===== */

#suggested-modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
}

#suggested-modal.visible {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

#suggested-modal-veil {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
}

#suggested-modal-box {
  position: relative;
  z-index: 1;
  background: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 340px;
}

#suggested-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #ccc;
  margin-bottom: 16px;
}

.suggested-field {
  margin-bottom: 12px;
}

.suggested-label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.suggested-key-row {
  display: flex;
  gap: 8px;
}

.suggested-select {
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-family: "Mulish", sans-serif;
  font-size: 14px;
  padding: 8px 10px;
  outline: none;
  height: 38px;
  flex: 1;
  min-width: 0;
}

.suggested-select-full {
  width: 100%;
}

.suggested-select:focus {
  border-color: #A0A69E;
}

#suggested-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #aaa;
  font-size: 14px;
  margin-bottom: 12px;
}

.suggested-loading-icon {
  font-size: 18px;
  animation: suggested-pulse 1.2s ease-in-out infinite;
}

@keyframes suggested-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#suggested-modal-btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

#suggested-modal-btns .confirm-btn {
  flex: 1;
}

/* ===== Accords Static Pages ===== */

body.accords-page {
  max-width: 600px;
  margin: 0 auto;
  padding: 68px 20px 40px;
  line-height: 1.8;
  height: auto;
  overflow: visible;
  user-select: text;
  -webkit-user-select: text;
}

.accords-page h1 {
  font-family: "Bebas Neue", sans-serif;
  color: #A0A69E;
  font-size: 28px;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.accords-page h2 {
  color: #ccc;
  font-size: 18px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.accords-page p {
  margin-bottom: 14px;
  color: #ccc;
  font-size: 15px;
}

.accords-page ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.accords-page li {
  color: #ccc;
  font-size: 15px;
  margin-bottom: 4px;
}

.accords-page a {
  color: #ccc;
}

.accords-page .video-container {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  background: #111;
  border-radius: 12px;
  overflow: hidden;
}

.accords-page .video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.accords-page .placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555;
  font-size: 16px;
}

.accords-page .material-symbols-outlined {
  font-size: 18px;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.accords-page .guide-btn {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  margin: 0 4px;
  height: 28px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #ccc;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

.accords-page .guide-btn .material-symbols-outlined {
  font-size: 20px;
  vertical-align: unset;
  position: unset;
  top: unset;
}

.accords-page .guide-btn svg {
  display: block;
}

.guide-support { margin-top: 24px; }

.guide-sound-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  color: #bbb;
  margin-bottom: 12px;
}

.guide-sound-notice .material-symbols-outlined {
  font-size: 30px;
  color: #bbb;
  flex-shrink: 0;
}

/* ===== Piano Widget ===== */

#piano-widget {
  padding: 0 0 2px;
  flex-shrink: 0;
}

#piano-widget-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 18px;
  margin-bottom: 4px;
}

#piano-chord-label {
  font-size: 14px;
  font-weight: 400;
  color: #888;
  letter-spacing: 0.5px;
}

#piano-close-btn {
  position: absolute;
  right: 0;
  bottom: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #666;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding-bottom: 2px;
}

#piano-close-btn:hover { color: #aaa; }

#piano-close-btn .material-symbols-outlined {
  font-size: 20px;
}

#piano-keyboard {
  position: relative;
  height: 66px;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}

.piano-key-white {
  position: absolute;
  top: 0;
  height: 100%;
  background: #d4d4d4;
  border: 1px solid #555;
  border-radius: 0 0 3px 3px;
  box-sizing: border-box;
  z-index: 1;
}

.piano-key-white.active {
  background: #666;
}

.piano-key-black {
  position: absolute;
  top: 0;
  height: 62%;
  background: #1c1c1c;
  border: 1px solid #444;
  border-radius: 0 0 3px 3px;
  box-sizing: border-box;
  z-index: 2;
}

.piano-key-black.active {
  background: #666;
}

.piano-key-white.active.root,
.piano-key-black.active.root,
.piano-key-white.root,
.piano-key-black.root {
  background: #aaa;
}

.piano-key-octave-marker {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 8px;
  color: #888;
  z-index: 1;
  pointer-events: none;
}

/* Active burger menu item (toggle on) */
#btn-piano-toggle.piano-on {
  color: #fff;
}

/* ===== Mobile font-size bump (same as jackfortin.com: +2px on ≤768px) ===== */

@media (max-width: 768px) {
  /* Grid */
  .grid-cell { font-size: 16px; }

  /* Header */
  #key-display { font-size: 16px; }
  #song-title { font-size: 17px; }
  #song-title-mirror { font-size: 17px; }

  /* Key picker */
  #bpm-display { font-size: 18px; }
  #bpm-label { font-size: 16px; }

  /* Section headers */
  .section-name-select { font-size: 15px; }

  /* Edit menu */
  #mode-select { font-size: 15px; }
  #intention-select { font-size: 15px; }
  #note-display { font-size: 20px; }
  .scale-chord-chip { font-size: 16px; }
  .suggestion-chip { font-size: 16px; }
  .toggle-btn { font-size: 16px; }

  /* Burger menu */
  .burger-menu-item { font-size: 18px; }
  #examples-submenu .song-list-title { font-size: 17px; }

  /* Auth */
  .auth-field label { font-size: 17px; }
  .auth-field input { font-size: 18px; }
  #auth-info { font-size: 17px; }
  .auth-checkbox { font-size: 17px; }
  #auth-submit-btn { font-size: 18px; }
  .auth-field-error { font-size: 15px; }
  #auth-error { font-size: 17px; }
  #auth-sent-msg { font-size: 17px; }

  /* Lyrics */
  #btn-syllable-toggle { font-size: 18px; }
  #lyrics-textarea { font-size: 18px; }

  /* Open / song list */
  .song-list-title { font-size: 17px; }
  .song-list-date { font-size: 14px; }
  .song-list-empty { font-size: 16px; }

  /* Modals */
  #confirm-modal-msg { font-size: 17px; }
  .confirm-btn { font-size: 16px; }
  #saveas-input { font-size: 17px; }
  #save-toast, #audio-loading-toast { font-size: 16px; }

  /* Static pages (guide, conditions) */
  .accords-page h2 { font-size: 20px; }
  .accords-page p { font-size: 17px; }
  .accords-page li { font-size: 17px; }
}
