:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #202326;
  --muted: #667078;
  --line: #d8dee3;
  --accent: #176f63;
  --accent-strong: #0f554c;
  --warning: #a85b16;
  --danger: #9d3030;
  --shadow: 0 18px 42px rgba(26, 33, 38, 0.1);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 280px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(32, 35, 38, 0.11);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 14px 16px 10px;
}

.brand {
  min-width: 0;
}

.brand__title {
  display: block;
  overflow: hidden;
  font-size: 16px;
  font-weight: 760;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__principle {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0;
  text-transform: uppercase;
}

.language-switch {
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 3px;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #eef2f4;
}

.language-switch__button,
.tabs__button,
.filter-chip {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.language-switch__button {
  font-size: 13px;
  font-weight: 760;
}

.language-switch__button.is-active,
.tabs__button.is-active,
.filter-chip.is-active {
  color: var(--surface-strong);
  background: var(--accent);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 0 16px 12px;
}

.tabs__button {
  min-width: 0;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}

.tabs__button:not(.is-active):hover,
.language-switch__button:not(.is-active):hover,
.filter-chip:not(.is-active):hover {
  background: rgba(40, 111, 108, 0.1);
  color: var(--accent-strong);
}

.app-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px 16px 44px;
}

.view {
  animation: view-enter 160ms ease-out;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-heading__eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 48px);
  line-height: 1.04;
  letter-spacing: 0;
}

.section-heading p:not(.section-heading__eyebrow) {
  max-width: 640px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.content-grid,
.flow-list,
.example-list,
.recovery-list {
  display: grid;
  gap: 12px;
}

.quick-card,
.flow-stage,
.example-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quick-card {
  position: relative;
  min-height: 206px;
  padding: 18px;
  overflow: hidden;
}

.quick-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--accent);
}

.quick-card--warning::before {
  background: var(--warning);
}

.quick-card--danger::before {
  background: var(--danger);
}

.quick-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: 0;
}

.quick-card p {
  margin: 10px 0 14px;
  color: var(--muted);
}

.quick-card ul,
.mini-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-card li,
.mini-list li {
  position: relative;
  padding-left: 18px;
}

.quick-card li::before,
.mini-list li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
}

.quick-card--warning li::before,
.mini-list--avoid li::before {
  background: var(--warning);
}

.quick-card--danger li::before {
  background: var(--danger);
}

.flow-list {
  counter-reset: flow;
}

.flow-stage {
  overflow: hidden;
}

.flow-stage summary {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 12px;
  align-items: center;
  min-height: 64px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.flow-stage summary::-webkit-details-marker,
.example-card summary::-webkit-details-marker {
  display: none;
}

.flow-stage summary::after {
  content: "+";
  grid-column: 2;
  justify-self: end;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  text-align: center;
  line-height: 25px;
}

.flow-stage[open] summary::after {
  content: "-";
}

.flow-stage__number {
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(23, 111, 99, 0.2);
  border-radius: 6px;
  color: var(--accent-strong);
  background: rgba(23, 111, 99, 0.08);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.flow-stage__title {
  min-width: 0;
  padding-right: 36px;
  font-size: 17px;
  font-weight: 760;
}

.flow-stage__body {
  display: grid;
  gap: 14px;
  padding: 0 16px 18px;
}

.flow-stage__goal {
  padding: 12px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: rgba(23, 111, 99, 0.08);
  color: var(--accent-strong);
  font-weight: 690;
}

.flow-stage__columns {
  display: grid;
  gap: 12px;
}

.mini-list {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f9fbfb;
}

.mini-list h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0;
  text-transform: uppercase;
}

.flow-stage__example {
  padding: 14px;
  border-radius: var(--radius);
  background: #202326;
  color: #ffffff;
}

.flow-stage__example span {
  display: block;
  margin-bottom: 8px;
  color: #f1bd6a;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.flow-stage__example p {
  margin: 0;
}

.example-card {
  overflow: hidden;
}

.example-card summary {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 16px;
  cursor: pointer;
  list-style: none;
}

.example-card summary::after {
  content: "+";
  position: absolute;
  right: 16px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  text-align: center;
  line-height: 25px;
}

.example-card[open] summary::after {
  content: "-";
}

.example-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.example-card__title {
  padding-right: 36px;
  font-size: 18px;
  font-weight: 760;
  line-height: 1.2;
}

.risk-label {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(23, 111, 99, 0.1);
  text-transform: none;
}

.risk-label--medium {
  color: #78410f;
  background: rgba(168, 91, 22, 0.13);
}

.risk-label--high {
  color: #7f2424;
  background: rgba(157, 48, 48, 0.13);
}

.example-card__body {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.definition {
  padding: 4px 0 4px 12px;
  border-left: 3px solid var(--line);
}

.definition h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.definition p {
  margin: 0;
}

.definition--line {
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 690;
}

.recovery-grid,
.nonverbal-grid {
  display: grid;
  gap: 12px;
}

.recovery-card,
.nonverbal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.recovery-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.recovery-card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.nonverbal-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.nonverbal-panel__heading h2 {
  margin: 0;
  font-size: 20px;
}

.nonverbal-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  box-shadow: none;
}

.nonverbal-card h3 {
  margin: 0;
  font-size: 16px;
}

.nonverbal-card p {
  margin: 0;
  color: var(--muted);
}

.distance-diagram {
  position: relative;
  height: 92px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(23, 111, 99, 0.08) 0 1px, transparent 1px 100%),
    #f9fbfb;
  background-size: 18px 18px;
}

.person {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.person::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -27px;
  width: 22px;
  height: 32px;
  border-radius: 999px 999px 6px 6px;
  transform: translateX(-50%);
}

.person--you,
.person--you::after {
  background: var(--accent);
}

.person--her,
.person--her::after {
  background: #d89535;
}

.person--you {
  left: 22%;
}

.person--her {
  right: 22%;
}

.exit-line,
.movement-line {
  position: absolute;
  pointer-events: none;
}

.exit-line {
  right: 10px;
  bottom: 10px;
  width: 42px;
  height: 2px;
  background: var(--danger);
}

.exit-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--danger);
  border-right: 2px solid var(--danger);
  transform: rotate(45deg);
}

.movement-line {
  left: 31%;
  top: 50%;
  width: 38%;
  height: 2px;
  border-top: 2px dashed rgba(32, 35, 38, 0.24);
}

.distance-diagram--close .person--you {
  left: 36%;
}

.distance-diagram--close .person--her {
  right: 36%;
}

.distance-diagram--close .movement-line {
  left: 43%;
  width: 14%;
  border-color: var(--danger);
}

.distance-diagram--exit .person--you {
  left: 58%;
}

.distance-diagram--exit .person--her {
  right: 12%;
}

.distance-diagram--exit .exit-line {
  right: 2px;
  width: 24px;
}

.distance-diagram--back .person--you {
  left: 18%;
}

.distance-diagram--back .movement-line {
  left: 24%;
  width: 24%;
  border-color: var(--accent);
}

.filter-row {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin: 0 0 14px;
  padding-bottom: 2px;
  overflow-x: auto;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 720;
}

.empty-state {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.empty-state__marker {
  width: 12px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #d39a46);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
}

@media (min-width: 760px) {
  .topbar__inner {
    padding: 18px 24px 12px;
  }

  .tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px 14px;
  }

  .tabs__button {
    min-width: 128px;
    padding: 0 16px;
  }

  .app-shell {
    padding: 34px 24px 60px;
  }

  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-stage__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recovery-grid,
  .nonverbal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
