.td-app {
  --td-accent: #f0997b;
  --td-accent-dark: #8c3a20;
  --td-soft: #faece7;
  --td-ink: #4a1b0c;
  --td-bg: transparent;
  --td-paper: #fffdf9;
  --td-surface-soft: #f6f1ea;
  --td-line: rgba(78, 64, 50, 0.14);
  --td-line-strong: rgba(78, 64, 50, 0.22);
  --td-muted: #766f68;
  --td-text: #2e2822;
  --td-shadow: 0 1px 2px rgba(43, 38, 34, 0.05), 0 18px 46px rgba(54, 42, 30, 0.10);
  min-height: calc(100vh - 80px);
  padding: 24px 14px 42px;
  background: var(--td-bg);
  color: var(--td-text);
}

.td-shell {
  width: min(100%, 420px);
  margin: 0 auto;
  background: var(--td-paper);
  border: 1px solid var(--td-line);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--td-shadow);
}

.td-shell[hidden] {
  display: none;
}

.td-hero {
  padding: 28px 22px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--td-soft) 0%, var(--td-paper) 122%);
  color: var(--td-ink);
}

.td-hero--guest {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.td-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--td-accent-dark);
}

.td-hero h1,
.td-result h1,
.td-loading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.td-hero p,
.td-loading p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.58;
  color: color-mix(in srgb, var(--td-ink) 72%, white);
}

.td-trust-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px 18px 12px;
}

.td-trust-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 9px;
  min-height: 92px;
  padding: 15px 14px;
  border: 1px solid rgba(78, 64, 50, 0.10);
  border-radius: 16px;
  background: var(--td-surface-soft);
  color: #615b54;
  font-size: 13px;
  line-height: 1.35;
}

.td-trust-chip svg {
  width: 18px;
  height: 18px;
  color: #8a837a;
  flex: 0 0 auto;
}

.td-trust-chip span {
  display: block;
  color: #4d463f;
  font-weight: 600;
  word-break: keep-all;
}

.td-target-note {
  margin: 0;
  padding: 0 18px 12px;
  font-size: 12px;
  color: var(--td-muted);
}

.td-consent-check {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 14px 18px;
  border-top: 1px solid var(--td-line);
  color: var(--td-text);
  font-size: 13px;
  line-height: 1.55;
  cursor: pointer;
}

.td-consent-check .td-consent-input {
  position: absolute !important;
  display: block !important;
  left: 18px;
  top: 16px;
  width: 20px;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.td-consent-box {
  position: relative;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  flex: 0 0 auto;
  border: 1.5px solid #b9b2aa;
  border-radius: 6px;
  background: #fff;
  box-sizing: border-box;
}

.td-consent-box::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--td-ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.td-consent-input:checked + .td-consent-box {
  border-color: var(--td-accent);
  background: var(--td-accent);
}

.td-consent-input:checked + .td-consent-box::after {
  opacity: 1;
}

.td-consent-text {
  flex: 1 1 auto;
}

.td-actions {
  display: flex;
  gap: 9px;
  padding: 14px 18px 20px;
}

.td-actions--single {
  display: block;
}

.td-actions:not(.td-actions--single) {
  align-items: stretch;
}

.td-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
}

.td-btn:focus-visible,
.td-consent-input:focus-visible + .td-consent-box {
  outline: 2px solid var(--td-accent-dark);
  outline-offset: 2px;
}

.td-actions:not(.td-actions--single) .td-btn {
  flex: 1 1 0;
  min-width: 0;
}

.td-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.td-btn--primary {
  width: 100%;
  background: var(--td-accent);
  color: var(--td-ink);
}

.td-actions:not(.td-actions--single) .td-btn--primary {
  width: auto;
}

.td-btn--ghost {
  flex: 1;
  background: transparent;
  border-color: var(--td-line-strong);
  color: var(--td-text);
}

.td-btn:not(:disabled):hover {
  filter: brightness(.985);
}

.td-btn:disabled {
  background: #d7d4cf;
  color: #827c75;
  cursor: not-allowed;
  opacity: 1;
}

.td-btn:not(:disabled):active {
  transform: translateY(1px);
}

.td-share-note {
  margin: -10px 0 20px;
  padding: 0 18px;
  text-align: center;
  font-size: 11px;
  color: var(--td-muted);
}

.td-loading {
  padding: 42px 28px;
  text-align: center;
}

.td-loader {
  width: 42px;
  height: 42px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 4px solid var(--td-soft);
  border-top-color: var(--td-accent);
  animation: td-spin .9s linear infinite;
}

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

