@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/SpaceGrotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* Font-style preview fonts — same files burned into the video by ffmpeg,
   so each option button can show a live preview of its own typeface. */
@font-face {
  font-family: "Preview Neutre";
  src: url("assets/fonts/Inter-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Elegant Serif";
  src: url("assets/fonts/PlayfairDisplay-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Fin Luxe";
  src: url("assets/fonts/CormorantGaramond-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Manuscrit Elegant";
  src: url("assets/fonts/DancingScript-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Manuscrit Decontracte";
  src: url("assets/fonts/Pacifico-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Impact";
  src: url("assets/fonts/Anton-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Condense";
  src: url("assets/fonts/BebasNeue-Regular.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Arrondi Ludique";
  src: url("assets/fonts/Baloo2-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Geometrique Tech";
  src: url("assets/fonts/Poppins-SemiBold.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Monospace Tech";
  src: url("assets/fonts/JetBrainsMono-Variable.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Preview Retro Display";
  src: url("assets/fonts/AbrilFatface-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --onyx-black: #000000;
  --slate-gray: #808285;
  --silver: #c9cacc;
  --off-white: #f5f5f5;
  --pure-white: #ffffff;
  --success: #1e8e5a;
  --success-bg: #eaf6f0;
  --warning: #a3670e;
  --warning-bg: #fdf3e2;
  --error: #c0392b;
  --error-bg: #fbeceb;
  /* The one accent color in the whole app — reserved exclusively for the
     Infinity / unlimited-credits treatment (credit pill, tier badge, card
     frame). Never used for anything else, so it keeps its meaning: "this
     is the unlimited tier," not just decoration. */
  --gold: #d4af37;
  --gold-bg: #faf5e6;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--off-white);
  color: var(--onyx-black);
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-word {
  font-family: "Space Grotesk", sans-serif;
}

a {
  color: inherit;
}

/* Consistent, visible keyboard focus everywhere — mouse clicks don't show it. */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--onyx-black);
  outline-offset: 2px;
  border-radius: 4px;
}
.topbar a:focus-visible,
.generate-btn:focus-visible {
  outline-color: var(--pure-white);
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 16px 32px;
  background: var(--onyx-black);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
  display: flex;
  align-items: center;
  flex: none;
  margin-right: auto;
}

.brand-mark img {
  height: 30px;
  width: auto;
  display: block;
  filter: invert(1);
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  order: 3;
  flex-basis: 100%;
}

.category-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  color: var(--silver);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 15px;
  border-radius: 999px;
  transition: color 0.15s ease, background 0.15s ease;
}

.category-nav a:hover {
  color: var(--pure-white);
}

.category-nav a.active {
  color: var(--onyx-black);
  background: var(--pure-white);
}

.category-nav a.nav-locked {
  color: var(--slate-gray);
  opacity: 0.55;
}

.category-nav .nav-icon {
  width: 15px;
  height: 15px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  color: var(--pure-white);
  border: 1px solid var(--slate-gray);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.credit-pill .credit-icon {
  height: 15px;
  width: auto;
  flex: none;
  display: block;
}

.credit-pill.low {
  color: var(--warning);
  border-color: var(--warning);
}

.credit-pill.empty {
  color: var(--error);
  border-color: var(--error);
}

.credit-pill.unlimited {
  color: var(--gold);
  border-color: var(--gold);
}

@media (min-width: 860px) {
  .category-nav {
    order: initial;
    flex-basis: auto;
    flex: 1 1 auto;
  }
}

/* ---------- Layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* The account page is the one place with 4-wide pricing/pack grids — the
   generic 720px reading width (sized for forms) only leaves room for 3
   cards per row at their comfortable size, so the 4th always wraps to its
   own line even when the viewport clearly has room. Widened just for this
   page; every generation form keeps the narrower, more readable 720px. */
main.account-main {
  max-width: 1040px;
}

.auth-main {
  flex: 1;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 64px 24px;
}

.auth-reassure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  margin-top: 16px;
  color: var(--slate-gray);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-reassure svg {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  color: var(--slate-gray);
  font-size: 14px;
}

.auth-switch a {
  color: var(--onyx-black);
  font-weight: 600;
  text-decoration: underline;
}

h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--slate-gray);
  line-height: 1.5;
  margin-bottom: 40px;
}

.site-footer {
  flex: none;
  text-align: center;
  padding: 24px;
  color: var(--slate-gray);
  font-size: 12.5px;
  border-top: 1px solid var(--silver);
}

.site-footer p {
  margin: 0;
}

.footer-bug-note {
  margin-top: 6px !important;
  font-size: 11.5px;
  color: var(--silver);
}

.footer-bug-note a {
  color: var(--silver);
}

/* ---------- Form fields ---------- */

.field {
  margin-bottom: 28px;
}

label.field-label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-gray);
  margin-bottom: 10px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--silver);
  border-radius: var(--radius-sm);
  font-family: "Inter", sans-serif;
  font-size: 15px;
  background: var(--pure-white);
  transition: border-color 0.15s ease;
  margin-bottom: 16px;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover {
  border-color: var(--slate-gray);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--onyx-black);
  outline: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: var(--silver);
}

.dropzone {
  border: 1.5px dashed var(--silver);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  background: var(--pure-white);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover {
  border-color: var(--slate-gray);
}

.dropzone.drag-active {
  border-color: var(--onyx-black);
  background: var(--off-white);
}

.dropzone.has-image {
  padding: 0;
  border-style: solid;
}

.dropzone img {
  max-width: 100%;
  max-height: 260px;
  display: block;
  margin: 0 auto;
}

.dropzone-icon {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  stroke: var(--slate-gray);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone-hint {
  display: block;
  color: var(--slate-gray);
  font-size: 14px;
  font-weight: 500;
}

.dropzone-subhint {
  display: block;
  color: var(--silver);
  font-size: 12.5px;
  margin-top: 4px;
}

.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.thumb-item {
  position: relative;
  width: 96px;
  height: 96px;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--silver);
  display: block;
}

.thumb-remove {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--onyx-black);
  color: var(--pure-white);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.field-note {
  color: var(--slate-gray);
  font-size: 12.5px;
  margin-top: 6px;
}

.field-hint {
  display: block;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  font-size: 12.5px;
  color: var(--slate-gray);
  margin-top: 4px;
}

.field-hint a {
  color: var(--slate-gray);
  text-decoration: underline;
}

.field-error {
  display: block;
  color: var(--error);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 6px;
}

.field.field-invalid .field-label {
  color: var(--error);
}

.field.field-invalid .dropzone {
  border-color: var(--error);
}

.cost-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--slate-gray);
  font-size: 13.5px;
  font-weight: 500;
  margin: 4px 0 14px;
}

.cost-note img {
  height: 13px;
  width: auto;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 48px;
  padding: 12px 12px;
  border: 1.5px solid var(--silver);
  border-radius: var(--radius-md);
  background: var(--pure-white);
  cursor: pointer;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--onyx-black);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.option-btn:hover {
  border-color: var(--slate-gray);
}

.option-btn:active {
  transform: scale(0.98);
}

.option-btn.selected {
  background: var(--onyx-black);
  border-color: var(--onyx-black);
  color: var(--pure-white);
}

.option-btn.has-badge {
  flex-direction: column;
  gap: 5px;
}

.option-btn .badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--off-white);
  color: var(--slate-gray);
}

.option-btn.selected .badge {
  background: rgba(255, 255, 255, 0.18);
  color: var(--pure-white);
}

.option-btn.option-locked {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--off-white);
}

.option-btn.option-locked:hover {
  border-color: var(--silver);
}

.option-btn .lock-badge {
  margin-left: 6px;
  font-size: 12px;
}

.format-btn .format-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 22px;
}

