/* ===================================================================
   SCRIPTLY.AI — Design System v2
   Direction: "Warm Studio" — soft, premium, photographic-feeling glass
   over a warm dark backdrop. Pill-shaped controls, a quiet serif for
   headlines, gentle elevation instead of heavy blur. The brand's
   signature is the Live Draft card: a softly elevated panel that
   shows real generated copy typing itself out, the way a finished
   piece of work would sit on a desk.
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* ---- Color tokens — black + violet, not warm neutrals ---- */
  --void: #07060A;
  /* true near-black background */
  --ink: #110E17;
  /* panel base, pre-glass */
  --ink-raised: #171220;
  /* raised surface */
  --glass-fill: rgba(167, 139, 250, 0.045);
  --glass-fill-strong: rgba(167, 139, 250, 0.085);
  --glass-border: rgba(167, 139, 250, 0.10);
  --glass-border-bright: rgba(167, 139, 250, 0.22);

  --terracotta: #7B5CFF;
  /* primary violet accent */
  --terracotta-soft: #A78BFA;
  --cream: #C9B8FF;
  /* secondary highlight, soft violet-lilac */
  --amber: #7B5CFF;
  /* kept as alias so existing rules using --amber still read violet */
  --amber-dim: #4B3A99;

  --text-pale: #F5F3F7;
  --text-mist: #B8B3C2;
  --text-faint: #6E6A78;

  --danger: #E58B7A;
  --success: #9DC9A0;

  /* kept for any legacy reference — now mapped violet instead of warm */
  --cyan: var(--terracotta);
  --violet: var(--cream);

  /* ---- Type ---- */
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', sans-serif;

  /* ---- Shape / depth ---- */
  --radius-sm: 14px;
  --radius-md: 22px;
  --radius-lg: 30px;
  --blur-glass: blur(14px) saturate(120%);

  /* soft elevation, not skeuomorphic carve — gentle warm drop shadows */
  --shadow-raised:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 14px 32px rgba(10, 8, 6, 0.45),
    0 2px 6px rgba(10, 8, 6, 0.3);
  --shadow-pressed:
    0 1px 3px rgba(10, 8, 6, 0.45) inset,
    0 -1px 0 rgba(255, 255, 255, 0.03) inset;
  --shadow-glass-panel:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 30px 70px rgba(10, 8, 6, 0.5),
    0 4px 14px rgba(10, 8, 6, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--void);
  color: var(--text-pale);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Ambient backdrop: warm glow field, like candlelight bloom ---- */
.bg-field {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--void);
  overflow: hidden;
}

.bg-field::before,
.bg-field::after {
  content: "";
  position: absolute;
  width: 58vw;
  height: 58vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.22;
}

.bg-field::before {
  background: radial-gradient(circle, var(--terracotta), transparent 70%);
  top: -16vw;
  right: -10vw;
  animation: drift1 24s ease-in-out infinite alternate;
}

.bg-field::after {
  background: radial-gradient(circle, var(--cream), transparent 72%);
  bottom: -20vw;
  left: -12vw;
  opacity: 0.12;
  animation: drift2 28s ease-in-out infinite alternate;
}

@keyframes drift1 {
  to {
    transform: translate(-5vw, 3vw) scale(1.08);
  }
}

@keyframes drift2 {
  to {
    transform: translate(4vw, -3vw) scale(1.12);
  }
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 247, 237, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 247, 237, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, rgba(0, 0, 0, 0.85), transparent 70%);
}

/* ===================== Layout shells ===================== */
.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ===================== Nav / status strip ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(26, 23, 20, 0.65);
  backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--glass-border);
}

.indicator-strip {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--amber-dim), var(--terracotta), var(--amber-dim));
  opacity: 0.7;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  max-width: 1240px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0;
  color: var(--text-pale);
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--terracotta-soft) 45%, var(--terracotta) 100%);
  box-shadow: 0 0 14px rgba(224, 138, 91, 0.5);
}

.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
}

.nav-links a {
  color: var(--text-mist);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color .2s;
}

.nav-links a:hover {
  color: var(--text-pale);
}

/* ===================== Pill buttons ===================== */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 12px 24px;
  transition: transform .12s ease, box-shadow .12s ease, filter .15s ease, background .15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  color: #241308;
  background: linear-gradient(180deg, var(--terracotta-soft) 0%, var(--terracotta) 100%);
  box-shadow: var(--shadow-raised), 0 0 22px rgba(224, 138, 91, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-ghost {
  color: var(--text-pale);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur-glass);
}

.btn-ghost:hover {
  background: var(--glass-fill-strong);
  border-color: var(--glass-border-bright);
}

.btn-ghost:active {
  transform: translateY(1px);
}

