/* ui.css — окна поверх игры в том же пиксельном духе, что и холст */
#ui {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(18, 10, 36, .8);
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.7;
  color: #1a1033;
  touch-action: manipulation;
}
#ui[hidden], #toast[hidden] { display: none; }
#ui .win {
  box-sizing: border-box;
  width: min(100%, 340px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #e6dcc0;
  border: 4px solid #1a1033;
  box-shadow: inset 4px 4px 0 #fff, inset -4px -4px 0 #8c8068, 8px 8px 0 rgba(26, 16, 51, .6);
  padding: 8px;
}
#ui .win.wide { width: min(100%, 420px); }
#ui .bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(90deg, #1c2470 60%, #3a6fd8);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px;
}
#ui .x {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px;
  padding: 0;
  font: inherit;
  font-size: 16px;
  line-height: 1;
  color: #1a1033;
  background: #e6dcc0;
  border: 2px solid #1a1033;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #8c8068;
  cursor: pointer;
}
#ui .body {
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 4px 4px;
}
#ui form { display: flex; flex-direction: column; gap: 10px; }
#ui p { margin: 0; }
#ui .lead { font-size: 10px; }
#ui .small { font-size: 8px; color: #5a4d7a; }
#ui .center { text-align: center; }
#ui a { color: #1c2470; }
#ui input, #ui select, #ui .btn {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  font: inherit;
  font-size: 16px; /* меньше 16px — телефон приближает страницу при вводе */
  line-height: 1.3;
  border-radius: 0;
  border: 4px solid #1a1033;
  padding: 11px 8px;
  color: #1a1033;
  -webkit-appearance: none;
  appearance: none;
}
#ui input, #ui select {
  background: #fff3d9;
  font-family: system-ui, sans-serif; /* в полях ввода обычный шрифт: его лучше видно и он знает все буквы */
  -webkit-user-select: text;
  user-select: text;
  outline: none;
}
#ui input:focus, #ui select:focus { background: #fff; border-color: #3a6fd8; }
#ui .btn {
  display: block;
  font-size: 11px;
  text-align: center;
  text-decoration: none;
  background: #e6dcc0;
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #8c8068;
  cursor: pointer;
}
#ui .btn.main { background: #ffd93b; font-size: 13px; padding: 14px 8px; }
#ui .btn.quiet { border-width: 2px; color: #5a4d7a; font-size: 9px; padding: 8px; }
#ui .btn:active { box-shadow: inset -3px -3px 0 #fff, inset 3px 3px 0 #8c8068; }
#ui .btn:disabled { opacity: .5; }
#ui .link { background: none; border: 0; padding: 4px; font: inherit; font-size: 9px; color: #1c2470; text-decoration: underline; cursor: pointer; }
#ui .err { min-height: 14px; font-size: 9px; color: #c8222a; }
#ui .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#ui .row > .btn { flex: 1; }
#ui .field { display: flex; flex-direction: column; gap: 4px; font-size: 9px; }
#ui .step { display: flex; gap: 8px; align-items: center; }
#ui .step .btn { width: 48px; }
#ui .step .num { flex: 1; text-align: center; font-size: 12px; }
#ui .box { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 2px dashed #8c8068; }
#ui .box input { font-size: 12px; padding: 8px; }
#ui .who { display: flex; gap: 10px; align-items: center; }
#ui .who div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#ui .who b { font-size: 13px; overflow-wrap: anywhere; }
#ui .ava { font-family: system-ui, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 28px; line-height: 1; }
#ui .ava.big { font-size: 40px; }
#ui .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
#ui .stat { display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; padding: 6px 2px; background: #f4ecd4; border: 2px solid #8c8068; }
#ui .stat b { font-size: 10px; }
#ui .stat span { font-size: 7px; color: #5a4d7a; }
#ui .coin::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
  background: #ffd93b;
  border: 2px solid #1a1033;
  vertical-align: -1px;
}
#ui .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#ui .grid2 .btn { font-family: system-ui, sans-serif; font-size: 15px; font-weight: 700; padding: 10px 4px; }
#ui .items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#ui .item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  padding: 8px 2px;
  font: inherit;
  font-size: 8px;
  color: #1a1033;
  background: #f4ecd4;
  border: 2px solid #8c8068;
  cursor: pointer;
}
#ui .item.on { background: #ffd93b; border-color: #1a1033; }
#ui .item small { font-size: 7px; }
#ui .list { display: flex; flex-direction: column; gap: 2px; }
#ui .list.tall { min-height: 120px; }
#ui .line { display: flex; gap: 8px; align-items: center; padding: 4px 6px; background: #f4ecd4; }
#ui .line.me { background: #ffd93b; }
#ui .line i { width: 22px; font-style: normal; color: #5a4d7a; }
#ui .line .ava { font-size: 18px; }
#ui .line b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ui .line em { font-style: normal; }
#ui .vs { display: flex; align-items: center; justify-content: space-around; gap: 4px; }
#ui .vs i { font-style: normal; font-size: 14px; color: #c8222a; }
#ui .pl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 6px 2px; }
#ui .pl b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ui .vs.res-win .pl:first-child, #ui .vs.res-lose .pl:last-child { background: #ffd93b; outline: 2px solid #1a1033; }
#ui .count { text-align: center; font-size: 40px; line-height: 1.2; color: #ff2d78; text-shadow: 3px 3px 0 #1a1033; }
#ui .spin {
  align-self: center;
  width: 32px;
  height: 32px;
  background: conic-gradient(#ff2d78 0 25%, #ffd93b 0 50%, #3a6fd8 0 75%, #1a1033 0);
  border: 4px solid #1a1033;
  animation: spin .8s steps(4) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#toast {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: max(10px, env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: 92vw;
  box-sizing: border-box;
  padding: 10px 12px;
  font-family: "Press Start 2P", system-ui, sans-serif;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  color: #1a1033;
  background: #ffd93b;
  border: 4px solid #1a1033;
  box-shadow: 6px 6px 0 rgba(26, 16, 51, .6);
  pointer-events: none;
}
@media (max-height: 420px) {
  #ui .body { gap: 6px; padding-top: 8px; }
  #ui input, #ui select { padding: 7px 8px; }
  #ui .btn.main { padding: 9px 8px; }
}

