/* ===== Фирменные шрифты ===== */
@font-face{
  font-family:"Intro";
  src: url("fonts/FpKueA6B.otf") format("opentype");
  font-display: swap;
}
@font-face{
  font-family:"PFDin";
  src: url("fonts/PFDinTextCondPro-Light.ttf") format("truetype");

}
@font-face{
  font-family:"PFDin";
  src: url("fonts/PFDinTextCondPro-Medium.ttf") format("truetype");

}

/* ===== Базовая сетка ===== */
:root{
  --ink:#0e1230;
  --ink-soft:#4a5385;
  --good:#1bbd77; --bad:#ff5577;
  --acc1:#7da6ff; --acc2:#3fdcff;

  /* бумага формы */
  --paper:#ffffff; --paper-ink:#111; --paper-ink2:#555;
  --paper-border:#e3e8f5; --paper-soft:#f6f8ff;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  color:var(--ink);
  font:16px/1.5 PFDin, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Arial;
  overflow-x:hidden;
}
h2{
	color: #ee3d25;
}	
/* Космическая подложка (задвигается за контент) */
#cosmic-bg{
  position:fixed; inset:0; z-index:-1;
  background: radial-gradient(1200px 800px at 70% 10%, rgba(255,255,255,.14), transparent 65%),
              radial-gradient(800px 600px at 20% 20%, rgba(127,197,255,.18), transparent 60%),
              #040616;
}

/* Темы по предметам */
body #cosmic-bg{ background-image: url("bg/lit-galaxy.jpg"); }

