:root {
  --bg: #f5faf7;
  --surface: #ffffff;
  --surface-soft: #eef8f3;
  --surface-warm: #fff8eb;
  --ink: #1d3029;
  --muted: #65766f;
  --primary: #2f8f72;
  --primary-dark: #1f6b55;
  --accent: #f0b84f;
  --line: #d7e7df;
  --line-strong: #bfd8cd;
  --shadow: 0 18px 45px rgba(39, 71, 61, 0.12);
  --shadow-soft: 0 10px 24px rgba(32, 49, 43, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fcfa 0%, var(--bg) 42%, #f4f8f6 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.hero {
  background:
    linear-gradient(135deg, rgba(238, 247, 242, 0.98), rgba(255, 248, 233, 0.92)),
    radial-gradient(circle at top right, rgba(240, 184, 79, 0.22), transparent 30%);
  padding: 22px clamp(18px, 5vw, 72px) 64px;
}

.topbar,
.hero-copy,
.app-shell {
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
}

.brand {
  color: var(--ink);
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  letter-spacing: 0;
  box-shadow: 0 10px 22px rgba(47, 143, 114, 0.25);
}

.brand-mark svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.brand-mark .instagram-dot {
  fill: currentColor;
  stroke: none;
}

.brand--instagram:hover,
.brand--instagram:focus-visible {
  color: var(--primary-dark);
}

.brand--instagram:focus-visible {
  outline: 3px solid rgba(47, 143, 114, 0.2);
  outline-offset: 4px;
}

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

.top-auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.access-status-note,
.auth-user {
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.auth-user {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-trigger,
.register-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius);
  font-weight: 900;
  padding: 8px 12px;
}

.auth-trigger {
  border: 0;
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 143, 114, 0.22);
}

.register-link {
  color: var(--primary-dark);
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.auth-signout {
  cursor: pointer;
  font-family: inherit;
}

.google-fallback {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-weight: 900;
  padding: 8px 12px;
}

.login-modal[hidden] {
  display: none;
}

.login-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: start center;
  padding: 76px 14px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.example-preview-modal[hidden] {
  display: none;
}

.example-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px 14px;
}

.youtube-modal[hidden] {
  display: none;
}

.youtube-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.image-generation-modal[hidden] {
  display: none;
}

.image-generation-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.image-generation-dialog {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(880px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  padding: clamp(18px, 4vw, 28px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-top: 7px solid var(--primary);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 70px rgba(17, 32, 28, 0.34);
}

.image-generation-header {
  padding-right: 42px;
}

.image-generation-header h2,
.image-generation-header p {
  margin: 0;
}

.image-generation-header h2 {
  margin-top: 4px;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.image-generation-header p:last-child {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.image-generation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.image-generation-prompt {
  max-height: 96px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  padding: 12px;
}

.youtube-dialog {
  position: relative;
  width: min(960px, calc(100vw - 28px));
  max-height: calc(100vh - 48px);
  padding: 20px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-top: 7px solid var(--primary);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 70px rgba(17, 32, 28, 0.34);
}

.youtube-dialog-header {
  padding: 2px 44px 16px 2px;
}

.youtube-dialog-header h2 {
  margin: 4px 0 4px;
  font-size: clamp(1.45rem, 4vw, 2rem);
}

.youtube-dialog-header p:last-child {
  margin: 0;
  color: var(--muted);
}

.youtube-player-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #101411;
}

.youtube-player-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.youtube-channel-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 160px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.youtube-channel-empty h3,
.youtube-channel-empty p {
  margin: 0;
}

.youtube-channel-empty p {
  margin-top: 4px;
  color: var(--muted);
}

.youtube-channel-icon {
  position: relative;
  width: 56px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary);
}

.youtube-channel-icon::after {
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 13px solid #fff;
  content: "";
  transform: translate(-50%, -50%);
}

.youtube-channel-link {
  white-space: nowrap;
  text-decoration: none;
}

.youtube-close {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--primary-dark);
  font-size: 1.8rem;
  line-height: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(21, 33, 29, 0.58);
  cursor: default;
}

.example-preview-dialog {
  position: relative;
  display: grid;
  width: min(430px, calc(100vw - 28px));
  height: min(608px, calc(100vh - 56px));
  box-sizing: border-box;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 28px 70px rgba(17, 32, 28, 0.34);
}

.example-preview-dialog img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 4px;
  object-fit: contain;
}

.example-preview-close {
  position: absolute;
  z-index: 1;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #fff;
  color: var(--primary-dark);
  font-size: 1.8rem;
  line-height: 1;
}