#ui .dot { flex: none; width: 8px; height: 8px; border: 2px solid #1a1033; background: #8c8068; }
#ui .dot.on { background: #4ade5b; }
#ui .dot.busy { background: #ff8a2b; }
#ui .btn.mini { width: auto; flex: none; font-size: 8px; padding: 6px 6px; border-width: 2px; background: #ffd93b; }
#ui .x.mini { width: 20px; height: 20px; margin: 0; font-size: 12px; opacity: .6; }
#ui .btn.small-main { font-size: 11px; padding: 11px 8px; }
#ui .row.tabs .btn { padding: 9px 4px; font-size: 9px; }
#ui .row.tabs .btn.main { font-size: 9px; padding: 9px 4px; }
#ui .line .h2h { color: #1c2470; }
#ui .vs { flex-wrap: wrap; }

/* армянских букв в пиксельном шрифте нет: окна на армянском набраны обычным шрифтом, покрупнее */
html[lang="hy"] #ui, html[lang="hy"] #toast { font-family: system-ui, sans-serif; font-weight: 700; font-size: 14px; line-height: 1.4; }
html[lang="hy"] #ui .lead, html[lang="hy"] #ui .btn, html[lang="hy"] #ui .field, html[lang="hy"] #ui .link, html[lang="hy"] #ui .stat b { font-size: 14px; }
html[lang="hy"] #ui .small, html[lang="hy"] #ui .stat span, html[lang="hy"] #ui .err, html[lang="hy"] #ui .item small { font-size: 12px; }
html[lang="hy"] #ui .bar, html[lang="hy"] #ui .btn.main { font-size: 16px; }
