/* Дінь-Дінь: Лісове піаніно — базові стилі (палітра і токени з docs/05) */
:root {
  --sky: #bfe3f2;
  --cloud: #fff9f0;
  --meadow: #a8ce8f;
  --meadow-deep: #7fb069;
  --sun: #ffd97a;
  --cream: #fff4dc;
  --wood: #c89b6c;
  --wood-light: #e3bd8f;
  --wood-dark: #8b6644;
  --coral: #f49a8e;
  --blush: #f7c8c0;
  --ink: #4a5d43;
  --night: #3e4a6b;
  --key-white: #fffdf5;
  --key-white-shadow: #e8dcc8;
  --key-glow: #ffe28a;
  --key-black: #5c5148;

  /* радіуси */
  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-pill: 999px;

  /* геометрія екрана */
  --topbar-h: 112px; /* куточок Діня 96 + відступи 6×2 + рамка 4 */
  --kb-h: 58vh; /* iOS ≥15.4 перекриває на svh нижче */
  --nook: 96px; /* куточок Діня у панелі */
  --shadow-soft: 0 6px 16px rgba(74, 93, 67, 0.18);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@supports (height: 1svh) {
  :root {
    --kb-h: 58svh;
  }
}

/* Шрифти (OFL, self-hosted; кирилиця + латиниця) */
@font-face {
  font-family: Comfortaa;
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/comfortaa-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: Comfortaa;
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('../assets/fonts/comfortaa-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;
}

@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../assets/fonts/nunito-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: Nunito;
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url('../assets/fonts/nunito-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;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Фон html — небо: якщо WebKit лишить смужку поза сторінкою (iPad, статус-бар), вона не буде білою */
html {
  background: var(--sky);
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  font-family:
    Nunito,
    Comfortaa,
    -apple-system,
    'Helvetica Neue',
    sans-serif;
  color: var(--ink);
  background: var(--sky);
}
h1,
h2 {
  font-family: Comfortaa, Nunito, sans-serif;
  font-weight: 700;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
}
[hidden] {
  display: none !important;
}

/* ── Сплеш ── */
#splash {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(4vh, env(safe-area-inset-top)) 16px max(4vh, env(safe-area-inset-bottom));
  background-image:
    url('../assets/img/app/splash.webp'),
    radial-gradient(130% 70% at 15% 108%, var(--meadow-deep) 0 42%, transparent 43%),
    linear-gradient(var(--sky), #e8f5fb 70%);
  background-size: cover, auto, auto;
  background-position: center;
  transition: opacity 0.4s ease;
}
#splash.hide {
  opacity: 0;
  pointer-events: none;
}
#splash-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
#splash > :not(#splash-art) {
  position: relative; /* над картинкою */
}
#splash h1 {
  font-size: clamp(38px, 8vw, 72px);
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow:
    0 2px 0 #6b8f5a,
    0 6px 18px rgba(74, 93, 67, 0.35);
}
#splash p {
  margin-top: -2px;
  font-size: clamp(16px, 2.6vw, 22px);
  color: #fff;
  text-shadow: 0 1px 6px rgba(74, 93, 67, 0.5);
}
#splash .title {
  display: contents;
}
/* кнопка-хмаринка з зеленим ▶ (U-серія) */
#start-btn {
  position: relative;
  margin-top: auto; /* назва вгорі, хмаринка внизу, Дінь між ними видимий */
  width: 212px;
  height: 140px;
  display: grid;
  place-items: center;
  background: url('../assets/img/bg/cloud-1.webp') center / contain no-repeat;
  filter: drop-shadow(0 8px 14px rgba(74, 93, 67, 0.3));
  cursor: pointer;
  transition: transform 0.15s var(--spring);
}
#start-btn:active {
  transform: scale(0.94);
}
#start-btn .play {
  width: 64px;
  height: 64px;
  margin-top: 10px;
  pointer-events: none;
}
#start-btn .ring {
  position: absolute;
  inset: 36px 64px 20px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(var(--sun), transparent 65%);
  mask: radial-gradient(farthest-side, transparent 78%, #000 80%);
  -webkit-mask: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
#start-btn.loading .ring {
  opacity: 1;
}
#start-btn[disabled] {
  filter: grayscale(1) opacity(0.6);
  pointer-events: none;
}