/* ===================== Glass panel primitive ===================== */
.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--blur-glass);
  box-shadow: var(--shadow-glass-panel);
}

/* ===================== Hero ===================== */
.hero {
  padding: 88px 0 56px;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 48px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 18px;
}

.eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--terracotta);
  box-shadow: 0 0 8px var(--terracotta);
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  50% {
    opacity: 0.35;
  }
}

h1.headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.3rem, 4.2vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--text-pale);
  margin-bottom: 20px;
}

h1.headline .accent {
  font-style: italic;
  color: var(--terracotta-soft);
}

.lede {
  font-size: 1.06rem;
  color: var(--text-mist);
  max-width: 480px;
  line-height: 1.65;
  margin-bottom: 30px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.hero-actions .meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ---- The Core: signature element, restyled as a "Live Draft" card ---- */
.core-stage {
  position: relative;
  height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.core {
  position: relative;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 24%),
    conic-gradient(from 180deg, var(--terracotta), var(--cream), var(--terracotta-soft), var(--terracotta));
  filter: saturate(1.0);
  box-shadow: 0 0 70px rgba(224, 138, 91, 0.3), 0 0 26px rgba(224, 138, 91, 0.25);
  animation: breathe 4.2s ease-in-out infinite;
}

.core::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--void);
}

.core::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  backdrop-filter: var(--blur-glass);
  background: rgba(255, 247, 237, 0.035);
  border: 1px solid rgba(255, 247, 237, 0.14);
}

.core-ring {
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  border: 1px solid rgba(255, 247, 237, 0.09);
}

.core-ring.r2 {
  inset: -52px;
  border-style: dashed;
  opacity: 0.4;
  animation: spin 30s linear infinite;
}

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

@keyframes breathe {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.06);
  }
}

.core-readout {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mist);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  padding: 6px 16px;
  border-radius: 999px;
  backdrop-filter: var(--blur-glass);
  white-space: nowrap;
}

/* ===================== Feature cards ===================== */
.section {
  padding: 68px 0;
}

.section-head {
  max-width: 560px;
  margin-bottom: 44px;
}

.section-head .eyebrow {
  color: var(--terracotta);
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 2.6vw, 2.2rem);
  margin-bottom: 10px;
}

.section-head p {
  color: var(--text-mist);
  line-height: 1.6;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  padding: 30px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .2s ease, border-color .2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-bright);
}

.card-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink-raised), var(--ink));
  box-shadow: var(--shadow-raised);
  color: var(--terracotta-soft);
  font-size: 1.2rem;
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
}

.card p {
  color: var(--text-mist);
  font-size: 0.92rem;
  line-height: 1.55;
}

/* ===================== Console preview (how it works) ===================== */
.console-mock {
  padding: 26px;
}

.console-mock .row {
  display: flex;
  gap: 18px;
}

.console-mock .line {
  height: 10px;
  border-radius: 6px;
  background: var(--glass-fill-strong);
  border: 1px solid var(--glass-border);
}

/* ===================== Footer ===================== */
.footer {
  border-top: 1px solid var(--glass-border);
  padding: 34px 0;
  color: var(--text-faint);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===================== Auth pages ===================== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 42px 38px;
}

.auth-card .brand {
  justify-content: center;
  margin-bottom: 8px;
}

.auth-sub {
  text-align: center;
  color: var(--text-mist);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--text-mist);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.field input {
  width: 100%;
  padding: 13px 18px;
  border-radius: 999px;
  background: var(--ink);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-pressed);
  color: var(--text-pale);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.field input:focus {
  border-color: var(--terracotta);
  box-shadow: var(--shadow-pressed), 0 0 0 3px rgba(224, 138, 91, 0.16);
}

.field-error {
  color: var(--danger);
  font-size: 0.78rem;
  margin-top: 6px;
  display: none;
}

.btn-block {
  width: 100%;
  text-align: center;
  margin-top: 6px;
}

.auth-foot {
  text-align: center;
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--text-mist);
}

.auth-foot a {
  color: var(--terracotta-soft);
  text-decoration: none;
}

.form-msg {
  font-size: 0.85rem;
  text-align: center;
  margin-top: 14px;
  min-height: 1.2em;
}

/* ---- Password show/hide toggle ---- */
.input-icon-wrap {
  position: relative;
}

.input-icon-wrap input {
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-mist);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
}

.password-toggle:hover {
  color: var(--text-pale);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ---- Auth divider + Google Sign-In mount ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  color: var(--text-faint);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-border);
}

.google-signin-wrap {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.form-msg.error {
  color: var(--danger);
}

.form-msg.success {
  color: var(--success);
}

/* ===================== Dashboard ===================== */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  min-height: calc(100vh - 64px);
}

.rail {
  padding: 24px 16px;
  border-right: 1px solid var(--glass-border);
}

