/* Design tokens for a quiet, utilitarian educational product UI. The palette avoids
   an over-gamified look because the first audience is children 10-13 and parents. */
:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #667281;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --line: #dce3ea;
  --blue: #2467c7;
  --green: #237a4d;
  --red: #c03b3b;
  --yellow: #d8991d;
  --teal: #287e86;
  --violet: #7651a6;
  --post-max-width: 1080px;
  --post-max-height: 1350px;
  --post-aspect-ratio: 1080 / 1350;
  --shadow: 0 20px 60px rgba(19, 31, 44, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

.hidden {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  font-weight: 750;
  cursor: pointer;
}

button.ghost {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

/* Main responsive shell: mobile-first, capped on desktop for comfortable scanning. */
.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 0 14px 72px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(560px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0 0 18px;
  text-align: center;
  font-size: clamp(30px, 6vw, 42px);
}

/* Brand logos are fixed-format UI elements: explicit dimensions prevent the header from jumping
   when the SVG finishes loading and keep the wordmark readable on narrow mobile screens. */
.brand-logo {
  display: block;
  width: clamp(164px, 28vw, 230px);
  height: auto;
}

.brand-button {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.brand-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.brand-lockup .brand-logo {
  width: clamp(150px, 22vw, 210px);
}

.header-brand-logo {
  width: clamp(150px, 22vw, 210px);
  max-height: 58px;
  object-fit: contain;
  object-position: left center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-brand-logo {
  width: min(320px, 82vw);
  margin: 0 auto 18px;
}

.login-secondary-action {
  width: 100%;
  margin-top: 10px;
}

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

.signup-section h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
}

.demo-accounts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.demo-account {
  min-height: 58px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.demo-account span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 2px;
}

.ig-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, .94);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: none;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 5vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  letter-spacing: 0;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-icon-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
}

.top-icon-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.feed-icon {
  display: grid;
  gap: 3px;
  width: 20px;
}

.feed-icon span {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.feed-icon span:nth-child(1) {
  width: 18px;
}

.feed-icon span:nth-child(2) {
  width: 13px;
}

.feed-icon span:nth-child(3) {
  width: 20px;
}

.search-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 9px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

.profile-menu {
  display: grid;
  place-items: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.profile-actions-menu {
  position: relative;
  margin-left: auto;
  z-index: 3;
  flex: 0 0 auto;
}

.profile-actions-menu summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.profile-actions-menu summary::-webkit-details-marker {
  display: none;
}

.profile-actions-menu[open] summary {
  border-color: var(--ink);
  border-width: 2px;
}

.more-icon {
  display: flex;
  align-items: center;
  gap: 3px;
}

.more-icon span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.profile-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 250px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 32px rgba(19, 31, 44, .14);
}

.profile-menu-dropdown button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: white;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
}

.profile-menu-dropdown button:hover {
  background: #f4f7fb;
}

.profile-menu-dropdown .danger-text {
  color: var(--red);
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 15px;
  font-weight: 900;
  overflow: hidden;
}

.profile-avatar img,
.account-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.ig-feed-screen {
  width: min(560px, 100%);
  margin: 0 auto;
}

.ig-feed-header {
  margin: 10px 0;
}

.feed-filter-panel {
  display: grid;
  grid-template-columns: auto auto 40px 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 0 10px;
}

.feed-filter-title {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.feed-filter-reset,
.feed-filter-chip {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.feed-filter-reset {
  padding: 8px 11px;
  font-size: 13px;
}

.feed-filter-chip {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.feed-filter-chip.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.feed-filter-reset:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.feed-filter-catalog {
  min-width: 0;
}

.feed-filter-tree > summary {
  min-height: 40px;
}

.feed-filter-tree > summary span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-filter-menu {
  left: auto;
  right: 0;
  width: min(520px, calc(100vw - 24px));
}

.instagram-feed {
  display: grid;
  gap: 18px;
}

.catalog-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  padding-top: 14px;
}

.catalog-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
}

.search-box {
  align-self: stretch;
}

.search-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.search-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 850;
}

.search-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.catalog-list {
  display: grid;
  gap: 14px;
}

.catalog-tree {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.catalog-tree-category {
  border-bottom: 1px solid var(--line);
  background: white;
}

.catalog-tree-category:last-child {
  border-bottom: 0;
}

.catalog-tree-category summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.catalog-tree-category summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.catalog-tree-category:not([open]) summary::before {
  transform: rotate(-45deg);
}

.catalog-tree-category summary::-webkit-details-marker {
  display: none;
}

.catalog-tree-category summary strong,
.catalog-tree-topic strong {
  display: block;
}

.catalog-tree-category summary small,
.catalog-tree-topic small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.catalog-tree-branches {
  display: grid;
  gap: 6px;
  padding: 0 14px 12px 42px;
}

.catalog-tree-topic {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfd;
}

.catalog-tree-topic::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 20px;
  width: 16px;
  border-top: 1px solid var(--line);
}

.catalog-follow-button {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
}

.catalog-follow-button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.profile-page {
  width: min(720px, 100%);
  margin: 0 auto;
  padding-top: 14px;
}

.profile-page > .ghost {
  margin-bottom: 12px;
}

.public-profile-head {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.public-profile-avatar-stack {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
}

.public-profile-avatar-stack:has(.profile-points-counter) {
  width: 136px;
}

.public-profile-main {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 134px;
  padding-right: 152px;
}

.public-profile-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.public-profile-title-row .profile-actions-menu {
  position: absolute;
  top: 16px;
  right: 16px;
  margin-left: 0;
}

.public-profile-title-row h2 {
  min-width: 0;
  margin: 0;
  line-height: 1.15;
}

.public-profile-main > p {
  margin: 0;
  line-height: 1.25;
}

.public-profile-main .status-row {
  display: grid;
  gap: 4px;
  margin: 3px 0 0;
  line-height: 1.15;
}

.public-profile-actions {
  position: absolute;
  top: 106px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 0;
}

.public-profile-avatar-stack .public-profile-actions {
  position: static;
  width: 100%;
  justify-content: stretch;
  margin-top: 0;
}

.public-profile-avatar-stack .profile-create-post-button,
.public-profile-avatar-stack .profile-points-counter {
  width: 100%;
}

.profile-create-post-button {
  width: auto;
  min-width: 104px;
  min-height: 44px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.1;
}

.danger-text {
  color: var(--red);
}

.small-action {
  min-height: 38px;
  padding: 8px 12px;
  white-space: nowrap;
}

.public-profile-avatar {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 28px;
  font-weight: 900;
}

.public-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-points-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto;
  min-width: 104px;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid #cbead8;
  border-radius: 8px;
  background: #e9f7ef;
  color: #19603a;
  text-align: center;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.profile-points-counter:hover {
  border-color: #7cc99c;
  box-shadow: 0 8px 18px rgba(25, 96, 58, .14);
  transform: translateY(-1px);
}

.profile-points-counter:focus-visible {
  outline: 3px solid rgba(36, 103, 199, .28);
  outline-offset: 3px;
}

.profile-points-counter strong {
  display: inline;
  font-size: 18px;
  line-height: 1;
}

.profile-points-counter span {
  display: inline;
  margin-top: 0;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.1;
}

.public-profile-posts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.public-profile-posts-head h3 {
  margin: 0;
}

.profile-filter-control {
  position: relative;
  width: min(465px, 100%);
}

.profile-filter-tree {
  position: relative;
}

.profile-filter-tree > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.profile-filter-tree > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
  justify-self: center;
}

.profile-filter-tree[open] > summary::after {
  transform: rotate(225deg);
}

.profile-filter-tree > summary::-webkit-details-marker,
.profile-filter-category > summary::-webkit-details-marker {
  display: none;
}

.profile-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  width: min(620px, calc(100vw - 28px));
  max-height: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: auto;
}