/* ── Каркас гри ── */
#game {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* Фон: арт B-01 (meadow.webp); під ним CSS-градієнти на випадок, якщо файл не завантажився */
#sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background-image:
    url('../assets/img/bg/meadow.webp'),
    radial-gradient(130% 70% at 15% 106%, var(--meadow-deep) 0 46%, transparent 47%),
    radial-gradient(150% 80% at 88% 110%, var(--meadow) 0 52%, transparent 53%),
    linear-gradient(var(--sky), #e8f5fb 72%);
  background-size: cover, auto, auto, auto;
  background-position: center;
}
/* хмари — арт B-03/B-04, рух лише transform */
.cloud {
  position: absolute;
  width: 220px;
  height: 150px;
  background: center / contain no-repeat;
  opacity: 0.9;
  pointer-events: none;
  will-change: transform;
}
.cloud.c1 {
  top: 6%;
  background-image: url('../assets/img/bg/cloud-1.webp');
}
.cloud.c2 {
  top: 22%;
  width: 160px;
  height: 110px;
  background-image: url('../assets/img/bg/cloud-2.webp');
}

/* ── Верхня панель ── */
#topbar {
  position: relative;
  z-index: 4;
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  /* текстура дерева, тонована в палітру (multiply з --wood-light) */
  background-image:
    url('../assets/img/ui/texture-wood.webp'), linear-gradient(var(--wood-light), var(--wood));
  background-size:
    auto 100%,
    auto;
  background-blend-mode: luminosity; /* зерно з текстури, колір — з палітри */
  border-bottom: 4px solid var(--wood-dark);
  box-shadow: 0 4px 14px rgba(74, 93, 67, 0.25);
}
.btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
  background-image: url('../assets/img/ui/btn-base.webp'), linear-gradient(var(--cream), #f4e3bf);
  background-size:
    100% 100%,
    auto;
  box-shadow:
    inset 0 -4px 0 #0001,
    inset 0 2px 0 #fff8,
    0 3px 8px #0002;
  transition:
    transform 0.13s var(--spring),
    box-shadow 0.2s;
}
/* Арт-шар: картинка з emoji-заглушкою (js/art.js) */
.art {
  display: inline-grid;
  place-items: center;
}
.art img {
  object-fit: contain;
  pointer-events: none;
}
.btn .art img {
  width: 46px;
  height: 46px;
}
.btn.small .art img {
  width: 34px;
  height: 34px;
}
.btn.lock .art img {
  width: 22px;
  height: 22px;
}
.btn.down,
.btn:active {
  transform: scale(0.92);
}
.btn.small {
  width: 64px;
  height: 64px;
  font-size: 28px;
}
.btn.active {
  box-shadow:
    0 0 0 5px var(--sun),
    0 0 22px 4px var(--key-glow);
}
.btn.lock {
  width: 44px;
  height: 44px;
  font-size: 18px;
  opacity: 0.55;
  position: relative;
  touch-action: none;
}
.spacer {
  flex: 1;
}
.parent-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(var(--sun) calc(var(--p, 0) * 1turn), transparent 0);
  mask: radial-gradient(farthest-side, transparent 68%, #000 70%);
  -webkit-mask: radial-gradient(farthest-side, transparent 68%, #000 70%);
}

/* ── Куточок Діня: кругле віконце у панелі — фіксоване місце, нічого не перекриває ── */
.nook {
  flex: none;
  position: relative;
  width: var(--nook);
  height: var(--nook);
  margin-right: 4px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 35%, #eef8ff, var(--sky) 78%);
  box-shadow:
    inset 0 0 0 4px var(--wood-dark),
    inset 0 0 0 8px var(--wood-light),
    0 3px 8px #0003;
}
#mascot-slot {
  position: absolute;
  inset: 10px 8px 4px;
  cursor: pointer;
}
.din {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.din .din-glow {
  fill: var(--sun);
  opacity: 0.18;
}
.din .din-fur {
  fill: #9dbf8e;
}
.din .din-belly {
  fill: var(--cream);
}
.din .din-sprout rect,
.din .din-sprout ellipse {
  fill: #6fa85e;
}
.din .din-eyes circle {
  fill: #3a4136;
}
.din .din-eyes .hl {
  fill: #fff;
}
.din .din-eyes.closed {
  display: none;
}
.din .din-eyes.closed path {
  fill: none;
  stroke: #3a4136;
  stroke-width: 3;
  stroke-linecap: round;
}
.din .din-cheek {
  fill: var(--blush);
}
.din .din-mouth {
  fill: none;
  stroke: #3a4136;
  stroke-width: 3;
  stroke-linecap: round;
}
.mascot.blink .din-eyes.open,
.mascot.sleep .din-eyes.open {
  display: none;
}
.mascot.blink .din-eyes.closed,
.mascot.sleep .din-eyes.closed {
  display: block;
}
.mascot.sleep {
  filter: saturate(0.8) brightness(0.92);
}
.din .din-sprout.flash ellipse {
  fill: var(--sun);
}
.din .din-sprout {
  transform-origin: 60px 30px;
}
.mascot img.din {
  object-fit: contain;
  object-position: bottom;
}
.mascot.antenna .din {
  filter: brightness(1.12) drop-shadow(0 0 8px var(--sun));
}

/* ── Сцена ── */
#stage {
  position: relative;
  z-index: 1;
  flex: 1;
}

