@charset "UTF-8";
/* ============================================================================
   Лист персонажа — «Личный листок по учёту кадров».
   Подключается только на sheet.html; порядок слоёв объявлен в main.css.

   Лист — бумажный документ на чёрной стене, как оттиски в раме: светлая
   бумага, машинопись PT Mono, чернильные кружки. Это единственное место
   сайта со светлой поверхностью, и оно светлое потому, что это бумага.
   ========================================================================== */

@layer sections {
  /* — панель действий ————————————————————————————————————————— */

  .sheet-bar {
    position: sticky;
    top: calc(var(--header-h) + var(--s2));
    z-index: var(--z-raised);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--s3) var(--s5);
    margin-block-end: var(--s6);
    padding: var(--s3) var(--s4);
    background: color-mix(in oklab, var(--ink-0) 90%, transparent);
    border: 1px solid var(--ink-3);
    border-radius: var(--r-sharp);
    backdrop-filter: blur(12px);
  }

  .sheet-bar__main,
  .sheet-bar__more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s2) var(--s3);
  }

  .sheet-bar__link {
    min-height: 40px;
    padding-inline: var(--s2);
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bone-dim);
    transition: color var(--dur-1) var(--ease);
  }

  .sheet-bar__link:hover {
    color: var(--gold-lt);
  }

  .sheet-bar__link--danger:hover {
    color: var(--gold-lt);
  }

  .sheet-bar__link.is-armed {
    color: var(--gold-lt);
    text-decoration: underline;
    text-underline-offset: 0.3em;
  }

  .sheet-bar [aria-busy="true"] {
    cursor: progress;
    opacity: 0.7;
  }

  .sheet-bar__status {
    flex-basis: 100%;
    min-height: 1.2em;
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
    color: var(--ash);
  }

  .sheet-bar__status:empty {
    display: none;
  }

  .sheet-bar__status.is-warn {
    color: var(--gold-lt);
  }

  .sheet-page__note {
    max-width: 70ch;
    margin: var(--s6) auto 0;
    font-size: var(--fs-sm);
    color: var(--bone-dim);
    text-align: center;
  }

  /* — бумага ————————————————————————————————————————————————— */

  .sheet {
    --paper: oklch(0.985 0.004 90);
    --ink: oklch(0.2 0.006 60);
    --line: oklch(0.38 0.008 60);
    --muted: oklch(0.45 0.012 60);
    --mark: var(--red-deep);
    --dot: 22px;

    position: relative;
    isolation: isolate;
  }

  /* красный — это свет: лист висит на стене, за ним свечение */
  .sheet::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 8% 4% -2%;
    background: radial-gradient(ellipse at 50% 60%, color-mix(in oklab, var(--red) 34%, transparent), transparent 70%);
    filter: blur(60px);
    pointer-events: none;
  }

  .sheet__pages {
    display: grid;
    gap: var(--s6);
    grid-template-columns: minmax(0, 1fr);
  }

  /* На широком экране — разворот, как на бумажном бланке: две половины
     листа A4 и линия сгиба между ними. */
  @media (min-width: 80rem) {
    .sheet__pages {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 0;
      box-shadow: 0 40px 90px -40px #000;
    }

    .sheet__page--two {
      border-inline-start: 2px solid var(--line);
    }

    /* В развороте колонка навыков ~300 px: «Коммуникабельность» и пять точек
       в неё не влезали и выталкивали точки за край. */
    .sheet__page {
      font-size: 14px;
    }

    .sheet {
      --dot: 20px;
    }

    .dots {
      gap: 3px;
    }
  }

  .sheet__page {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
    padding: clamp(16px, 2.6vw, 40px);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-type);
    font-size: 15px;
    line-height: 1.45;
    box-shadow: 0 0 0 1px color-mix(in oklab, #000 60%, transparent);
  }

  .sheet :focus-visible {
    outline: 2px solid var(--mark);
    outline-offset: 2px;
  }

  .sheet ::placeholder {
    color: var(--muted);
  }

  .sheet__head {
    text-align: center;
  }

  .sheet__title {
    font-family: var(--font-ui);
    font-size: clamp(1.4rem, 1.1rem + 1vw, 1.75rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.02em;
  }

  .sheet__subtitle {
    margin-block-start: 2px;
    font-size: 14px;
    letter-spacing: 0.42em;
  }

  .sheet__label {
    font-family: var(--font-type);
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.3;
  }

  .sheet__label small {
    font-size: 12px;
  }

  /* Заголовок раздела с жирными линиями по бокам — как «━━ Атрибуты ━━» на бланке. */
  .sheet__rule {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin-block-end: var(--s3);
    font-family: var(--font-ui);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--ink);
  }

  .sheet__rule::before,
  .sheet__rule::after {
    content: "";
    flex: 1;
    height: 3px;
    background: var(--ink);
    border-radius: 2px;
  }

  .sheet__group-title {
    margin-block: var(--s3) var(--s2);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: none;
    color: var(--ink);
    text-align: center;
  }

  /* Блоки и группы — дети грид-колонок: без min-width:0 длинное название
     навыка раздвигает колонку шире бумаги. */
  .sheet__block,
  .sheet__group {
    min-width: 0;
  }

  /* Нижний ряд левой половины: навыки слева, вооружение и живчик справа —
     колонки прижаты к верху, как на бланке. */
  .sheet__cols--kit {
    align-items: start;
  }

  .sheet__cols {
    display: grid;
    gap: var(--s2) var(--s6);
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  @media (min-width: 40rem) {
    .sheet__cols {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  /* — поле ввода на бумаге ————————————————————————————————————— */

  .sheet__input {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 2px 4px 1px;
    background: transparent;
    border: 0;
    border-block-end: 1px solid var(--line);
    border-radius: 0;
    color: var(--ink);
    font: inherit;
    font-family: var(--font-type);
  }

  .sheet__input:hover {
    background: color-mix(in oklab, var(--ink) 4%, transparent);
  }

  /* Не влезет на бланк даже мелким кеглем — подчёркивание становится тревожным. */
  .sheet__input.is-overflow {
    border-block-end: 2px solid var(--mark);
  }

  .kit__input.is-overflow {
    border: 1px solid var(--mark);
    box-shadow: inset 0 -2px 0 var(--mark);
  }

  .sheet__input:focus {
    background: color-mix(in oklab, var(--mark) 6%, transparent);
    border-block-end-color: var(--mark);
  }

  /* — анкета ——————————————————————————————————————————————————— */

  .anketa {
    display: grid;
    gap: var(--s4);
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .anketa__fields {
    display: flex;
    flex-direction: column;
    gap: var(--s2);
  }

  .anketa__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s1) var(--s4);
  }

  .anketa__pair {
    display: flex;
    flex: 1 1 9rem;
    align-items: baseline;
    gap: var(--s2);
    min-width: 0;
  }

  .anketa__pair.is-wide {
    flex-basis: 100%;
  }

  .anketa__pair.is-short {
    flex: 0 0 5.5rem;
  }

  .anketa__label {
    flex: none;
    white-space: nowrap;
  }

  /* На телефоне пары «подпись — поле» по две в строку не помещаются:
     поле сжималось в чёрточку. Каждой — своя строка. */
  @media (max-width: 34.99rem) {
    .anketa__pair,
    .anketa__pair.is-short {
      flex: 1 1 100%;
    }
  }

  /* — фото 3×4 ——————————————————————————————————————————————— */

  .photo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s2);
    width: clamp(92px, 12vw, 128px);
  }

  .photo__frame {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 3 / 4;
    border: 1px solid var(--ink);
    background: var(--paper);
    overflow: hidden;
  }

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

  .photo__empty {
    font-size: 12px;
    color: var(--muted);
  }

  .photo__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 var(--s2);
  }

  .photo__btn {
    min-height: 32px;
    font-family: var(--font-type);
    font-size: 12px;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .photo__btn:hover {
    color: var(--mark);
  }

  @media (max-width: 29.99rem) {
    .anketa {
      grid-template-columns: minmax(0, 1fr);
    }

    .photo {
      flex-direction: row;
      width: auto;
    }

    .photo__frame {
      width: 84px;
    }

    .photo__actions {
      flex-direction: column;
      align-items: flex-start;
    }
  }

  /* — строка характеристики: «Сила ______ ●○○○○» ————————————————— */

  .trait {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 34px;
  }

  .trait__name {
    flex: none;
    padding: 2px 0;
    color: var(--ink);
    font: inherit;
    font-family: var(--font-type);
    text-align: start;
    text-decoration: underline dotted color-mix(in oklab, var(--ink) 55%, transparent);
    text-underline-offset: 4px;
    cursor: help;
  }

  .trait__name:hover {
    color: var(--mark);
    text-decoration-color: var(--mark);
  }

  /* Надпись бланка, открывающая описание: выглядит как подпись, а не как кнопка. */
  .sheet__info {
    padding: 0;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-align: inherit;
    text-decoration: underline dotted color-mix(in oklab, var(--ink) 55%, transparent);
    text-underline-offset: 4px;
    cursor: help;
  }

  .sheet__info:hover {
    color: var(--mark);
    text-decoration-color: var(--mark);
  }

  .anketa__label.sheet__info {
    flex: none;
    white-space: nowrap;
  }

  .kold__legend {
    margin-block-start: var(--s3);
    font-size: 14px;
    text-align: center;
  }

  .trait__custom {
    flex: 0 1 11rem;
  }

  .trait__leader {
    flex: 1;
    min-width: 8px;
    align-self: flex-end;
    margin: 0 6px 9px;
    border-block-end: 1px solid var(--line);
  }

  .trait__custom + .trait__leader {
    border-block-end-color: transparent;
  }

  /* — точки ———————————————————————————————————————————————————— */

  .dots {
    display: inline-flex;
    flex: none;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    cursor: pointer;
    touch-action: manipulation;
  }

  .dot {
    width: var(--dot);
    height: var(--dot);
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    background: var(--paper);
    transition: background-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
  }

  .dot.is-on {
    background: var(--ink);
  }

  .dot.is-preview {
    background: color-mix(in oklab, var(--ink) 28%, var(--paper));
  }

  /* напечатанный на бланке закрашенный кружок: он не снимается */
  .dot.is-fixed {
    background: var(--ink);
    cursor: default;
  }

  .dots:hover .dot:not(.is-fixed):hover {
    transform: scale(1.12);
  }

  .dots--box {
    border-radius: 0;
  }

  .dots--box .dot {
    border-radius: 0;
  }

  .dots--long {
    gap: 3px;
  }

  .dots--long .dot {
    width: calc(var(--dot) - 2px);
    height: calc(var(--dot) - 2px);
  }

  @media (prefers-reduced-motion: reduce) {
    .dots:hover .dot:not(.is-fixed):hover {
      transform: none;
    }
  }

  /* — психологический портрет ————————————————————————————————— */

  .portrait {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--s3);
    margin-block-start: var(--s2);
    padding: var(--s3);
    border: 1px solid var(--ink);
    border-block-end: 0;
  }

  .portrait__tracks {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }

  .portrait__aspects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--ink);
  }

  .portrait__col {
    display: flex;
    flex-direction: column;
    padding: 0 var(--s2) var(--s2);
  }

  .portrait__col + .portrait__col {
    border-inline-start: 1px solid var(--ink);
  }

  @media (max-width: 34.99rem) {
    .portrait {
      grid-template-columns: 1fr 1fr;
      grid-template-areas: "a b" "t t";
    }

    .portrait__end:first-child {
      grid-area: a;
    }

    .portrait__end:last-child {
      grid-area: b;
      text-align: end;
    }

    .portrait__tracks {
      grid-area: t;
    }

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

    .portrait__col + .portrait__col {
      border-inline-start: 0;
      border-block-start: 1px solid var(--ink);
    }
  }

  /* — вооружение и живчик ————————————————————————————————————— */

  .kit {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--s5);
    align-items: start;
    padding-block-start: var(--s6);
  }

  .kit__boxes {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
  }

  .kit__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .kit__label {
    font-family: var(--font-ui);
    font-weight: 600;
  }

  .kit__input {
    min-height: 40px;
    border: 1px solid var(--line);
  }

  .zhiv-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .zhiv-wrap .sheet__group-title {
    margin-block-start: 0;
  }

  .zhiv {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .zhiv__row {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .zhiv__box {
    position: relative;
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--ink);
    background: var(--paper);
  }

  .zhiv__box:hover {
    background: color-mix(in oklab, var(--ink) 8%, var(--paper));
  }

  /* «/» — лёгкое, «×» — летальное: так же, как это рисуют на бумаге */
  .zhiv__box::before,
  .zhiv__box::after {
    content: "";
    position: absolute;
    inset: 50% 2px auto;
    height: 2px;
    background: var(--ink);
    opacity: 0;
  }

  .zhiv__box::before {
    rotate: -45deg;
  }

  .zhiv__box::after {
    rotate: 45deg;
  }

  .zhiv__box[data-hurt="1"]::before,
  .zhiv__box[data-hurt="2"]::before,
  .zhiv__box[data-hurt="2"]::after {
    opacity: 1;
  }

  .zhiv__pen {
    width: 2ch;
    font-size: 13px;
  }

  .zhiv__dead {
    margin-block-start: var(--s2);
    font-family: var(--font-ui);
    font-weight: 600;
  }

  .zhiv__hint {
    max-width: 14ch;
    margin-block-start: var(--s2);
    font-size: 11px;
    line-height: 1.35;
    color: var(--muted);
    text-align: center;
  }

  @media (max-width: 29.99rem) {
    .kit {
      grid-template-columns: minmax(0, 1fr);
    }
  }

  /* — колдовство ———————————————————————————————————————————————— */

  .kold {
    display: block;
    width: min(100%, 320px);
    height: auto;
    margin-inline: auto;
    overflow: visible;
  }

  .kold__frame {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
  }

  .kold__line {
    stroke: var(--ink);
    stroke-width: 1.5;
  }

  .kold__dot {
    fill: var(--paper);
    stroke: var(--ink);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill var(--dur-1) var(--ease);
  }

  .kold__dot.is-on {
    fill: var(--ink);
  }

  .kold__dot.is-preview {
    fill: color-mix(in oklab, var(--ink) 28%, var(--paper));
  }

  .kold__axis {
    outline: none;
  }

  .kold__axis:focus-visible .kold__dot {
    stroke: var(--mark);
    stroke-width: 3;
  }

  .kold__label {
    font-family: var(--font-type);
    font-size: 15px;
    fill: var(--ink);
  }

  /* — права ————————————————————————————————————————————————————— */

  .prava {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  /* В правах название вписывает игрок, и оно длиннее названия навыка:
     поле забирает всю ширину до точек, отточие не нужно. */
  .prava .trait__custom {
    flex: 1 1 auto;
    margin-inline-end: var(--s3);
  }

  .prava .trait__leader {
    display: none;
  }

  /* — разлинованные поля ——————————————————————————————————————— */

  .sheet__lined {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  .lined {
    --lh: 30px;
    width: 100%;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(var(--lh) - 1px),
      var(--line) calc(var(--lh) - 1px),
      var(--line) var(--lh)
    );
    background-attachment: local;
    color: var(--ink);
    font-family: var(--font-type);
    font-size: 15px;
    line-height: var(--lh);
    resize: vertical;
  }

  .lined:focus {
    background-color: color-mix(in oklab, var(--mark) 4%, transparent);
  }

  .lined__count {
    margin-block-start: var(--s1);
    font-size: 12px;
    color: var(--muted);
  }

  .lined__count.is-over {
    color: var(--mark);
    font-weight: 400;
  }

  /* — узкий экран: чуть мельче набор, чтобы строка навыка влезала ———— */

  @media (max-width: 26rem) {
    .sheet__page {
      font-size: 14px;
    }

    .sheet {
      --dot: 21px;
    }
  }

  /* — окно описания ——————————————————————————————————————————— */

  .sheet-info__text {
    font-size: var(--fs-body);
    line-height: 1.65;
    color: var(--bone);
    text-wrap: pretty;
  }

  .sheet-info__text b {
    color: var(--gold-lt);
    font-weight: 600;
  }

  .sheet-info__subtitle {
    margin-block: var(--s5) var(--s2);
    font-family: var(--font-ui);
    font-size: var(--fs-xs);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
  }

  .sheet-info__list div {
    padding-block: var(--s2);
    border-block-end: 1px solid var(--ink-3);
  }

  .sheet-info__list dt {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--bone);
  }

  .sheet-info__list dd {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--bone-dim);
  }

  .sheet-info__more {
    margin-block-start: var(--s4);
    font-size: var(--fs-sm);
  }

  .sheet-info h2 {
    margin-block-start: var(--s1);
    font-size: var(--fs-h2);
  }

  /* — печать: только готовый бланк, на весь лист A4 ——————————————— */

  .sheet-print {
    display: none;
  }

  @media print {
    @page {
      size: A4 landscape;
      margin: 0;
    }

    body {
      background: #fff;
    }

    body::after {
      display: none;
    }

    body > *:not(.sheet-print) {
      display: none !important;
    }

    .sheet-print {
      display: block;
    }

    .sheet-print img {
      display: block;
      width: 297mm;
      height: 210mm;
      max-width: none;
    }
  }
}