.rail.right {
  border-right: none;
  border-left: 1px solid var(--glass-border);
}

.rail-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 18px 8px 10px;
}

.new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border-radius: 999px;
  background: var(--glass-fill);
  border: 1px dashed var(--glass-border-bright);
  color: var(--text-pale);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.new-btn:hover {
  background: var(--glass-fill-strong);
}

.history-item {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid transparent;
  font-size: 0.86rem;
  color: var(--text-mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}

.history-item:hover {
  background: var(--glass-fill);
  color: var(--text-pale);
}

.history-item.active {
  background: var(--glass-fill-strong);
  color: var(--text-pale);
  border-color: var(--glass-border-bright);
}

.history-empty {
  color: var(--text-faint);
  font-size: 0.85rem;
  padding: 0 12px;
}

.main-canvas {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.canvas-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.82rem;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--text-mist);
  cursor: pointer;
  transition: all .15s;
}

.chip:hover {
  border-color: var(--glass-border-bright);
}

.chip.active {
  color: #241308;
  background: linear-gradient(180deg, var(--terracotta-soft), var(--terracotta));
  border-color: transparent;
  font-weight: 600;
}

.prompt-panel {
  padding: 20px;
}

.prompt-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-pale);
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.5;
}

.prompt-footrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border);
}

.char-count {
  font-family: var(--font-body);
  font-size: 0.76rem;
  color: var(--text-faint);
}

.output-panel {
  flex: 1;
  padding: 24px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.output-empty {
  margin: auto;
  text-align: center;
  color: var(--text-faint);
}

.output-empty .core {
  width: 74px;
  height: 74px;
  margin: 0 auto 16px;
  animation: none;
  opacity: 0.55;
}

.output-text {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.98rem;
  color: var(--text-pale);
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.thinking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-mist);
  font-family: var(--font-body);
  font-size: 0.84rem;
}

.thinking-row .core {
  width: 22px;
  height: 22px;
  box-shadow: none;
}

/* ---- Soft slider ---- */
.slider-group {
  margin-bottom: 22px;
  padding: 0 8px;
}

.slider-group .slabel {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-mist);
  margin-bottom: 10px;
}

.slider-group .slabel span:last-child {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--terracotta-soft);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--amber-dim), var(--terracotta));
  box-shadow: var(--shadow-pressed);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #e9ddc8 60%, #c4b7a0 100%);
  box-shadow: var(--shadow-raised), 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  margin-top: -1px;
}

/* ---- Soft toggle ---- */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 8px;
}

.toggle-row span {
  font-size: 0.86rem;
  color: var(--text-mist);
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-track {
  position: absolute;
  inset: 0;
  border-radius: 30px;
  cursor: pointer;
  background: var(--ink);
  box-shadow: var(--shadow-pressed);
  transition: .2s;
}

.slider-track::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #d8cdb9 70%);
  box-shadow: var(--shadow-raised);
  transition: .2s;
}

.switch input:checked+.slider-track {
  background: linear-gradient(180deg, var(--terracotta-soft), var(--terracotta));
}

.switch input:checked+.slider-track::before {
  transform: translateX(20px);
  background: radial-gradient(circle at 35% 30%, #fff, #fff 80%);
}

/* ===================== Misc / utility ===================== */
.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.mt-8 {
  margin-top: 8px;
}

.hidden {
  display: none !important;
}


/* ===================== Trend Intelligence Panel ===================== */
.trend-panel {
  margin-bottom: 16px;
  padding: 22px 26px;
}

.trend-panel-head {
  margin-bottom: 14px;
}

.trend-panel-head .eyebrow {
  margin-bottom: 6px;
}

.trend-sub {
  font-size: 0.84rem;
  color: var(--text-mist);
  margin: 0;
  line-height: 1.55;
}

.trend-input-row {
  display: flex;
  gap: 10px;
}

.trend-input-row input {
  flex: 1;
  background: var(--ink);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-pale);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 11px 18px;
  box-shadow: var(--shadow-pressed);
  outline: none;
  transition: border-color 0.15s;
}

.trend-input-row input:focus {
  border-color: var(--terracotta);
}

.trend-result {
  margin-top: 14px;
  padding: 16px 18px;
  background: rgba(10, 8, 6, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.trend-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--terracotta-soft);
  background: rgba(224, 138, 91, 0.12);
  border: 1px solid rgba(224, 138, 91, 0.28);
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 8px;
}

.trend-insight {
  font-size: 0.87rem;
  color: var(--text-mist);
  margin: 0 0 10px;
  line-height: 1.55;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 7px 16px;
}

/* ===================== Slider sub-labels ===================== */
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-mist);
  opacity: 0.6;
  padding: 0 2px;
  margin-top: 4px;
}