.profile-filter-all {
  justify-content: flex-start;
  width: 100%;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: white;
  color: var(--ink);
  text-align: left;
}

.profile-filter-all.active,
.profile-filter-category summary button.active,
.profile-filter-branch.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.profile-filter-catalog-tree {
  display: grid;
}

.profile-filter-category {
  border-bottom: 1px solid var(--line);
}

.profile-filter-category:last-child {
  border-bottom: 0;
}

.profile-filter-category > summary {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.profile-filter-category > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.profile-filter-category:not([open]) > summary::before {
  transform: rotate(-45deg);
}

.profile-filter-category strong,
.profile-filter-category small,
.profile-filter-branch strong,
.profile-filter-branch small {
  display: block;
}

.profile-filter-category small,
.profile-filter-branch small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.profile-filter-category > summary button {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 12px;
}

.profile-filter-branches {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px 40px;
}

.profile-filter-branch {
  position: relative;
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
}

.profile-filter-branch::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 21px;
  width: 14px;
  border-top: 1px solid var(--line);
}

.author-results {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.author-results header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.author-results h3 {
  margin-bottom: 4px;
}

.author-results p {
  margin: 0;
}

.author-results header > span {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 850;
}

.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.author-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 88px;
  border: 1px solid var(--line);
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
}

