:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --paper: #f6f7f9;
  --mint: #1b998b;
  --coral: #ef6f61;
  --gold: #e0a458;
  --blue: #386fa4;
  --shadow: 0 20px 60px rgba(17, 24, 39, 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;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(27, 153, 139, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(239, 111, 97, 0.14), transparent 38%),
    var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 24px;
}

.workspace,
.preview-rail {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(216, 222, 232, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  padding: clamp(24px, 4vw, 48px);
  border-radius: 8px;
}

.preview-rail {
  position: sticky;
  top: 28px;
  align-self: start;
  border-radius: 8px;
  padding: 18px;
}

.masthead {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 32px;
}

.masthead > div {
  min-width: 0;
  flex: 1 1 auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(1.55rem, 3.2vw, 2.5rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.copy-button,
.secondary-button,
.primary-button,
.upload-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  min-height: 42px;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.secondary-button,
.upload-button,
.copy-button {
  padding: 0 14px;
}

.reset-link {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reset-link:hover {
  color: var(--ink);
}

.techie-frame {
  width: clamp(92px, 16vw, 150px);
  height: 220px;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

#techieImage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top center;
}

.masthead-description {
  margin-top: 18px;
  max-width: 100%;
}

.editor {
  display: grid;
  gap: 18px;
}

.workspace-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
}

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

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

.field span {
  font-size: 0.82rem;
  font-weight: 800;
  color: #283040;
}

.field small {
  min-height: 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.field-error {
  color: #b42318;
  font-weight: 800;
}

.field-error:not([hidden])::before {
  content: " ";
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 4px rgba(27, 153, 139, 0.14);
}

.publish-panel {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(27, 153, 139, 0.35);
  border-radius: 8px;
  background: rgba(27, 153, 139, 0.08);
}

.publish-panel[hidden] {
  display: none;
}

.publish-panel > span {
  font-size: 0.82rem;
  font-weight: 800;
  color: #283040;
}

.publish-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.secondary-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  text-decoration: none;
}

.compact-action {
  min-height: 34px;
  align-self: center;
  padding: 0 10px;
  font-size: 0.78rem;
}

.toolbar,
.panel-head {
  display: flex;
  align-items: start;
  gap: 12px;
  min-width: 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  justify-items: stretch;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.tab {
  min-width: 0;
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab:last-child {
  border-right: 0;
}

.tab.is-active {
  color: #fff;
  background: var(--blue);
}

.toggle {
  display: grid;
  grid-template-columns: auto minmax(0, max-content);
  align-items: center;
  column-gap: 4px;
  min-width: 0;
  max-width: 100%;
  justify-self: start;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.toggle span {
  min-width: 0;
  max-width: 100%;
}

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

.preview-card {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #cfd7e4;
  border-radius: 8px;
  background: #fff;
}

.preview-card.is-small {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
}

.preview-card.is-slack {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  padding: 12px;
  gap: 12px;
  border-left: 4px solid var(--gold);
}

.preview-image-wrap {
  position: relative;
  aspect-ratio: 1.91 / 1;
  background: linear-gradient(135deg, #eceff5, #dfe7ee);
  overflow: hidden;
}

.preview-card.is-small .preview-image-wrap,
.preview-card.is-slack .preview-image-wrap {
  aspect-ratio: 1 / 1;
  min-width: 112px;
  min-height: 112px;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
}

.preview-image-wrap.has-image img {
  display: block;
}

.image-empty {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 10px;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.2;
}

.preview-image-wrap.is-empty .image-empty,
.preview-image-wrap.has-error .image-empty {
  display: grid;
}

.preview-copy {
  padding: 14px;
}

.preview-card.is-small .preview-copy,
.preview-card.is-slack .preview-copy {
  padding: 0;
}

.preview-domain {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-copy h2 {
  margin: 0 0 7px;
  font-size: 1.08rem;
  line-height: 1.24;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.preview-copy p:last-child {
  display: -webkit-box;
  margin: 0;
  color: #475467;
  font-size: 0.92rem;
  line-height: 1.42;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.checks div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.checks p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.check-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--coral);
  flex: 0 0 auto;
}

.check-dot.is-good {
  background: var(--mint);
}

.code-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  overflow: hidden;
}

.panel-head {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-head h2 {
  margin: 0;
  font-size: 0.95rem;
}

.copy-button {
  min-height: 34px;
  background: #f9fafb;
}

pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cookie-banner {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(420px, calc(100% - 36px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .preview-rail {
    position: static;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 22px;
  }

  .field-grid,
  .publish-row,
  .preview-card.is-small,
  .preview-card.is-slack {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

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

  .cookie-banner {
    align-items: stretch;
    flex-direction: column;
  }
}
