/* Внешняя страница: панели, рамка телефона, бинго */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--page-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background .4s, color .4s;
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand); }
[data-skin="tbank"] a { color: #2A6BD1; }

.page {
  display: grid;
  grid-template-columns: minmax(260px, 340px) auto minmax(280px, 380px);
  gap: 40px;
  justify-content: center;
  align-items: start;
  padding: 32px 24px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

.panel { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; scrollbar-width: thin; padding-right: 4px; }
.pblock {
  background: var(--page-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--page-line);
  border-radius: 22px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}
.pblock h2 { font-family: var(--font); font-size: 15px; margin: 0 0 4px; letter-spacing: -.01em; }
.hint { color: var(--page-muted); font-size: 13px; line-height: 1.45; margin: 0 0 12px; }
.hint.small { font-size: 12px; margin: 12px 0 0; }

.intro { padding: 4px 4px 18px; }
.intro-logo { font-family: "Unbounded", sans-serif; font-weight: 900; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.logo-badge {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-grad); color: var(--on-brand); font-weight: 900; font-size: 20px;
}
.intro h1 { font-family: var(--font); font-size: 26px; line-height: 1.15; margin: 16px 0 10px; letter-spacing: -.02em; }
.intro h1 em { font-style: normal; background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
[data-skin="tbank"] .intro h1 em { background: none; color: var(--page-text); box-shadow: inset 0 -.4em 0 #FFDD2D; }
.intro p { color: var(--page-muted); font-size: 14px; line-height: 1.5; margin: 0; }

/* Задачи */
.missions { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.missions li {
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
  padding: 10px 12px; border-radius: 14px; background: var(--page-line);
  transition: background .3s, color .3s;
}
.missions li i {
  flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--page-muted);
  display: grid; place-items: center; font-style: normal; font-size: 12px; opacity: .6;
}
.missions li.done { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.missions li.done i { background: var(--ok); border-color: var(--ok); color: #fff; opacity: 1; }
.missions li.done span { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--page-text) 40%, transparent); }
.missions li small { margin-left: auto; color: var(--page-muted); font-weight: 500; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats div { background: var(--page-line); border-radius: 14px; padding: 10px 12px; }
.stats b { display: block; font-family: var(--font); font-size: 20px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: var(--page-muted); }

.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.skin-btn {
  border: 2px solid transparent; background: var(--page-line); border-radius: 14px; padding: 10px 6px 8px;
  display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 700; transition: transform .15s, border-color .2s;
}
.skin-btn:hover { transform: translateY(-2px); }
.skin-btn i { width: 26px; height: 26px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px rgba(255,255,255,.7), 0 2px 6px rgba(0,0,0,.15); }
.skin-btn.on { border-color: var(--brand); }
[data-skin="tbank"] .skin-btn.on { border-color: #333; }

.reset { width: 100%; border: 1px dashed var(--page-muted); background: transparent; border-radius: 14px; padding: 10px; color: var(--page-muted); font-weight: 600; }
.reset:hover { color: var(--page-text); border-color: var(--page-text); }

/* Бинго */
.bingo-head { display: flex; align-items: baseline; justify-content: space-between; }
.bingo-count { font-family: var(--font); font-size: 14px; color: var(--page-muted); }
.bingo-count b { color: var(--page-text); font-size: 22px; }
.bingo-bar { height: 8px; border-radius: 8px; background: var(--page-line); overflow: hidden; margin: 10px 0 12px; }
.bingo-bar i { display: block; height: 100%; width: 0; background: var(--brand-grad); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.bingo { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; counter-reset: b; }
.bingo li {
  counter-increment: b; position: relative; padding: 8px 10px 8px 40px; border-radius: 12px;
  font-size: 13px; line-height: 1.35; color: var(--page-muted); cursor: default; transition: background .3s, color .3s;
}
.bingo li::before {
  content: counter(b); position: absolute; left: 8px; top: 7px; width: 24px; height: 20px; border-radius: 6px;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--page-line); color: var(--page-muted);
}
.bingo li b { font-weight: 600; }
.bingo li p { margin: 4px 0 0; font-size: 12px; display: none; }
.bingo li:hover p, .bingo li.open p { display: block; }
.bingo li.hit { color: var(--page-text); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.bingo li.hit::before { content: "✓"; background: var(--brand-grad); color: var(--on-brand); }
.bingo li.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { background: color-mix(in srgb, var(--brand) 9%, transparent); } 30% { background: color-mix(in srgb, var(--brand) 35%, transparent); } }

/* Устройство */
.device-wrap { display: grid; justify-items: center; position: sticky; top: 24px; }
.device {
  position: relative; width: 410px; height: 864px; border-radius: 62px; padding: 10px;
  background: linear-gradient(145deg, #2B2B30, #0E0E10);
  box-shadow: 0 0 0 2px #3A3A40, 0 40px 80px -20px rgba(0,0,0,.45), 0 20px 40px -20px rgba(0,0,0,.35);
}
.device-btn { position: absolute; width: 4px; background: #222; border-radius: 2px; }
.device-btn.b1 { left: -5px; top: 170px; height: 34px; }
.device-btn.b2 { left: -5px; top: 220px; height: 60px; }
.device-btn.b3 { right: -5px; top: 240px; height: 90px; }
.screen { position: relative; width: 100%; height: 100%; border-radius: 52px; overflow: hidden; background: var(--bg); isolation: isolate; }
.island { position: absolute; z-index: 100; top: 11px; left: 50%; transform: translateX(-50%); width: 120px; height: 34px; border-radius: 20px; background: #000; pointer-events: none; }

/* Масштаб под высоту окна выставляет JS через --scale */
.device { transform: scale(var(--scale, 1)); transform-origin: top center; margin-bottom: calc(864px * (var(--scale, 1) - 1)); }

/* Тосты страницы */
.page-toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 1000; max-width: 340px;
  background: var(--page-text); color: var(--bg); border-radius: 16px; padding: 12px 16px;
  font-size: 13px; line-height: 1.4; box-shadow: 0 12px 30px rgba(0,0,0,.25);
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: .35s cubic-bezier(.2,.8,.2,1);
}
.page-toast.in { transform: none; opacity: 1; }
.page-toast b { display: block; font-family: var(--font); font-size: 12px; opacity: .7; margin-bottom: 2px; }

.strip { display: none; }
.skin-pop { display: none; }

/* Средние экраны */
@media (max-width: 1240px) {
  .page { grid-template-columns: minmax(260px, 340px) auto; }
  .panel-right { grid-column: 1 / -1; position: static; max-height: none; }
  .bingo { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 1000px) {
  .page { grid-template-columns: 1fr; padding-top: 16px; }
  .device-wrap { order: -1; position: static; }
  .panel { position: static; max-height: none; }
  .panel-left { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .panel-left .intro, .panel-left .reset { grid-column: 1 / -1; }
  .panel-left .pblock { margin: 0; }
}

/* Телефон: приложение во весь экран, панели ниже */
@media (max-width: 560px) {
  .strip {
    display: flex; align-items: center; gap: 8px; position: fixed; top: 0; left: 0; right: 0; z-index: 500;
    height: 36px; padding: 0 10px; background: #0D0D10; color: #fff; font-size: 12px;
  }
  .strip-logo { font-family: "Unbounded", sans-serif; font-weight: 700; }
  .strip-note { opacity: .5; margin-right: auto; }
  .strip-btn { border: 0; background: rgba(255,255,255,.12); border-radius: 10px; padding: 5px 9px; font-size: 12px; color: #fff; }
  .strip-btn.pulse { animation: pulse .8s ease 2; }
  @keyframes pulse { 50% { background: var(--brand); color: var(--on-brand); } }
  .page { padding: 36px 0 32px; gap: 16px; }
  .device-wrap { width: 100%; }
  .device { width: 100%; height: calc(100dvh - 36px); border-radius: 0; padding: 0; background: none; box-shadow: none; transform: none !important; margin: 0 !important; }
  .device-btn, .island { display: none; }
  .screen { border-radius: 0; }
  .panel-left { grid-template-columns: 1fr; padding: 0 16px; }
  .panel-right { padding: 0 16px; }
  .bingo { grid-template-columns: 1fr; }
  .page-toast { left: 16px; right: 16px; bottom: auto; top: 44px; max-width: none; transform: translateY(-20px); }
  .skin-pop {
    position: fixed; top: 40px; right: 10px; z-index: 600; display: none; grid-template-columns: repeat(3, 1fr); gap: 6px;
    background: #0D0D10; padding: 10px; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,.4); width: 260px;
  }
  .skin-pop.in { display: grid; }
  .skin-pop .skin-btn { background: rgba(255,255,255,.08); color: #fff; }
}