.author-card .avatar {
  flex: 0 0 auto;
}

.author-card span,
.author-card small {
  display: block;
  color: var(--muted);
}

.author-card strong {
  display: block;
  margin-bottom: 3px;
}

.direction-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.direction-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.direction-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 2px solid #e15b6c;
  border-radius: 50%;
  color: var(--blue);
  font-size: 22px;
  font-weight: 850;
}

.direction-head h3 {
  margin-bottom: 4px;
}

.direction-head p {
  margin-bottom: 0;
}

.direction-head > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.branch-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.branch-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.branch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.branch-head p {
  margin: 4px 0 0;
}

.branch-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.catalog-posts,
.catalog-post-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.catalog-post-results {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.catalog-post {
  min-height: 112px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.catalog-post span,
.catalog-post small {
  display: block;
  color: var(--muted);
}

.catalog-post strong {
  display: block;
  margin: 6px 0;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.achievement-card,
.badge-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.achievement-card span,
.badge-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.achievement-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 26px;
}

.points-card {
  border-color: #cbead8;
  background: #e9f7ef;
}

.points-card span {
  color: #19603a;
}

.points-card strong {
  color: #19603a;
  font-size: 34px;
}

.badge-list {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
}

.badge-card.earned {
  border-color: #b8dfc8;
  background: #eaf7ef;
}

.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
}

.instagram-card {
  width: min(100%, var(--post-max-width));
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 26px rgba(19, 31, 44, .08);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.post-author-link {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.post-author-link small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.post-author-link strong {
  color: var(--ink);
  font-size: 14px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-weight: 850;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.post-kind {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: var(--muted);
  font-weight: 750;
}

.post-menu {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
}

.post-menu summary {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  list-style: none;
}

.post-menu summary::-webkit-details-marker {
  display: none;
}

.post-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  min-width: 170px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 32px rgba(19, 31, 44, .14);
}

.post-menu-dropdown span {
  padding: 6px 8px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.post-menu-dropdown .post-menu-empty {
  padding-top: 2px;
  text-transform: none;
}

.post-menu-dropdown button {
  justify-content: flex-start;
  width: 100%;
  border: 0;
  background: white;
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}

.post-menu-dropdown button:hover {
  background: #f4f7fb;
}

.post-menu-dropdown .danger-text {
  color: var(--red);
}

.post-media {
  width: min(100%, var(--post-max-width));
  max-height: var(--post-max-height);
  aspect-ratio: var(--post-aspect-ratio);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
  overflow: hidden;
}

.post-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.text-poster {
  display: grid;
  align-content: center;
  min-height: 100%;
  padding: 26px;
  background: #f8fafc;
  overflow: auto;
}

.text-poster span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.text-poster strong {
  margin: 10px 0;
  font-size: 30px;
  line-height: 1.1;
}

.rich-text {
  display: grid;
  gap: 10px;
  color: #344253;
  font-size: 16px;
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}

.rich-text p,
.rich-text ul,
.rich-text ol {
  margin: 0;
}

.rich-text ul,
.rich-text ol {
  display: grid;
  gap: 6px;
  padding-left: 22px;
}

.rich-text strong {
  font-weight: 850;
}

.rich-text em {
  color: #1f2f3f;
}

.rich-text code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #eef2f6;
  color: #233142;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}

.rich-text a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 10px;
}

.post-actions button {
  min-width: 42px;
  padding: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 18px;
}

.post-actions button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.post-actions .studied-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 18px;
  font-weight: 850;
}

.post-actions .skip-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.post-actions .skip-button svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.series-card {
  overflow: hidden;
}

.series-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.series-slide {
  position: relative;
  min-width: 0;
  scroll-snap-align: start;
}

.series-step {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(18, 29, 39, .86);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.post-caption {
  padding: 6px 12px 4px;
}

.post-blocks {
  padding: 10px 12px 12px;
}

.post-caption {
  display: grid;
  gap: 2px;
}

.post-caption strong {
  line-height: 1.12;
}

.post-created-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 8px;
  min-height: 18px;
  width: 100%;
}

.post-created-date {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.15;
}

.post-stats {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
}

.post-stats span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.post-stats svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.post-caption p {
  margin-bottom: 0;
}

.post-element-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  width: min(100%, var(--post-max-width));
  max-height: var(--post-max-height);
  aspect-ratio: var(--post-aspect-ratio);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  background: #f7f9fb;
}

.post-element-slide {
  position: relative;
  min-width: 0;
  height: 100%;
  max-height: var(--post-max-height);
  scroll-snap-align: start;
  display: grid;
  overflow: hidden;
}

.post-element-step {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(18, 29, 39, .86);
  color: white;
  font-size: 12px;
  font-weight: 850;
}

.post-element-slide > .block {
  min-height: 0;
  height: 100%;
  max-height: var(--post-max-height);
  margin: 0;
  border: 0;
  border-radius: 0;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 42px 18px 22px;
  background: white;
  overflow: auto;
}

.post-element-slide > .text-block {
  align-content: center;
}

.post-element-slide > .text-poster {
  min-height: 0;
  height: 100%;
  max-height: var(--post-max-height);
}

.post-element-slide > .block > img {
  width: calc(100% + 36px);
  height: calc(100% + 64px);
  min-height: 0;
  max-height: none;
  margin: -42px -18px -22px;
  object-fit: cover;
  border-radius: 0;
}

.post-element-slide > .image-block {
  align-content: stretch;
  padding: 0;
  background: #f7f9fb;
  overflow: hidden;
}

.post-element-slide > .image-block > img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0;
}

