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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #121212;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background-color: #1e1e1e;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.status-indicator {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background-color: orange;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  flex-shrink: 0;
  border: none;
  padding: 0;
  cursor: pointer;
}

.admin-nav {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: #252525;
  border-bottom: 1px solid #333;
}

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

.admin-tabs {
  display: flex;
}

.admin-tab {
  flex: 1;
  padding: 12px 8px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #888;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab.active {
  color: #fff;
  border-bottom-color: #4CAF50;
}

.admin-panel {
  width: 100%;
}

.admin-panel.hidden {
  display: none;
}

.admin-client-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.admin-client-row {
  background: #252525;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
}

.admin-client-row.status-green {
  border-color: #4CAF50;
  background: rgba(76, 175, 80, 0.08);
}

.admin-client-row.status-blue {
  border-color: #42a5f5;
  background: rgba(66, 165, 245, 0.1);
}

.admin-client-row.status-orange {
  border-color: #ff9800;
  background: rgba(255, 152, 0, 0.1);
}

.admin-client-row.status-yellow {
  border-color: #fdd835;
  background: rgba(253, 216, 53, 0.08);
}

.admin-client-row.status-gray {
  border-color: #757575;
  background: rgba(117, 117, 117, 0.12);
}

.admin-client-row.now-playing {
  box-shadow: 0 0 0 1px #4CAF50;
}

.admin-hide-inactive {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #aaa;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.admin-queue-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-stop-wrap {
  position: relative;
  flex-shrink: 0;
}

.admin-stop-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #c62828;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.admin-stop-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 100;
  overflow: hidden;
}

.admin-stop-menu.hidden {
  display: none;
}

.admin-stop-menu-item {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: none;
  background: transparent;
  color: #eee;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.admin-stop-menu-item:hover {
  background: #333;
}

.admin-stop-menu-danger {
  color: #ff8a80;
  border-top: 1px solid #444;
}

.admin-hide-inactive input {
  width: 16px;
  height: 16px;
}

body.hide-inactive-users .admin-client-row.is-inactive {
  display: none;
}

.skipped-banner {
  padding: 12px 14px;
  margin-bottom: 14px;
  background: rgba(253, 216, 53, 0.12);
  border: 1px solid rgba(253, 216, 53, 0.45);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #ffe082;
}

.skipped-banner.hidden {
  display: none;
}

.skipped-banner p {
  margin: 0;
}

.admin-client-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-client-order {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.admin-order-btn {
  width: 28px;
  height: 24px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #2a2a2a;
  color: #ccc;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.admin-order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.admin-client-main {
  flex: 1;
  min-width: 0;
}

.admin-client-name-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.admin-client-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.admin-status-badge.connected {
  background: rgba(76, 175, 80, 0.2);
  color: #81c784;
}

.admin-status-badge.disconnected {
  background: rgba(255, 152, 0, 0.15);
  color: #ffb74d;
}

.admin-queue-count {
  font-size: 12px;
  color: #888;
}

.admin-now-playing-badge {
  font-size: 11px;
  font-weight: 600;
  color: #4CAF50;
}

.admin-client-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.admin-impersonate-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #4CAF50;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.admin-empty-state {
  text-align: center;
  color: #888;
  padding: 24px 16px;
  font-size: 14px;
}

.admin-settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.admin-settings-label {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
}

.admin-settings-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #fff;
  font-size: 14px;
}

.admin-settings-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #ddd;
  cursor: pointer;
}

.admin-settings-check input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.admin-songs-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-songs-bar.hidden {
  display: none;
}

.admin-view-as-label {
  font-size: 13px;
  color: #aaa;
  white-space: nowrap;
}

.admin-view-as {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #2a2a2a;
  color: #fff;
  font-size: 14px;
}

.admin-impersonate-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #4CAF50;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.client-name-btn {
  background: none;
  border: none;
  color: #bbb;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.client-name-btn.has-name {
  color: #fff;
}

.client-name-btn:hover {
  color: #4CAF50;
}

.client-name-edit {
  flex: 1;
  min-width: 0;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background-color: #2a2a2a;
  color: white;
  font-size: 14px;
}

.client-name-edit.hidden {
  display: none;
}

.client-name-btn.hidden {
  display: none;
}

.lang-picker {
  background-color: #333;
  color: white;
  border: 1px solid #555;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
}

