:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #697586;
  --line: #d9e0e8;
  --focus: #0f6f7d;
  --primary: #0e5f68;
  --primary-hover: #0a4b52;
  --secondary: #243447;
  --secondary-hover: #172333;
  --success: #147646;
  --error: #b42318;
  --shadow: 0 18px 45px rgba(20, 30, 45, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(244, 246, 248, 0.94)),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.04rem;
  line-height: 1.25;
}

.brand-link {
  flex: 0 0 auto;
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.brand-link:hover {
  color: var(--primary-hover);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

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

.form-panel,
.preview-panel,
.html-panel {
  padding: 22px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.with-action {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.field span {
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c9d3df;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

input {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 240px;
  padding: 14px;
  resize: vertical;
  background: #f8fafc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

input:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(15, 111, 125, 0.16);
}

.output-stack {
  display: grid;
  gap: 22px;
}

.preview-frame {
  overflow-x: auto;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.signature-preview {
  display: inline-block;
  min-width: 500px;
  font-family: Montserrat, Helvetica, Arial, sans-serif;
}

.button {
  min-height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible {
  outline: 3px solid rgba(15, 111, 125, 0.28);
  outline-offset: 2px;
}

.button-primary {
  background: var(--success);
}

.button-primary:hover {
  background: #0f5d37;
}

.button-secondary {
  background: var(--secondary);
}

.button-secondary:hover {
  background: var(--secondary-hover);
}

.copy-message {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 160ms ease;
}

.copy-message.is-visible {
  opacity: 1;
}

.copy-message.is-error {
  color: var(--error);
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1280px);
    padding: 18px 0;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.06;
  }

  .form-panel,
  .preview-panel,
  .html-panel {
    padding: 16px;
  }

  .with-action {
    display: grid;
  }

  .button {
    width: 100%;
  }
}