/* Клавіатура: до країв екрана, без проміжків між клавішами (зона дотику суцільна) */
#keyboard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--kb-h);
  display: flex;
  gap: 0;
  /* знизу — запас під home-індикатор iPad/iPhone (без viewport-fit=cover inset = 0) */
  padding: 0 env(safe-area-inset-right) max(14px, env(safe-area-inset-bottom))
    env(safe-area-inset-left);
  touch-action: none;
}
/* дотик трохи вище клавіш — теж клавіша (KEYBOARD_REACH_PX) */
#keyboard::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 16px;
}
.key {
  position: relative;
  border-radius: 0 0 var(--r-md) var(--r-md);
  cursor: pointer; /* без overflow:hidden — промінь цілі (::after) виходить за клавішу */
}
/* кольоровий шар ноти (--note-color з keyboard.js): підсвітка і ціль — лише opacity */
.key::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--note-color, var(--key-glow));
  opacity: 0;
  pointer-events: none;
}
.key.white {
  flex: 1;
  min-width: 0;
  background: linear-gradient(var(--key-white) 88%, #f3e9d2);
  box-shadow:
    inset -2px 0 0 var(--key-white-shadow),
    inset 0 -7px 0 var(--key-white-shadow);
}
.key.white:last-of-type {
  box-shadow: inset 0 -7px 0 var(--key-white-shadow);
}
.key.black {
  position: absolute;
  top: 0;
  height: 57%;
  z-index: 2;
  background: linear-gradient(#6b5f55, var(--key-black));
  border-radius: 0 0 12px 12px;
  box-shadow:
    inset 0 -6px 0 #0003,
    0 4px 8px #0003;
}
.note-label {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #0003;
  pointer-events: none;
}

/* Стрічка інструментів — над клавіатурою, праворуч місце під Діня */
#strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--kb-h);
  z-index: 3;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  background: #fff9f0f5;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 3px solid var(--wood);
  border-bottom: 3px solid var(--wood);
}
.card {
  flex: none;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--cream);
  box-shadow: var(--shadow-soft);
  font-size: 44px;
  cursor: pointer;
  transition:
    transform 0.15s var(--spring),
    box-shadow 0.2s;
}
.card:active {
  transform: scale(0.92);
}
.card.selected {
  box-shadow:
    0 0 0 5px var(--sun),
    0 0 24px 5px var(--key-glow);
}
.card .card-title {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.65;
}
.card .art img {
  width: 68px;
  height: 68px;
}

