:root {
  --brand-primary: #ff6b6b;
  --brand-secondary: #764ba2;
  --surface-dark: #0b0f1e;
  --surface-card: #1b1f30;
  --border-color: rgba(255, 255, 255, 0.12);
  --text-muted: #a9b1d6;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(140deg, #0d1024 0%, #21124f 50%, #46104b 100%);
  color: #fff;
  min-height: 100vh;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.tile {
  background: rgba(11, 15, 30, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(5, 0, 30, 0.4);
  margin-bottom: 24px;
}

.tile h2,
.tile h3 {
  margin-top: 0;
}

.header-flex {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
}

.header-copy {
  max-width: 620px;
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.logout-button {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.logout-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}


form label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  color: #fff;
  font-size: 1rem;
  margin-bottom: 14px;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

button,
.cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  color: #fff;
  box-shadow: 0 12px 30px rgba(255, 107, 107, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
}

button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

button:hover:not([disabled]) {
  transform: translateY(-3px);
}

.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.thumb-grid img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #000;
}

.history-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.message {
  margin: 12px 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
}

.message.success {
  background: rgba(46, 213, 115, 0.15);
  color: #9ef7c1;
}

.message.error {
  background: rgba(255, 107, 107, 0.15);
  color: #ffc2c2;
}

.tabs {
  display: inline-flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.tabs button {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 12px 24px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tabs button.active {
  cursor: default;
  background: transparent;
  box-shadow: none;
  color: #fff;
  border-bottom: 2px solid var(--brand-primary);
}

.tabs button:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

.help-text {
  display: inline-block;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.helper-card {
  margin-top: 20px;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form input[type="email"] {
  flex: 1;
  min-width: 200px;
}

.inline-form button {
  flex-shrink: 0;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
}

.loading .spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--brand-primary);
  animation: spin 0.9s linear infinite;
}

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

.hidden {
  display: none !important;
}

.result-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}

.result-link {
  display: block;
}

.result-link img {
  width: 100%;
  border-radius: 12px;
}

.result-note {
  margin-top: 10px;
  font-weight: 700;
  color: #ff8c42;
}

.history-link:link,
.history-link:visited,
.result-link:link,
.result-link:visited {
  color: #ff8c42;
  font-weight: 600;
}

.reference-list {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.youtube-preview {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
}

.youtube-preview img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  display: block;
}

@media (max-width: 600px) {
  .page-shell {
    padding: 20px 12px 60px;
  }
}