/* ===================== Platform select ===================== */
.platform-select {
  width: 100%;
  margin: 4px 8px 0;
  padding: 10px 16px;
  background: var(--ink);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-mist);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  box-shadow: var(--shadow-pressed);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
}

.platform-select option {
  background: #2a251f;
}

/* ===================== History type badge ===================== */
.history-type {
  display: block;
  font-size: 0.68rem;
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--terracotta-soft);
  opacity: 0.85;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;

}

/* ===================== Accessibility: keyboard focus ===================== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.chip:focus-visible,
.history-item:focus-visible {
  outline: 2px solid var(--terracotta-soft);
  outline-offset: 2px;
}

/* ===================== Tablet breakpoint ===================== */
@media (max-width: 880px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .core-stage {
    height: 280px;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    border: none;
    border-bottom: 1px solid var(--glass-border);
  }

  .rail.right {
    border-bottom: none;
    border-top: 1px solid var(--glass-border);
  }
}

/* ===================== Phone breakpoint ===================== */
@media (max-width: 560px) {
  .shell {
    padding: 0 18px;
  }

  .nav {
    padding: 14px 18px;
  }

  .nav-links {
    gap: 10px;
  }

  .nav-links a:not(.btn) {
    display: none;
  }

  .nav-links .btn {
    padding: 9px 16px !important;
    font-size: 0.85rem;
  }

  .brand {
    font-size: 1.15rem;
  }

  .hero {
    padding: 48px 0 36px;
  }

  h1.headline {
    font-size: clamp(1.9rem, 8vw, 2.4rem);
  }

  .lede {
    font-size: 1rem;
  }

  .hero-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .hero-actions .btn {
    width: 100%;
    text-align: center;
  }

  .core-stage {
    height: 200px;
    margin-top: 8px;
  }

  .core {
    width: 150px;
    height: 150px;
  }

  .core-ring {
    inset: -16px;
  }

  .core-ring.r2 {
    inset: -32px;
  }

  .section {
    padding: 48px 0;
  }

  .section-head {
    margin-bottom: 28px;
  }

  .card {
    padding: 22px;
  }

  .footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 24px 0;
  }

  .auth-card {
    padding: 32px 24px;
    max-width: 100%;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
  }

  .main-canvas {
    order: 1;
    padding: 18px 16px;
  }

  .rail {
    order: 2;
    padding: 18px 16px;
  }

  .rail.right {
    order: 3;
  }

  .canvas-toolbar {
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .canvas-toolbar::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .trend-panel {
    padding: 18px 20px;
  }

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

  .trend-input-row .btn {
    width: 100%;
  }

  .prompt-panel {
    padding: 16px;
  }

  .prompt-footrow {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .prompt-footrow>div {
    justify-content: space-between;
  }

  .output-panel {
    padding: 18px;
    min-height: 200px;
  }

  .history-item {
    font-size: 0.88rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  .core,
  .core-ring.r2,
  .bg-field::before,
  .bg-field::after,
  .eyebrow .dot {
    animation: none !important;
  }
}

/* ===================== Sidebar polish (Director / Ad Creator) ===================== */
.rail-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  color: var(--terracotta-soft);
  flex-shrink: 0;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.history-item:hover {
  box-shadow: 0 2px 10px rgba(123, 92, 255, 0.12);
}

/* Give the active/hovered state a left accent bar, like a bookmark tab */
.history-item {
  position: relative;
  padding-left: 16px;
}

.history-item::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: transparent;
  transition: background .15s;
}

.history-item:hover::before {
  background: var(--glass-border-bright);
}

.history-item.active::before {
  background: linear-gradient(180deg, var(--terracotta-soft), var(--terracotta));
}

/* Subtle divider under the nav links (Director's Assist / Ad Creator / Console) at top of rail */
.rail .new-btn+.new-btn {
  margin-bottom: 14px;
}

.rail .new-btn:last-of-type {
  margin-bottom: 4px;
}

.rail .new-btn:last-of-type+.rail-title {
  border-top: 1px solid var(--glass-border);
  padding-top: 18px;
}

/* Empty state gets a touch more personality than a flat gray line */
.history-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--text-faint);
  opacity: 0.8;
}

/* ===================== History item: label above text, with separators ===================== */
.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  white-space: normal;
  padding-bottom: 13px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}

.history-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.history-type {
  display: block;
  margin-bottom: 0;
  /* was 2px, gap above now handles spacing */
}

/* The prompt text itself — was inline before, now its own line, truncated */
.history-item>*:not(.history-type) {
  font-size: 0.86rem;
  color: var(--text-mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* ===================== History item: label above text, with separators ===================== */
.history-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  white-space: normal;
  padding-bottom: 13px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
}

.history-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.history-prompt {
  display: block;
  font-size: 0.86rem;
  color: var(--text-mist);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}