/* Оверлей списку пісень */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 6;
  background: #4a5d4333;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
}
.overlay-head {
  display: flex;
  justify-content: flex-end;
  padding: 10px max(14px, env(safe-area-inset-right)) 10px 14px;
}
.songs-grid {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y;
  display: grid;
  gap: 14px;
  padding: 0 max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  /* рядки не стискаються під висоту контейнера — картки не налазять одна на одну */
  grid-auto-rows: minmax(120px, auto);
  align-content: start;
}
.song-card {
  position: relative;
  min-height: 120px;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--cream);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 52px;
  cursor: pointer;
  transition: transform 0.15s var(--spring);
}
.song-card:active {
  transform: scale(0.94);
}
.song-card .art-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.song-card .song-title {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--ink);
  text-align: center;
  padding: 2px 8px;
  border-radius: var(--r-md);
  background: #fff9f0cc;
}
.song-card .badge {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 16px;
  z-index: 1;
}
.song-card.disabled {
  opacity: 0.45;
  filter: grayscale(0.5);
}

/* Плашки під панеллю: «грає пісня» і HUD «граю сам» */
.hud {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 12px;
  border-radius: var(--r-pill);
  background: #fff9f0e6;
  box-shadow: var(--shadow-soft);
  font-size: 34px;
}
#np-cover {
  position: relative;
  width: 72px;
  height: 54px;
  border-radius: var(--r-md);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--cream);
}
#np-cover .art-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#nowplaying .track {
  width: 120px;
  height: 12px;
  border-radius: var(--r-pill);
  background: #e8dcc8;
  overflow: hidden;
}
#np-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--meadow-deep), var(--sun));
  transform-origin: left;
  transform: scaleX(0);
}
#learn-hud {
  gap: 10px;
}
#flowers {
  display: flex;
  gap: 4px;
}
#flowers .slot {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 26px;
}
#flowers .slot img {
  width: 44px;
  height: 44px;
  transition: transform 0.3s var(--spring);
}
#flowers .slot.s3 img {
  transform: scale(1.12);
}
#guide-leaf {
  position: absolute;
  z-index: 3;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  font-size: 34px;
  pointer-events: none;
}
#guide-leaf .art img {
  width: 52px;
  height: 52px;
}

/* Батьківський куточок */
.overlay.parent {
  align-items: center;
  justify-content: center;
}
.panel {
  width: min(520px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  background-color: var(--cloud);
  background-image: url('../assets/img/ui/texture-paper.webp');
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  position: relative;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
}
.panel h2 {
  font-size: 22px;
  margin-bottom: 14px;
}
.panel .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed #c9bfa5;
  font-size: 16px;
}
.panel select,
.panel input[type='checkbox'] {
  transform-origin: right;
  transform: scale(1.15);
}
.panel select {
  font: inherit;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--wood);
  background: #fff;
}
.panel .hint {
  font-size: 13px;
  opacity: 0.75;
  margin-top: 12px;
  line-height: 1.45;
}
.panel #b-parent-close {
  position: absolute;
  top: 10px;
  right: 10px;
}
.panel #set-reset,
.panel #set-update {
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--blush);
  cursor: pointer;
  font-size: 14px;
}
.panel #set-update {
  background: var(--sun);
}

/* Індикатор гучності — квітка (U-11..13) */
#vol-ind {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-size: 74px;
  pointer-events: none;
  filter: drop-shadow(0 4px 14px #0003);
}
#vol-ind .art img {
  width: 110px;
  height: 110px;
}
#vol-ind.v0 {
  opacity: 0.45;
  filter: grayscale(0.6);
}
#vol-ind.v4 .art img {
  transform: scale(1.18);
}