.td-result {
  --td-accent: var(--result-accent, #f0997b);
  --td-accent-dark: var(--result-accent-dark, #8c3a20);
  --td-soft: var(--result-soft, #faece7);
  --td-ink: var(--result-ink, #4a1b0c);
}

.td-result-hero {
  padding: 28px 22px 24px;
  text-align: center;
  background: linear-gradient(180deg, var(--td-soft) 0%, var(--td-paper) 122%);
  color: var(--td-ink);
}

.td-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--td-accent-dark);
}

.td-type-icon svg {
  width: 28px;
  height: 28px;
}

.td-type-name {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  color: var(--td-ink);
  letter-spacing: 0;
  word-break: keep-all;
}

.td-secondary {
  display: inline-flex;
  margin: 12px 0 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--td-accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.td-one-liner {
  margin: 12px auto 0;
  max-width: 320px;
  font-size: 14px;
  line-height: 1.55;
  color: color-mix(in srgb, var(--td-ink) 78%, white);
}

.td-note {
  margin: 12px auto 0;
  font-size: 12px;
  color: var(--td-accent-dark);
}

.td-basis {
  padding: 12px 18px;
  border-bottom: 1px solid var(--td-line);
  color: var(--td-muted);
  font-size: 12px;
  text-align: center;
}

.td-section {
  padding: 18px;
  border-top: 1px solid var(--td-line);
}

.td-section:first-of-type {
  border-top: 0;
}

.td-section h2 {
  margin: 0 0 10px;
  color: var(--td-text);
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.td-section p {
  margin: 0;
  color: #4d463f;
  font-size: 14px;
  line-height: 1.65;
}

.td-mini-title {
  margin-top: 12px !important;
  margin-bottom: 8px !important;
  color: var(--td-muted) !important;
  font-size: 12px !important;
  font-weight: 800;
}

.td-section-note {
  margin-top: 12px !important;
  color: var(--td-muted) !important;
  font-size: 12px !important;
}

.td-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.td-list li {
  position: relative;
  padding-left: 14px;
  color: #4d463f;
  font-size: 14px;
  line-height: 1.55;
}

.td-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--td-accent);
}

.td-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.td-section p + .td-chips,
.td-chips + .td-list {
  margin-top: 12px;
}

.td-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--td-soft);
  color: var(--td-accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.td-chips--muted .td-chip {
  background: #f5f1ec;
  color: #635a51;
}

.td-chip--stat {
  gap: 6px;
  padding-right: 7px;
}

.td-chip--stat .td-chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--td-accent-dark);
  color: var(--td-paper);
  font-size: 11px;
  font-weight: 700;
}

.td-stat-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.td-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--td-surface-soft);
}

.td-stat-label {
  color: var(--td-text);
  font-size: 13px;
  font-weight: 600;
}

.td-stat-count {
  flex: 0 0 auto;
  color: var(--td-accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.td-radar-section h2 {
  margin-bottom: 4px;
}

.td-radar-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 2px 0;
}

.td-radar-svg {
  display: block;
  width: min(100%, 340px);
  height: auto;
  overflow: visible;
  color: var(--td-muted);
}

.td-radar-disc {
  fill: var(--td-soft);
  fill-opacity: 0.7;
  stroke: var(--td-line-strong);
  stroke-width: 1;
}

.td-radar-ring {
  fill: none;
  stroke: rgba(78, 64, 50, 0.12);
  stroke-width: 1;
}

.td-radar-ring--edge {
  stroke: rgba(78, 64, 50, 0.22);
}

.td-radar-axis {
  stroke: rgba(78, 64, 50, 0.14);
  stroke-width: 1;
  stroke-dasharray: 1.5 4;
  stroke-linecap: round;
}

.td-radar-area {
  stroke: var(--td-accent-dark);
  stroke-width: 3;
  stroke-linejoin: round;
  transform-box: fill-box;
  transform-origin: center;
  animation: td-radar-pop 0.62s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.td-radar-halo {
  fill: var(--td-accent);
  opacity: 0.22;
}

.td-radar-point {
  fill: var(--td-accent-dark);
  stroke: var(--td-paper);
  stroke-width: 2;
}

.td-radar-point--top {
  stroke-width: 2.5;
}

.td-radar-label {
  fill: currentColor;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.td-radar-label--top {
  fill: var(--td-accent-dark);
}

@keyframes td-radar-pop {
  from { opacity: 0; transform: scale(0.62); }
  to { opacity: 1; transform: scale(1); }
}

.td-radar-caption {
  margin: -2px 0 0 !important;
  color: var(--td-muted) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
  text-align: center;
}

.td-score-grid {
  display: grid;
  gap: 10px;
}

.td-score-row {
  display: grid;
  grid-template-columns: 72px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--td-muted);
}

.td-score-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--td-surface-soft);
  overflow: hidden;
}