.format-btn .format-icon svg {
  width: 26px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

.format-btn .option-label {
  font-size: 13px;
}

.field-counter {
  display: block;
  text-align: right;
  color: var(--silver);
  font-size: 12px;
  margin-top: 4px;
}

.field-counter.near-limit {
  color: var(--warning);
}

.option-grid.loading::after {
  content: "Chargement des options…";
  grid-column: 1 / -1;
  color: var(--slate-gray);
  font-size: 13.5px;
  padding: 8px 2px;
}

.ai-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--off-white);
  border: 1px solid var(--silver);
  border-radius: var(--radius-sm);
  color: var(--slate-gray);
  font-size: 12.5px;
  line-height: 1.5;
}

.ai-disclaimer svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  fill: none;
  stroke: var(--slate-gray);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.generate-btn {
  display: block;
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--onyx-black);
  color: var(--pure-white);
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.generate-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.generate-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.generate-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status-box {
  margin-top: 28px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--pure-white);
  border: 1px solid var(--silver);
  font-size: 14px;
  line-height: 1.5;
}

.status-box.error {
  border-color: var(--error);
  background: var(--error-bg);
  color: var(--error);
}

.status-box.success {
  border-color: var(--success);
  background: var(--success-bg);
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--silver);
  border-top-color: var(--onyx-black);
  border-radius: 50%;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}

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

