:root {
  --bg-base: #f8f5ee;
  --bg-panel: #fffdf8;
  --bg-soft: #efe8dc;
  --bg-sunken: #e7efe8;
  --ink: #1a1814;
  --text-secondary: #52493f;
  --text-muted: #857a6e;
  --border: #e2d8c9;
  --border-strong: #c6b9a8;
  --green: #2f6b57;
  --green-dark: #214f40;
  --blue: #425f93;
  --red-soft: #f8e7de;
  --gold-soft: #f5e7bd;
  --shadow: 0 24px 70px rgba(45, 35, 20, 0.1);
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Libre Baskerville", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(66, 95, 147, 0.16), transparent 36rem),
    linear-gradient(135deg, #f8f5ee 0%, #f4efe4 48%, #edf2ec 100%);
  color: var(--ink);
  font-family: var(--font-sans);
}

a {
  color: inherit;
}

.topbar {
  min-height: 72px;
  padding: 18px clamp(18px, 4vw, 44px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: var(--ink);
  color: #fffdf8;
  font-family: var(--font-serif);
  font-size: 0.92rem;
}

.topbar-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.app {
  padding: 10px clamp(14px, 3.6vw, 42px) 38px;
}

.workspace {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 430px) minmax(0, 1fr);
  gap: 22px;
}

.input-panel,
.output-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: clamp(20px, 3vw, 30px);
  align-self: start;
  position: sticky;
  top: 18px;
}

.output-panel {
  min-height: 720px;
  overflow: hidden;
}

.output-panel.updated {
  animation: card-flash 650ms ease-out;
}

@keyframes card-flash {
  0% {
    box-shadow: 0 0 0 4px rgba(47, 107, 87, 0.28), var(--shadow);
  }

  100% {
    box-shadow: var(--shadow);
  }
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.3vw, 3.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.lede {
  margin: 18px 0 26px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

.coach-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
}

.option-section {
  display: grid;
  gap: 8px;
}

.section-label {
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
}

.option-strip,
.option-stack {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.option-strip {
  max-height: 158px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
}

.option-chip {
  min-height: 40px;
  flex: 1 1 auto;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}

.option-chip:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.option-chip.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.option-section.compact .option-chip {
  flex: 1 1 auto;
  border-radius: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

textarea,
button {
  min-height: 46px;
  border-radius: 8px;
  font: inherit;
}

textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 112px;
  padding: 12px 13px;
  resize: vertical;
  line-height: 1.45;
}

textarea:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold-soft);
  outline-offset: 2px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-action:hover {
  background: var(--green-dark);
}

.boundary {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
}

.boundary h2 {
  margin: 0 0 8px;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.boundary p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.5;
}

.card-header {
  padding: clamp(22px, 4vw, 38px);
  background: linear-gradient(135deg, var(--bg-sunken), #fffaf0);
  border-bottom: 1px solid var(--border);
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  padding: 5px 11px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.card-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.situation {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--text-secondary);
  font-size: 1.08rem;
  line-height: 1.55;
}

.card-body {
  padding: clamp(18px, 3vw, 30px);
}

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

.panel {
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel h3 {
  margin: 0 0 9px;
  color: var(--blue);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel p,
.panel li {
  color: var(--text-secondary);
  line-height: 1.55;
}

.panel p {
  margin: 0;
}

.panel ul {
  margin: 0;
  padding-left: 1.1rem;
}

.safety {
  background: var(--red-soft);
  border-color: #e7b99e;
}

.visual-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.visual-card {
  min-height: 64px;
  display: grid;
  place-items: center;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--ink);
  text-align: center;
  font-weight: 700;
  line-height: 1.2;
}

.copy-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.secondary-action {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.secondary-action.listening {
  border-color: var(--green);
  background: var(--bg-sunken);
  color: var(--green-dark);
}

.toast {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.prompt-status {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
}

.action-status {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid var(--green);
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--green-dark);
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.3;
}

.action-status.updated {
  animation: status-pop 420ms ease-out;
}

@keyframes status-pop {
  0% {
    transform: scale(0.985);
    background: var(--gold-soft);
  }

  100% {
    transform: scale(1);
    background: var(--bg-sunken);
  }
}

.profile-helper {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.profile-helper summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.profile-note {
  margin: 10px 0 14px;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.profile-helper .option-section + .option-section {
  margin-top: 14px;
}

.profile-options {
  max-height: 176px;
}

.profile-options .option-chip {
  border-radius: 8px;
  font-size: 0.84rem;
}

.profile-result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.profile-result p {
  margin: 0 0 8px;
}

.profile-result p:last-of-type {
  margin-bottom: 12px;
}

.profile-result:empty {
  display: none;
}

.clear-profile {
  width: 100%;
}

.profile-panel {
  background: var(--bg-sunken);
}

.footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 clamp(14px, 3.6vw, 42px) 32px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--text-muted);
  font-size: 0.84rem;
}

.footer p {
  margin: 0 0 7px;
}

.footer-links {
  display: inline-flex;
  gap: 8px;
}

.footer-trademark {
  max-width: 590px;
  line-height: 1.5;
}

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

  .input-panel {
    position: static;
  }

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

@media (max-width: 680px) {
  .topbar,
  .footer {
    display: grid;
  }

  .field-grid,
  .section-grid,
  .visual-board {
    grid-template-columns: 1fr;
  }

  .meta-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