.login-dialog {
  position: relative;
  width: min(560px, 100%);
  border-top: 7px solid var(--primary);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 250, 0.98));
  box-shadow: 0 28px 70px rgba(17, 32, 28, 0.34);
  padding: 92px clamp(18px, 6vw, 56px) 24px;
}

.login-avatar {
  position: absolute;
  top: -72px;
  left: 50%;
  display: grid;
  width: 144px;
  height: 144px;
  place-items: center;
  transform: translateX(-50%);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 16px 32px rgba(47, 143, 114, 0.28);
}

.login-avatar span {
  position: relative;
  width: 68px;
  height: 72px;
}

.login-avatar span::before,
.login-avatar span::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
}

.login-avatar span::before {
  top: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.login-avatar span::after {
  bottom: 0;
  width: 70px;
  height: 38px;
  border-radius: 18px 18px 8px 8px;
}

.login-close {
  position: absolute;
  top: 22px;
  right: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 2rem;
  line-height: 1;
}

.login-dialog h2 {
  color: var(--primary-dark);
  font-size: clamp(1.9rem, 5vw, 2.35rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  margin: 0 -18px 28px;
  padding-bottom: 22px;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 1px solid #e9edf0;
}

.modal-login-form {
  display: grid;
  gap: 16px;
}

.modal-login-form input[type="text"],
.modal-login-form input[type="password"] {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 1.08rem;
  padding: 12px 14px;
}

.modal-login-form input:focus-visible {
  outline: 3px solid rgba(47, 143, 114, 0.2);
  border-color: var(--primary);
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #3f474d;
  flex-wrap: wrap;
}

.login-options a {
  color: #39444a;
  font-weight: 700;
  text-decoration: none;
}

.remember-login {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.remember-login input {
  width: 28px;
  height: 28px;
  accent-color: var(--primary);
}

.modal-submit {
  min-height: 52px;
  border: 0;
  border-radius: 3px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 12px 24px rgba(47, 143, 114, 0.22);
}

.modal-submit:hover,
.modal-submit:focus-visible {
  background: var(--primary-dark);
}

.modal-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.modal-auth-divider::before,
.modal-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e4ece8;
}

.modal-google {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 18px;
  text-align: center;
}

.modal-google .google-fallback {
  width: min(320px, 100%);
}

.modal-create-account {
  display: block;
  color: #3f474d;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.hero-copy {
  text-align: center;
  padding: 12px 0 0;
}

.eyebrow {
  color: var(--primary-dark);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: clamp(2.9rem, 8vw, 5.7rem);
  line-height: 0.98;
  margin: 0 0 18px;
}

.hero-title {
  display: grid;
  gap: 2px;
  justify-items: center;
  letter-spacing: 0;
}

.hero-title-main,
.hero-title-sub {
  display: block;
}

.hero-title-main {
  color: var(--ink);
  font-size: clamp(3.6rem, 9vw, 7rem);
  font-weight: 950;
  line-height: 0.9;
}

.hero-title-sub {
  color: var(--primary-dark);
  font-size: clamp(2.55rem, 6.8vw, 5rem);
  font-weight: 850;
  line-height: 1;
}

.subtitle {
  color: var(--muted);
  font-size: clamp(1.08rem, 2.5vw, 1.35rem);
  max-width: 680px;
  margin: 0 auto 28px;
}

.primary-button,
.secondary-button,
.copy-button,
.ai-link-button {
  border: 0;
  border-radius: var(--radius);
  font-weight: 900;
  min-height: 48px;
  padding: 13px 18px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(47, 143, 114, 0.24);
}

.video-button {
  padding-inline: 20px;
}

.video-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  flex: 0 0 auto;
}

.video-icon::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #fff;
}

.secondary-button,
.copy-button {
  background: var(--surface-soft);
  color: var(--primary-dark);
}

.copy-button,
.ai-link-button {
  min-height: 42px;
  padding: 10px 14px;
  white-space: nowrap;
}

.ai-link-button {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.template-list button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  min-height: 104px;
  padding: 18px;
  text-align: left;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.template-list button:hover,
.primary-button:hover,
.secondary-button:hover,
.copy-button:hover,
.ai-link-button:hover {
  transform: translateY(-1px);
}

.ai-link-button:hover {
  border-color: rgba(47, 143, 114, 0.45);
  color: var(--primary-dark);
}

.template-list button:hover {
  border-color: rgba(47, 143, 114, 0.45);
  box-shadow: 0 14px 28px rgba(32, 49, 43, 0.1);
}

.app-shell {
  display: grid;
  gap: 24px;
  padding: 34px clamp(18px, 5vw, 72px) 56px;
}

.creation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 287px);
  gap: 24px;
  align-items: stretch;
}

