:root {
  color-scheme: light;
  --bg: #f5f2ea;
  --panel: #fffdfa;
  --text: #211f1b;
  --muted: #6d675d;
  --border: #ddd4c7;
  --accent: #0f6b5d;
  --accent-strong: #0a4f45;
  --soft: #e7f2ef;
  --warning: #7b4f12;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 16px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(1.55rem, 5vw, 2.25rem);
  line-height: 1.2;
}

.settings-button,
.back-button,
.secondary {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.settings-button {
  padding: 0 14px;
}

.settings-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.settings-panel label,
.note-field {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.settings-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.preview-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.preview-name,
.preview-business {
  margin-bottom: 0;
}

.preview-name {
  font-weight: 900;
}

.preview-business {
  color: var(--muted);
  font-size: 0.9rem;
}

.preview-stars {
  color: #b7791f;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.preview-text {
  margin-bottom: 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.edit-toggle {
  margin-top: 12px;
}

.draft-editor {
  margin-top: 12px;
}

input[type="text"] {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 108px;
  padding: 12px;
  resize: vertical;
  line-height: 1.6;
}

.progress {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
}

.progress-item {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-item.active,
.progress-item.done {
  color: var(--accent-strong);
}

.progress-line {
  height: 2px;
  background: var(--border);
}

.flow {
  display: block;
}

.step {
  display: none;
  min-height: calc(100vh - 148px);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(15, 107, 93, 0.05), transparent 220px),
    var(--panel);
}

.step.active {
  display: block;
}

.step-kicker {
  margin-bottom: 8px;
  color: var(--accent);
  font-weight: 800;
}

.rating-list,
.chip-grid,
.phrase-grid,
.final-actions {
  display: grid;
  gap: 10px;
}

.rating-list input,
.chip-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-list label,
.chip-grid label {
  cursor: pointer;
}

.rating-list span,
.chip-grid span,
.phrase-button {
  display: flex;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 800;
}

.rating-list span {
  gap: 12px;
  padding: 0 16px;
}

.rating-list strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
}

.chip-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.chip-grid span,
.phrase-button {
  justify-content: center;
  padding: 0 12px;
  text-align: center;
}

.phrase-button {
  width: 100%;
  cursor: pointer;
}

.rating-list input:checked + span,
.chip-grid input:checked + span,
.phrase-button:focus-visible,
.phrase-button:hover {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent-strong);
}

.back-button {
  margin-bottom: 18px;
  padding: 0 14px;
}

.primary,
.secondary {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

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

.secondary {
  border: 1px solid var(--accent);
  color: var(--accent-strong);
}

.policy-note {
  margin: 12px 0 18px;
  color: var(--warning);
  font-size: 0.92rem;
  line-height: 1.6;
}

button:focus-visible,
input:focus-visible + span,
textarea:focus-visible,
input[type="text"]:focus-visible {
  outline: 3px solid rgba(15, 107, 93, 0.28);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.52;
  cursor: wait;
}

code {
  font-size: 0.86em;
  word-break: break-all;
}

@media (max-width: 520px) {
  .app-shell {
    padding: 12px;
  }

  .step {
    min-height: calc(100vh - 132px);
    padding: 18px;
  }

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