/* Фирменный стиль Aster (astercafe.ru): Roboto Slab, кремовый фон,
   тёплый тёмно-серый текст, чёрные тонкие рамки, почти прямые углы.
   Тёмная тема Telegram получает тёплую тёмную палитру с тем же шрифтом. */
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(/fonts/roboto-slab-cyrillic.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url(/fonts/roboto-slab-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg: #f2eee8;
  --card: #fbf9f6;
  --text: #3c3935;
  --hint: #6e6861;
  --ink: #070808;
  --link: var(--ink);
  --button: var(--ink);
  --button-text: #f2eee8;
  --accent: #e8694a;
  --line: rgba(60, 57, 53, .18);
  --ok: #3f7a4a;
  --bad: #b3261e;
  --warn: #8a5a00;
  --radius: 4px;
  --font: "Roboto Slab", Georgia, serif;
  color-scheme: light;
}
:root[data-scheme=dark] {
  --bg: #1e1c1a;
  --card: #282522;
  --text: #eee9e2;
  --hint: #a39c93;
  --ink: #eee9e2;
  --button-text: #1e1c1a;
  --accent: #ff8562;
  --line: rgba(238, 233, 226, .16);
  --ok: #7cc48f;
  --bad: #ff8a80;
  --warn: #f0b24a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--font); background: var(--bg); color: var(--text);
  padding-bottom: calc(72px + var(--safe-bottom)); }
:root { --safe-top: max(env(safe-area-inset-top), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --safe-bottom: max(env(safe-area-inset-bottom), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --header-h: 53px; }
a, button, summary, label, input, select, textarea { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.top { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: calc(12px + var(--safe-top)) 16px 12px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 3; }
.top h1 { font-size: 19px; font-weight: 300; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back { border: 0; background: none; color: var(--link); font-size: 28px; line-height: 1; padding: 0 8px; min-height: 44px; cursor: pointer; }
main { padding: 12px 16px; max-width: 720px; margin: 0 auto; transition: opacity .15s; }
main.loading { opacity: .45; pointer-events: none; }

/* нижние вкладки: значок и подпись, касание не меньше 52px */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); z-index: 3; }
/* пока открыта клавиатура, вкладки не закрывают поле ввода */
body.typing .tabs { display: none; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; color: var(--hint); text-decoration: none; font-size: 12px; position: relative; }
.tabs a.on { color: var(--ink); font-weight: 500; }
.tabs a.on::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--accent); }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tabs a[href="#/more"] .icon { stroke-width: 3; }
.icon.dim { color: var(--hint); width: 18px; height: 18px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card.row { display: flex; }
a.card.link { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.row > *, .grow { min-width: 0; }
.row.start { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; overflow-wrap: anywhere; }
.muted { color: var(--hint); font-size: 15px; }
.big { font-size: 26px; font-weight: 300; }
.huge { font-size: 38px; font-weight: 300; line-height: 1.2; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
h2 { font-size: 20px; font-weight: 300; margin: 22px 0 10px; }
h3 { font-size: 16px; font-weight: 500; margin: 14px 0 6px; }
.body { white-space: pre-wrap; }
.prose { font-size: 17px; line-height: 1.55; }
.hello { padding: 4px 2px 10px; }
.hello .name { font-size: 28px; font-weight: 300; line-height: 1.2; }
.logo { display: block; height: 30px; width: auto; margin: 4px 0 14px; }
:root[data-scheme=dark] .logo { filter: invert(1); }
.badge { background: var(--accent); color: #fff; color: var(--button-text); border-radius: 999px; min-width: 24px; padding: 2px 8px; text-align: center; font-size: 14px; font-weight: 600; }

/* кнопки: главная, обычная, опасная */
button.main, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; border: 1px solid var(--ink); border-radius: 2px; background: var(--button); color: var(--button-text); padding: 10px 18px; font: inherit; font-weight: 400; cursor: pointer; text-decoration: none; margin: 0 0 10px; }
button.ghost, button.danger { min-height: 44px; background: none; color: var(--ink); border: 1px solid var(--ink); border-radius: 2px; padding: 9px 14px; font: inherit; cursor: pointer; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.small { min-height: 36px; padding: 6px 12px; font-size: 15px; }
button.chosen { background: var(--ink); color: var(--button-text); font-weight: 500; }
button.wide, .btn.wide { width: 100%; }
button:disabled { opacity: .5; cursor: default; }
a.ghostlink { background: none; color: var(--ink); border: 1px solid var(--ink); }
/* фирменная волнистая линия под ссылками-действиями, как на сайте Aster */
main a:not([class]) { color: var(--ink); text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 4px; }

input[type=search], input[type=text], input[type=number], textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 2px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; margin: 0 0 10px; }
.field input, .field select, .field textarea { margin: 0; }
textarea { resize: vertical; }
.field { display: block; margin: 0 0 14px; }
.field .label { display: block; font-size: 14px; font-weight: 500; margin: 0 0 4px; }
.field .muted { display: block; margin-top: 4px; font-size: 14px; }
.error { color: var(--bad); }

/* дневник и тест */
.tick { width: 22px; height: 22px; flex: none; border-radius: 2px; border: 1.5px solid var(--hint); display: inline-flex; align-items: center; justify-content: center; }
.tick.on { background: var(--ok); border-color: var(--ok); }
.tick.on::after { content: ""; width: 6px; height: 11px; border: solid var(--card); border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
.line { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; }
button.card.item { width: 100%; text-align: left; border: 0; font: inherit; color: inherit; cursor: pointer; }
.card.item { margin: 0 0 8px; }
details.day { margin: 0 0 6px; }
details.day > summary { display: flex; justify-content: space-between; gap: 12px; padding: 12px 2px; cursor: pointer; list-style: none; scroll-margin-top: 60px; }
details.day > summary::-webkit-details-marker { display: none; }
#today { scroll-margin-top: 60px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 2px; background: var(--bg); margin: 6px 0; cursor: pointer; min-height: 44px; }
.opt input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
fieldset.question { border: 0; }
fieldset.question legend { font-weight: 700; padding: 0; float: left; width: 100%; margin-bottom: 4px; }
fieldset.question.missing { outline: 2px solid var(--warn); }
.timer { position: sticky; top: calc(var(--header-h) + var(--safe-top)); display: flex; justify-content: space-between; background: var(--bg); padding: 8px 0; font-weight: 700; z-index: 2; font-variant-numeric: tabular-nums; }
.sticky-action { position: sticky; bottom: calc(62px + var(--safe-bottom)); background: var(--bg); padding: 8px 0 0; }
.result { text-align: center; padding: 24px 14px; }
.bar { height: 6px; background: color-mix(in srgb, var(--text) 10%, transparent); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; background: var(--accent); }
.facts > div { margin: 2px 0; }

.tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 2px; border: 1px solid var(--line); background: var(--bg); color: var(--hint); margin-right: 4px; white-space: nowrap; }
.tag.on { color: var(--ok); }
.warn-tag { color: var(--warn); }
details.dish > summary { display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
details.dish > summary::-webkit-details-marker { display: none; }
img.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 2px; flex: none; background: var(--bg); }
details.dish .label { display: block; font-size: 14px; font-weight: 500; margin: 10px 0 0; }
ul.bullets { margin: 4px 0 6px; padding-left: 20px; }
ul.bullets li { margin: 2px 0; }
ul.bullets.warn li::marker { color: var(--warn); }
img.media, video.media { display: block; max-width: 100%; height: auto; aspect-ratio: auto 4 / 3; border-radius: var(--radius); margin: 8px 0; }

/* отчёты */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 2px; padding: 3px; margin: 0 0 12px; }
.seg a { flex: 1; text-align: center; padding: 8px 4px; border-radius: 2px; color: var(--text); text-decoration: none; font-size: 15px; min-height: 40px; }
.seg.many { flex-wrap: wrap; }
.seg.many a { flex: 1 0 30%; }
.seg a.on { background: var(--ink); color: var(--button-text); font-weight: 500; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 500; border-bottom: 1px dotted var(--text); }
th.num, td.num { text-align: right; }
.scroll { overflow-x: auto; }

/* редактор материалов */
.action { margin: 12px 0; }
.action .error { margin-top: 6px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.card.form { background: var(--card); }
.optedit { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.optedit input[type=text] { margin: 0; }
.optedit input[type=checkbox], .optedit input[type=radio] { width: 22px; height: 22px; flex: none; accent-color: var(--ok); }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.answers { margin: 6px 0; padding-left: 18px; }

/* надпись «Сохранено»: появляется над вкладками и сама исчезает */
.notice { position: fixed; left: 50%; bottom: calc(76px + var(--safe-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--button-text); padding: 10px 18px; border-radius: 2px; z-index: 5; transition: opacity .4s; pointer-events: none; }
.notice.gone { opacity: 0; }
.question { -webkit-user-select: none; user-select: none; }
body.shield #view { visibility: hidden; }
body.shield::after { content: "Вернитесь к тесту"; position: fixed; inset: 0; display: grid; place-items: center; background: #fff; color: #888; z-index: 10; }
