:root {
  color-scheme: light;
  font-family: "IBM Plex Sans", "Space Grotesk", sans-serif;
  --primary: #0fbfba;
  --primary-glow: rgba(15, 191, 186, 0.3);
  --secondary: #ffb545;
  --text: #0b1220;
  --muted: #5a647a;
  --border: rgba(11, 18, 32, 0.12);
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 60px rgba(9, 18, 38, 0.12);
  --card-shadow: 0 18px 48px rgba(8, 16, 32, 0.08);
  --accent: var(--primary);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background: #f5f7fb;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 14px;
}

.platform-note {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  text-align: center;
  padding: 20px 0;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.hero-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.hero-subtitle {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--text);
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transform: translateY(-1px);
}

.hero-desc {
  font-size: 16px;
  color: var(--muted);
}

.input-form {
  width: min(640px, 100%);
  position: relative;
  z-index: 10;
}

/* Add a subtle glow behind the input form */
.input-form::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(15, 191, 186, 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

.input-form {
  width: min(760px, 100%);
}

.input-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 18px;
  border-radius: 100px;
  /* Pillow shape */
  background: #fff;
  border: 1px solid rgba(11, 18, 32, 0.08);
  box-shadow: 0 16px 40px -10px rgba(11, 18, 32, 0.1);
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  height: 64px;
}

.input-row:focus-within {
  border-color: rgba(15, 191, 186, 0.5);
  box-shadow: 0 20px 50px -10px rgba(15, 191, 186, 0.2);
  transform: translateY(-2px);
}

.input-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
}

input[type="url"] {
  border: none;
  outline: none;
  font-size: 16px;
  width: 100%;
  color: var(--text);
  background: transparent;
}

input[type="url"]::placeholder {
  color: #94a3b8;
}

button {
  border: none;
  border-radius: 99px;
  padding: 0 28px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  /* Black button for high contrast */
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  background: #000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.primary-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.status {
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-info {
  background: rgba(15, 191, 186, 0.08);
  color: #087c78;
}

.status-loading {
  background: rgba(15, 191, 186, 0.08);
  color: #087c78;
}

.status-loading::before {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse 1s infinite;
}

.status-success {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.status-success::before {
  content: "✓";
  font-size: 14px;
}

.status-error {
  background: rgba(239, 68, 68, 0.08);
  color: #dc2626;
}

.status-error::before {
  content: "!";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #dc2626;
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.helper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.sample-link {
  background: none;
  border: none;
  padding: 0;
  color: #087c78;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.sample-link:hover {
  color: #0b8f89;
}

.output-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.output-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.output-header h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  margin-bottom: 6px;
}

.output-note {
  font-size: 13px;
  color: var(--muted);
}

.chip {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(15, 191, 186, 0.1);
  color: #087c78;
  border: 1px solid rgba(15, 191, 186, 0.2);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
  background: #fff;
  border-radius: 20px;
  border: 1px solid rgba(11, 18, 32, 0.06);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.control-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.color-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg);
  border: 4px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.3, 0, 0.2, 1);
  position: relative;
}

.color-swatch:hover {
  transform: scale(1.1);
  background: var(--bg);
  /* Override default button hover */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-swatch.active {
  transform: scale(1);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px #fff;
}

.color-swatch.active::after {
  content: "";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.control-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(11, 18, 32, 0.06);
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235A647A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  pointer-events: none;
}

select {
  width: 100%;
  appearance: none;
  background: #f8fafc;
  border: 1px solid rgba(11, 18, 32, 0.08);
  border-radius: 10px;
  padding: 10px 32px 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

select:hover {
  background: #f1f5f9;
  border-color: rgba(11, 18, 32, 0.15);
}

select:focus {
  outline: none;
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 191, 186, 0.1);
}

.card-gallery {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.content-card {
  position: relative;
  border-radius: 22px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border: 1px solid rgba(11, 18, 32, 0.1);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  color: var(--text);
}

.content-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 22px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.content-card.is-selected {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 18px 40px rgba(9, 18, 38, 0.14);
  border-color: rgba(15, 191, 186, 0.5);
}

.variant-label {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-header .time.is-logo {
  color: #1da1f2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.card-header .time.is-logo .platform-logo {
  width: 20px;
  height: 20px;
  display: block;
}

.content-card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

.summary {
  color: #3f475e;
  line-height: 1.7;
  font-size: 14px;
}

.highlights {
  display: grid;
  gap: 10px;
}

.highlight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 191, 186, 0.08);
  font-size: 14px;
  border: 1px solid rgba(15, 191, 186, 0.2);
}

.highlight span {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding-top: 12px;
  border-top: 1px solid rgba(11, 18, 32, 0.08);
}

.download-btn {
  width: 100%;
  margin-top: auto;
}

.download-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  box-shadow: none;
}

.content-card.is-capturing .download-btn {
  display: none;
}

.highlights.hidden {
  display: none;
}

.variant-nebula {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.95), rgba(224, 250, 248, 0.9));
  --accent: #0fbfba;
}

.variant-circuit {
  background: linear-gradient(150deg, #ffffff, #e9eef7);
  --accent: #6474ff;
}

.variant-circuit::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 18px;
  border: 1px dashed rgba(100, 116, 255, 0.25);
  pointer-events: none;
}

.variant-prism {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 243, 219, 0.9));
  --accent: #ff8a4c;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visible {
  display: block !important;
  animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

@media (max-width: 980px) {
  .card-gallery {
    grid-template-columns: 1fr;
  }
}

/* --- Skeleton Loading --- */

.is-skeleton {
  pointer-events: none;
}

.skeleton-line {
  display: block;
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #eef1f5 25%, #e2e8f0 50%, #eef1f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-block {
  width: 100%;
  height: 60px;
  border-radius: 12px;
  background: linear-gradient(90deg, #eef1f5 25%, #e2e8f0 50%, #eef1f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-highlights {
  display: grid;
  gap: 10px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Spinner --- */

.spinner {
  width: 16px;
  height: 16px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.primary-btn.is-loading {
  opacity: 0.85;
  cursor: wait;
}

/* --- Error Panel --- */

.error-panel {
  width: min(760px, 100%);
  margin: 0 auto;
}

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.error-icon {
  flex-shrink: 0;
  color: #dc2626;
  margin-top: 2px;
}

.error-text {
  flex: 1;
  min-width: 0;
}

.error-text strong {
  display: block;
  font-size: 14px;
  color: #991b1b;
  margin-bottom: 4px;
}

.error-text p {
  font-size: 13px;
  color: #7f1d1d;
  line-height: 1.5;
  word-break: break-word;
}

.retry-btn {
  flex-shrink: 0;
  padding: 0 16px;
  height: 36px;
  font-size: 13px;
  background: #dc2626;
  color: #fff;
  border-radius: 8px;
  align-self: center;
}

.retry-btn:hover {
  background: #b91c1c;
  transform: none;
  box-shadow: none;
}

/* --- Responsive --- */

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    gap: 6px;
  }

  .input-line {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

  .meta {
    flex-direction: column;
    gap: 6px;
  }

  .error-content {
    flex-direction: column;
  }
}