/* Шапка с «крошками» */
.topbar{
  position:sticky; top:0; z-index:5;
  backdrop-filter: blur(8px);
  background: linear-gradient( to right, rgba(10,14,40,.7), rgba(10,14,40,.3) );
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.crumbs{
  max-width:1200px;
  margin:0 auto;
  padding:14px 16px;
  color:#eaf3ff;
  font-family:Intro, PFDin, system-ui;
  font-size:20px;
  letter-spacing:.3px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

/* левая часть шапки: привет + путь */
.crumbs-left{
  display:flex;
  align-items:baseline;
  gap:8px;
  flex-wrap:wrap;
}

/* правая часть: кнопка "Мои награды" и т.п. */
.crumbs-right{
  display:flex;
  align-items:center;
  gap:8px;
}

/* приветствие */
.crumb-hello{
  font-size:14px;
  color:#ffe1c2;
}

/* путь "2025 · школьный этап · математика · 5 класс" */
.crumb-path{
  font-size:14px;
  color:#cfd9ff;
}

/* старый стиль крошек — нужен для других страниц (start/awards) */
.crumbs .part{ cursor:pointer; padding:2px 6px; border-radius:8px; transition:.2s }
.crumbs .part:hover{ background:rgba(255,255,255,.1) }
.crumbs .sep{ opacity:.6; margin:0 6px }
.crumbs .muted{ opacity:.8 }


/* Панель выпадающих ссылок */
.crumbs-panel{
  position:sticky; top:58px; z-index:6;
  background: rgba(255,255,255,.98); color:#111;
  border-bottom:1px solid #e6e9f6;
  padding:12px 16px;
}
.crumbs-panel .grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap:10px; max-width:1200px; margin:0 auto }
.crumbs-panel a{ display:block; background:#f6f8ff; border:1px solid #e1e6f7; border-radius:10px; padding:10px 12px; text-decoration:none; color:#0e1230; font-weight:500 }
.crumbs-panel a:hover{ background:#eaf0ff }

/* Контейнер */
.wrap{ max-width:1100px; margin: 24px auto 80px; padding:0 16px }

/* Карточки */
.card{ border-radius:16px; padding:16px; margin:16px 0; box-shadow: 0 10px 30px rgba(0,0,0,.18) }
.preview.card{ background: rgba(255,255,255,1); border:1px solid rgba(255,255,255,.14) }
.preview img{ width:100%; max-height:70vh; object-fit:contain; border-radius:12px; background:#FFFFFF }
.preview .hint{ color:#dbe6ff; font-size:12px; margin-top:6px }

/* Белая форма ответов */
.answer-card{
  background: var(--paper);
  color: var(--paper-ink);
  border:1px solid var(--paper-border);
}
.answer-card h2{ font-family:Intro; margin:0 0 10px }
.field{ margin:14px 0; padding:12px; border:1px solid var(--paper-border); border-radius:12px; background:#fff }
.field.ok{ outline:2px solid var(--good) }
.field.err{ outline:2px solid var(--bad) }
label.lbl{ display:block; margin:0 0 8px; color:var(--paper-ink2) }
.options{ display:flex; flex-wrap:wrap; gap:10px }
.options .opt{ padding:8px 10px; border:1px solid var(--paper-border); border-radius:10px; background:#fff }
.options .opt input{ margin-right:6px }
.field select,.field input[type="text"]{
  width:100%; background:#fff; border:1px solid var(--paper-border);
  border-radius:10px; padding:10px 12px; color:#111
}
.actions{ margin-top:14px; display:flex; gap:8px; align-items:center }
.btn{ display:inline-block; background:linear-gradient(90deg,var(--acc1),var(--acc2)); color:#08122b; border:none; border-radius:12px; padding:10px 16px; font-weight:700; cursor:pointer }
.btn:disabled{ opacity:.5; cursor:not-allowed }
.result{ margin-top:12px; font-weight:700 }

/* MATRIX RADIO */
.matrix{ width:100%; overflow-x:auto; margin-top:8px }
.matrix table{ width:100%; border-collapse:collapse; background:#fff }
.matrix th,.matrix td{ border:1px solid var(--paper-border); padding:12px 10px; text-align:center }
.matrix thead th{ background:var(--paper-soft); font-weight:600 }
.matrix td input[type=radio]{ width:18px; height:18px; cursor:pointer }
.matrix tr.ok td{ background:#eefaf3 }
.matrix tr.err td{ background:#fff0f3 }
.matrix .cimg,.matrix .rimg{ display:block; margin:0 auto; height:48px }

/* Разбор */
.explain-card{ background: rgba(255,255,255,.92); border:1px solid var(--paper-border); }

/* Индекс */
.index-card{ background: rgba(255,255,255,.95); border:1px solid var(--paper-border) }
#indexTitle{ font-family:Intro; margin:0 0 10px }
.index-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap:10px }
.index-grid a{ display:block; padding:12px 14px; background:#f6f8ff; border:1px solid #e1e6f7; border-radius:10px; text-decoration:none; color:#0e1230; font-weight:500 }
.index-grid a:hover{ background:#eaf0ff }

/* Модальное изображение */
#imgModal[hidden] { display: none !important; }
#imgModal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.85);
  z-index: 2147483647;
  -webkit-overflow-scrolling: touch;
}
#imgModal .imgbox {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(8px + env(safe-area-inset-top))
    calc(8px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    calc(8px + env(safe-area-inset-left));
  box-sizing: border-box;
}
#imgModal img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
#imgModal .close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: calc(14px + env(safe-area-inset-right));
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  color: #fff;
  font-size: 28px;
  line-height: 44px;
  text-align: center;
  cursor: pointer;
}

/* Карточный формат для чекбоксов/радио */
.checks, .radios{
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.checks .opt, .radios .opt{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--paper-border);
  border-radius: 10px;
}
.checks .opt input, .radios .opt input{
  margin-top: 3px;
}
.opt-text{ white-space: normal; }

@media (min-width: 900px){
  .checks .opt, .radios .opt{ flex: 1 1 calc(50% - 10px); }
}

/* Подсветка правильных/неправильных */
.field.ok  { outline: 2px solid var(--good); }
.field.bad { outline: 2px solid var(--bad);  }
.opt.ok  { background: #eefaf3; border-color: var(--good); }
.opt.bad { background: #fff0f3; border-color: var(--bad);  }
.matrix td.ok  { background:#eefaf3; }
.matrix td.bad { background:#fff0f3; }

/* СЧЁТ X/Y */
.score-card{
  background: rgba(255,255,255,.95);
  border:1px solid var(--paper-border);
}
.score-line{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap:wrap;
}

/* чтобы медаль не отъезжала вниз */
.score-card .trophy{
  margin-top: 0;
}


#scoreBig{
  font-family: Intro, PFDin, system-ui;
  font-size: clamp(32px, 6vw, 64px);
  line-height: 1;
  letter-spacing: 1px;
  color: #ee3d25;
}
.score-status{ font-weight: 700; color: var(--ink-soft); font-size: clamp(16px, 2.5vw, 22px) }
.score-hint{ margin-top:8px; font-size: 13px; color: var(--ink-soft) }

.result .scoreline{ margin-top:8px; font-weight:700 }
.result .scoreline .badge{ padding:4px 8px; border-radius:10px; background:#f6f8ff; border:1px solid #e1e6f7 }

/* === ДОБАВЛЕНО ДЛЯ НОВОЙ ЛОГИКИ === */
.btn.btn-disabled{
  opacity: .5;
  cursor: not-allowed;
  pointer-events:none;
}

/* ===== Итоговый экран по тегам ===== */
.summary-card{
  background: rgba(255,255,255,.97);
  border:1px solid var(--paper-border);
}
.summary-card h2{
  font-family: Intro;
  margin:0 0 10px;
}
.summary-main{
  margin-bottom: 14px;
}
.summary-score{
  display:flex;
  align-items:baseline;
  flex-wrap:wrap;
  gap:12px;
}
#summaryBigScore{
  font-family: Intro, PFDin, system-ui;
  font-size: clamp(32px, 5vw, 56px);
  line-height:1;
}
.summary-status{
  font-weight:700;
  color: var(--ink-soft);
}
.summary-hint{
  margin:6px 0 0;
  font-size:14px;
  color: var(--ink-soft);
}

.summary-tags{
  display:flex;
  flex-wrap:wrap;
  gap:16px;
  margin-top:8px;
}
.summary-col{
  flex:1 1 220px;
}
.summary-col h3{
  margin:0 0 6px;
  font-size:16px;
}
.summary-tags-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.tag-pill{
  display:inline-flex;
  align-items:center;
  padding:6px 10px;
  border-radius:999px;
  font-size:14px;
  text-decoration:none;
  border:1px solid transparent;
  transition:.2s;
  cursor:pointer;
}
.tag-strong{
  background:#e6fbf2;
  border-color:var(--good);
  color:#074428;
}
.tag-strong:hover{
  background:#d5f6e8;
}
.tag-weak{
  background:#fff0f3;
  border-color:var(--bad);
  color:#7b1028;
}
.tag-weak:hover{
  background:#ffe3ea;
}

.summary-note{
  font-size:14px;
  color:var(--ink-soft);
}
.summary-actions{
  margin-top:16px;
}

.crumb{
  cursor: pointer; 	
}

@media (max-width: 600px){
  .summary-score{
    align-items:flex-start;
  }
}


.explain-card h2 {
    font-family: Intro;
    margin: 0 0 10px;
}

/* ===== Карта заданий ===== */
/* ===== Карта заданий (космическая) ===== */

.taskmap-card {
  margin-top: 0.9rem;
  background: radial-gradient(circle at 0 0, #ffffffee 0, #f1f4ff 35%, #e3e9ff 100%);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow:
    0 10px 25px rgba(0,0,0,0.25),
    0 0 0 1px rgba(120,154,255,0.25);
  border-radius: 18px;
}

.taskmap-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #16244b;
}

.taskmap-title::before {
  content: "🚀";
  font-size: 1.1rem;
}

/* «орбита» с планетами-заданиями */
.taskmap-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding-bottom: 0.1rem;
}

/* базовый стиль планеты */
.taskmap-pill {
  position: relative;
  min-width: 2.3rem;
  height: 2.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 1px solid rgba(14,18,48,0.12);
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
  color: #0e1230;
  background: radial-gradient(circle at 30% 20%, #ffffff, #d9e2ff);
  box-shadow:
    0 3px 8px rgba(0,0,0,0.15),
    0 0 0 1px rgba(255,255,255,0.8);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

/* маленькая звёздочка слева от номера */
.taskmap-pill::before {
  content: "★";
  font-size: 0.65rem;
  margin-right: 0.15rem;
  opacity: 0.6;
}

/* hover-эффект */
.taskmap-pill:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow:
    0 5px 14px rgba(0,0,0,0.25),
    0 0 0 1px rgba(255,255,255,0.9);
}

/* ещё не трогали — «спящие» планеты */
.taskmap-pill--pending {
  background: radial-gradient(circle at 30% 20%, #ffffff, #e6ebff);
  color: #48527a;
  border-color: rgba(87,112,189,0.35);
}

/* решены верно — зелёные планеты */
.taskmap-pill--ok {
  background: radial-gradient(circle at 25% 15%, #ffffff, #d5f6e8);
  border-color: #26a96b;
  color: #0d5132;
  box-shadow:
    0 4px 10px rgba(8, 81, 50, 0.3),
    0 0 0 1px rgba(255,255,255,0.95);
}

/* были попытки, но пока не решено — красные планеты */
.taskmap-pill--bad {
  background: radial-gradient(circle at 25% 15%, #ffffff, #ffe1e8);
  border-color: #e3516b;
  color: #801b2a;
  box-shadow:
    0 4px 10px rgba(128,27,42,0.28),
    0 0 0 1px rgba(255,255,255,0.95);
}

/* текущее задание — выделяем орбитой и лёгкой пульсацией */
.taskmap-pill--current {
  outline: none;
  color: #102a6b;
  background: radial-gradient(circle at 25% 15%, #ffffff, #cce4ff);
  border-color: #3b82f6;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.98),
    0 0 0 3px rgba(59,130,246,0.35),
    0 8px 18px rgba(15,23,42,0.35);
  animation: taskmap-orbit 1.6s ease-out infinite;
}

/* убираем звёздочку у текущего задания — пусть номер будет крупнее */
.taskmap-pill--current::before {
  content: "";
}

/* пульсирующая «орбита» вокруг текущей планеты */
@keyframes taskmap-orbit {
  0% {
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.98),
      0 0 0 3px rgba(59,130,246,0.35),
      0 8px 18px rgba(15,23,42,0.35);
  }
  100% {
    box-shadow:
      0 0 0 1px rgba(255,255,255,0.98),
      0 0 0 10px rgba(59,130,246,0),
      0 8px 18px rgba(15,23,42,0.35);
  }
}




/* общий контейнер награды */
.trophy {
  --trophy-pct: 0;
  --trophy-color: #ffcc33;
  --trophy-ring: #f8e29b;
  --trophy-stage-color: #d4af37;

  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.5rem;
  font-family: inherit;
}

/* иконка: медаль + ленточка вертикально */
.trophy-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

/* сама медаль */
.trophy-medal {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 20%, #fff8, transparent 55%),
    radial-gradient(circle at 75% 80%, #0006, transparent 55%),
    var(--trophy-ring);
  box-shadow:
    0 0 0 3px #fff2,
    0 6px 12px rgba(0,0,0,0.5);
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* цветная заливка по проценту */
.trophy-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    var(--trophy-color) 0%,
    var(--trophy-color) calc(var(--trophy-pct) * 100%),
    transparent calc(var(--trophy-pct) * 100%),
    transparent 100%
  );
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

/* внутренний круг с подписью предмета и степени */
.trophy-inner {
  position: relative;
  z-index: 1;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 20%, #fff9, #c9d5ff);

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
}

.trophy-subject {
  font-size: 11px;
  letter-spacing: 0.06em;
}

.trophy-stage {
  font-size: 10px;
  opacity: 0.8;
}

/* ленточка под медалью */
.trophy-ribbon {
  width: 30px;
  height: 18px;
  background:
    linear-gradient(135deg, var(--trophy-stage-color), #fff),
    linear-gradient(-135deg, var(--trophy-stage-color), #fff);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  background-position: left, right;
  clip-path: polygon(0 0, 100% 0, 80% 100%, 50% 70%, 20% 100%);
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
}

/* космическое свечение медали "Герой галактики" на странице задания */
@keyframes cosmicGlow {
  0% {
    box-shadow:
      0 0 0 0 rgba(255,255,255,0.5),
      0 0 12px rgba(120,200,255,0.8),
      0 8px 16px rgba(0,0,0,0.6);
  }
  100% {
    box-shadow:
      0 0 0 4px rgba(255,255,255,0.15),
      0 0 28px rgba(160,220,255,1),
      0 10px 24px rgba(0,0,0,0.8);
  }
}

.trophy--hero .trophy-medal{
  animation: cosmicGlow 1.8s ease-in-out infinite alternate;
}

.trophy--hero .trophy-ribbon{
  filter: saturate(1.4) brightness(1.1);
}

.trophy--hero .trophy-medal::after{
  content:"👑";
  position:absolute;
  top:-10px;
  right:-6px;
  font-size:18px;
  text-shadow:0 0 6px rgba(0,0,0,0.6);
}


/* текст справа от медали */
.trophy-meta {

  display: none;
}

.trophy-year {
  opacity: 0.9;
}

.trophy-pct {
  font-weight: 700;
}

/* цвета по предметам и степеням — как были */
.trophy--rus   { --trophy-color:#ff6f61; --trophy-ring:#ffd1c7; }
.trophy--math  { --trophy-color:#4dd0e1; --trophy-ring:#c8f5ff; }
.trophy--phys  { --trophy-color:#9575cd; --trophy-ring:#e2d7ff; }
.trophy--astr  { --trophy-color:#ffd54f; --trophy-ring:#fff3c2; }

.trophy--stage-1 { --trophy-stage-color:#d4af37; }
.trophy--stage-2 { --trophy-stage-color:#c0c0c0; }
.trophy--stage-3 { --trophy-stage-color:#cd7f32; }


/* эмодзи-иконка предмета внутри медали */
.trophy-emoji{
  font-size: 26px;
  line-height: 1;
}

/* нижняя строка: степень + год */
.trophy-bottom{
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 2px;
  font-size: 9px;
}

.trophy-stage{
  font-size: 9px;
  opacity: 0.9;
}

.trophy-year{
  font-size: 9px;
  opacity: 0.85;
}

/* цвет процентов = цвет медали */
.score-card #scoreBig{
  color: var(--trophy-color);
  transition: color 0.25s ease;
}

/* Картинка задания: не реагирует на дабл-тап, жесты зума и случайные выделения */
.no-zoom-image {
  touch-action: manipulation;  /* отключает дабл-тап-zoom, сохраняет скролл */
  user-select: none;
  -webkit-user-drag: none;
}

/* Хинт под картинкой — теперь это "кнопка" с лупой */
.preview .img-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 13px;
  color: #dbe6ff;
  cursor: pointer;
  user-select: none;
}

.preview .img-hint:hover {
  opacity: 0.9;
}

.preview .zoom-icon {
  font-size: 1.1em;
  flex-shrink: 0;
}