/* ---------- Generation progress ---------- */

.progress-state {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14.5px;
}

.progress-head .spinner {
  margin-right: 0;
}

.progress-label {
  flex: 1;
}

.progress-elapsed {
  font-variant-numeric: tabular-nums;
  color: var(--slate-gray);
  font-weight: 500;
  font-size: 13px;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--off-white);
  overflow: hidden;
}

/* Indeterminate on purpose — the backend gives no real percentage, and a
   made-up bar that hits 90% then hangs erodes trust. This slides a segment
   across to say "actively working" without ever claiming a false ETA. */
.progress-bar-indeterminate {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: var(--onyx-black);
  animation: progress-slide 1.5s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.progress-note {
  margin: 0;
  font-size: 12.5px;
  color: var(--slate-gray);
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar-indeterminate {
    animation: none;
    left: 0;
    width: 100%;
    opacity: 0.5;
  }
}

.result video,
.result img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-top: 16px;
  display: block;
  background: var(--off-white);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

.result a.download,
.result .next-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  color: var(--onyx-black);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}

.result .reset-btn {
  color: var(--slate-gray);
}

/* ---------- History ---------- */

.history-notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 32px;
  padding: 12px 14px;
  background: var(--off-white);
  border: 1px solid var(--silver);
  border-radius: var(--radius-sm);
  color: var(--slate-gray);
  font-size: 12.5px;
  line-height: 1.5;
}

.history-notice svg {
  width: 15px;
  height: 15px;
  flex: none;
  margin-top: 1px;
  fill: none;
  stroke: var(--slate-gray);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-notice.urgent {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.history-notice.urgent svg {
  stroke: var(--error);
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.history-card {
  border: 1px solid var(--silver);
  border-radius: var(--radius-md);
  background: var(--pure-white);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.history-media {
  aspect-ratio: 4 / 3;
  background: var(--off-white);
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-media img,
.history-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.history-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.history-category {
  display: inline-flex;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--off-white);
  color: var(--slate-gray);
}

.history-date {
  font-size: 12.5px;
  color: var(--slate-gray);
}

.history-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.history-actions-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.history-actions .download,
.history-actions .next-step {
  border: none;
  background: none;
  padding: 0;
  color: var(--onyx-black);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.history-actions .next-step {
  color: var(--slate-gray);
}

.history-delete {
  border: none;
  background: none;
  padding: 4px;
  color: var(--slate-gray);
  cursor: pointer;
  display: flex;
  align-items: center;
}

.history-delete:hover {
  color: var(--error);
}

.history-delete svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--slate-gray);
}

/* ---------- Account ---------- */

.account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--silver);
  transition: color 0.15s ease, background 0.15s ease;
}

.account-link svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-link:hover {
  color: var(--pure-white);
}

.account-link.active {
  color: var(--onyx-black);
  background: var(--pure-white);
}

.balance-breakdown p {
  margin: 0 0 4px;
}

.balance-detail {
  color: var(--slate-gray);
  font-size: 13px;
}

.subscription-summary {
  margin-bottom: 18px;
}

.subscription-summary p {
  margin: 0 0 4px;
}

.secondary-btn,
.logout-btn {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--silver);
  background: var(--pure-white);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  color: var(--onyx-black);
}

.secondary-btn {
  margin-top: 10px;
  font-size: 13px;
  padding: 8px 14px;
}

.secondary-btn:hover,
.logout-btn:hover {
  border-color: var(--slate-gray);
}

.logout-btn {
  margin-top: 8px;
}

