/* Внутренние экраны мастерской. Общие элементы — в style.css.
   Цвет раздела живёт в пиктограмме и маркере; статус и основной текст от него не зависят. */
.app-shell {
  --sidebar-width: 268px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: #f7f7f9;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  padding: 24px 18px;
  background: #fff;
  border-right: 1px solid var(--line, #e4e7ee);
  color: var(--ink, #15171c);
}
.sidebar > .brand { padding: 0 9px; font-size: 19px; gap: 10px; }
.sidebar .brand-mark { width: 33px; height: 33px; }
.series-switch {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 13px 12px;
  border: 1px solid var(--line, #e4e7ee);
  border-radius: 10px;
  background: #fff;
  color: var(--ink, #15171c);
  text-align: left;
  line-height: 1.5;
  transition: border-color .18s, box-shadow .18s;
}
.series-switch:hover { border-color: #bfc0c9; box-shadow: 0 2px 8px #15171c06; }
.series-switch > div { min-width: 0; }
.series-switch small { display: block; margin-bottom: 3px; font-size: 14px; font-weight: 500; color: var(--muted, #626875); }
.series-switch strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 700; }
.series-switch-icon {
  width: 34px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 7px;
  color: #7251c9;
  background: #f2edfc;
}
.series-switch-icon svg { width: 19px; height: 19px; }
.series-switch > svg:last-child { flex: none; margin-left: auto; width: 15px; height: 15px; color: #626875; }
.side-caption { margin: 0 12px 12px; color: #626875; font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.sidebar > div { min-width: 0; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #626875;
  text-align: left;
  font-size: 15px;
  font-weight: 550;
  transition: color .18s, background .18s;
}
.nav-item { --section-color: #535363; --section-soft: #f0f0f4; }
.nav-item[data-target="heroes"] { --section-color: #bc3d31; --section-soft: #fff0eb; }
.nav-item[data-target="world"] { --section-color: #087f79; --section-soft: #eaf7f4; }
.nav-item[data-target="style"] { --section-color: #7251c9; --section-soft: #f2edfc; }
.nav-item[data-target="references"] { --section-color: #9c6b09; --section-soft: #fff6dd; }
.nav-item[data-target="episodes"] { --section-color: #7251c9; --section-soft: #f2edfc; }
.nav-item .nav-icon { color: var(--section-color); }
.nav-item:hover { color: #15171c; background: #f6f6f8; }
.nav-item[aria-current="page"] { background: var(--section-soft); color: #15171c; box-shadow: inset 3px 0 0 var(--section-color); font-weight: 750; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; flex: none; }
.nav-icon svg { display: block; width: 18px; height: 18px; }
.nav-order { margin-left: auto; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; opacity: 1; }
.nav-item[aria-current="page"] .nav-order { opacity: 1; }
.step-no { width: 20px; flex: none; color: #626875; font-size: 14px; }
.sidebar-note { padding: 15px 13px; border-radius: 9px; background: #f6f6f8; color: #626875; font-size: 15px; line-height: 1.75; }
.sidebar-note p { margin: 0; }
.sidebar-note strong { display: block; color: #303846; font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.sidebar-foot { margin-top: auto; padding: 22px 12px 0; border-top: 1px solid var(--line, #e4e7ee); }
.sidebar-foot .side-caption { margin-left: 0; margin-bottom: 11px; }
.sidebar-foot .help { font-size: 14px; line-height: 1.7; margin: 9px 0 15px; color: #626875; }
.sidebar-foot .text-btn { font-size: 15px; color: #626875; }
.progress-line { height: 3px; overflow: hidden; border-radius: 5px; background: #e4e7ee; }
.progress-line span { display: block; height: 100%; background: var(--progress, #535363); border-radius: inherit; transition: width .25s ease; }
.shell-body { grid-column: 2; min-width: 0; }
.topbar {
  min-height: 68px;
  padding: 12px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line, #e4e7ee);
  background: #fff;
}
.breadcrumb { min-width: 0; font-size: 15px; color: #626875; line-height: 1.6; overflow-wrap: anywhere; }
.breadcrumb strong { color: #15171c; font-weight: 600; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 16px; }
.top-actions .text-btn { font-size: 15px; padding: 5px 0; white-space: nowrap; }
.top-actions > .help { margin: 0; font-size: 14px; color: #626875; }
.top-actions .account-controls { font-size: 15px; }
.project-menu-button .icon { width: 15px; height: 15px; }
.save-status { display: inline-flex; align-items: center; gap: 6px; color: #626875; font-size: 14px; }
.save-status:not(:empty)::before { content: ''; width: 5px; height: 5px; flex: none; border-radius: 50%; background: #626875; }
.mobile-brand { display: none; }
.main { max-width: 1340px; margin: 0 auto; padding: 32px 36px 64px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; }
.content-grid > * { min-width: 0; }
.main h1 { color: #15171c; font-family: var(--sans, Manrope, system-ui, sans-serif); font-size: clamp(30px, 2.7vw, 40px); line-height: 1.2; letter-spacing: -.045em; font-weight: 650; margin: 0 0 17px; }
.main .eyebrow { color: #626875; font-size: 14px; letter-spacing: .045em; margin: 0 0 16px; }
.main h2 { font-size: 22px; line-height: 1.45; letter-spacing: -.025em; font-weight: 700; }
.main h3 { font-size: 18px; line-height: 1.5; letter-spacing: -.018em; font-weight: 700; }
.lead { max-width: 660px; margin: 0 0 26px; color: var(--muted, #626875); font-size: 17px; line-height: 1.65; }
.section-number { color: #626875; font-size: 14px; font-variant-numeric: tabular-nums; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading > :first-child { min-width: 0; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 17px; }
.item-card { display: flex; flex-direction: column; }
.item-card h3 { overflow-wrap: anywhere; margin-bottom: 5px; }
.item-card p { white-space: pre-line; overflow-wrap: anywhere; }
.item-card .actions { margin-top: auto; padding-top: 18px; gap: 8px; }
.item-card .actions .btn { flex-grow: 1; }
.item-card .reference-count { margin-top: auto; }
.card-subtitle { color: #626875; font-size: 14px; line-height: 1.6; }
.reference-count { color: #626875; font-size: 14px; line-height: 1.6; }
.file-meta { color: #626875; font-size: 14px; line-height: 1.7; }
.hero-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.add-card {
  display: flex;
  min-height: 174px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  padding: 20px;
  border: 1px dashed #c9c7d0;
  border-radius: 12px;
  color: #626875;
  background: #fcfbfd;
  font-size: 15px;
  font-weight: 600;
  transition: background .18s, border-color .18s;
}
.add-card:hover { background: var(--action-soft); border-color: var(--action-text); color: #15171c; }
.add-card > span { width: 32px; height: 32px; border-radius: 50%; background: var(--action-soft); color: var(--action-text); border-color: var(--action-text); display: grid; place-items: center; font-size: 23px; font-weight: 400; }
.step-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 27px; }
.next-note { color: #626875; font-size: 14px; line-height: 1.7; margin: 0; }
.right-rail { position: sticky; top: 26px; padding-top: 1px; }
.profile-layout { max-width: 880px; margin: 0 auto; }
.profile-layout .lead { max-width: 720px; margin-bottom: 20px; }
.profile-layout h1 { margin-bottom: 10px; }
.profile-panel { padding: 26px 28px; }
.profile-age { max-width: 340px; margin-bottom: 24px; }
.custom-interest-row { margin-top: 14px; }
.custom-interest-row .search-input { max-width: 360px; }
.profile-optional { margin-top: 24px; }
.profile-optional summary { display: flex; align-items: baseline; gap: 9px; color: #41424c; }
.profile-optional summary span { color: #7a7f8b; font-size: 13px; font-weight: 500; }
.profile-optional .fields { margin-top: 20px; }
.preview-card { border: 1px solid #e4e7ee; border-radius: 12px; overflow: hidden; background: #fff; }
.preview-top {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  padding: 25px;
  background: #f7f6fa;
  color: #15171c;
}
/* Небольшая палитра связывает черновик с многоцветным миром мастерской. */
.preview-top::before { content: ''; position: absolute; z-index: -1; width: 110px; height: 110px; right: -55px; bottom: -60px; border: 18px solid #7251c9; border-radius: 50%; opacity: .13; }
.preview-top::after { content: ''; position: absolute; z-index: -1; width: 9px; height: 24px; border-radius: 3px; right: 45px; bottom: 26px; background: #d95c48; box-shadow: 13px 0 #0f8d86, 26px 0 #e6b541; transform: rotate(-10deg); }
.preview-top .eyebrow { color: #626875; font-size: 14px; letter-spacing: .04em; margin-bottom: 24px; }
.preview-top h3 { max-width: 220px; margin: 0; color: #15171c; font-family: var(--sans, Manrope, system-ui, sans-serif); font-size: 28px; font-weight: 750; line-height: 1.15; letter-spacing: -.025em; overflow-wrap: anywhere; }
.avatar-stack { display: flex; gap: 0; margin-top: 27px; }
.avatar { display: inline-grid; width: 40px; height: 40px; flex: none; place-items: center; border-radius: 12px; background: #fff0eb; color: #bc3d31; font-size: 15px; font-weight: 650; overflow: hidden; }
.avatar:nth-child(2), .item-card:nth-child(2) .avatar { background: #eaf7f4; color: #076c67; }
.avatar:nth-child(3), .item-card:nth-child(3) .avatar { background: #f2edfc; color: #7251c9; }
.avatar:nth-child(4), .item-card:nth-child(4) .avatar { background: #fff6dd; color: #80570a; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-stack .avatar { width: 34px; height: 34px; border: 2px solid #f7f6fa; border-radius: 50%; margin-left: -5px; font-size: 15px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.preview-caption { padding: 21px 22px; }
.preview-caption > strong { display: block; font-size: 15px; font-weight: 650; margin-bottom: 8px; }
.preview-caption .help { margin: 0 0 14px; font-size: 14px; line-height: 1.8; }
.preview-caption .reference-count { font-size: 14px; }
.rail-note { padding: 23px 4px; border-bottom: 1px solid var(--line, #e4e7ee); }
.rail-note:last-child { border-bottom: 0; }
.rail-note h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.rail-note h3::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: #7251c9; flex: none; }
.rail-note p { font-size: 14px; line-height: 1.9; color: #626875; margin: 0; }
.drop-zone { padding: 37px 24px 30px; text-align: center; border: 1px dashed #c9c7d0; border-radius: 12px; background: #f8f8fa; transition: background .18s, border-color .18s; }
.drop-zone.dragging { border-color: var(--action-text); background: var(--action-soft); }
.drop-zone h3 { margin-bottom: 9px; }
.drop-zone p { color: #626875; font-size: 15px; margin-bottom: 22px; }
.drop-zone input { max-width: 100%; }
.drop-zone .text-btn { font-size: 15px; }
.file-preview { display: flex; align-items: center; justify-content: center; width: 100%; height: 160px; background: #f6f6f8; border-radius: 7px; overflow: hidden; margin-bottom: 18px; }
.file-preview img { width: 100%; height: 100%; object-fit: contain; }
.file-preview audio { max-width: 95%; }
.file-preview > span { color: #626875; font-size: 16px; }
.option-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option { display: flex; flex-direction: column; gap: 9px; padding: 17px; border: 1px solid var(--line, #e4e7ee); border-radius: 9px; font-size: 15px; cursor: pointer; transition: border-color .18s, background .18s; }
.option:hover { border-color: var(--action-text); }
.option:has(input:checked) { border-color: var(--action-text); background: var(--action-soft); }
.option input { margin: 0; accent-color: var(--action); }
.option strong { font-size: 15px; font-weight: 650; }
.option small { color: #626875; font-size: 14px; line-height: 1.7; }
.choice-description { color: #626875; font-size: 15px; line-height: 1.8; margin-top: 12px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line, #e4e7ee); font-size: 16px; line-height: 1.7; }
.status-row:last-child { border-bottom: 0; }
.status-row .text-btn { flex: none; color: #41424c; font-size: 15px; text-decoration: underline; text-underline-offset: 4px; }
.status-row .text-btn:hover { color: var(--action-text); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; font-size: 15px; line-height: 1.7; }
.check-icon { width: 17px; flex: none; color: #626875; }
.check-icon.done { color: var(--success); }
.episode-composer { box-shadow: 0 3px 14px #37204a05; border-color: #e2d9f2; }
.episode-composer textarea { min-height: 164px; font-size: 17px; line-height: 1.7; }
.example { display: block; padding: 8px 0; border: 0; background: transparent; color: #626875; font-size: 14px; text-align: left; line-height: 1.7; text-decoration: underline; text-decoration-color: #c9c7d0; text-underline-offset: 4px; }
.example:hover { color: var(--action-text); text-decoration-color: currentColor; }
.version-stamp { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 21px; border-top: 1px solid var(--line, #e4e7ee); color: #626875; font-size: 14px; line-height: 1.8; }
.version-stamp .btn { flex: none; }
.empty-state { padding: 35px 24px; color: #626875; border: 1px dashed #c9c7d0; border-radius: 11px; text-align: center; font-size: 16px; line-height: 1.8; }
.callout { padding-left: 16px; margin: 25px 0; border-left: 2px solid #7251c9; }
.callout p { margin: 0; color: #626875; font-size: 15px; line-height: 1.85; }
.recipe { list-style: none; padding: 0; counter-reset: recipe; }
.recipe li { display: flex; gap: 12px; margin: 17px 0; counter-increment: recipe; font-size: 16px; line-height: 1.75; }
.recipe li::before { display: grid; flex: none; place-items: center; content: counter(recipe); width: 24px; height: 24px; border-radius: 50%; color: #7251c9; background: #f2edfc; font-size: 14px; font-weight: 700; }
.link-list a { display: block; margin: 12px 0; font-size: 16px; line-height: 1.7; color: var(--action-text); text-decoration: underline; text-underline-offset: 4px; }
.upload-progress { margin: 13px 0 0; font-size: 15px; }
.upload-progress:empty { margin: 0; }
.page-error { padding: 10px 0; }

@media (min-width: 1600px) {
  .main { padding-top: 42px; }
  .content-grid { grid-template-columns: minmax(0, 1fr) 296px; gap: 32px; }
  .topbar { padding-inline: 48px; }
}
@media (max-width: 1240px) {
  .app-shell { --sidebar-width: 248px; }
  .sidebar { padding-inline: 14px; }
  .main { padding: 35px 30px 60px; }
  .topbar { padding-inline: 30px; }
  .content-grid { grid-template-columns: minmax(0, 1fr) 230px; gap: 24px; }
  .preview-top { padding: 22px; }
  .top-actions { gap: 13px; }
  .top-actions > .help { display: none; }
}
@media (max-width: 1120px) {
  .content-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .right-rail { position: static; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 10px; }
  .preview-card { grid-row: span 2; }
  .preview-top { min-height: 164px; }
  .rail-note { padding: 15px 0; }
  .rail-note:last-child { padding-top: 0; }
  .save-status { display: none; }
}
@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; padding: 12px 22px; border-right: 0; border-bottom: 1px solid var(--line, #e4e7ee); gap: 0; overflow: visible; }
  .sidebar > .brand, .sidebar .series-switch, .sidebar .side-caption, .sidebar-foot, .sidebar-note { display: none; }
  .side-nav { flex-direction: row; width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-padding-inline: 8px; padding: 4px 4px 6px; gap: 5px; scrollbar-width: thin; }
  .nav-item { width: auto; flex: none; padding: 10px 13px; gap: 8px; min-height: 46px; font-size: 15px; white-space: nowrap; }
  .nav-order { display: none; }
  .nav-icon, .nav-icon svg { width: 16px; height: 16px; }
  .shell-body { width: 100%; }
  .topbar { padding: 14px 24px; min-height: 65px; }
  .mobile-brand { display: inline-flex; font-size: 16px; gap: 9px; }
  .mobile-brand .brand-mark { width: 28px; height: 28px; }
  .breadcrumb { display: none; }
  .top-actions { gap: 15px; }
  .top-actions .text-btn { min-height: 44px; }
  .main { max-width: 770px; padding: 32px 24px 56px; }
  .main h1 { font-size: 34px; }
  .lead { font-size: 17px; }
}
@media (max-width: 560px) {
  .sidebar { padding-inline: 13px; }
  .topbar { padding: 13px 18px; gap: 12px; flex-wrap: wrap; }
  .top-actions { margin-left: auto; gap: 13px; }
  .top-actions .text-btn { font-size: 14px; }
  .top-actions .account-controls { width: 100%; justify-content: flex-end; order: 3; }
  .main { padding: 29px 18px 42px; }
  .main h1 { font-size: 29px; }
  .main .eyebrow { margin-bottom: 13px; }
  .lead { margin-bottom: 23px; }
  .main :is(input, textarea, select) { font-size: 16px; }
  .card-grid, .option-grid { grid-template-columns: 1fr; }
  .item-card .actions .btn { flex-grow: 0; }
  .panel-heading { flex-wrap: wrap; gap: 8px; }
  .panel-heading h2 { margin-bottom: 4px; }
  .step-footer { align-items: flex-start; flex-wrap: wrap; gap: 16px; }
  .next-note { max-width: none; flex: 1 1 150px; }
  .right-rail { grid-template-columns: 1fr; padding-top: 0; }
  .right-rail .rail-note { display: none; }
  .preview-top { min-height: 163px; }
  .preview-caption { padding: 19px 22px; }
  .drop-zone { padding: 28px 18px; }
  .status-row { font-size: 15px; align-items: flex-start; }
  .status-row .text-btn { font-size: 14px; }
  .version-stamp { flex-wrap: wrap; gap: 16px; }
  .version-stamp .btn { width: 100%; }
  .option { padding: 17px; }
}

@media (pointer: coarse) {
  .app-shell .text-btn, .app-shell .btn.small, .app-shell .example { min-height: 44px; }
  .app-shell .chip { min-height: 44px; }
}

.optional-caption{margin-top:18px;margin-bottom:9px;font-size:14px}@media(max-width:860px){.optional-caption{display:none}}

/* Mobile shell: one utility bar, then the horizontally scrollable steps. */
@media(max-width:860px){
  .app-shell{display:flex;flex-direction:column}
  .shell-body{display:contents}
  .topbar{order:0;min-height:72px;padding:12px 20px;gap:12px}
  .sidebar{order:1;padding-block:8px}
  .main{order:2;width:100%}
  .top-actions{gap:12px;flex-wrap:nowrap}
  .top-actions>.storage-pill{display:none}
  .top-actions>.text-btn[data-action="export"]{font-size:0;width:40px;height:44px;justify-content:center}
  .top-actions>.text-btn[data-action="export"] .icon{width:22px;height:22px}
  .top-actions>.text-btn[data-action="project-menu"]{font-size:15px}
}
@media(max-width:560px){
  .topbar{padding:12px 18px;flex-wrap:nowrap}
  .top-actions:has(.account-controls){flex-wrap:nowrap}
  .top-actions .account-controls{width:auto;order:initial}
  .top-actions .account-controls>.icon,.top-actions .account-controls>span{display:none}
}

.series-switch strong{white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2}

.top-actions>.storage-pill{display:none}