.auth-box,
.security-panel,
.form-panel,
.examples-panel,
.templates-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.auth-page-hero {
  background:
    linear-gradient(135deg, rgba(238, 247, 242, 0.98), rgba(255, 248, 233, 0.92));
  padding: 22px clamp(18px, 5vw, 72px);
}

.auth-page-shell {
  max-width: 980px;
  margin: 0 auto;
  padding: 34px clamp(18px, 5vw, 72px) 56px;
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.auth-panel h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  margin: 0 0 22px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 18px;
}

.auth-box,
.security-panel {
  box-shadow: none;
  padding: 18px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.google-auth-block {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fcfa;
}

.google-auth-block small {
  color: var(--muted);
  font-weight: 800;
}

.login-dialog .modal-google {
  justify-items: center;
  margin-bottom: 18px;
  text-align: center;
}

.login-dialog .modal-google .google-fallback {
  width: min(320px, 100%);
}

.auth-divider {
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.check-field input {
  width: auto;
  min-height: 0;
  margin-top: 5px;
}

.password-meter {
  display: grid;
  gap: 7px;
}

.password-meter::before {
  content: "";
  height: 7px;
  border-radius: 99px;
  background: var(--surface-soft);
}

.password-meter span {
  display: block;
  width: 0;
  height: 7px;
  margin-top: -14px;
  border-radius: 99px;
  background: var(--line-strong);
  transition: width 160ms ease, background 160ms ease;
}

.password-meter small {
  color: var(--muted);
  font-weight: 800;
}

.password-meter.is-medium span {
  width: 62%;
  background: var(--accent);
}

.password-meter.is-strong span {
  width: 100%;
  background: var(--primary);
}

.security-panel {
  background:
    linear-gradient(135deg, rgba(238, 248, 243, 0.96), rgba(255, 248, 235, 0.88));
}

.security-panel h3 {
  margin: 0 0 8px;
}

.security-panel p {
  color: var(--muted);
  font-weight: 800;
  margin: 0 0 14px;
}

.security-panel ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  font-weight: 800;
}

.studio-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.studio-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-shell {
  max-width: 1060px;
}

.studio-panel {
  display: grid;
  gap: 18px;
}

.studio-intro {
  color: var(--muted);
  font-weight: 800;
  margin: -6px 0 0;
}

.studio-prompt-field {
  gap: 10px;
}

.studio-prompt {
  min-height: 260px;
  line-height: 1.55;
}

.studio-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.studio-status {
  color: var(--muted);
  font-weight: 800;
  margin: 0;
}

.studio-status[data-status-type="success"] {
  color: var(--primary-dark);
}

.studio-status[data-status-type="error"] {
  color: #9f321f;
}

.studio-loading {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 900;
  padding: 14px 16px;
}

.generated-image-wrap {
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(238, 248, 243, 0.82), rgba(255, 248, 235, 0.68));
  padding: clamp(14px, 3vw, 22px);
}

.generated-image-wrap img {
  width: min(100%, 760px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.examples-panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  position: sticky;
  top: 18px;
}

.template-library {
  scroll-margin-top: 18px;
}

.section-heading h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  margin: 0 0 22px;
}

.prompt-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.additional-field {
  gap: 12px;
}

label {
  color: var(--ink);
  font-weight: 900;
}

.field-hint {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfb;
  color: var(--ink);
  min-height: 48px;
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
}

#additionalInstructions {
  min-height: 150px;
  resize: vertical;
  overflow-y: hidden;
}

.attachment-box {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfb;
  padding: 16px;
}

.attachment-copy strong {
  display: block;
  color: var(--ink);
  font-weight: 900;
  margin-bottom: 4px;
}

.attachment-copy p {
  color: var(--muted);
  margin: 0;
}

.attachment-copy .attachment-notice {
  margin-top: 10px;
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 700;
}

.file-drop {
  display: grid;
  gap: 5px;
  justify-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary-dark);
  padding: 18px;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.file-drop:hover {
  border-color: var(--primary);
  background: #e9f6ef;
}

.file-drop span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.attachment-list:empty {
  display: none;
}

.attachment-list li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px 12px;
}

.attachment-list span {
  color: var(--ink);
  font-weight: 800;
}

.reference-file-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.reference-file-name {
  overflow-wrap: anywhere;
}

.reference-file-meta,
.reference-file-summary,
.reference-file-error,
.attachment-limit-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.reference-file-status {
  width: fit-content;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 0.74rem;
  font-weight: 900;
  padding: 3px 8px;
}

.reference-file-status.is-processing {
  background: #fff4d7;
  color: #755318;
}

