:root {
  --ink: #1a1a1a;
  --paper: #f7f4ef;
  --stage: #e4d9cc;
  --card: #fffdf8;
  --line: #e4d8c8;
  --button: #0f6b4c;
  --button-ink: #ffffff;
  --stop-bg: #fdecec;
  --stop-ink: #9b1c1c;
  --ask-bg: #fff6e0;
  --ask-ink: #8a5a00;
  --clear-bg: #e7f6ef;
  --clear-ink: #0f6b4c;
}

* { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--stage);
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
  font-size: 1.2rem;
  line-height: 1.45;
}

button, textarea { font: inherit; }

[hidden] { display: none !important; }

.phone {
  width: min(28rem, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  background: var(--paper);
}

.brand {
  text-align: center;
}

.eyebrow {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--stop-ink);
  cursor: pointer;
}

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

h1 {
  margin: 0.2rem 0 1rem;
  font-size: 1.65rem;
  line-height: 1.3;
}

h2 { font-size: 1.2rem; }
h3 { margin: 0.8rem 0 0.3rem; font-size: 1.05rem; }

.steps {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 0 0.55rem;
  padding: 0.75rem 0.85rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 8px 16px rgba(70, 48, 24, 0.05);
}

.steps li.step-warn {
  background: var(--stop-bg);
  border-color: #f0c2c2;
  color: var(--stop-ink);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font-weight: 700;
  display: grid;
  place-items: center;
}

.steps li.step-warn::before {
  background: var(--stop-ink);
}

.action, .sample {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.action {
  min-height: 4.25rem;
  margin: 0.7rem 0;
  padding: 0.9rem 1rem;
  border: 2px solid #084832;
  background: var(--button);
  color: var(--button-ink);
  box-shadow: 0 5px 0 #084832;
}

.action:hover { background: #12845d; }

.action:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #084832;
}

.action-second {
  background: #fff;
  color: var(--button);
  border: 2px solid var(--button);
  box-shadow: 0 5px 0 #b7c9c0;
}

.action-second:hover { background: #f3faf6; }

.action-second:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b7c9c0;
}

.sample-rail {
  display: flex;
  gap: 0.75rem;
  margin: 0.75rem -0.15rem 0.35rem;
  padding: 0.15rem 0.15rem 0.7rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.sample-card {
  flex: 0 0 88%;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  padding: 0.85rem;
  border: 2px solid var(--line);
  border-radius: 1.1rem;
  background: #fff;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.08);
}

.sample-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.chat-group {
  margin: 0.2rem 0 0.55rem;
  color: #6d5c4b;
  font-size: 0.92rem;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.7rem;
  border-radius: 0.95rem;
  background: #efe4d6;
}

.chat-sender {
  margin: 0;
  color: var(--button);
  font-size: 0.92rem;
  font-weight: 700;
}

.bubble {
  align-self: flex-start;
  max-width: 95%;
  margin: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 0.25rem 0.9rem 0.9rem 0.9rem;
  background: #fff;
  box-shadow: 0 2px 0 rgba(70, 48, 24, 0.06);
}

.chat img {
  display: block;
  width: 100%;
  border-radius: 0.7rem;
}

.sample-card .sample { margin: 0.7rem 0 0; }

.sample-dots {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.15rem 0 0.35rem;
}

.sample-dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #c8b8a6;
  cursor: pointer;
}

.sample-dot.is-on {
  width: 1.5rem;
  background: var(--button);
}

#sample-chat { margin: 0 0 0.8rem; }

.sample {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  min-height: 3.1rem;
  margin: 0.45rem 0;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--ink);
  border: 2px solid #5f7d70;
  box-shadow: 0 4px 0 #8fa399;
  font-weight: 700;
  text-align: left;
}

.sample-group {
  color: #6d5c4b;
  font-size: 0.92rem;
  font-weight: 600;
}

.guide-mid {
  margin-top: 0.85rem;
  padding: 0.95rem 0.9rem;
  background: #fff;
  border: 2px solid #c4a574;
  border-radius: 1.1rem;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.08);
}

.guide-mid h3 {
  margin: 0.85rem 0 0.35rem;
  font-size: 1.2rem;
}

.guide-mid h3:first-child { margin-top: 0; }

#guide-read p {
  margin: 0.35rem 0;
}

#guide-title {
  margin: 0.15rem 0 0.45rem;
  font-size: 1.55rem;
  line-height: 1.3;
}

a.sample,
a.sample:visited {
  color: var(--ink);
  text-decoration: none;
}

.sample:hover { background: #f7fbf8; }

.sample:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #d5ddd8;
}

.panel {
  margin-top: 0.9rem;
  padding: 0.85rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.06);
}

.field-label, .sample-title {
  display: block;
  margin: 0;
  font-weight: 700;
}