/* Нічна вуаль (таймер сну): темніє 4 с, Дінь спить поверх неї */
#sleep-veil {
  position: fixed;
  inset: 0;
  z-index: 8;
  background-image:
    url('../assets/img/bg/meadow-night.webp'), linear-gradient(#2e3a57, var(--night));
  background-size: cover, auto;
  background-position: center;
  opacity: 0;
  transition: opacity 4s ease;
}
#sleep-veil.on {
  opacity: 1;
}
#sleep-veil .btn.lock {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  opacity: 0.7;
}
/* Ніч: панель прозора над вуаллю, лишається лише куточок із сплячим Дінем */
#game.sleep #topbar {
  z-index: 9;
  pointer-events: none;
  background: none;
  border-color: transparent;
  box-shadow: none;
}
#game.sleep #topbar .btn {
  visibility: hidden;
}
#game.sleep .nook {
  pointer-events: auto;
  background: radial-gradient(circle at 50% 35%, #4a5a86, var(--night) 78%);
}
.firefly {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 10px 3px #ffd97a99;
  opacity: 0;
}
.firefly:nth-child(1) {
  left: 12%;
  top: 30%;
}
.firefly:nth-child(2) {
  left: 28%;
  top: 55%;
}
.firefly:nth-child(3) {
  left: 45%;
  top: 22%;
}
.firefly:nth-child(4) {
  left: 60%;
  top: 62%;
}
.firefly:nth-child(5) {
  left: 76%;
  top: 36%;
}
.firefly:nth-child(6) {
  left: 88%;
  top: 70%;
}

/* Частинки */
#fx {
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}
.particle {
  position: absolute;
  font-size: 22px;
  opacity: 0;
  will-change: transform;
}
.particle img {
  width: 1.2em;
  height: 1.2em;
  object-fit: contain;
}
.particle.z {
  font-family: Comfortaa, sans-serif;
  font-weight: 700;
  color: #e8eef9;
}

/* Підказка «поверни мене» (portrait) */
#rotate-hint {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--r-pill);
  background: #fff9f0ee;
  box-shadow: var(--shadow-soft);
  font-size: 34px;
  pointer-events: none;
}
#rotate-hint .arr {
  animation: hint-rotate 1.6s ease-in-out infinite;
  display: inline-block;
}

@keyframes hint-rotate {
  0%,
  100% {
    transform: rotate(0);
  }
  55% {
    transform: rotate(90deg);
  }
}

/* Телефони в landscape: компактніша панель, менший Дінь */
@media (max-height: 460px) {
  :root {
    --topbar-h: 78px;
    --nook: 62px;
  }
  .btn {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }
  .btn .art img {
    width: 38px;
    height: 38px;
  }
  .btn.small {
    width: 52px;
    height: 52px;
    font-size: 24px;
  }
  .btn.small .art img {
    width: 28px;
    height: 28px;
  }
  #topbar {
    padding-top: 6px;
    padding-bottom: 6px;
    gap: 8px;
  }
  .card {
    width: 96px;
    height: 96px;
  }
  .card .art img {
    width: 56px;
    height: 56px;
  }
  #start-btn {
    width: 170px;
    height: 112px;
  }
  #start-btn .play {
    width: 52px;
    height: 52px;
  }
}

/* Portrait: гра працює, панель у два ряди, клавіатура нижча */
@media (orientation: portrait) {
  :root {
    --topbar-h: 160px;
    --kb-h: 45vh;
    --nook: 72px;
  }
  #topbar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
  }
  .spacer {
    flex: 0 0 100%;
    height: 0;
  }
  .btn {
    width: 64px;
    height: 64px;
    font-size: 30px;
  }
  .btn .art img {
    width: 38px;
    height: 38px;
  }
  .btn.small {
    width: 56px;
    height: 56px;
  }
  .note-label {
    min-width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .hud {
    top: calc(var(--topbar-h) + 8px);
  }
}

@supports (height: 1svh) {
  @media (orientation: portrait) {
    :root {
      --kb-h: 45svh;
    }
  }
}
