@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-cyrillic-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-cyrillic-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Old Standard TT";
  src: url("/assets/fonts/old-standard-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --paper: #efe6d1;
  --ink: #1e1a16;
  --ink-soft: #6d6354;
  --rubric: #ad2a1b;
  --shadow: 38, 24, 10;
  --serif: "Old Standard TT", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171310;
    --ink: #e8dec7;
    --ink-soft: #9a8e79;
    --rubric: #e4634a;
    --shadow: 0, 0, 0;
  }
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#page,
#text {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#text { pointer-events: none; }

#rubric {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#rubric text {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  fill: var(--rubric);
  opacity: 0;
  transition: opacity 620ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

#rubric.is-open text { opacity: 1; }

#rubric.is-open text:nth-of-type(2) { transition-delay: 110ms; }
#rubric.is-open text:nth-of-type(3) { transition-delay: 220ms; }
#rubric.is-open text:nth-of-type(4) { transition-delay: 330ms; }
#rubric.is-open text:nth-of-type(5) { transition-delay: 440ms; }
#rubric:not(.is-open) text { transition-duration: 160ms; }

#cat {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  cursor: grab;
  touch-action: none;
  outline: none;
  will-change: transform;
  visibility: hidden;
}

#cat.is-ready { visibility: visible; }
#cat.is-held { cursor: grabbing; }

#cat img {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  max-width: none;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
  -webkit-user-drag: none;
  filter:
    drop-shadow(0 2px 2px rgba(var(--shadow), 0.34))
    drop-shadow(0 10px 14px rgba(var(--shadow), 0.26));
  transition: filter 240ms ease;
}

#cat img.is-on {
  opacity: 1;
  pointer-events: auto;
}

#cat.is-held img {
  filter:
    drop-shadow(0 6px 5px rgba(var(--shadow), 0.16))
    drop-shadow(0 46px 38px rgba(var(--shadow), 0.3));
}

/* Фокус с клавиатуры: обводка по силуэту, а не по рамке картинки. */
#cat:focus-visible img.is-on {
  filter:
    drop-shadow(0 0 1.5px var(--rubric))
    drop-shadow(0 0 1.5px var(--rubric))
    drop-shadow(0 0 5px var(--rubric))
    drop-shadow(0 10px 14px rgba(var(--shadow), 0.26));
}

#foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 0 clamp(20px, 5vw, 72px) calc(18px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

#foot p { margin: 0; }

#clock {
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
}

#hint {
  font-style: italic;
  text-align: right;
  transition: opacity 500ms ease;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.nojs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-size: 20px;
  text-align: center;
}

@media (max-width: 700px) {
  #foot {
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    font-size: 12px;
  }
  #hint { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #rubric text, #cat img { transition: none; }
}
