:root {
  --paper: #f5f1e8;
  --paper-deep: #e8ddcc;
  --ink: #17140f;
  --muted: #6f675b;
  --soft: #fffaf0;
  --surface: rgba(255, 252, 244, 0.9);
  --line: rgba(34, 28, 19, 0.14);
  --green: #12785f;
  --clay: #c75532;
  --blue: #315f9d;
  --gold: #d49a28;
  --shadow: 0 26px 80px rgba(62, 45, 20, 0.16);
  --radius: 30px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans SC", "Avenir Next", sans-serif;
  background:
    radial-gradient(circle at 8% 14%, rgba(199, 85, 50, 0.18), transparent 28%),
    radial-gradient(circle at 86% 9%, rgba(18, 120, 95, 0.2), transparent 31%),
    linear-gradient(135deg, #fff8e9 0%, #f4ead8 44%, #e8f0e5 100%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(18, 120, 95, 0.28);
  outline-offset: 3px;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: stretch;
}

.practice,
.mirror-panel {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.practice {
  min-height: calc(100vh - 36px);
  border-radius: 38px;
  padding: 22px 26px;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 14px;
}

.topbar,
.step-actions,
.mirror-head,
.history-dock header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.step-count {
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-top: 4px;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.quiet-button,
.text-button,
.secondary-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease;
}

.quiet-button,
.secondary-button {
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  border: 1px solid var(--line);
}

.quiet-button {
  min-height: 42px;
  padding: 0 18px;
}

.text-button {
  padding: 0;
  background: transparent;
  color: var(--muted);
}

.primary-button,
.secondary-button {
  min-height: 46px;
  padding: 0 22px;
}

.primary-button {
  min-width: 132px;
  background: var(--ink);
  color: white;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.quiet-button:hover,
.text-button:hover,
.secondary-button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.progress {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(23, 20, 15, 0.07);
  overflow: hidden;
}

.progress::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
}

.progress-line {
  position: absolute;
  inset: 5px auto 5px 5px;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 260ms ease;
}

.progress button {
  position: relative;
  z-index: 1;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(23, 20, 15, 0.55);
  font-weight: 900;
}

.progress button.is-current,
.progress button.is-done {
  color: white;
}

.question-card {
  min-height: 0;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.74), rgba(255, 248, 233, 0.48)),
    var(--soft);
  border: 1px solid rgba(255, 255, 255, 0.62);
  padding: clamp(18px, 2.4vw, 28px);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 16px;
}

.question-copy {
  max-width: 760px;
}

.question-copy h2 {
  margin-top: 8px;
  font-size: clamp(27px, 3.4vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}

.question-copy p:last-child {
  max-width: 620px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.step-body {
  min-width: 0;
}

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

.choice-card {
  position: relative;
  min-height: 108px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 18px;
  text-align: left;
  overflow: hidden;
  transition: transform 180ms ease, border 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.choice-card::after {
  content: "";
  position: absolute;
  right: -28px;
  top: -28px;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--choice-color, var(--green));
  opacity: 0.13;
}

.choice-card:hover,
.choice-card.is-selected {
  transform: translateY(-3px);
  border-color: rgba(18, 120, 95, 0.45);
  box-shadow: 0 18px 40px rgba(62, 45, 20, 0.12);
  background: white;
}

.choice-card.is-selected {
  box-shadow: 0 0 0 4px rgba(18, 120, 95, 0.14), 0 18px 40px rgba(62, 45, 20, 0.12);
}

.choice-card small {
  color: var(--choice-color, var(--green));
  font-weight: 900;
}

.choice-card strong {
  display: block;
  margin-top: 10px;
  font-size: 19px;
  line-height: 1.28;
}

.choice-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.event-field {
  display: grid;
  gap: 14px;
}

textarea {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 22px;
  resize: vertical;
  line-height: 1.8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.writing-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--muted);
  line-height: 1.65;
}

.writing-hint span {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(199, 85, 50, 0.12);
  color: var(--clay);
  font-weight: 900;
}

.result-view {
  display: grid;
  gap: 14px;
}

.pattern-panel,
.experiment-panel,
.insight-row article {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.72);
}

.pattern-panel {
  padding: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(18, 120, 95, 0.16), transparent 32%),
    rgba(255, 255, 255, 0.76);
}

.pattern-panel small,
.insight-row small,
.experiment-panel small {
  color: var(--clay);
  font-weight: 900;
}

.pattern-panel h3 {
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.22;
  letter-spacing: -0.04em;
}

.pattern-panel p,
.insight-row p,
.experiment-panel p,
.experiment-panel li {
  color: var(--muted);
  line-height: 1.7;
}

.pattern-panel p {
  margin-top: 12px;
}

.insight-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insight-row article,
.experiment-panel {
  padding: 18px;
}

.insight-row p,
.experiment-panel p {
  margin-top: 8px;
}

.experiment-panel {
  background:
    linear-gradient(135deg, rgba(23, 20, 15, 0.94), rgba(33, 48, 44, 0.94)),
    var(--ink);
  color: white;
}

.experiment-panel small,
.experiment-panel p,
.experiment-panel li {
  color: rgba(255, 255, 255, 0.72);
}

.experiment-panel h3 {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.22;
}

.experiment-panel ol {
  margin: 14px 0 0;
  padding-left: 22px;
}

.step-actions {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.mirror-panel {
  position: sticky;
  top: 28px;
  height: calc(100vh - 56px);
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 18px;
}

.mirror-head strong,
.history-dock strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.25;
}

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

.map-list div,
.signal-box {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
  padding: 14px;
}

.map-list dt {
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
}

.map-list dd {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.signal-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  background: rgba(18, 120, 95, 0.08);
}

.signal-box span {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(18, 120, 95, 0.12);
}

.signal-box p {
  color: #405348;
  line-height: 1.6;
}

.history-dock {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.history-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

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

.history-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  padding: 14px;
}

.history-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.history-item strong {
  display: block;
  margin-top: 8px;
  line-height: 1.45;
}

.history-item p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

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

  .practice {
    min-height: auto;
  }

  .mirror-panel {
    position: static;
    height: auto;
    grid-template-rows: auto;
  }

  .history-list {
    max-height: 320px;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    padding: 9px 0 18px;
    gap: 12px;
  }

  .practice,
  .mirror-panel {
    border-radius: 24px;
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .quiet-button {
    min-height: 38px;
    padding: 0 14px;
  }

  .progress button {
    min-height: 32px;
  }

  .question-card {
    min-height: auto;
    border-radius: 22px;
    padding: 16px;
    gap: 18px;
  }

  .question-copy h2 {
    font-size: 28px;
    letter-spacing: -0.04em;
  }

  .question-copy p:last-child {
    font-size: 15px;
  }

  .choice-grid,
  .insight-row {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 116px;
    border-radius: 20px;
    padding: 15px;
  }

  .choice-card strong {
    font-size: 18px;
  }

  textarea {
    min-height: 170px;
    border-radius: 20px;
    padding: 16px;
  }

  .step-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .primary-button,
  .secondary-button {
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
  }

  .mirror-panel {
    display: block;
  }

  .map-list,
  .signal-box {
    margin-top: 12px;
  }

  .history-dock {
    margin-top: 16px;
  }
}