.reference-file-status.is-error,
.reference-file-error {
  color: #9c3d32;
}

.reference-file-warning {
  margin: 0;
  color: #755318;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.reference-file-status.is-unsupported {
  background: #f3f1ed;
  color: #756d61;
}

.reference-file-summary {
  color: var(--ink);
  font-weight: 600;
}

.attachment-limit-note {
  color: #755318;
}

.attachment-list button {
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-weight: 900;
  padding: 8px 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(47, 143, 114, 0.13);
}

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

.form-actions {
  grid-column: 1 / -1;
}

.access-gate-note {
  grid-column: 1 / -1;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.coherence-feedback {
  grid-column: 1 / -1;
  border: 1px solid #e6c77a;
  border-radius: var(--radius);
  background: #fffaf0;
  color: #624b17;
  padding: 14px 16px;
}

.coherence-feedback strong {
  display: block;
  font-size: 0.92rem;
}

.coherence-feedback ul {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.template-list {
  display: grid;
  gap: 10px;
}

.template-library .template-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.template-list button,
.template-list article {
  min-height: 58px;
  box-shadow: none;
}

.template-list button span,
.template-list button small,
.template-list article span,
.template-list article small {
  display: block;
}

.template-list button small,
.template-list article small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 6px;
}

.template-list article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.template-list article span {
  color: var(--ink);
  font-weight: 900;
}

.plan-card-featured {
  border-color: rgba(47, 143, 114, 0.42);
  background: linear-gradient(180deg, rgba(239, 248, 244, 0.9), var(--surface));
}

.plan-badge {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: rgba(47, 143, 114, 0.12);
  color: var(--primary-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  padding: 5px 9px;
  text-transform: uppercase;
}

.checkout-note {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
  margin: 18px 0 0;
}

[data-auth-status][data-status-type="error"] {
  color: #9f2f2f;
}

.example-list {
  display: grid;
  gap: 13px;
  align-content: start;
  grid-auto-rows: auto;
  justify-items: center;
}

.possible-results-carousel {
  overflow: hidden;
}

.possible-results-track {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.possible-results-track.is-changing {
  opacity: 0;
  transform: translateY(6px);
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.carousel-indicator {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  opacity: 0.78;
  padding: 0;
  transition: background 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.carousel-indicator:hover,
.carousel-indicator:focus-visible {
  opacity: 1;
  outline: 2px solid rgba(47, 143, 114, 0.24);
  outline-offset: 3px;
}

.carousel-indicator.is-active {
  background: var(--primary);
  opacity: 1;
  transform: scale(1.16);
}

.example-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 320px;
  min-height: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdfb;
  padding: 9px;
}

.examples-panel .example-card {
  width: 100%;
  max-width: 320px;
  justify-self: center;
}

.example-card h3 {
  font-size: 0.97rem;
  margin: 10px 0 2px;
  min-height: 1.85em;
  display: flex;
  align-items: center;
}

.example-card p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0;
}

.example-preview {
  display: grid;
  width: min(100%, 300px);
  max-width: 300px;
  height: 160px;
  min-height: 160px;
  align-self: center;
  flex: 0 0 160px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  position: relative;
}

.example-reference-image {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 146px;
  max-width: none;
  height: 196px;
  max-height: none;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  box-shadow: 0 7px 16px rgba(29, 48, 41, 0.16);
  object-fit: fill;
}

.example-image-trigger {
  display: grid;
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 300px;
  height: 206px;
  min-height: 0;
  flex: 0 0 206px;
  align-self: center;
  box-sizing: border-box;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: zoom-in;
  overflow: hidden;
}

.example-image-trigger::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: -12px;
  background: var(--example-image) center / cover no-repeat;
  filter: blur(10px) saturate(0.8);
  opacity: 0.28;
}

.example-image-trigger:hover,
.example-image-trigger:focus-visible {
  border-color: var(--primary);
  outline: none;
}

.infographic-preview {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px;
}

.infographic-preview::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 18px;
  right: 18px;
  height: 12px;
  border-radius: 99px;
  background: #2f8f72;
}

.infographic-preview span {
  margin-top: 24px;
  border-radius: 6px;
  background: #eef8f3;
}

.infographic-preview span:nth-child(2),
.infographic-preview span:nth-child(3) {
  background: #fff3cf;
}

.game-preview {
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 14px;
  background: #fffaf0;
}

.game-preview span {
  border-radius: 50%;
  background: #2f8f72;
}

.game-preview span:nth-child(2),
.game-preview span:nth-child(3) {
  background: #f0b84f;
}

.cards-preview {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}

.cards-preview span {
  border-radius: 6px;
  background:
    linear-gradient(#2f8f72 0 12px, transparent 12px),
    #eef8f3;
}

.coloring-preview {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px;
  background: #fff;
}

.coloring-preview span {
  border: 2px solid var(--ink);
  border-radius: 50% 50% 44% 44%;
}

.poster-preview {
  align-content: center;
  gap: 9px;
  padding: 16px;
  background: linear-gradient(180deg, #fff8eb, #ffffff);
}

.poster-preview span {
  border-radius: 8px;
  background: #f0b84f;
  min-height: 16px;
}

.poster-preview span:nth-child(1) {
  background: #1f6b55;
}

.poster-preview span:nth-child(2) {
  width: 72%;
}

.poster-preview span:nth-child(3) {
  width: 52%;
  background: #bfd8cd;
}

.review-preview {
  gap: 8px;
  padding: 14px;
  background: #f8fcfa;
}

.review-preview span {
  min-height: 12px;
  border-radius: 99px;
  background: #bfd8cd;
}

.review-preview span:nth-child(1) {
  width: 90%;
  background: #2f8f72;
}

.review-preview span:nth-child(3) {
  width: 76%;
  background: #f0b84f;
}

.results-panel {
  scroll-margin-top: 18px;
}

.result-header {
  display: block;
}

.empty-state {
  display: none;
}

.results-workspace {
  display: grid;
  gap: 18px;
}

.prompt-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 14px 16px;
}

.prompt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.prompt-summary span {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 8px;
}

.prompt-quality {
  margin: 0;
  color: var(--primary-dark);
  font-weight: 900;
  text-align: left;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 253, 251, 0.98));
  padding: clamp(18px, 3vw, 24px);
  box-shadow: var(--shadow-soft);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.card-kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 28px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 9px;
}

