:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #fff;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.47;
  font-weight: 400;
  letter-spacing: -0.011em;
  font-optical-sizing: auto;
}

:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

::selection {
  background: #d6d6d8;
  color: var(--ink);
}

.frame {
  width: min(40rem, calc(100% - 48px));
  margin: 0 auto;
}

header {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  padding: 1.35rem 0 0.85rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 1.55rem;
  row-gap: 0.45rem;
}

nav a,
.account-link {
  color: inherit;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

body:not(:has(:target)) nav a[href="#kak"],
body:has(#kak:target) nav a[href="#kak"],
body:has(#cenyu:target) nav a[href="#cenyu"],
body:has(#hochu:target) nav a[href="#hochu"],
body:has(#delayu:target) nav a[href="#delayu"],
body:has(#soprotivlyayus:target) nav a[href="#soprotivlyayus"],
body:has(#planiruyu:target) nav a[href="#planiruyu"],
body:has(#profil:target) .account-plain,
body:has(#profil:target) .account-link {
  font-weight: 600;
}

main {
  padding: 0.35rem 0 6rem;
}

article {
  display: none;
  scroll-margin-top: 5.5rem;
}

#kak:target,
#cenyu:target,
#hochu:target,
#delayu:target,
#soprotivlyayus:target,
#planiruyu:target,
#profil:target,
body:not(:has(:target)) #kak {
  display: block;
}

h1 {
  margin: 0.2rem 0 1.35rem;
  font-family: var(--sans);
  font-size: clamp(2.125rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-optical-sizing: auto;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

p + p {
  margin-top: 1.05em;
}

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

.steps li {
  display: grid;
  grid-template-columns: 1.65rem minmax(0, 1fr);
  column-gap: 0.8rem;
  align-items: start;
}

.steps li + li {
  margin-top: 1.15rem;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  grid-column: 1;
  grid-row: 1;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.08rem;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.65rem;
  text-align: center;
}

.steps li > * {
  grid-column: 2;
}

.step-title {
  font-weight: 600;
}

.steps p + p {
  margin-top: 0.35rem;
}

.text-link {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  cursor: pointer;
  appearance: none;
  vertical-align: baseline;
}

.fields {
  margin-top: 1.15rem;
}

.field {
  display: block;
}

.field + .field {
  margin-top: 0.95rem;
}

.field span {
  display: block;
  margin-bottom: 0.35rem;
}

textarea,
.field input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

textarea {
  min-height: 4.6rem;
  resize: vertical;
}

.note {
  margin-top: 1.15rem;
}

.spheres {
  margin-top: 1.8rem;
}

.sphere + .sphere {
  margin-top: 1.8rem;
}

.sphere-title {
  margin: 0;
  font-weight: 600;
}

.sphere .fields {
  margin-top: 0.7rem;
}

.field .score-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0;
}

.field .score-end,
.field .score-row output {
  display: inline;
  margin: 0;
}

.score-end,
.score-row output {
  font-variant-numeric: tabular-nums;
}

.score-row output {
  min-width: 1.6rem;
  font-weight: 600;
  text-align: right;
}

.score-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 1.25rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.score-row input[type="range"]:focus,
.score-row input[type="range"]:focus-visible {
  outline: none;
}

.score-row input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--ink);
}

.score-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0.95rem;
  height: 0.95rem;
  margin-top: -0.45rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

.score-row input[type="range"][data-set]::-webkit-slider-thumb {
  background: var(--ink);
}

.score-row input[type="range"]::-moz-range-track {
  height: 1px;
  border: 0;
  background: var(--ink);
}

.score-row input[type="range"]::-moz-range-thumb {
  width: 0.95rem;
  height: 0.95rem;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: #fff;
}

.score-row input[type="range"][data-set]::-moz-range-thumb {
  background: var(--ink);
}

.score-row input[type="range"]:focus-visible::-webkit-slider-thumb {
  outline: 1px solid var(--ink);
  outline-offset: 3px;
}

.balance-note {
  margin-top: 1.35rem;
}

.radar {
  width: min(34rem, 100%);
  margin: 2rem auto 0;
}

.radar[hidden] {
  display: none;
}

.radar svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.radar figcaption {
  margin-top: 0.35rem;
  text-align: center;
}

.examples {
  margin: 1.15rem 0 1.35rem;
}

.examples > p {
  margin-bottom: 0.45rem;
}

.example-list textarea + textarea {
  margin-top: 0.7rem;
}

.add-example {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  margin-top: 0.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  appearance: none;
}

.add-example .tip {
  position: absolute;
  left: calc(100% + 0.6rem);
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  display: none;
  padding: 0.28rem 0.5rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.add-example:hover .tip,
.add-example:focus-visible .tip {
  display: block;
}

dialog.sheet {
  width: min(40rem, calc(100vw - 2rem));
  max-height: min(86vh, 44rem);
  margin: auto;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  overflow: auto;
}

dialog.sheet::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.sheet-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  padding: 0.85rem 1.25rem 0.35rem;
  background: #fff;
}

.sheet-body {
  padding: 0.15rem 1.35rem 1.6rem;
}

.sheet-body h2 {
  margin: 0 0 0.85rem;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.sheet-body h3 {
  margin: 1.25rem 0 0.45rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.sheet-body p + p,
.sheet-body ul,
.sheet-body ol,
.sheet-body .beliefs,
.sheet-body pre {
  margin-top: 0.7rem;
}

.sheet-body ul,
.sheet-body ol {
  margin-bottom: 0;
  padding-left: 1.15rem;
}

.sheet-body li + li {
  margin-top: 0.35rem;
}

.sheet-body pre {
  margin-bottom: 0;
  font: inherit;
  letter-spacing: inherit;
  white-space: pre-wrap;
}

.sheet-body q {
  quotes: "«" "»";
}

.beliefs {
  margin-top: 1.75rem;
  overflow-x: auto;
}

.beliefs-lead {
  margin-top: 1.35rem;
}

#soprotivlyayus .beliefs {
  margin-top: 0.85rem;
}

[data-beliefs] tbody tr {
  cursor: pointer;
}

[data-beliefs] tbody tr.is-picked td {
  background: #d4f5dc;
}

.journal-log {
  overflow-x: hidden;
}

.journal-log table {
  table-layout: fixed;
  font-size: 0.78rem;
  line-height: 1.3;
}

.journal-log th,
.journal-log td {
  white-space: normal;
  overflow-wrap: break-word;
  hyphens: auto;
  padding: 0.4rem 0.4rem 0.4rem 0;
}

.journal-log th:first-child,
.journal-log td:first-child {
  width: 20%;
  white-space: normal;
}

.journal-log th:nth-child(2),
.journal-log td:nth-child(2) {
  width: 19%;
}

.journal-log th:nth-child(3),
.journal-log td:nth-child(3) {
  width: 13%;
}

.journal-log th:nth-child(4),
.journal-log td:nth-child(4) {
  width: 11%;
}

.journal-log th:nth-child(5),
.journal-log td:nth-child(5) {
  width: 37%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font: inherit;
  letter-spacing: inherit;
}

th,
td {
  padding: 0.7rem 0.85rem 0.7rem 0;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  border-bottom: 1px solid #d2d2d7;
}

th {
  font-weight: 600;
  border-bottom-color: #1d1d1f;
}

th:first-child,
td:first-child {
  width: 2.4rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

th:nth-child(2),
td:nth-child(2) {
  width: 38%;
}

@media (max-width: 720px) {
  .frame {
    width: min(40rem, calc(100% - 32px));
  }

  header {
    padding-top: 1.05rem;
  }

  nav {
    column-gap: 1.05rem;
  }

  h1 {
    margin-bottom: 1.1rem;
  }
}

.account {
  position: relative;
}

.account-link,
.account-drop {
  display: none;
}

.account-link {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

body.is-admin .account-plain {
  display: none;
}

body.is-admin .account-link {
  display: inline;
}

.caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 0.38rem;
  border-left: 0.28rem solid transparent;
  border-right: 0.28rem solid transparent;
  border-top: 0.34rem solid currentColor;
  vertical-align: 0.12em;
}

.account-link.is-open .caret {
  border-top: 0;
  border-bottom: 0.34rem solid currentColor;
  vertical-align: 0.18em;
}

body.is-admin .account-drop:not([hidden]) {
  display: block;
  position: absolute;
  z-index: 2;
  top: calc(100% + 0.7rem);
  left: 0;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.95rem 1rem 1.05rem;
  border: 1px solid var(--ink);
  background: #fff;
}

.account-drop .fields {
  margin-top: 0.75rem;
}

.form-actions {
  margin-top: 0.95rem;
}

.form-note {
  margin-top: 0.7rem;
}

.form-note[hidden],
.user-empty[hidden] {
  display: none;
}

.user-empty {
  margin-top: 0.95rem;
}

.user-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
}

.user-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #d2d2d7;
}

.profile-form.fields {
  margin-top: 0;
}

.register-form {
  margin-bottom: 2rem;
}

.consent {
  display: grid;
  grid-template-columns: 1.05rem minmax(0, 1fr);
  column-gap: 0.65rem;
  align-items: start;
  margin-top: 0.95rem;
}

.consent input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0.22rem 0 0;
  accent-color: var(--ink);
}

.account-ready {
  margin: 0 0 1.6rem;
}

.profile-delete {
  margin-top: 1.8rem;
}

dialog.confirm {
  width: min(24rem, calc(100vw - 2rem));
  margin: auto;
  padding: 1.25rem 1.35rem 1.1rem;
  border: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
}

dialog.confirm::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1.35rem;
  margin-top: 1.15rem;
}

.confirm-actions .text-link:last-child {
  font-weight: 600;
}
