:root {
  color-scheme: light;
  --ink: #20242a;
  --muted: #667085;
  --line: #d0d5dd;
  --page: #f4f6f8;
  --panel: #ffffff;
  --accent: #0f766e;
  --danger: #b42318;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--page);
  color: var(--ink);
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  align-items: center;
  background: #174ea6;
  border-bottom: 1px solid #103b82;
  display: flex;
  justify-content: flex-start;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 2;
}

main {
  margin: 0 auto;
  max-width: 1120px;
  padding: 24px 20px 48px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 750;
  gap: 6px;
  letter-spacing: 0;
  text-transform: uppercase;
}

input,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  text-transform: none;
  width: 100%;
}

textarea {
  line-height: 1.45;
  min-height: 136px;
  resize: vertical;
}

button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
  min-height: 40px;
  padding: 0 14px;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.danger {
  color: var(--danger);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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

.deck-title {
  margin: 0 auto 26px;
  max-width: 560px;
  text-align: center;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}

.slides-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
  margin: 0;
}

#slideCount {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

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

.add-slide-bottom {
  margin-top: 14px;
  width: 100%;
}

.slide-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
  scroll-margin-top: 140px;
  scroll-margin-bottom: 16px;
}

.slide-card-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.slide-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.slide-number {
  font-size: 14px;
  font-weight: 800;
}

.language-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.language-grid.english-only {
  grid-template-columns: 1fr;
}

.language-grid [hidden] {
  display: none;
}

.language-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  text-transform: none;
}

.language-toggle input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
}

.busy {
  opacity: 0.65;
  pointer-events: none;
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
  }

  .deck-title {
    max-width: none;
  }

  .actions {
    justify-content: stretch;
  }

  .actions button {
    flex: 1 1 130px;
  }

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

/* Workspace navigation */
[hidden] {
  display: none !important;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  bottom: 0;
  left: 0;
  padding: 28px 16px;
  position: fixed;
  top: 0;
  width: 220px;
}

.brand {
  color: var(--ink);
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
  margin: 0 12px 32px;
  text-decoration: none;
}

.sidebar-tabs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-tab {
  background: transparent;
  border-color: transparent;
  min-height: 46px;
  text-align: left;
}

.sidebar-tab:hover {
  background: var(--page);
}

.sidebar-tab[aria-selected="true"] {
  background: #e7f3f0;
  color: var(--accent);
}

.workspace {
  margin-left: 220px;
  min-width: 0;
}

.empty-state {
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  margin-top: 24px;
  padding: 64px 24px;
  text-align: center;
}

.empty-state svg {
  color: var(--accent);
}

.empty-state h2 {
  color: var(--ink);
  font-size: 18px;
  margin: 20px 0 8px;
}

.empty-state p {
  line-height: 1.5;
  margin: 0;
}

@media (max-width: 720px) {
  .sidebar {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 16px 20px;
    position: static;
    width: auto;
  }

  .brand {
    margin: 0 0 16px;
  }

  .workspace {
    margin-left: 0;
  }
}

