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

:root {
  --bg: #0a0a0a;
  --surface: #161616;
  --border: #2a2a2a;
  --text: #f0f0f0;
  --muted: #888;
  --red: #ff0000;
  --red-dim: #cc0000;
  --radius: 14px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px 80px;
}

.page {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ── Header ── */
header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.yt-icon {
  width: 52px;
  height: auto;
  flex-shrink: 0;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

/* ── Input row ── */
.input-row {
  display: flex;
  width: 100%;
  gap: 10px;
}

#urlInput {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 14px 18px;
  outline: none;
  transition: border-color 0.15s;
}

#urlInput::placeholder { color: #555; }
#urlInput:focus { border-color: #555; }

#generateBtn {
  background: var(--red);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 26px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

#generateBtn:hover { background: var(--red-dim); }
#generateBtn:active { transform: scale(0.97); }
#generateBtn:disabled { background: #444; cursor: not-allowed; transform: none; }

/* ── Status / error ── */
.status {
  font-size: 14px;
  padding: 12px 18px;
  border-radius: 10px;
  width: 100%;
  text-align: center;
}

.status.loading {
  background: #1a1a1a;
  color: var(--muted);
}

.status.error {
  background: #1f0c0c;
  color: #ff7070;
  border: 1px solid #3a1818;
}

.hidden { display: none !important; }

/* ── Canvas output ── */
.output {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.canvas-wrap {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  max-width: 100%;
}

#card {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Background colour palette swatches ── */
.palette {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
}

.palette-swatch {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  padding: 0;
}

.palette-swatch:hover {
  transform: scale(1.12);
}

.palette-swatch.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.5);
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a1a;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 24px;
  transition: background 0.15s, border-color 0.15s;
}

.download-btn:hover {
  background: #222;
  border-color: #444;
}

/* Spinner animation for loading state */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #444;
  border-top-color: #888;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