.sample-title {
  font-size: 1.35rem;
  line-height: 1.35;
  text-align: center;
}

textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 6.4rem;
  max-height: min(14rem, 38vh);
  margin-top: 0.45rem;
  padding: 0.8rem;
  border: 2px solid var(--line);
  border-radius: 0.9rem;
  background: #fff;
  color: var(--ink);
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  resize: none;
}

.quiet {
  margin: 0.45rem 0 0;
  color: var(--ink);
  font-size: 0.98rem;
}

.recaptcha-note a {
  color: inherit;
}

.grecaptcha-badge {
  visibility: hidden;
}

.verdict {
  margin: 0 0 0.9rem;
  padding: 1.35rem 1.1rem 1.2rem;
  border-radius: 1.25rem;
  border: 2px solid transparent;
  background: var(--card);
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 14px 28px rgba(70, 48, 24, 0.1);
}

.verdict .mark {
  width: 4.6rem;
  height: 4.6rem;
  margin: 0 auto 0.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.16);
}

.verdict.stop .mark { background: var(--stop-ink); color: #fff; box-shadow: 0 7px 0 #6f1212; }
.verdict.ask .mark { background: var(--ask-ink); color: #fff; box-shadow: 0 7px 0 #5c3b00; }
.verdict.clear .mark { background: var(--clear-ink); color: #fff; box-shadow: 0 7px 0 #084832; }

.verdict h2 {
  margin: 0;
  font-size: 2.15rem;
  line-height: 1.2;
}

.verdict p { margin: 0.4rem 0 0; }

.verdict.stop {
  background: var(--stop-bg);
  color: var(--stop-ink);
  border-color: #f0c2c2;
}
.verdict.ask {
  background: var(--ask-bg);
  color: var(--ask-ink);
  border-color: #f0ddb0;
}
.verdict.clear {
  background: var(--clear-bg);
  color: var(--clear-ink);
  border-color: #b7dfcc;
}

.detail {
  padding: 0.85rem 0.95rem 0.95rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.07);
}

.detail h3, .todo h3 {
  margin: 0 0 0.45rem;
  font-size: 1.15rem;
}

.preview-text, .quote, .error-text {
  padding: 0.9rem;
  border-radius: 1rem;
  background: var(--card);
  border: 2px solid var(--line);
}

.loading-card {
  margin-top: 0.4rem;
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.07);
}

.spinner {
  width: 3.4rem;
  height: 3.4rem;
  margin: 0.15rem auto 0.95rem;
  border: 0.38rem solid #e4d8c8;
  border-top-color: var(--button);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

.loading-line {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.loading-card .quiet {
  margin-top: 0.45rem;
  font-size: 1.05rem;
}

.preview-list {
  max-height: min(22rem, 46vh);
  margin-top: 0.7rem;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.preview-list figure { margin: 0; }

.preview-list figcaption {
  margin: 0 0 0.3rem;
  font-weight: 700;
}

.preview-list img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 1rem;
}

.sample-flag {
  display: inline-block;
  margin: 0 0 0.6rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: #fff3bf;
  font-weight: 700;
}

.notes { padding-left: 1.2rem; }
.notes:empty { display: none; }

#summary {
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

#reasons-title[hidden] { display: none; }

#reasons {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
}

#reasons li {
  margin: 0 0 0.7rem;
  line-height: 1.45;
}

#reasons li:last-child { margin-bottom: 0; }

.todo {
  margin-top: 0.9rem;
  padding: 0.85rem 0.95rem 0.45rem;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: 0 10px 22px rgba(70, 48, 24, 0.07);
}

.todo h3 { margin-top: 0; }

#actions {
  list-style: none;
  margin: 0.4rem 0 0.6rem;
  padding: 0;
  counter-reset: job;
}

#actions li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0 0 0.55rem;
  padding: 0.75rem 0.8rem;
  border-radius: 0.9rem;
  background: #fff;
  box-shadow: 0 4px 0 rgba(70, 48, 24, 0.06);
}

#actions li::before {
  counter-increment: job;
  content: counter(job);
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: var(--ink);
}

.todo.stop #actions li::before { background: var(--stop-ink); }
.todo.ask #actions li::before { background: var(--ask-ink); }
.todo.clear #actions li::before { background: var(--clear-ink); }

button:focus-visible, textarea:focus-visible {
  outline: 3px solid #1a1a1a;
  outline-offset: 3px;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

@media (min-width: 700px) {
  body { padding: 1.5rem 1rem; }

  .phone {
    width: min(40rem, 100%);
    min-height: calc(100vh - 3rem);
    border-radius: 1.8rem;
    box-shadow: 0 16px 40px rgba(70, 48, 24, 0.14);
  }
}
