:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --ink: #22211f;
  --muted: #66706d;
  --line: #d5dedb;
  --panel: #ffffff;
  --panel-strong: #e8f0ee;
  --accent: #2f7d73;
  --accent-dark: #205c54;
  --accent-soft: #dceee9;
  --warn: #b45b4f;
  --blue: #426a91;
  --shadow: 0 16px 40px rgba(43, 37, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(47, 125, 115, 0.08), transparent 34%),
    linear-gradient(300deg, rgba(180, 91, 79, 0.08), transparent 36%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.brand-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(213, 222, 219, 0.9);
  background: rgba(244, 247, 246, 0.94);
  padding: 12px clamp(16px, 4vw, 40px);
  backdrop-filter: blur(16px);
}

.brand-link,
.brand-strip nav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-link {
  color: var(--accent-dark);
  font-weight: 760;
}

.brand-link img {
  width: 30px;
  height: 30px;
}

.brand-strip nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.brand-strip nav a {
  border-radius: 999px;
  padding: 8px 10px;
}

.brand-strip nav a:hover {
  background: rgba(47, 125, 115, 0.08);
  color: var(--accent-dark);
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  width: min(1240px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.workspace,
.history-panel,
.panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.workspace {
  overflow: hidden;
}

.topbar,
.history-head,
.field-head,
.button-row,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p,
blockquote {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

.tool-note {
  max-width: 620px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover,
.secondary-button:hover,
.text-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.client-band {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 170px;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(47, 125, 115, 0.16), transparent 45%),
    var(--panel-strong);
}

.portrait {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  border: 1px solid rgba(32, 92, 84, 0.24);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 34%, #f6d1bd 0 20%, transparent 21%),
    radial-gradient(circle at 50% 84%, #426a91 0 34%, transparent 35%),
    #dceee9;
}

.portrait-mark {
  width: 42px;
  height: 34px;
  border-top: 4px solid rgba(32, 92, 84, 0.56);
  border-radius: 50%;
  transform: translateY(18px);
}

blockquote {
  max-width: 760px;
  font-size: 24px;
  line-height: 1.55;
  font-weight: 650;
}

.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  padding: 16px;
}

.panel {
  border-radius: 8px;
  padding: 18px;
}

.practice-panel {
  display: grid;
  gap: 20px;
}

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

.field-head span {
  color: var(--muted);
  font-size: 13px;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.emotion-inputs {
  display: grid;
  gap: 8px;
}

.map-toggle {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
  color: var(--accent-dark);
  font-weight: 750;
}

.map-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.hidden {
  display: none !important;
}

.chip-grid {
  display: grid;
  gap: 12px;
}

.choice-group {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(213, 222, 219, 0.72);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}

.choice-group h3 {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.35;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  background: #f8fbfa;
  color: var(--ink);
  font-size: 14px;
}

.chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.response-box {
  display: grid;
  gap: 10px;
}

.response-box span {
  font-size: 15px;
  font-weight: 700;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfdfc;
  color: var(--ink);
  line-height: 1.6;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfdfc;
  color: var(--ink);
}

textarea:focus,
input:focus {
  outline: 3px solid rgba(47, 125, 115, 0.18);
  border-color: var(--accent);
}

.primary-button,
.secondary-button,
.text-button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
}

.primary-button {
  border: 1px solid var(--accent-dark);
  background: var(--accent);
  color: #fff;
  font-weight: 750;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.text-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
}

.full {
  width: 100%;
}

.ethics-note {
  margin-top: -2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.feedback-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.feedback-section {
  display: grid;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.feedback-section:last-of-type {
  border-bottom: 0;
  padding-bottom: 0;
}

.score-block {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.score-label {
  color: var(--muted);
  font-size: 13px;
}

#scoreValue {
  font-size: 26px;
}

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebe8;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.feedback-list {
  display: grid;
  gap: 9px;
}

.feedback-item {
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  background: #f7faf9;
  line-height: 1.55;
  font-size: 14px;
}

.feedback-item.warn {
  border-left-color: var(--warn);
}

.suggested-emotions {
  display: grid;
  gap: 8px;
}

.suggested-emotion {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(213, 222, 219, 0.78);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfdfc;
  font-size: 14px;
}

.suggested-emotion strong {
  color: var(--accent-dark);
}

.stars {
  color: #b88724;
  letter-spacing: 1px;
}

.sample-box {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.sample-box p {
  color: #303735;
  line-height: 1.7;
}

.history-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  border-radius: 8px;
  padding: 18px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.empty-history {
  color: var(--muted);
  line-height: 1.6;
}

.history-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfc;
}

.history-card strong {
  color: var(--accent-dark);
}

.history-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

dialog {
  width: min(680px, calc(100vw - 30px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(34, 33, 31, 0.42);
}

.dialog-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.icp-footer {
  padding: 4px 24px 28px;
  text-align: center;
  font-size: 13px;
}

.icp-footer a {
  color: var(--muted);
}

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

  .history-panel {
    order: 2;
  }
}

@media (max-width: 640px) {
  .brand-strip {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .shell {
    width: min(100vw - 20px, 620px);
    padding: 10px 0;
  }

  .topbar,
  .client-band {
    padding: 18px;
  }

  .client-band {
    grid-template-columns: 1fr;
  }

  .portrait {
    width: 72px;
    height: 72px;
  }

  blockquote {
    font-size: 20px;
  }
}