/* Image studio */
.images-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #174ea6; color: white; padding: 22px; border-radius: 12px; }
.images-heading .eyebrow { color: #d8e8ff; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 9px; }
.images-heading h1 { font-family: Georgia, serif; font-weight: 500; font-size: 36px; }
.images-intro { color: var(--muted); max-width: 680px; line-height: 1.6; }
.connection-note { padding: 12px 16px; background: #e9f2ef; border: 1px solid #c6ded6; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.image-columns { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 1.4fr); gap: 20px; align-items: start; margin-top: 24px; }
.image-compose { display: grid; gap: 16px; }
.image-card { border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: white; }
.image-card h2 { margin: 0 0 12px; font-size: 15px; }
.image-card form, #imageGenerateForm { display: grid; gap: 14px; }
#imagePrompt { min-height: 190px; font-size: 15px; }
.image-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 5px 0; }
.image-options summary, #imageLayers summary { cursor: pointer; font-size: 13px; font-weight: 700; padding: 10px 0; }
.image-options > label { margin: 14px 0; }
select { width: 100%; font: inherit; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; min-height: 40px; padding: 8px; text-transform: none; }
.generate-button { width: 100%; min-height: 48px; }
.image-preview { background: #122a2d; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview-placeholder { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 9%; background: radial-gradient(ellipse at top right, #6d7151, transparent 70%), linear-gradient(120deg, #102e31, #243d37); color: #f9edcb; }
.preview-placeholder h3 { font: 500 clamp(22px, 3vw, 36px)/1.2 Georgia, serif; margin: 14px 0; }
.preview-placeholder p { color: #c8d4ce; font-size: 12px; }
.preview-cross { color: #d9b877; font-size: 24px; }
.preview-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
#imageSlidePosition { color: var(--muted); font-size: 12px; white-space: nowrap; }
.image-thumbnails { display: flex; overflow-x: auto; gap: 8px; padding: 12px 0; }
.image-thumbnails button { padding: 3px; flex: 0 0 100px; min-height: 0; border: 2px solid transparent; }
.image-thumbnails button[aria-pressed="true"] { border-color: var(--accent); }
.image-thumbnails img { width: 100%; display: block; border-radius: 3px; }
.asset-library { display: grid; gap: 8px; margin-top: 12px; }
.asset-row, .photo-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #edf0f2; font-size: 12px; overflow-wrap: anywhere; }
.asset-row button { flex-shrink: 0; }
.photo-control { flex-wrap: wrap; }
.photo-control select { font-size: 12px; }
#imageLayerList { display: grid; gap: 8px; }
.layer-row { padding: 10px; background: #f4f6f8; border-radius: 6px; font-size: 13px; }
.layer-row img { display: block; max-width: 100%; max-height: 130px; margin-top: 8px; background: #d9dfdf; }
.layer-row pre { white-space: pre-wrap; font: inherit; line-height: 1.5; }
.deck-history { display: grid; gap: 8px; }
.deck-history button { text-align: left; }
#imageGenerateForm[aria-busy="true"] { opacity: .75; }
@media (max-width: 1100px) { .image-columns { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .images-heading { align-items: start; flex-direction: column; } .images-heading h1 { font-size: 29px; } .image-card { padding: 14px; } }

[hidden] { display: none !important; }
.login-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-gate .image-card { width: min(100%, 460px); }

.brand-assets { margin-top: 24px; border: 2px solid var(--accent); background: #f4faf8; }
.brand-assets h2 { font-size: 21px; }
.generated-assets { margin-top: 24px; }
.asset-preview { width: 72px; height: 56px; object-fit: contain; background: white; border: 1px solid var(--line); border-radius: 6px; }
.asset-row span { flex: 1; }
@media (max-width: 600px) { .asset-row { flex-wrap: wrap; } }

.asset-upload { display: grid; gap: 14px; }

/* A quiet canvas: warm paper, confident typography, and a clear editing hierarchy. */
:root { --ink: #263c38; --muted: #6a7772; --line: #dce2da; --page: #f6f5ef; --accent: #28634f; }
button { border-radius: 9px; font-weight: 650; transition: background .15s, box-shadow .15s; }
button:not(:disabled):hover { background: #eef2e9; border-color: #a6b8a6; }
button.primary:not(:disabled):hover { background: #1c4d3c; color: white; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #9ac0a8; outline-offset: 2px; }
input, textarea, select { border-radius: 9px; }
label { font-size: 12px; letter-spacing: .015em; text-transform: none; }
.sidebar { background: #edf0e7; border-color: #dce2d5; padding-top: 36px; }
.brand { font-family: Georgia, serif; font-size: 24px; font-weight: 500; line-height: 1.15; letter-spacing: -.8px; margin-bottom: 40px; }
.sidebar-tab[aria-selected="true"] { background: #d9e5d5; color: #214d3a; }
#imageSignIn { margin-top: 32px; background: transparent; width: 100%; }
.topbar { background: #edf0e7; border-color: var(--line); padding: 20px; }
.images-workspace { max-width: 1480px; padding: 40px 32px 64px; }
.images-heading { background: none; color: var(--ink); padding: 0 0 12px; border-radius: 0; }
.images-heading .eyebrow { color: var(--accent); }
.images-heading h1 { font-size: clamp(32px, 3.5vw, 50px); letter-spacing: -1.5px; line-height: 1.08; }
.images-intro { margin-top: 8px; font-size: 15px; }
.connection-note { background: #eef1e7; border-color: #dce4d4; }
.image-columns { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.4fr); gap: 24px; }
.image-card { border-radius: 18px; border-color: #e0e5dc; padding: 24px; box-shadow: 0 4px 22px #263c3804; }
.image-card h2 { font-size: 16px; font-weight: 650; }
#imagePrompt { background: #fafbf7; min-height: 170px; }
.image-options { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 0; }
.image-options summary, #imageLayers summary { color: var(--accent); }
.preview-header { margin-bottom: 10px; }
.image-preview { border-radius: 12px; }
.image-thumbnails { gap: 10px; padding: 16px 0; }
.image-thumbnails button { border-radius: 7px; flex-basis: 112px; background: #f5f6f0; }
.deck-history button { font-weight: 500; background: #fafbf7; }
.slide-editor { display: grid; gap: 16px; margin: 24px 0 18px; padding-top: 24px; border-top: 1px solid var(--line); }
.editor-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.editor-heading h2 { margin: 0; }
.editor-badge { border-radius: 30px; padding: 6px 10px; background: #edf3e9; font-size: 10px; color: #436247; }
#editSlideText { min-height: 140px; }
.login-gate { background: radial-gradient(ellipse at 20% 20%, #e4ead9, transparent 60%), var(--page); }
.login-gate .image-card { padding: 40px; }
.login-gate h1 { font: 38px/1.1 Georgia, serif; letter-spacing: -1px; }
.login-gate p { line-height: 1.6; color: var(--muted); }
@media (max-width: 1180px) { .image-columns { grid-template-columns: 1fr; } }
@media (max-width: 720px) {
  .images-workspace { padding: 28px 16px 48px; }
  .sidebar { padding: 20px; }
  .brand { font-size: 23px; margin-bottom: 18px; }
  .sidebar-tabs { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar-tab { min-height: 40px; padding: 0 10px; }
  #imageSignIn { margin-top: 12px; width: auto; }
  .image-card { padding: 18px; }
  .editor-heading { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
