:root {
  --bg: #14161a;
  --surface: #1d2026;
  --surface-hover: #262a32;
  --border: #2c3038;
  --text: #f1f2f4;
  --text-dim: #8a8f98;
  --accent: #ff9d42;
  --danger: #e5484d;
  --error: #e5484d;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px 96px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.app-header h1 {
  font-size: 1.2rem;
  margin: 0;
  white-space: nowrap;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

select, input[type="text"], input[type="url"] {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.icon-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--surface-hover);
}

.search-bar {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px 10px;
}

.search-bar input {
  width: 100%;
}

.banner {
  max-width: 600px;
  width: 100%;
  margin: 0 auto 10px;
  padding: 8px 16px;
  background: #3a2f1a;
  color: #ffd28a;
  font-size: 0.85rem;
}

.station-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.station-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.station-row:hover {
  background: var(--surface-hover);
}

.station-row.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.favicon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #0f1114;
  flex-shrink: 0;
}

.station-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.station-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-error {
  font-size: 0.75rem;
  color: var(--error);
}

.play-btn, .delete-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
}

.delete-btn {
  color: var(--text-dim);
}

.delete-btn.confirming {
  color: var(--danger);
  border-color: var(--danger);
  width: auto;
  padding: 0 8px;
  font-size: 0.75rem;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 16px;
}

.now-playing {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.now-playing-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.now-playing-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.now-playing-status {
  font-size: 0.75rem;
  color: var(--text-dim);
}

#volume-slider {
  width: 80px;
}

.hidden {
  display: none !important;
}

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: min(90vw, 380px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

dialog h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

dialog label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.field-error {
  color: var(--error);
  font-size: 0.8rem;
  margin: -4px 0 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-actions button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

#add-submit {
  background: var(--accent);
  color: #14161a;
  border-color: var(--accent);
  font-weight: 600;
}