.td-score-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--td-accent);
  transition: width .55s cubic-bezier(.22, .61, .36, 1);
}

.td-progress-hero {
  padding: 30px 22px 20px;
  text-align: center;
}

.td-progress-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #f2f1ee;
  color: #639922;
}

.td-progress-icon svg {
  width: 29px;
  height: 29px;
}

.td-progress-hero h1 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.td-progress-hero p {
  margin: 0;
  color: var(--td-muted);
  font-size: 14px;
  line-height: 1.55;
}

.td-progress-box {
  padding: 16px 18px;
  border-top: 1px solid var(--td-line);
}

.td-progress-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--td-muted);
}

.td-progress-top strong {
  color: var(--td-ink);
}

.td-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--td-surface-soft);
  overflow: hidden;
}

.td-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--td-accent);
  transition: width .55s cubic-bezier(.22, .61, .36, 1);
}

.td-progress-caption {
  margin: 8px 0 0;
  color: var(--td-muted);
  font-size: 12px;
}

.td-progress-guide {
  padding: 16px 18px;
  border-top: 1px solid var(--td-line);
}

.td-progress-guide h2 {
  margin: 0 0 8px;
  color: var(--td-text);
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0;
}

.td-progress-current {
  margin: 0 0 12px;
  color: var(--td-muted);
  font-size: 12px;
  line-height: 1.45;
}

.td-guide-list {
  display: grid;
  gap: 8px;
}

.td-guide-item {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--td-line);
  border-radius: 14px;
  background: #fffaf5;
}

.td-guide-item strong {
  color: var(--td-text);
  font-size: 13px;
  line-height: 1.35;
}

.td-guide-item span {
  color: var(--td-muted);
  font-size: 12px;
  line-height: 1.45;
}

.td-guide-item--current {
  border-color: rgba(240, 153, 123, 0.52);
  background: var(--td-soft);
}

.td-guide-item--done {
  border-color: rgba(99, 153, 34, 0.28);
  background: #f4f8ee;
}

.td-error {
  padding: 18px;
  color: #7a2f21;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

@media (min-width: 720px) {
  .td-app {
    padding: 56px clamp(24px, 4vw, 56px) 80px;
  }

  .td-shell {
    width: min(92vw, 640px);
    border-radius: 30px;
  }

  .td-hero,
  .td-result-hero {
    padding: 38px 44px 34px;
  }

  .td-hero h1,
  .td-result h1,
  .td-loading h2 {
    font-size: 30px;
  }

  .td-hero p,
  .td-loading p {
    font-size: 15px;
  }

  .td-trust-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 22px 28px 12px;
    gap: 12px;
  }

  .td-trust-chip {
    min-height: 118px;
    padding: 17px 16px;
    font-size: 14px;
  }

  .td-target-note {
    padding: 0 28px 14px;
    font-size: 13px;
  }

  .td-consent-check {
    padding: 18px 28px;
    font-size: 14px;
  }

  .td-consent-check .td-consent-input {
    left: 28px;
    top: 20px;
  }

  .td-actions {
    gap: 12px;
    padding: 20px 28px 26px;
  }

  .td-btn {
    min-height: 52px;
    font-size: 15px;
  }

  .td-share-note {
    padding: 0 28px;
  }

  .td-loading {
    padding: 58px 44px;
  }

  .td-type-icon {
    width: 64px;
    height: 64px;
  }

  .td-type-icon svg {
    width: 32px;
    height: 32px;
  }

  .td-type-name {
    font-size: 34px;
  }

  .td-one-liner {
    max-width: 480px;
    font-size: 15px;
  }

  .td-basis {
    padding: 14px 28px;
    font-size: 13px;
  }

  .td-section {
    padding: 24px 28px;
  }

  .td-section h2 {
    font-size: 17px;
  }

  .td-section p,
  .td-list li {
    font-size: 15px;
  }

  .td-score-row {
    grid-template-columns: 86px 1fr 44px;
    font-size: 14px;
  }

  .td-progress-hero {
    padding: 42px 44px 26px;
  }

  .td-progress-icon {
    width: 58px;
    height: 58px;
  }

  .td-progress-hero h1 {
    font-size: 28px;
  }

  .td-progress-hero p {
    font-size: 15px;
  }

  .td-progress-box {
    padding: 20px 28px;
  }

  .td-progress-guide {
    padding: 20px 28px;
  }

  .td-progress-guide h2 {
    font-size: 16px;
  }

  .td-progress-current {
    font-size: 13px;
  }

  .td-guide-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .td-guide-item {
    min-height: 82px;
    padding: 13px 14px;
  }

  .td-guide-item strong {
    font-size: 14px;
  }

  .td-guide-item span {
    font-size: 13px;
  }

  .td-error {
    padding: 24px 28px;
  }
}