.content {
  flex: 1;
  padding: 20px;
  padding-bottom: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

h1 {
  margin-bottom: 20px;
  text-align: center;
  color: #4CAF50;
  font-size: 1.4rem;
}

.app-panel {
  width: 100%;
}

.app-panel.hidden {
  display: none;
}

.search-bar-wrap {
  position: relative;
  width: 100%;
}

.search-bar {
  display: flex;
  gap: 10px;
  width: 100%;
}

.search-bar input {
  flex: 1;
  padding: 14px;
  border-radius: 8px;
  border: none;
  background-color: #2a2a2a;
  color: white;
  font-size: 16px;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  list-style: none;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

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

.search-suggestion {
  padding: 12px 14px;
  font-size: 15px;
  color: #ddd;
  cursor: pointer;
  border-bottom: 1px solid #333;
}

.search-suggestion:last-child {
  border-bottom: none;
}

.search-suggestion:hover,
.search-suggestion.active {
  background: #3a3a3a;
  color: #fff;
}

button {
  padding: 14px 18px;
  border-radius: 8px;
  border: none;
  background-color: #4CAF50;
  color: white;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

button:disabled {
  background-color: #555;
  color: #888;
  cursor: not-allowed;
}

button.secondary {
  background-color: #333;
  border: 1px solid #555;
}

button.secondary:hover:not(:disabled) {
  background-color: #444;
}

button.queue-accepted {
  background-color: #2e7d32;
}

button.queue-rejected {
  background-color: #c62828;
}

.search-status {
  margin-top: 12px;
  font-size: 14px;
  color: #aaa;
  text-align: center;
}

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

.search-results {
  list-style: none;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding-bottom: 8px;
}

.queue-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  pointer-events: none;
}

.queue-panel.hidden {
  display: none;
}

.queue-panel.is-expanded {
  pointer-events: auto;
}

.queue-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 0;
}

.queue-backdrop.hidden {
  display: none;
}

.queue-sheet {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  background: #1a3d72;
  border-top: 1px solid #3d6db5;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  transition: transform 0.25s ease;
}

.queue-panel.is-expanded .queue-sheet {
  transform: translateY(0);
}

.queue-peek {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.queue-peek-thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: #214878;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.queue-peek-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-peek-thumb.hidden {
  display: none;
}

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

.queue-peek-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #888;
  font-weight: 600;
  margin-bottom: 2px;
}

.queue-peek-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-peek-chevron {
  color: #888;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.queue-panel.is-expanded .queue-peek-chevron {
  transform: rotate(180deg);
}

.queue-expanded {
  display: none;
  border-top: 1px solid #3d6db5;
  max-height: min(52vh, 360px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.queue-panel.is-expanded .queue-expanded {
  display: block;
}

.queue-expanded-header {
  padding: 12px 16px 8px;
  position: sticky;
  top: 0;
  background: #1a3d72;
  z-index: 1;
}

.queue-expanded-title {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.my-queue {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 8px 12px;
}

.my-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
}

.my-queue-item:active {
  background: #214878;
}

.queue-empty-item {
  padding: 20px 16px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

.my-queue-item img {
  width: 56px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

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

.my-queue-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.my-queue-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

.my-queue-actions button {
  padding: 6px 10px;
  font-size: 13px;
  min-width: 32px;
}

.my-queue-actions .remove-btn {
  background: #c62828;
}

.search-result {
  display: flex;
  gap: 12px;
  background: #1e1e1e;
  border-radius: 10px;
  padding: 10px;
  border: 1px solid #333;
}

.search-result img {
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #333;
}

.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.official-music-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2e7d32;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 4px;
  flex-shrink: 0;
}

.my-queue-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.result-channel {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.result-actions button {
  padding: 8px 12px;
  font-size: 13px;
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.preview-content {
  position: relative;
  width: min(92vw, 560px);
  background: #1e1e1e;
  border-radius: 12px;
  overflow: hidden;
  z-index: 1;
}

.close-preview {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  font-size: 22px;
  line-height: 1;
}

.preview-frame-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
}

.preview-frame-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: #2e7d32;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.queue-panel.is-expanded ~ .toast,
body:has(.queue-panel.is-expanded) .toast {
  bottom: calc(88px + min(52vh, 360px));
}

.toast.error {
  background: #c62828;
}

.toast.hidden {
  display: none;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.overlay.hidden {
  display: none;
}

.overlay-content {
  text-align: center;
  padding: 30px;
}

.overlay h2 {
  color: #F44336;
  font-size: 24px;
  line-height: 1.4;
}
