:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6b6f76;
  --line: #d8dde6;
  --paper: #fffdf8;
  --panel: #f6f8fb;
  --mint: #51bfa3;
  --coral: #f06d5f;
  --blue: #3d72c9;
  --gold: #e4a72f;
  --shadow: 0 24px 70px rgba(24, 34, 51, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(81, 191, 163, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(240, 109, 95, 0.2), transparent 34%),
    #eef2f5;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.workspace {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: 410px minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
}

.control-panel,
.preview-panel {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.preview-panel {
  padding: 24px;
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(90deg, rgba(61, 114, 201, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(61, 114, 201, 0.08) 1px, transparent 1px),
    rgba(255, 253, 248, 0.94);
  background-size: 26px 26px;
}

.brand,
.card-header,
.preview-topbar,
.toolbar,
.range-row,
.fake-actions,
.tag-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
}

.brand-mark {
  width: 48px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

h2 {
  font-size: 24px;
}

.field-label {
  display: block;
  color: #30343b;
  font-size: 14px;
  font-weight: 800;
}

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

textarea:focus,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(61, 114, 201, 0.25);
  outline-offset: 2px;
}

.toolbar {
  gap: 10px;
}

.primary-button,
.ghost-button,
.segment,
.icon-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.segment:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  flex: 1;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(23, 23, 23, 0.18);
}

.ghost-button {
  padding: 0 18px;
  background: #fff;
  border-color: var(--line);
  color: #30343b;
  font-weight: 800;
}

.field-group {
  display: grid;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

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

.range-row {
  justify-content: space-between;
}

output {
  color: var(--blue);
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--coral);
}

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

.metrics div {
  min-height: 82px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metrics span {
  color: var(--ink);
  font-size: 27px;
  font-weight: 950;
}

.metrics small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.preview-topbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.icon-button {
  width: 46px;
  aspect-ratio: 1;
  background: var(--gold);
  color: #171717;
  font-size: 22px;
  font-weight: 900;
}

.share-card {
  width: min(470px, 100%);
  min-height: 520px;
  margin: auto;
  padding: 28px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
  box-shadow: 0 30px 60px rgba(17, 24, 39, 0.16);
  transition: background 180ms ease, color 180ms ease;
}

.moments-card {
  background: #ffffff;
}

.redbook-card {
  background: linear-gradient(180deg, #fffafa, #ffffff 42%);
  border-top: 8px solid #f25263;
}

.chat-card {
  background: #eaf3ee;
}

.roast-card {
  background: #191919;
  color: #fffdf8;
}

.card-header {
  gap: 12px;
  margin-bottom: 28px;
}

.avatar {
  width: 54px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--mint);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.card-header h3 {
  font-size: 18px;
}

.card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.roast-card .card-header p {
  color: #b7bcc5;
}

.generated-copy {
  min-height: 230px;
  margin: 0;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tag-row {
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.tag-row span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(61, 114, 201, 0.1);
  color: var(--blue);
  font-size: 13px;
  font-weight: 850;
}

.roast-card .tag-row span {
  background: rgba(240, 109, 95, 0.18);
  color: #ff938a;
}

.fake-actions {
  justify-content: space-between;
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid rgba(107, 111, 118, 0.24);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.roast-card .fake-actions {
  color: #cdd1d8;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 16px;
    align-items: start;
  }

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

  .preview-panel {
    min-height: auto;
  }

  .share-card {
    min-height: 480px;
  }
}

@media (max-width: 520px) {
  .control-panel,
  .preview-panel {
    padding: 18px;
  }

  .segmented,
  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .generated-copy {
    font-size: 21px;
  }
}