.result-card h3 {
  font-size: clamp(1.1rem, 2.3vw, 1.45rem);
  margin: 0;
}

.result-card p {
  color: #40524b;
  margin: 0;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 13px 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .auth-layout,
  .creation-layout,
  .prompt-form {
    grid-template-columns: 1fr;
  }

  .examples-panel {
    position: static;
  }

  .image-generation-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .hero {
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 34px;
  }

  .top-auth-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .studio-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .studio-top-actions,
  .studio-actions {
    width: 100%;
  }

  .auth-trigger,
  .register-link {
    flex: 1;
    justify-content: center;
  }

  .login-modal {
    padding: 18px 12px;
  }

  .login-dialog {
    padding-inline: 18px;
  }

  .youtube-modal {
    padding: 12px;
  }

  .youtube-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .image-generation-modal {
    padding: 12px;
  }

  .image-generation-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    padding: 14px;
  }

  .youtube-dialog-header {
    padding: 2px 42px 12px 0;
  }

  .youtube-channel-empty {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 20px 16px;
  }

  .youtube-channel-link {
    grid-column: 1 / -1;
    width: 100%;
    text-align: center;
  }

  .login-avatar {
    width: 118px;
    height: 118px;
    top: -59px;
  }

  .form-actions .primary-button,
  .form-actions .secondary-button {
    width: 100%;
  }

  .prompt-overview {
    grid-template-columns: 1fr;
  }

  .prompt-quality {
    text-align: left;
  }

  .card-heading {
    display: grid;
  }

  .card-actions,
  .copy-button,
  .ai-link-button {
    width: 100%;
  }
}

@media (max-height: 780px) {
  .login-modal {
    place-items: center;
    padding: 18px 14px;
  }

  .login-dialog {
    width: min(560px, calc(100vw - 28px));
    max-height: calc(100dvh - 36px);
    box-sizing: border-box;
    overflow-y: auto;
    padding-top: 86px;
    padding-bottom: 16px;
    scrollbar-gutter: stable;
  }

  .login-avatar {
    top: 12px;
    width: 100px;
    height: 100px;
  }

  .login-avatar span {
    width: 48px;
    height: 52px;
  }

  .login-avatar span::before {
    width: 30px;
    height: 30px;
  }

  .login-avatar span::after {
    width: 50px;
    height: 28px;
  }

  .login-dialog h2 {
    margin-bottom: 16px;
    padding-bottom: 14px;
  }

  .modal-login-form {
    gap: 12px;
  }

  .modal-login-form input[type="text"],
  .modal-login-form input[type="password"] {
    min-height: 54px;
  }

  .modal-submit {
    min-height: 48px;
  }

  .modal-auth-divider {
    margin: 12px 0 10px;
  }

  .modal-google,
  .login-dialog .modal-google {
    margin-bottom: 8px;
  }
}
