/* шрифт лежит в сборке (17.11): площадки не любят внешние запросы, Google Fonts из России грузится не всегда. Лицензия OFL */
@font-face { font-family: 'Press Start 2P'; font-display: swap; src: url(assets/fonts/ps2p-cyr.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Press Start 2P'; font-display: swap; src: url(assets/fonts/ps2p-latext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Press Start 2P'; font-display: swap; src: url(assets/fonts/ps2p-lat.woff2) format('woff2'); 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; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #2a1d14; overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
body { display: flex; align-items: center; justify-content: center; font-family: 'Press Start 2P', 'Courier New', monospace; color: #fff3dc; }
#wrap { position: relative; height: 100vh; aspect-ratio: 720 / 1400; max-width: 100vw; display: flex; flex-direction: column; background: #3b2a1c; }
#game { width: 100%; aspect-ratio: 720 / 1080; display: block; image-rendering: pixelated; cursor: pointer; }
#panel { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #5a3d26; border-top: 4px solid #2a1d14; box-shadow: inset 0 4px 0 #7a5435; }
#tabs { display: flex; gap: 4px; padding: 6px 6px 0; }
.tab, #mute { font: inherit; font-size: clamp(8px, 1.5vh, 12px); color: #fff3dc; background: #3b2a1c; border: 3px solid #2a1d14; padding: 6px 8px; cursor: pointer; }
.tab.active { background: #8a5d35; }
#mute { margin-left: auto; min-width: 40px; }
#mute.off { opacity: .45; }
/* flex, а не grid: в grid строка не росла под перенесённый на две строки текст и подпись вылезала за рамку (16.11) */
#upgrades { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
#upgrades > .up { width: calc(50% - 3px); }
.up { display: flex; align-items: center; gap: 6px; background: #f1d9a8; color: #3b2a1c; border: 3px solid #2a1d14; box-shadow: inset -3px -3px 0 #c9a46a; padding: 5px; cursor: pointer; font: inherit; text-align: left; min-height: 66px; }
.up:active { transform: translateY(2px); }
.up canvas { width: 40px; height: 40px; image-rendering: pixelated; flex: none; }
.up > div { min-width: 0; }
.up .t { font-size: clamp(8px, 1.3vh, 12px); line-height: 1.35; }
.up .i { font-size: clamp(7px, 1.1vh, 10px); line-height: 1.35; color: #4a3220; margin-top: 3px; }
.up .c { font-size: clamp(8px, 1.3vh, 12px); color: #1f5a12; margin-top: 4px; }
.up.no { filter: grayscale(.7); opacity: .6; cursor: default; }
.up.max .c { color: #7a5435; }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #3b2a1c; font-size: 12px; }
#win { position: absolute; inset: 0; background: rgba(20,12,6,.75); display: flex; align-items: center; justify-content: center; }
#win[hidden] { display: none; }
#win .box { background: #f1d9a8; color: #3b2a1c; border: 4px solid #2a1d14; padding: 20px; width: 80%; text-align: center; }
#win h2 { font-size: 16px; margin-bottom: 12px; }
#win p { font-size: 10px; line-height: 1.6; margin-bottom: 14px; }
#win button { font: inherit; font-size: 10px; padding: 10px; background: #8a5d35; color: #fff3dc; border: 3px solid #2a1d14; cursor: pointer; }

#game { touch-action: none; }
/* подсказки обучения: кнопка мигает рамкой */
.hint { animation: hint 0.9s ease-in-out infinite; position: relative; z-index: 1; }
@keyframes hint { 0%, 100% { outline: 3px solid #ffd84a; outline-offset: 0; } 50% { outline: 3px solid #ff9ec7; outline-offset: 3px; } }
.tab[hidden] { display: none; }
.up.ad .c { color: #b0306a; }
.up.iap { background: #ffe9a8; box-shadow: inset -3px -3px 0 #e0b84a; }
.up.iap .c { color: #8a5d00; }
#offline { position: absolute; inset: 0; background: rgba(20,12,6,.75); display: flex; align-items: center; justify-content: center; z-index: 4; }
#offline[hidden] { display: none; }
#offline .box { background: #f1d9a8; color: #3b2a1c; border: 4px solid #2a1d14; padding: 20px; width: 84%; text-align: center; }
#offline h2 { font-size: 14px; margin-bottom: 12px; }
#offline p { font-size: 10px; line-height: 1.7; margin-bottom: 14px; }
#offline b { color: #2f6b1f; }
#offline button { font: inherit; font-size: 10px; padding: 10px; margin: 4px; background: #8a5d35; color: #fff3dc; border: 3px solid #2a1d14; cursor: pointer; }
#offline #offAd { background: #b0306a; }
#offline button[hidden] { display: none; }
#cups { position: absolute; inset: 0; background: rgba(20,12,6,.75); display: flex; align-items: center; justify-content: center; z-index: 4; }
#cups[hidden] { display: none; }
#cups .box { background: #f1d9a8; color: #3b2a1c; border: 4px solid #2a1d14; padding: 14px; width: 90%; max-height: 86%; display: flex; flex-direction: column; }
#cupsTabs { display: flex; gap: 6px; margin-bottom: 10px; }
#cupsTabs button { flex: 1; font: inherit; font-size: 10px; padding: 8px 4px; background: #c9a46a; color: #3b2a1c; border: 3px solid #2a1d14; cursor: pointer; }
#cupsTabs button.on { background: #8a5d35; color: #fff3dc; }
#cupsTabs button[hidden] { display: none; }
#cupsTabs span { font-size: 7px; opacity: .8; }
#cupsList[hidden], #lbView[hidden] { display: none; }
#lbView { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#lbList { flex: 1; overflow-y: auto; font-size: 8px; }
.lbr { display: flex; gap: 8px; padding: 6px 4px; border-bottom: 2px solid #e0c48a; align-items: center; }
.lbr .r { width: 26px; color: #7a5435; }
.lbr .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbr .s { color: #2f6b1f; }
.lbr.top1 .r { color: #c9900c; } .lbr.top2 .r { color: #8a93a3; } .lbr.top3 .r { color: #a8622c; }
.lbr.me { background: #ffe9a8; outline: 2px solid #b0306a; }
#lbName { display: flex; gap: 6px; margin-top: 8px; }
#lbName input { flex: 1; min-width: 0; font: inherit; font-size: 9px; padding: 6px; border: 3px solid #2a1d14; background: #fffaf0; color: #3b2a1c; }
#lbName button { font: inherit; font-size: 9px; padding: 6px 10px; background: #8a5d35; color: #fff3dc; border: 3px solid #2a1d14; cursor: pointer; }
#cupsList { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cup { display: flex; gap: 8px; align-items: center; background: #ffe9c2; border: 3px solid #2a1d14; padding: 5px; }
.cup canvas { width: 36px; height: 44px; image-rendering: pixelated; flex: none; }
.cup .n { font-size: 9px; line-height: 1.3; }
.cup .d { font-size: 7px; color: #7a5435; margin-top: 3px; line-height: 1.3; }
.cup.locked { opacity: .55; }
#cupsClose { font: inherit; font-size: 10px; padding: 10px; margin-top: 10px; background: #8a5d35; color: #fff3dc; border: 3px solid #2a1d14; cursor: pointer; }
#adwait { position: fixed; inset: 0; background: rgba(20,12,6,.8); display: flex; align-items: center; justify-content: center; font-size: 12px; z-index: 5; }
#adwait[hidden] { display: none; }

/* Компьютер и любой широкий экран: поле слева во всю высоту, магазин справа колонкой (16.11.2026).
   Ширина = поле (720:1080 по высоте) + магазин 0,62 высоты, поэтому пустых полей по бокам почти нет. */
@media (min-aspect-ratio: 1/1) {
  #wrap { flex-direction: row; aspect-ratio: auto; height: 100vh; width: min(100vw, 128.7vh); }
  #game { width: auto; height: 100%; flex: none; }
  #panel { border-top: 0; border-left: 4px solid #2a1d14; box-shadow: inset 4px 0 0 #7a5435; min-width: 0; }
  #tabs { padding: 10px 10px 0; flex-wrap: wrap; }
  .tab, #mute { font-size: clamp(9px, 1.7vh, 14px); padding: 8px 10px; }
  #upgrades { padding: 10px; gap: 8px; }
  #upgrades > .up { width: calc(50% - 4px); }
  .up { min-height: 76px; padding: 7px; }
  .up canvas { width: 48px; height: 48px; }
  .up .t { font-size: clamp(9px, 1.6vh, 14px); }
  .up .i { font-size: clamp(8px, 1.3vh, 12px); }
  .up .c { font-size: clamp(9px, 1.6vh, 14px); }
  #offline .box, #win .box { width: min(84%, 520px); }
  #cups .box { width: min(90%, 560px); }
}
/* очень широкий экран (монитор 16:9, 16:10): магазин шире, карточки в три колонки */
@media (min-aspect-ratio: 16/10) and (min-width: 1100px) {
  #wrap { width: min(100vw, 150vh); }
  #upgrades > .up { width: calc((100% - 16px) / 3); }
}
