/* ШУЛАЙ — мини-игра «Забег за Шулай».
   Палитра и шрифты строго по брендбуку: 4 цвета, Ubuntu Light/Medium.
   Пятого цвета нет; оттенки — только прозрачность этих же четырёх. */

:root{
  --white:#f0f1f2;
  --grey:#d8d8d8;
  --green:#057c49;
  --dark:#302e2e;
  --ease:cubic-bezier(.22,.61,.36,1);
}

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

html,body{
  width:100%;height:100%;
  overflow:hidden;
  background:var(--dark);
  color:var(--white);
  font-family:'Ubuntu',system-ui,-apple-system,sans-serif;
  font-weight:300;
  -webkit-font-smoothing:antialiased;
  -webkit-user-select:none;user-select:none;
  touch-action:none;overscroll-behavior:none;
}

canvas#game{
  display:block;
  width:100%;height:100%;
  touch-action:none;
}

.is-hidden{display:none !important}

/* ─────────── HUD (счёт во время забега) ─────────── */
.hud{
  position:fixed;top:0;left:0;right:0;
  display:flex;justify-content:space-between;align-items:flex-start;
  padding:calc(14px + env(safe-area-inset-top)) 18px 0;
  pointer-events:none;
  text-shadow:0 2px 8px rgba(48,46,46,.7);
  z-index:10;
}
.hud__score{display:flex;flex-direction:column;line-height:1}
.hud__score b{font-size:30px;font-weight:500}
.hud__score span{font-size:12px;opacity:.8;letter-spacing:.06em;text-transform:uppercase}
.hud__found{
  font-size:14px;padding:7px 13px;border-radius:999px;
  background:rgba(5,124,73,.85);color:var(--white);font-weight:500;
}
.hud__found b{font-weight:500}

/* ─────────── экраны меню / конца ─────────── */
.screen{
  position:fixed;inset:0;z-index:20;
  display:flex;align-items:center;justify-content:center;
  padding:24px;
  /* полупрозрачная тёмная подложка поверх canvas */
  background:rgba(48,46,46,.72);
  backdrop-filter:blur(3px);
}
.screen__box{
  width:100%;max-width:360px;text-align:center;
  display:flex;flex-direction:column;align-items:center;gap:14px;
}
.screen__logo{
  width:168px;height:auto;margin-bottom:4px;
  filter:drop-shadow(0 4px 14px rgba(48,46,46,.5));
}
.screen__title{
  font-weight:500;font-size:30px;line-height:1.1;letter-spacing:.01em;
}
.screen__text{font-size:16px;line-height:1.5;opacity:.92;max-width:300px}
.screen__hint{
  font-size:13px;opacity:.7;margin-top:2px;min-height:1.2em;
}
.screen__back{
  margin-top:6px;font-size:13px;opacity:.6;text-decoration:none;color:var(--white);
}
.screen__back:hover{opacity:.9}

/* результат забега */
.result{display:flex;gap:14px;margin:4px 0 2px}
.result__cell{
  flex:1;padding:12px 10px;border-radius:14px;
  background:rgba(240,241,242,.08);border:1px solid rgba(240,241,242,.15);
  display:flex;flex-direction:column;line-height:1.1;
}
.result__cell b{font-size:28px;font-weight:500;color:var(--green)}
/* рекорд — второй столбец — зелёным читался бы как «текущий»; делаем белым */
.result__cell:last-child b{color:var(--white)}
.result__cell span{font-size:12px;opacity:.75;letter-spacing:.05em;text-transform:uppercase;margin-top:2px}

/* ─────────── кнопки ─────────── */
.btn{
  font-family:inherit;font-weight:500;font-size:16px;
  padding:13px 22px;border-radius:999px;border:2px solid transparent;
  cursor:pointer;width:100%;max-width:280px;
  transition:transform .12s var(--ease),background .2s,color .2s;
  pointer-events:auto;
}
.btn:active{transform:scale(.96)}
.btn--green{background:var(--green);color:var(--white);border-color:var(--green)}
.btn--green:hover{background:#046a3e}
.btn--ghost{background:transparent;color:var(--white);border-color:rgba(240,241,242,.5)}
.btn--ghost:hover{border-color:var(--white);background:rgba(240,241,242,.08)}

/* ─────────── модалка коллекции ─────────── */
.modal{
  position:fixed;inset:0;z-index:30;
  display:flex;align-items:flex-end;justify-content:center;
  background:rgba(48,46,46,.82);backdrop-filter:blur(3px);
}
.modal__box{
  width:100%;max-width:520px;max-height:88vh;
  background:var(--dark);border-top:3px solid var(--green);
  border-radius:20px 20px 0 0;
  padding:18px 18px calc(18px + env(safe-area-inset-bottom));
  display:flex;flex-direction:column;overflow:hidden;
}
.modal__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}
.modal__title{font-weight:500;font-size:22px}
.modal__close{
  width:38px;height:38px;border-radius:50%;border:none;cursor:pointer;
  background:rgba(240,241,242,.1);color:var(--white);font-size:24px;line-height:1;
}
.modal__close:hover{background:rgba(240,241,242,.2)}
.modal__progress{font-size:14px;color:var(--green);font-weight:500;margin-bottom:12px}
.modal__demo{font-size:11px;opacity:.55;line-height:1.4;margin-top:12px;text-align:center}

.collection{
  display:grid;grid-template-columns:repeat(2,1fr);gap:10px;
  overflow-y:auto;padding-right:2px;-webkit-overflow-scrolling:touch;
}
@media (min-width:440px){.collection{grid-template-columns:repeat(3,1fr)}}

.collection-card{
  background:rgba(240,241,242,.06);border:1px solid rgba(240,241,242,.12);
  border-radius:14px;overflow:hidden;display:flex;flex-direction:column;
}
.collection-cover{
  aspect-ratio:1/1;display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:500;color:var(--white);text-align:center;padding:6px;
  background:var(--dark);
}
.collection-cover img{width:100%;height:100%;object-fit:cover;display:block}
.collection-cover.locked{
  font-size:34px;font-weight:500;color:rgba(240,241,242,.55);
  background:rgba(240,241,242,.05);
}
.collection-info{padding:9px 10px 11px;display:flex;flex-direction:column;gap:3px}
.collection-info strong{font-size:13px;font-weight:500;line-height:1.2}
.collection-info p{font-size:11px;opacity:.7;line-height:1.35}
.collection-info a{
  margin-top:3px;font-size:12px;font-weight:500;color:var(--green);text-decoration:none;
}
.collection-info a:hover{text-decoration:underline}
.collection-info.locked strong{opacity:.6}
.collection-info .not-found{font-size:11px;opacity:.45}

/* ─────────── подсказки под платформу ─────────── */
.only-touch{display:none}
@media (hover:none) and (pointer:coarse){
  .only-desktop{display:none}
  .only-touch{display:inline}
}