@media (min-width: 1080px) {
  .td-shell {
    width: min(84vw, 720px);
  }
}

@media (max-width: 480px) {
  .td-actions:not(.td-actions--single) {
    flex-direction: column;
  }
}

html[data-theme="dark"] .td-app {
  --td-bg: transparent;
  --td-paper: var(--bg-content, #211f1d);
  --td-surface-soft: var(--bg-secondary, #2d2926);
  --td-line: rgba(255, 255, 255, 0.10);
  --td-line-strong: rgba(255, 255, 255, 0.16);
  --td-muted: var(--text-tertiary, #aaa29a);
  --td-text: var(--text-primary, #f2eee9);
  --td-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .td-hero,
html[data-theme="dark"] .td-result-hero {
  background: linear-gradient(180deg, color-mix(in srgb, var(--td-accent) 18%, #1f1c1a) 0%, var(--td-paper) 122%);
}

html[data-theme="dark"] .td-hero p,
html[data-theme="dark"] .td-loading p,
html[data-theme="dark"] .td-section p,
html[data-theme="dark"] .td-list li,
html[data-theme="dark"] .td-one-liner {
  color: var(--text-secondary, #d3cdc6);
}

html[data-theme="dark"] .td-trust-chip,
html[data-theme="dark"] .td-guide-item {
  background: var(--td-surface-soft);
  border-color: var(--td-line);
}

html[data-theme="dark"] .td-trust-chip,
html[data-theme="dark"] .td-trust-chip span,
html[data-theme="dark"] .td-guide-item strong,
html[data-theme="dark"] .td-section h2,
html[data-theme="dark"] .td-progress-guide h2 {
  color: var(--td-text);
}

html[data-theme="dark"] .td-trust-chip svg,
html[data-theme="dark"] .td-target-note,
html[data-theme="dark"] .td-share-note,
html[data-theme="dark"] .td-progress-current,
html[data-theme="dark"] .td-guide-item span,
html[data-theme="dark"] .td-progress-caption,
html[data-theme="dark"] .td-basis,
html[data-theme="dark"] .td-score-row {
  color: var(--td-muted);
}

html[data-theme="dark"] .td-consent-box {
  background: #181614;
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="dark"] .td-btn--ghost {
  background: transparent;
  border-color: var(--td-line-strong);
  color: var(--td-text);
}

html[data-theme="dark"] .td-btn:disabled {
  background: #3a3632;
  color: #8f8780;
}

html[data-theme="dark"] .td-progress-icon {
  background: var(--td-surface-soft);
  color: #9ac461;
}

html[data-theme="dark"] .td-score-bar,
html[data-theme="dark"] .td-progress-track {
  background: #37322e;
}

html[data-theme="dark"] .td-radar-disc {
  fill: var(--td-surface-soft);
  fill-opacity: 0.55;
  stroke: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .td-radar-ring {
  stroke: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .td-radar-ring--edge {
  stroke: rgba(255, 255, 255, 0.24);
}

html[data-theme="dark"] .td-radar-axis {
  stroke: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .td-radar-label,
html[data-theme="dark"] .td-radar-caption {
  color: var(--td-muted);
}

html[data-theme="dark"] .td-radar-label--top {
  fill: var(--td-accent);
}

html[data-theme="dark"] .td-radar-point {
  stroke: var(--td-paper);
}

html[data-theme="dark"] .td-chip {
  background: color-mix(in srgb, var(--td-accent) 20%, #1f1c1a);
  color: var(--td-text);
}

html[data-theme="dark"] .td-chips--muted .td-chip {
  background: var(--td-surface-soft);
  color: var(--text-secondary, #d3cdc6);
}

html[data-theme="dark"] .td-stat-row {
  background: var(--td-surface-soft);
}

html[data-theme="dark"] .td-chip--stat .td-chip__count {
  color: #1f1c1a;
}

html[data-theme="dark"] .td-guide-item--current {
  border-color: color-mix(in srgb, var(--td-accent) 42%, transparent);
  background: color-mix(in srgb, var(--td-accent) 14%, #1f1c1a);
}

html[data-theme="dark"] .td-guide-item--done {
  border-color: rgba(154, 196, 97, 0.30);
  background: rgba(154, 196, 97, 0.08);
}

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

  .td-btn,
  .td-progress-fill,
  .td-score-fill {
    transition: none;
  }

  .td-radar-area {
    animation: none;
  }
}

@supports not (color: color-mix(in srgb, white, black)) {
  .td-hero p,
  .td-one-liner {
    color: var(--td-accent-dark);
  }
}
