/* Каляки-маляки — отдельная страница игры MargoStory.com.
   Оболочка вокруг игры: шапка, название, описание, подвал. Сама игра стилизуется в style.css. */

:root { --bar: 52px; }

/* в style.css игра занимает всё окно; здесь страница прокручивается, а игра — блок под шапкой */
html { height: auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: auto; }
/* прокручивается только окно: если дать body свою прокрутку, шапка перестанет прилипать к верху */
body.site { height: auto; min-height: 100%; overflow: visible; overscroll-behavior: auto; }
body.site { display: flex; flex-direction: column; }

.site a { color: var(--ink); }
.site a:focus-visible { outline: 3px dashed var(--red); outline-offset: 3px; }

/* шапка: знак MargoStory, фраза и кнопка в каталог */
.site-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--bar); padding: 6px max(16px, env(safe-area-inset-left)) 6px max(16px, env(safe-area-inset-right));
  background: var(--paper); border-bottom: 2px solid rgba(31, 58, 156, 0.18);
}
.site-brand { font-size: 22px; text-decoration: none; white-space: nowrap; }
.site-brand span { color: var(--red); }
.site-more { flex: 1; min-width: 0; font-size: 15px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-btn {
  flex: none; font-size: 16px; text-decoration: none; padding: 5px 12px;
  border: 2px solid var(--ink); border-radius: 12px 4px 14px 5px / 5px 13px 4px 12px;
  box-shadow: 2px 2px 0 rgba(31, 58, 156, 0.25); white-space: nowrap;
}
.site-btn:hover { transform: translate(-1px, -1px); }

/* название и описание */
.intro { max-width: 720px; margin: 0 auto; padding: 18px 16px 10px; text-align: center; }
.intro h1 { font-weight: normal; font-size: 44px; line-height: 1.05; margin: 0 0 8px; }
.intro-lead { font-size: 18px; line-height: 1.4; margin: 0 auto 6px; max-width: 34em; }
.intro-note { font-size: 15px; color: var(--ink-soft); margin: 0; }

/* игра: блок высотой в экран под шапкой; isolation держит слои игры внутри блока */
#app {
  position: relative; inset: auto; flex: none; isolation: isolate; scroll-margin-top: var(--bar);
  width: 100%; height: calc(100vh - var(--bar)); height: calc(100svh - var(--bar)); min-height: 460px;
  border-top: 2px solid rgba(31, 58, 156, 0.12); border-bottom: 2px solid rgba(31, 58, 156, 0.12);
}

/* подвал */
.site-footer { text-align: center; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); font-size: 15px; color: var(--ink-soft); }
.site-footer p { margin: 6px 0; }
.site-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.site-small { font-size: 13px; }

@media (max-width: 560px) {
  .site-more { display: none; }
  .site-bar { justify-content: space-between; }
  .intro h1 { font-size: 36px; }
  .intro-lead { font-size: 16px; }
}

/* языковые страницы: подзаголовок, строка с названиями, ссылки на другие языки */
.intro-sub { font-size: 18px; color: var(--red); margin: 0 0 10px; }
.intro-names { font-size: 16px; line-height: 1.4; color: var(--ink-soft); margin: 10px auto 8px; max-width: 36em; }
.intro-langs { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; font-size: 15px; margin: 4px 0 0; }
.intro-langs a[aria-current="page"] { color: var(--red); text-decoration: none; }

/* корневая страница выбора языка */
.chooser-main { flex: 1; padding-top: 40px; }
.chooser-langs { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 22px; }
.chooser-langs a {
  min-width: min(320px, 100%); font-size: 21px; text-decoration: none; padding: 10px 18px;
  border: 2.5px solid var(--ink); border-radius: 20px 6px 24px 8px / 8px 22px 6px 20px;
  box-shadow: 3px 3px 0 rgba(31, 58, 156, 0.2);
}

/* ---------- компактная шапка языковых страниц игры ---------- */
.game-page { --bar: 56px; }
.game-bar {
  height: var(--bar); min-height: 0; gap: 14px; padding-top: 0; padding-bottom: 0;
  flex-wrap: nowrap;
}
.game-bar .site-brand { font-size: 20px; flex: none; }
.bar-title { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; line-height: 1.1; }
.bar-title h1 { font-weight: normal; font-size: 24px; line-height: 1.05; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-sub { font-size: 13px; color: var(--red); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bar-langs { display: flex; flex: none; gap: 2px; font-size: 15px; }
.bar-langs a { padding: 4px 6px; border-radius: 8px; text-decoration: none; color: var(--ink-soft); }
.bar-langs a:hover { color: var(--ink); text-decoration: underline; }
.bar-langs a[aria-current="page"] { color: var(--red); border: 1.5px solid currentColor; }

/* «Об игре»: кнопка ⓘ и всплывающее окно под шапкой */
.about { flex: none; }
.about summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; padding: 4px 8px; border-radius: 10px; color: var(--ink);
}
.about summary::-webkit-details-marker { display: none; }
.about summary:focus-visible { outline: 3px dashed var(--red); outline-offset: 2px; }
.about-i {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border: 2px solid currentColor; border-radius: 50%; font-size: 14px; font-weight: bold; font-family: Georgia, serif;
}
.about[open] summary { color: var(--red); }
.about-panel {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 12px; z-index: 30;
  width: min(460px, calc(100vw - 24px)); max-height: calc(100svh - var(--bar) - 24px); overflow-y: auto;
  padding: 14px 16px; background: var(--paper); text-align: start;
  border: 2.5px solid var(--ink); border-radius: 18px 6px 20px 8px / 8px 18px 6px 20px;
  box-shadow: 4px 5px 0 rgba(31, 58, 156, 0.18);
}
.about-panel p { margin: 0 0 10px; font-size: 16px; line-height: 1.4; }
.about-panel .about-names { color: var(--ink-soft); font-size: 15px; }
.about-panel .about-more { margin: 0; font-size: 15px; }

.site-btn .btn-short { display: none; }
.game-bar .site-btn { font-size: 15px; padding: 4px 10px; }

/* средняя ширина: убираем подпись у кнопки ⓘ и длинный текст кнопки каталога */
@media (max-width: 900px) {
  .about-label { display: none; }
  .site-btn .btn-long { display: none; }
  .site-btn .btn-short { display: inline; }
}

/* телефон: две строки — [MargoStory · ⓘ · каталог] и [название · языки] */
@media (max-width: 560px) {
  .game-page { --bar: 92px; }
  .game-bar {
    display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: 40px 44px; column-gap: 8px; row-gap: 0;
    align-items: center; padding: 4px 12px;
  }
  .game-bar .site-brand { grid-column: 1; grid-row: 1; font-size: 19px; }
  .game-bar .about { grid-column: 2; grid-row: 1; }
  .game-bar .site-btn { grid-column: 3; grid-row: 1; font-size: 14px; padding: 3px 8px; }
  .bar-title { grid-column: 1 / 3; grid-row: 2; }
  .bar-title h1 { font-size: 21px; }
  .bar-sub { font-size: 12px; }
  .bar-langs { grid-column: 3; grid-row: 2; font-size: 14px; }
  .bar-langs a { padding: 3px 5px; }
  .about-panel { inset-inline-end: 8px; width: calc(100vw - 16px); }
}
