* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0d0d1a;
  color: #ccc;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  background: #12122a;
  border-right: 1px solid #2a2a4a;
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #2a2a4a;
}

.sidebar-header h1 {
  color: #7c6af7;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.sidebar-header p {
  color: #555;
  font-size: 11px;
  margin-top: 3px;
}

/* ── Google account section ── */
.google-acct-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #2a2a4a;
}

.gacct-signin-label {
  color: #666;
  font-size: 10px;
  margin-bottom: 8px;
}

.gacct-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e1b4b;
  border-radius: 12px;
  padding: 10px 12px;
}

.gacct-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #7c6af7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.gacct-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

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

.gacct-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gacct-email {
  color: #7c6af7;
  font-size: 10px;
  margin-top: 2px;
  word-break: break-all;
}

.gacct-signout {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  flex-shrink: 0;
  line-height: 1;
}

.gacct-signout:hover { color: #e94560; }

.song-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.song-item {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.song-item:hover {
  background: #1a1a3a;
}

.song-item.active {
  background: #1e1b4b;
  border-left: 3px solid #7c6af7;
  padding-left: 9px;
}

.song-item .song-title {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.song-item .key-badges {
  display: flex;
  gap: 6px;
}

.badge {
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
}

.badge-orig {
  background: #1e1e3a;
  color: #888;
}

.badge-target {
  background: #1e1b4b;
  color: #a89df7;
}

/* ── Date groups in sidebar ── */
.date-group {
  margin-bottom: 4px;
}

.date-header {
  color: #7c6af7;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 4px;
  border-bottom: 1px solid #2a2a4a;
  margin-bottom: 2px;
}

.empty-state {
  padding: 24px 16px;
  text-align: center;
  color: #555;
  font-size: 13px;
  line-height: 1.6;
}

.empty-state a {
  color: #7c6af7;
  text-decoration: none;
}

/* ── Layout ── */
.app-layout {
  display: flex;
  height: 100vh;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  overflow: hidden;
  min-width: 0;
}

/* ── Key info bar ── */
.key-bar {
  background: #12122a;
  border-radius: 8px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.key-bar .song-name {
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.key-display {
  display: flex;
  align-items: center;
  gap: 10px;
}

.key-block {
  text-align: center;
}

.key-block .label {
  color: #555;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.key-block .value {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.key-block .value.target {
  color: #7c6af7;
}

.arrow {
  color: #7c6af7;
  font-size: 18px;
}

.semitone-box {
  background: #1e1b4b;
  border: 1px solid #7c6af7;
  border-radius: 6px;
  padding: 4px 12px;
  text-align: center;
  margin-left: 6px;
}

.semitone-box .label {
  color: #555;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.semitone-box .value {
  color: #7c6af7;
  font-size: 14px;
  font-weight: 700;
}

/* ── Extension badge ── */
.ext-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}

.ext-badge.not-installed {
  background: #1a1a2e;
  border-color: #444;
  color: #666;
}

.ext-badge.waiting {
  background: #1a1a2e;
  border-color: #555;
  color: #888;
}

.ext-badge.applied {
  background: #0d2e1a;
  border-color: #4ecca3;
  color: #4ecca3;
}

.ext-badge.no-shift {
  background: #1a1a2e;
  border-color: #555;
  color: #888;
}

.ext-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Content split (player + score) ── */
.content-split {
  flex: 1;
  display: flex;
  gap: 12px;
  min-height: 0;
}

/* ── YouTube player ── */
.player-wrapper {
  flex: 1;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a4a;
  min-height: 0;
}

.player-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.player-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #333;
}

.player-placeholder .icon {
  font-size: 40px;
}

/* ── Score panel ── */
.score-panel {
  flex: 1;
  background: #12122a;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a4a;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.score-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #333;
}

.score-placeholder .icon {
  font-size: 40px;
}

.score-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* ── Speed bar ── */
.speed-bar {
  background: #12122a;
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.speed-bar .label {
  color: #555;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.speed-btn {
  background: #1a1a2e;
  color: #777;
  border: 1px solid #2a2a4a;
  border-radius: 4px;
  padding: 3px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.speed-btn:hover {
  border-color: #7c6af7;
  color: #ccc;
}

.speed-btn.active {
  background: #1e1b4b;
  border-color: #7c6af7;
  color: #7c6af7;
}

/* ── Admin page ── */
.admin-layout {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100vh;
  overflow-y: auto;
}

.admin-header {
  margin-bottom: 24px;
}

.admin-header h1 {
  color: #7c6af7;
  font-size: 20px;
  font-weight: 700;
}

.admin-header p {
  color: #555;
  font-size: 13px;
  margin-top: 4px;
}

.admin-header a {
  color: #7c6af7;
  text-decoration: none;
  font-size: 13px;
}

.add-form {
  background: #12122a;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

input[type="text"], input[type="date"], select {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 5px;
  padding: 7px 10px;
  color: #fff;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus, input[type="date"]:focus, select:focus {
  border-color: #7c6af7;
}

select option {
  background: #1a1a2e;
}

.input-title { width: 180px; }
.input-url { width: 280px; }
.input-key { width: 80px; }

.btn-add {
  background: #7c6af7;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  align-self: flex-end;
}

.btn-add:hover {
  background: #9580ff;
}

.song-table {
  background: #12122a;
  border-radius: 8px;
  overflow: hidden;
}

.song-table-header {
  display: grid;
  grid-template-columns: 1fr 2fr 80px 80px 100px 1fr 160px;
  padding: 10px 16px;
  border-bottom: 1px solid #2a2a4a;
  color: #555;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.song-row {
  display: grid;
  grid-template-columns: 1fr 2fr 80px 80px 100px 1fr 160px;
  padding: 10px 16px;
  border-bottom: 1px solid #1a1a2e;
  align-items: center;
}

.song-row:last-child {
  border-bottom: none;
}

.song-row .col-title {
  color: #fff;
  font-size: 13px;
}

.song-row .col-url {
  color: #555;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
}

.song-row .col-key {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.col-key.orig { color: #888; }
.col-key.target { color: #7c6af7; }

.song-row .col-date {
  color: #666;
  font-size: 11px;
  text-align: center;
}

.col-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.btn-edit {
  background: none;
  border: 1px solid #2a2a4a;
  color: #7c6af7;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 3px;
  transition: background 0.15s;
}

.btn-edit:hover {
  background: #1e1b4b;
}

.btn-save {
  background: #7c6af7;
  border: none;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 3px;
  transition: background 0.15s;
  font-weight: 600;
}

.btn-save:hover {
  background: #9580ff;
}

.btn-cancel {
  background: none;
  border: 1px solid #2a2a4a;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 3px;
  transition: background 0.15s;
}

.btn-cancel:hover {
  background: #1a1a2e;
}

.btn-remove {
  background: none;
  border: none;
  color: #e94560;
  font-size: 12px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 3px;
  transition: background 0.15s;
}

.btn-remove:hover {
  background: #2a1a1e;
}

.song-row.editing {
  background: #14143a;
}

.edit-input {
  background: #1a1a2e;
  border: 1px solid #7c6af7;
  border-radius: 4px;
  padding: 5px 8px;
  color: #fff;
  font-size: 12px;
  outline: none;
  width: 100%;
}

.error-msg {
  color: #e94560;
  font-size: 12px;
  padding: 6px 0;
  display: none;
}

body.admin-page {
  overflow-y: auto;
  height: auto;
}