.page-head-with-back {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}

.page-head-with-back > div {
  grid-column: 1;
  grid-row: 1;
}

.page-head-with-back > .page-back-button {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}

.page-head-with-back h2,
.page-head-with-back p {
  margin-top: 0;
}

.page-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.page-back-button {
  min-width: 96px;
  white-space: nowrap;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

/* Cards are used only for repeated content/moderation items and panels, not as
   nested decorative sections. */
.edu-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.edu-card {
  overflow: hidden;
}

.card-body {
  padding: 16px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f7;
  color: #435160;
  font-size: 12px;
  font-weight: 750;
}

.pill.green {
  background: #e5f5ed;
  color: var(--green);
}

.pill.yellow {
  background: #fff5dc;
  color: #8a6100;
}

.pill.red {
  background: #fdeaea;
  color: var(--red);
}

/* A content block is the smallest renderable learning unit in the feed. */
.block {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.block img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
}

.choice {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
}

.choice.primary {
  background: var(--ink);
  color: white;
  text-align: center;
  font-weight: 850;
}

.multi-choice-options {
  display: grid;
  gap: 8px;
}

.multi-choice-option {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.multi-choice-option input {
  width: 20px;
  height: 20px;
  padding: 0;
}

.multi-choice-option.selected {
  border-color: #cbead8;
  background: #e9f7ef;
}

.answer-feedback {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.answer-feedback.success {
  background: transparent;
  color: #19603a;
}

.answer-feedback.warning {
  color: #8a6100;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.panel {
  padding: 16px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.author-tab-panel {
  display: none;
}

.author-tab-panel.active {
  display: block;
}

.draft-form-actions {
  width: min(520px, 100%);
  margin: 4px auto 0;
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  background: rgba(244, 246, 248, .96);
  backdrop-filter: blur(12px);
}

.draft-form-actions button {
  width: 100%;
}

.draft-form-actions button:first-child.hidden + button {
  grid-column: 1 / -1;
}

.draft-mobile-composer {
  width: min(520px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

.mobile-composer-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.mobile-composer-status strong {
  display: block;
  line-height: 1.2;
}

.mobile-composer-status span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.mobile-composer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid #cbead8;
  border-radius: 999px;
  background: #e9f7ef;
  color: #19603a !important;
  font-size: 11px !important;
  font-weight: 850;
  white-space: nowrap;
}

.mobile-composer-panel {
  display: none;
  gap: 12px;
}

.mobile-composer-panel.active {
  display: grid;
}

.mobile-composer-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mobile-composer-meta label {
  gap: 6px;
}

.mobile-add-title {
  margin: 4px 0 -2px;
  font-size: 16px;
  line-height: 1.25;
}

.mobile-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
}

.mobile-quick-tile {
  min-height: 78px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  text-align: left;
  display: grid;
  align-content: center;
  gap: 5px;
}

.mobile-quick-tile strong {
  font-size: 13px;
  line-height: 1.2;
}

.mobile-quick-tile span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.mobile-quick-tile:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.mobile-limit-note {
  padding: 10px 12px;
  border: 1px solid #f0da9f;
  border-radius: 8px;
  background: #fff4d8;
  color: #714d05;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

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

.mobile-element-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 22px rgba(19, 31, 44, .06);
}

.mobile-element-card > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.mobile-element-card > header strong {
  display: block;
  line-height: 1.2;
}

.mobile-element-card > header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.mobile-element-actions {
  display: flex;
  gap: 6px;
}

.mobile-element-actions .icon-button {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  font-size: 15px;
}

.mobile-upload-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  display: grid;
  gap: 5px;
}

.mobile-upload-box strong {
  font-size: 14px;
  line-height: 1.25;
}

.mobile-upload-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.mobile-answer-list {
  display: grid;
  gap: 8px;
}

.mobile-answer-row {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 8px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 40px;
  gap: 8px;
  align-items: center;
}

.mobile-answer-row.correct {
  border-color: #cbead8;
  background: #e9f7ef;
}

.mobile-answer-radio-label {
  display: grid;
  place-items: center;
  gap: 0;
}

.mobile-answer-radio-label input {
  width: 22px;
  height: 22px;
  padding: 0;
}

.mobile-image-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: #344353;
  font-size: 13px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

/* Result panels expose raw API responses so product/agent behavior is easy to audit. */
.result {
  min-height: 42px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #111820;
  color: #d8e5f0;
  font-size: 12px;
  line-height: 1.45;
}

.inline-json {
  max-height: 160px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: #f5f7fa;
  color: var(--muted);
  font-size: 12px;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.brief-form {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.account-profile-editor,
.account-profile-fields,
.account-edit-unlock,
.account-access-editor,
.account-settings-tabs {
  display: grid;
  gap: 12px;
}

.account-edit-unlock {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.account-edit-unlock span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.account-edit-unlock label {
  grid-column: 1 / -1;
}

.account-profile-editor {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
}

.account-avatar-editor {
  display: flex;
  align-items: flex-start;
}

.account-avatar-preview {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #eef3f7;
  color: var(--ink);
  font-size: 23px;
  font-weight: 850;
  cursor: pointer;
}

.account-avatar-preview:disabled {
  cursor: not-allowed;
  opacity: .72;
}

.account-avatar-menu-wrap {
  position: relative;
}

.account-avatar-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  min-width: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.account-avatar-menu button {
  display: flex;
  align-items: center;
  min-height: 42px;
  width: 100%;
  justify-content: flex-start;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: white;
  color: var(--ink);
  text-align: left;
}

.account-avatar-menu button:hover {
  background: #f3f6f9;
}

.account-avatar-menu .danger-text {
  color: var(--red);
}

.account-profile-fields {
  grid-template-columns: 1fr;
}

.account-access-editor {
  padding-top: 4px;
}

.account-tab-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.account-tab {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  line-height: 1.2;
  white-space: normal;
}

.account-tab:not(.active) {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}

.account-tab.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
  -webkit-text-fill-color: white;
}

.account-tab-panel {
  display: none;
}

.account-tab-panel.active {
  display: block;
}

/* Защита от старой разметки: списки настроек должны жить только внутри
   tab-panel, иначе они могут появиться сразу под всеми вкладками. */
#account-settings-form > .account-subscriptions,
#account-branches-all {
  display: none !important;
}

.account-tab-panel .account-subscriptions {
  display: grid;
}

.preference-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.preference-head {
  display: grid;
  gap: 2px;
}

.preference-head span {
  color: var(--muted);
  font-size: 13px;
}

.preference-head-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.preference-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.account-access-tree {
  display: grid;
  gap: 10px;
}

.account-tree-category {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.account-tree-category-head,
.account-tree-branch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.account-tree-branches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  padding-left: 24px;
}

.account-tree-topic {
  display: grid;
  gap: 6px;
}

.account-tree-branch {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  font-size: 13px;
}

.account-tree-branch.muted {
  color: var(--muted);
  opacity: .62;
}

.account-tree-category input,
.account-tree-branch input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.choice-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 750;
}

.choice-pill input {
  width: 18px;
  height: 18px;
}

.series-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-top: 20px;
}

.series-toggle input {
  width: 18px;
  height: 18px;
}

.account-subscriptions {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.following-list,
.saved-post-list {
  display: grid;
  gap: 8px;
}

.following-item,
.saved-post-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.saved-post-copy {
  min-width: 0;
}

.saved-post-copy strong {
  display: block;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.following-item span,
.saved-post-copy span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.saved-post-item > button.ghost {
  justify-self: end;
  display: inline-grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 0;
  line-height: 1;
}

.saved-post-item > button.ghost::before {
  content: "↩";
  font-size: 20px;
}

#account-liked-post-list .saved-post-item > button.ghost::before {
  content: "×";
}

.notice,
.settings-message {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.settings-message.error {
  border-color: rgba(192, 59, 59, .35);
  background: #fff6f6;
  color: var(--red);
}

.account-form-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.account-form-actions .account-save-button {
  min-width: 0;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.compact-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.danger {
  background: var(--red);
}

.success {
  background: var(--green);
}

@media (max-width: 640px) {
  .shell {
    padding-inline: 10px;
  }

  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  #author > .panel {
    padding: 12px;
  }

  #author .page-head-with-back {
    align-items: start;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  #author .page-head-with-back p {
    display: none;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    min-height: 62px;
    padding: 8px 2px;
  }

  .brand-lockup .brand-logo,
  .header-brand-logo {
    width: clamp(120px, 38vw, 150px);
    max-height: 44px;
  }

  .userbar {
    align-items: center;
    flex: 1 1 auto;
    flex-direction: row;
    justify-content: flex-end;
    min-width: 0;
    gap: 6px;
  }

  .top-icon-nav {
    gap: 6px;
  }

  .top-icon-button,
  .profile-menu {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .feed-header {
    align-items: stretch;
    flex-direction: column;
  }

  .feed-filter-panel {
    display: grid;
    grid-template-columns: auto auto 44px 44px minmax(0, 1fr);
    gap: 6px;
  }

  .feed-filter-title {
    min-height: 44px;
    font-size: 13px;
  }

  .feed-filter-reset {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .feed-filter-chip {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    font-size: 17px;
  }

  .feed-filter-catalog {
    min-width: 0;
  }

  .feed-filter-tree > summary {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 12px;
  }

  .catalog-follow-button,
  .search-tab,
  .small-action,
  .profile-create-post-button,
  .profile-points-counter,
  .profile-actions-menu summary,
  .post-menu summary {
    min-height: 44px;
  }

  .profile-actions-menu summary,
  .post-menu summary {
    width: 44px;
    height: 44px;
  }

  .page-head-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .public-profile-posts-head {
    align-items: stretch;
    flex-direction: column;
  }

  .public-profile-main {
    padding-right: 0;
  }

  .public-profile-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
    gap: 8px;
  }

  .public-profile-title-row .small-action {
    max-width: 100%;
  }

  .public-profile-actions {
    position: static;
    justify-content: flex-start;
    margin-top: 8px;
  }

  .profile-filter-control {
    width: 100%;
  }

  .catalog-head {
    grid-template-columns: 1fr;
  }

  .catalog-tree-category summary {
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .catalog-tree-category summary .catalog-follow-button {
    width: auto;
    padding-inline: 9px;
    font-size: 12px;
  }

  .account-profile-editor {
    grid-template-columns: 1fr;
  }

  .account-tab-buttons,
  .draft-form-actions,
  .preference-head-row {
    grid-template-columns: 1fr;
  }

  .draft-mobile-composer {
    display: grid;
    gap: 12px;
  }

  .mobile-composer-meta {
    grid-template-columns: 1fr;
  }

  .draft-mobile-composer label {
    font-size: 12px;
  }

  .draft-mobile-composer input,
  .draft-mobile-composer select,
  .draft-mobile-composer textarea {
    min-height: 48px;
    padding: 12px;
    font-size: 15px;
  }

  .draft-mobile-composer textarea {
    line-height: 1.45;
  }

  .draft-form-actions {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: 4px -12px -12px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
    background: rgba(244, 246, 248, .96);
    backdrop-filter: blur(12px);
  }

  .draft-form-actions button {
    min-height: 48px;
  }

  .preference-actions {
    justify-content: stretch;
  }

  .preference-actions button {
    flex: 1 1 160px;
  }

  .account-tree-branches {
    grid-template-columns: 1fr;
    padding-left: 0;
  }

  .account-form-actions {
    grid-template-columns: 1fr;
  }

  .card-list {
    grid-template-columns: 1fr;
  }
}