.tier-grid,
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.tier-card,
.pack-card {
  position: relative;
  border: 1.5px solid var(--silver);
  border-radius: var(--radius-md);
  background: var(--pure-white);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tier-card:hover,
.pack-card:hover {
  border-color: var(--slate-gray);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* The call-to-offer tier (Studio) — a 2px onyx frame + soft shadow + the
   "Le plus populaire" badge lifts it out of the row so a hesitating client
   has an obvious, reassuring default choice. Onyx, not gold: gold stays
   reserved for the Infinity/unlimited treatment. */
.tier-card.featured {
  border: 2px solid var(--onyx-black);
  box-shadow: var(--shadow-md);
}

.tier-card.featured:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
}

/* Infinity's own featured treatment — gold instead of onyx, since gold is
   this app's one reserved marker for "unlimited." Warmer, richer shadow to
   match (a plain gray shadow under a gold frame looks muddy). */
.tier-card.featured-gold {
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.22);
}

.tier-card.featured-gold:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(212, 175, 55, 0.3);
}

.tier-card.current {
  border-color: var(--onyx-black);
}

.tier-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--onyx-black);
  color: var(--pure-white);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.tier-badge.tier-badge-current {
  background: var(--pure-white);
  color: var(--onyx-black);
  border: 1.5px solid var(--onyx-black);
}

.tier-badge.tier-badge-gold {
  background: var(--gold);
  /* Black, not white — gold is light enough that white text loses contrast;
     black-on-gold also reads as a wax/foil seal, reinforcing "premium." */
  color: var(--onyx-black);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.45);
}

.tier-card h3,
.pack-card h3 {
  margin: 0;
  font-size: 15px;
}

.tier-tagline {
  font-size: 12px;
  color: var(--slate-gray);
  margin: 2px 0 4px;
  line-height: 1.4;
}

.tier-price {
  font-size: 22px;
  font-weight: 700;
  margin: 2px 0 0;
  letter-spacing: -0.01em;
}

.tier-price span {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-gray);
  letter-spacing: 0;
}

.tier-founder-note {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  margin: 4px 0 0;
  display: inline-block;
}

.tier-credits {
  font-size: 13.5px;
  color: var(--slate-gray);
  margin: 0;
}

.tier-generation-cap {
  font-size: 12px;
  font-weight: 600;
  color: var(--onyx-black);
  margin: 2px 0 0;
}

.tier-perk {
  font-size: 12px;
  color: var(--success);
  margin: 0;
}

.tier-inherits {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-gray);
  margin: 10px 0 0;
}

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

.tier-features li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--onyx-black);
}

.tier-features li::before {
  content: "✓";
  flex-shrink: 0;
  font-weight: 700;
  color: var(--success);
}

.tier-missing-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--slate-gray);
  margin: 12px 0 0;
}

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

.tier-missing li {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--slate-gray);
}

.tier-missing li::before {
  content: "✕";
  flex-shrink: 0;
  font-weight: 700;
  color: var(--silver);
}

.tier-btn,
.pack-btn {
  /* auto pushes the CTA to the bottom so every card's button aligns on one
     line regardless of how many feature rows each card has. */
  margin-top: auto;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--onyx-black);
  background: var(--onyx-black);
  color: var(--pure-white);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease, background 0.15s ease, color 0.15s ease;
}

.tier-btn:hover:not(:disabled),
.pack-btn:hover {
  opacity: 0.9;
}

.tier-btn:active:not(:disabled),
.pack-btn:active {
  transform: scale(0.98);
}

.tier-btn:disabled,
.pack-btn:disabled {
  background: var(--pure-white);
  color: var(--slate-gray);
  border-color: var(--silver);
  cursor: default;
}

/* Visible but not purchasable — a new client can see what's on offer
   without being told a plan is required first. Dimmed content (not the
   whole card, so the price/credit count stay legible) plus the disabled
   button above already carries "why". */
.pack-card-locked .pack-credits,
.pack-card-locked .pack-price {
  opacity: 0.55;
}

/* Reassurance row under the pricing grid — the four things a client
   worries about right before committing to a recurring charge, answered
   inline so they never have to go looking for them. */
