:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #667085;
  --line: #d8dee8;
  --surface: #ffffff;
  --page: #f4f7fb;
  --accent: #007a7a;
  --accent-dark: #005c5c;
  --warn: #8a5a00;
  --shadow: 0 18px 45px rgba(30, 46, 64, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
}

a { color: var(--accent-dark); }

.app {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
  line-height: 1.15;
}

h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: 1.05rem; }

.brand-link {
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 14px;
  margin-bottom: 18px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 126px;
  border: 1px dashed #95a3b8;
  border-radius: 8px;
  background: #f9fbfd;
  cursor: pointer;
  text-align: center;
}

.dropzone.drag-over {
  border-color: var(--accent);
  background: #ecfbfb;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.drop-title {
  font-weight: 800;
  font-size: 1.08rem;
}

.drop-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.preview-panel,
.compose-panel {
  padding: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.25rem;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  background: #e8edf4;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

canvas {
  display: none;
  max-width: 100%;
  height: auto;
  background: #fff;
}

canvas.ready { display: block; }

.empty-state {
  position: absolute;
  color: var(--muted);
  margin: 0;
  padding: 0 20px;
  text-align: center;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

select:disabled,
textarea:disabled {
  color: #98a2b3;
  background: #f8fafc;
}

.course-link {
  min-height: 28px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.button,
.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.ghost,
.share-button {
  background: #fff;
  color: var(--accent-dark);
}

.button:disabled,
.share-button[aria-disabled="true"] {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--warn);
  font-size: 0.92rem;
}

@media (max-width: 920px) {
  .app { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .content-grid { grid-template-columns: 1fr; }
  .preview-frame { min-height: 300px; }
}

@media (max-width: 540px) {
  .share-grid { grid-template-columns: 1fr 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .brand-link { white-space: normal; }
}
