/* =========================
   TELEGRAM MINI APP UI KIT
   ========================= */

/* ---- RESET ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
}

/* ---- TELEGRAM THEME ---- */
:root {
  --bg: var(--tg-theme-bg-color, #0f0f0f);
  --card: var(--tg-theme-secondary-bg-color, #1c1c1e);
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, #9a9a9a);
  --accent: var(--tg-theme-button-color, #2ea6ff);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: #ff453a;
}

/* ---- LAYOUT ---- */
.app {
  max-width: 4800px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
}
#mapCanvas, #tokenCanvas, #fogSvg{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

#mapCanvas { z-index: 1; }
#fogSvg { z-index: 5; pointer-events: none; }
#tokenCanvas { z-index: 10; }



@media (min-width: 900px) {
  .app { max-width: none; padding: 24px; }
  /* бонус: лобби/панель можно сделать “десктопнее” */
}

/* ---- TYPOGRAPHY ---- */
h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

p {
  font-size: 15px;
  line-height: 1.45;
  color: var(--hint);
}

/* ---- CARDS ---- */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* ---- BUTTONS ---- */
.button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
/* Панель снизу — чуть красивее и с safe-area */
.control-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  justify-content: space-around;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 10;
}

/* Кнопки-файлы */
.file-input-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, rgba(58,145,255,0.95), rgba(35,110,255,0.95));
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.file-input-label:active {
  transform: scale(0.98);
  filter: brightness(0.92);
}

.file-input-label.secondary {
  background: linear-gradient(180deg, rgba(90,90,90,0.9), rgba(60,60,60,0.9));
}

.file-input-label input { display: none; }

/* Важно для мобилок: мы сами обрабатываем жесты */
canvas { touch-action: none; }


.button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(255,255,255,0.15);
}

.button.danger {
  background: var(--danger);
}

.button:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* ---- INPUTS ---- */
.input {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-size: 15px;
  margin-bottom: 12px;
}

.input::placeholder {
  color: var(--hint);
}

.input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- LISTS ---- */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---- BADGES ---- */
.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.12);
}

/* ---- DIVIDER ---- */
.divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 14px 0;
}

/* ---- TOAST / ALERT ---- */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: fadeUp 0.25s ease;
  z-index: 100;
}

/* ---- MODAL ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal {
  width: 90%;
  max-width: 400px;
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
}

/* ---- ANIMATIONS ---- */
.fade-in {
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---- SAFE AREA (iOS) ---- */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}
/* ---- MOBILE FIRST ---- */
html, body {
  width: 100%;
  min-width: 320px;
  max-width: 4800px;
  margin: 0 auto;
}

/* ---- FILE INPUT AS BUTTON ---- */
.file-input-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 14px;
}

.file-input-wrapper input[type="file"] {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
  cursor: pointer;
}

.file-input-label {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: center;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.file-input-label:active {
  transform: scale(0.97);
}

/* ---- LOCK / UNLOCK BUTTON ---- */
.lock-button {
  padding: 12px 16px;
  border-radius: 14px;
  border: none;
  font-weight: 600;
  width: 48%;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease, opacity 0.1s ease;
}

.lock-button.locked {
  background: rgba(255,255,255,0.1);
  color: var(--hint);
}

.lock-button.unlocked {
  background: var(--accent);
  color: var(--accent-text);
}

.lock-button:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* ---- AVATARS ---- */
.avatar-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
}


.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
}


/* Скрываем кнопки на ПК */
@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
}

/* Кнопки на мобильных */
.zoom-button {
  position: fixed;
  left: 10px;
  width: 45px;
  height: 45px;
  background-color: rgba(68,68,68,0.5);
  color: #fff;
  font-size: 1.6rem;
  border: none;
  border-radius: 8px;
  z-index: 11;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}
canvas {
 /* предотвращаем масштабирование страницы */
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #222;
}
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  /* ключевое: мы сами обрабатываем жесты */
  touch-action: none;
}
canvas { touch-action: none; }



/* Активный режим (ластик включён) */
.file-input-label.active {
  opacity: 0.55;
  filter: grayscale(1);
  border-color: rgba(255,255,255,0.28);
}

/* Курсор-ластик */
#eraserCursor {
  position: fixed;
  left: 0; top: 0;
  width: 100px; height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0); /* только кружок, без затемнения */
  pointer-events: none;
  z-index: 9998;
  transform: translate(-9999px, -9999px);
  display: none;
}
.control-panel{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  z-index: 10;
}

.panel-row{
  display: flex;
  gap: 10px;
}

.panel-row .file-input-label{
  flex: 1;
  min-width: 0;
}
#canvas{
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

#fogSvg{
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;
}
.control-panel{ z-index: 10; }
#lobby{ z-index: 9999; }
 nm

#inviteBtn {
  font-weight: 600;
  letter-spacing: .06em;
}

#inviteBtn.copied {
  background: rgba(80,160,90,0.9);
  border-color: rgba(180,255,200,0.6);
}