.trust-strip {
  list-style: none;
  margin: 20px 0 0;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: center;
  background: var(--pure-white);
  border: 1px solid var(--silver);
  border-radius: var(--radius-md);
}

.trust-strip li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--onyx-black);
}

.trust-strip svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: var(--success);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pack-credits {
  font-size: 13.5px;
  color: var(--slate-gray);
  margin: 0;
}

.pack-price {
  font-size: 18px;
  font-weight: 700;
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pack-price-original {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-gray);
  text-decoration: line-through;
}

.pack-discount-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 2px 7px;
  border-radius: 999px;
}

.transaction-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.transaction-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--silver);
  border-radius: var(--radius-sm);
}

.transaction-desc {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
}

.transaction-date {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--slate-gray);
}

.transaction-amount {
  font-weight: 700;
  font-size: 14px;
  flex: none;
}

.transaction-amount.positive {
  color: var(--success);
}

.transaction-amount.negative {
  color: var(--onyx-black);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.modal-overlay.modal-open {
  opacity: 1;
}

.modal-box {
  width: 100%;
  max-width: 400px;
  background: var(--pure-white);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.modal-overlay.modal-open .modal-box {
  transform: translateY(0) scale(1);
}

.modal-box h2 {
  font-size: 18px;
  margin: 0 0 10px;
}

.modal-box p {
  color: var(--slate-gray);
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modal-btn {
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--silver);
  background: var(--pure-white);
  font-family: "Inter", sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.modal-cancel:hover {
  border-color: var(--slate-gray);
}

.modal-btn:active {
  transform: scale(0.98);
}

/* Default confirm = positive commitment (subscribe, buy): confident onyx
   black, never red. Red is reserved for the -danger variant (delete,
   downgrade that loses credits) so it keeps its "stop and think" meaning. */
.modal-confirm {
  border-color: var(--onyx-black);
  background: var(--onyx-black);
  color: var(--pure-white);
}

.modal-confirm:hover {
  opacity: 0.9;
}

.modal-confirm-danger {
  border-color: var(--error);
  background: var(--error);
  color: var(--pure-white);
}

.modal-reassure {
  margin: 14px 0 0 !important;
  padding-top: 14px;
  border-top: 1px solid var(--off-white);
  font-size: 12px !important;
  line-height: 1.5;
  color: var(--slate-gray);
  text-align: center;
}

/* ---------- Undo toast ---------- */

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px 12px 18px;
  background: var(--onyx-black);
  color: var(--pure-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  line-height: 1.5;
  z-index: 90;
}

.undo-toast span {
  flex: 1;
}

.undo-toast-btn {
  border: none;
  background: none;
  color: var(--pure-white);
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  flex: none;
  align-self: flex-start;
}

.notice-urgent {
  background: var(--error);
  box-shadow: 0 8px 24px rgba(192, 57, 43, 0.35);
}

/* ---------- Motion & entrances ---------- */

/* A quiet fade-and-rise on the main content each load — reads as "the app
   is composed and considered," which is exactly the feeling that makes a
   client comfortable putting money on the table. Deliberately subtle: 8px
   and 0.4s, never a bouncy or attention-grabbing entrance. */
@keyframes onyx-rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main {
  animation: onyx-rise-in 0.4s ease both;
}

.auth-main {
  animation: onyx-rise-in 0.4s ease both;
}

.status-box {
  animation: onyx-rise-in 0.3s ease both;
}

/* Everyone who's asked their OS to reduce motion gets none of it — no
   entrances, no card lifts, no spinners spinning fast. Accessibility isn't
   optional polish; a page that ignores this reads as careless. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  main,
  .auth-main,
  .status-box {
    animation: none;
  }

  .tier-card:hover,
  .pack-card:hover,
  .tier-card.featured:hover,
  .tier-card.featured-gold:hover {
    transform: none;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 600px) {
  .topbar {
    padding: 14px 18px;
  }

  main {
    padding: 32px 16px 110px;
  }

  h1 {
    font-size: 24px;
  }

  .option-grid {
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }

  .generate-btn {
    position: sticky;
    bottom: 14px;
    box-shadow: var(--shadow-md);
  }

  .trust-strip {
    gap: 10px 16px;
  }

  .trust-strip li {
    font-size: 12px;
  }
}
