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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --border: #333;
  --text: #e8e8e8;
  --text-dim: #888;
  --accent: #ff4444;
  --accent-hover: #ff6666;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 10vh 1rem 2rem;
}

.container {
  width: 100%;
  max-width: 560px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-dim);
  margin-top: 0.35rem;
  font-size: 0.95rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

#url-input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

#url-input:focus {
  border-color: var(--accent);
}

#url-input::placeholder {
  color: var(--text-dim);
}

#play-btn {
  padding: 0.75rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

#play-btn:hover {
  background: var(--accent-hover);
}

#play-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: #2a1515;
  border: 1px solid #4a2020;
  border-radius: var(--radius);
  color: #ff8888;
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
}

#player-section {
  margin-top: 2rem;
}

.now-playing {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

#thumbnail {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface);
}

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

.track-info h2 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.track-info p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

audio {
  width: 100%;
  height: 48px;
  border-radius: var(--radius);
  outline: none;
}

audio::-webkit-media-controls-panel {
  background: var(--surface);
}

.format-info {
  margin-top: 0.5rem;
  text-align: right;
}

#format-label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

footer {
  margin-top: 3rem;
  text-align: center;
}

footer p {
  font-size: 0.8rem;
  color: var(--text-dim);
}

#debug-panel {
  margin-top: 1.5rem;
}

#debug-panel summary {
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-btn {
  margin-left: auto;
  padding: 0.2rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.copy-btn:active {
  background: var(--border);
}

#debug-log {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: #aaa;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.7rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 50vh;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}

footer p.build-info {
  margin-top: 1.5rem;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 0.55rem;
  opacity: 0.25;
  letter-spacing: 0.05em;
}


@media (max-width: 480px) {
  body {
    padding: 6vh 1rem 2rem;
  }

  .input-row {
    flex-direction: column;
  }

  #play-btn {
    width: 100%;
  }
}
