/* ===== base.css — Roblox-Квест: базовые стили, переменные, HUD ===== */

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Comfortaa', 'Trebuchet MS', system-ui, sans-serif;
  background-color: #1a1d29;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(0,102,204,.08) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(138,43,226,.08) 0%, transparent 40%),
    linear-gradient(135deg, #1a1d29 0%, #252938 50%, #1a1d29 100%);
  background-attachment: fixed;
  color: #fff;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
[hidden] { display: none !important; }
input, textarea { font-family: inherit; }

/* ---- Roblox-палитра ---- */
:root {
  --rb-red:    #E2231A;
  --rb-red-d:  #A8120B;
  --rb-blue:   #0066CC;
  --rb-blue-d: #003D7A;
  --rb-green:  #00A651;
  --rb-green-d:#007A3D;
  --rb-yellow: #FFD700;
  --rb-yellow-d:#C9A800;
  --rb-orange: #FF8C00;
  --rb-purple: #8E44AD;
  --rb-pink:   #FF69B4;
  --rb-cyan:   #00CED1;
  --rb-gray:   #4A4E69;
  --rb-gray-l: #9A9DB5;
  --rb-dark:   #1a1d29;
  --rb-dark-2: #252938;
  --rb-dark-3: #2D3142;
  --rb-light:  #F5F5F7;
  --rb-cream:  #FFF8E7;
  --rb-shadow: 0 4px 0 rgba(0,0,0,.35);
  --rb-shadow-l: 0 2px 0 rgba(0,0,0,.35);
  --rb-inset: inset 0 -4px 0 rgba(0,0,0,.25);
  --rb-radius: 8px;
  --rb-radius-l: 14px;
  --rb-font: 'Comfortaa', 'Trebuchet MS', system-ui, sans-serif;
}

/* ---- Каркас-обёртка (sticky footer) ---- */
.app-root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-main { flex: 1 0 auto; }
.app-footer {
  flex-shrink: 0;
  background: var(--rb-dark);
  color: var(--rb-gray-l);
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  border-top: 3px solid var(--rb-dark-3);
}

/* ---- Экраны ---- */
.screen { display: none; width: 100%; min-height: 100vh; padding: 16px; }
.screen.active { display: block; }
@media (min-width: 768px) { .screen { padding: 24px; } }

/* ---- Кнопки (блочный стиль Roblox) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-weight: 700;
  font-size: 16px;
  border-radius: var(--rb-radius);
  box-shadow: var(--rb-shadow), var(--rb-inset);
  transition: transform .08s, box-shadow .08s, filter .15s;
  text-align: center;
  min-height: 44px;
  border: 2px solid rgba(0,0,0,.2);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
  transition: left .5s;
}
.btn:hover::before { left: 100%; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: var(--rb-shadow-l), var(--rb-inset); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:disabled::before { display: none; }
.btn-primary { background: linear-gradient(180deg, #00C961, var(--rb-green)); }
.btn-danger  { background: linear-gradient(180deg, #FF3A30, var(--rb-red)); }
.btn-info    { background: linear-gradient(180deg, #0080E6, var(--rb-blue)); }
.btn-warn    { background: linear-gradient(180deg, #FFE040, var(--rb-yellow)); color: #1a1d29; text-shadow: none; }
.btn-purple  { background: linear-gradient(180deg, #A558C7, var(--rb-purple)); }
.btn-ghost   { background: linear-gradient(180deg, #3D4156, var(--rb-dark-3)); }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 32px; }
.btn-lg { padding: 16px 32px; font-size: 20px; }

/* ---- Карточки ---- */
.card {
  background: linear-gradient(180deg, var(--rb-dark-3), var(--rb-dark-2));
  border: 3px solid var(--rb-dark-3);
  border-radius: var(--rb-radius-l);
  padding: 18px;
  box-shadow: var(--rb-shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
.card-glass {
  background: rgba(37, 41, 56, .85);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255,255,255,.12);
  border-radius: var(--rb-radius-l);
  padding: 14px 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

/* ---- HUD (верхняя панель) ---- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(26,29,41,.97), rgba(26,29,41,.88));
  backdrop-filter: blur(12px);
  border-bottom: 3px solid var(--rb-dark-3);
  box-shadow: 0 3px 8px rgba(0,0,0,.4), inset 0 -1px 0 rgba(255,255,255,.05);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-avatar {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px;
}
.hud-noob {
  width: 32px; height: 32px;
  background: var(--rb-yellow);
  border: 2px solid #1a1d29;
  border-radius: 4px;
  position: relative;
  box-shadow: var(--rb-shadow-l);
}
.hud-noob::before { /* лицо нубика */
  content: '';
  position: absolute;
  top: 8px; left: 4px; right: 4px; height: 14px;
  background: 
    radial-gradient(circle at 25% 50%, #1a1d29 3px, transparent 4px),
    radial-gradient(circle at 75% 50%, #1a1d29 3px, transparent 4px);
  background-color: #fff;
  border-radius: 2px;
}
.hud-noob::after { /* тело */
  content: '';
  position: absolute;
  top: 18px; left: -2px; right: -2px; bottom: -8px;
  background: var(--rb-blue);
  border: 2px solid #1a1d29;
  border-radius: 3px;
  z-index: -1;
}
.hud-score {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, var(--rb-dark-3), var(--rb-dark));
  padding: 6px 12px;
  border-radius: var(--rb-radius);
  font-weight: 800;
  font-size: 18px;
  border: 2px solid var(--rb-yellow);
  color: var(--rb-yellow);
  box-shadow: 0 0 12px rgba(255,215,0,.3), var(--rb-shadow-l);
}
.hud-score-icon {
  display: inline-block;
  width: 18px; height: 18px;
  background: var(--rb-yellow);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.hud-grade {
  background: var(--rb-purple);
  padding: 6px 10px;
  border-radius: var(--rb-radius);
  font-weight: 700;
  font-size: 13px;
  border: 2px solid rgba(0,0,0,.2);
}

/* ---- Плавающие +10/−2 ---- */
.float-points {
  position: absolute;
  font-size: 28px;
  font-weight: 900;
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
  z-index: 60;
  text-shadow: 2px 2px 0 #000;
}
.float-points.plus { color: var(--rb-green); }
.float-points.minus { color: var(--rb-red); }
@keyframes floatUp {
  0%   { transform: translateY(0) scale(.8); opacity: 0; }
  20%  { transform: translateY(-10px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-50px) scale(1); opacity: 0; }
}

/* ---- Тосты ---- */
.toasts {
  position: fixed;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  width: min(90vw, 460px);
}
.toast {
  background: var(--rb-dark-3);
  border-left: 6px solid var(--rb-blue);
  border-radius: var(--rb-radius);
  padding: 12px 16px;
  box-shadow: var(--rb-shadow);
  animation: toastIn .3s ease-out;
  font-weight: 600;
  font-size: 14px;
}
.toast.success { border-left-color: var(--rb-green); }
.toast.error   { border-left-color: var(--rb-red); }
.toast.warn    { border-left-color: var(--rb-yellow); }
.toast.fade { animation: toastOut .3s ease-in forwards; }
@keyframes toastIn  { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to   { transform: translateY(-20px); opacity: 0; } }

/* ---- Модалки ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--rb-dark-2);
  border: 3px solid var(--rb-dark-3);
  border-radius: var(--rb-radius-l);
  max-width: 560px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 8px 0 rgba(0,0,0,.4);
}
.modal-header {
  padding: 16px 20px;
  background: var(--rb-dark-3);
  border-radius: 10px 10px 0 0;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 800; font-size: 18px;
  position: sticky; top: 0;
}
.modal-body { padding: 20px; }
.modal-close {
  width: 32px; height: 32px;
  background: var(--rb-red);
  border-radius: 6px;
  font-size: 20px; font-weight: 900;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Заголовки ---- */
.h-1 { font-size: 32px; font-weight: 900; line-height: 1.15; }
.h-2 { font-size: 24px; font-weight: 800; line-height: 1.2; }
.h-3 { font-size: 18px; font-weight: 700; line-height: 1.3; }
@media (max-width: 480px) {
  .h-1 { font-size: 24px; }
  .h-2 { font-size: 20px; }
}

/* ---- Блок-эмодзи (декоративные) ---- */
.block-emoji {
  display: inline-block;
  width: 1em; height: 1em;
  background: var(--rb-dark-3);
  border: 2px solid rgba(255,255,255,.15);
  border-radius: 4px;
  vertical-align: middle;
  text-align: center;
  line-height: 1;
}

/* ---- Утилиты ---- */
.row { display: flex; gap: 12px; }
.row-wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: 6px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 20px; }
.mt-sm { margin-top: 8px; } .mt-md { margin-top: 16px; } .mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; } .mb-md { margin-bottom: 16px; } .mb-lg { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-sm { font-size: 13px; } .text-lg { font-size: 18px; }
.text-muted { color: var(--rb-gray-l); }
.text-yellow { color: var(--rb-yellow); }
.text-green { color: var(--rb-green); }
.text-red { color: var(--rb-red); }
.fw-bold { font-weight: 700; } .fw-black { font-weight: 900; }
.w-full { width: 100%; }

/* ---- Скроллбар ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--rb-dark); }
::-webkit-scrollbar-thumb { background: var(--rb-dark-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--rb-gray); }

/* ---- Спиннер ---- */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--rb-dark-3);
  border-top-color: var(--rb-yellow);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Бейджи ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: var(--rb-dark-3);
  border: 2px solid rgba(255,255,255,.15);
}
.badge-red { background: var(--rb-red); }
.badge-blue { background: var(--rb-blue); }
.badge-green { background: var(--rb-green); }
.badge-yellow { background: var(--rb-yellow); color: #1a1d29; }
.badge-purple { background: var(--rb-purple); }

/* ---- Анимации ---- */
.shake { animation: shake .4s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.bounce { animation: bounce .5s; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* ===== Тумблер учебной версии (config.js) ===== */
html.no-workshop #btn-workshop,
html.no-workshop #btnWorkshop,
html.no-workshop [data-workshop-btn] {
  display: none !important;
}
