/* ============================================================
   screens.css — главный экран, карта приключений, финал
   ============================================================ */

/* ===== ГЛАВНЫЙ ЭКРАН ===== */
#main-screen { background: url('../img/main-bg.jpg') center/cover; position: relative; overflow: hidden; }
#main-screen::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(15,12,41,0.6), rgba(48,43,99,0.5), rgba(36,36,62,0.7)); }
.stars { position: absolute; width: 100%; height: 100%; background-image: radial-gradient(2px 2px at 20px 30px, #fff, transparent), radial-gradient(2px 2px at 60px 70px, #fff, transparent), radial-gradient(1px 1px at 50px 160px, #fff, transparent), radial-gradient(1px 1px at 130px 40px, #fff, transparent), radial-gradient(2px 2px at 90px 120px, #fff, transparent); background-size: 200px 200px; animation: twinkle 3s infinite; }
@keyframes twinkle { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.moon { position: absolute; top: 50px; right: 8%; width: 80px; height: 80px; background: radial-gradient(circle, #fff9c4, #fff59d); border-radius: 50%; box-shadow: 0 0 40px #fff59d, 0 0 80px #fff59d; animation: float 6s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
.glowing-flowers { position: absolute; bottom: 30px; width: 100%; display: flex; justify-content: space-around; z-index: 2; }
.flower { font-size: 40px; animation: glow 2s ease-in-out infinite; }
@keyframes glow { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5) drop-shadow(0 0 10px #fff); } }
.main-content { position: relative; z-index: 10; text-align: center; padding: 84px 20px 60px; color: white; }
.main-content h1 {
  font-size: clamp(1.8em, 5vw, 3em); margin-bottom: 20px;
  background: linear-gradient(45deg, #ffffff 30%, #fff3b0 55%, #ffd700 75%, #ffffff 95%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(255,215,0,0.35));
  animation: fadeInDown 1s ease;
}
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-50px); } to { opacity: 1; transform: translateY(0); } }
.main-content p { font-size: clamp(1em, 2.5vw, 1.2em); max-width: 700px; margin: 0 auto 30px; line-height: 1.6; animation: fadeIn 1.5s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Карточка ученика (ввод имени) ===== */
.player-card {
  background: rgba(255,255,255,0.95);
  max-width: 430px; margin: 0 auto;
  padding: 24px; border-radius: 22px;
  box-shadow: 0 10px 35px rgba(0,0,0,0.4);
  border-top: 5px solid #ffd700;
  animation: fadeIn 1.2s ease;
}
.player-card label { display: block; color: #c44569; font-weight: bold; margin-bottom: 12px; font-size: 1.05em; }
.player-input {
  width: 100%; padding: 14px 18px;
  border-radius: 14px; border: 3px solid #ff6b9d;
  font-family: inherit; font-size: 1.1em; text-align: center;
  outline: none; transition: all 0.3s; color: #333;
  background: #fff8fb;
}
.player-input:focus { border-color: #c44569; box-shadow: 0 0 15px rgba(255,107,157,0.5); }
.player-input.error { border-color: #f44336; animation: shake 0.5s; background: #fff5f5; }

/* Выбор аватара */
.avatar-picker { display: flex; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.avatar-option {
  width: 42px; height: 42px; font-size: 1.35em; line-height: 1;
  background: #fff0f6; border: 2px solid #ffd6e5; border-radius: 50%;
  cursor: pointer; transition: all 0.25s; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
}
.avatar-option:hover { transform: scale(1.15); border-color: #ff9ec7; }
.avatar-option.selected {
  border-color: #ff6b9d; background: #ffe3ef;
  transform: scale(1.15); box-shadow: 0 0 14px rgba(255,107,157,0.55);
}
/* Выбор класса (от класса зависят задания) */
.grade-label {
  display: block; color: #8e5aa8; font-weight: bold;
  margin: 16px 0 8px; font-size: 1.02em;
}
.grade-picker { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.grade-option {
  width: 58px; height: 58px;
  background: #f3ecff; border: 2px solid #ddccf5;
  border-radius: 16px; cursor: pointer;
  font-family: inherit; transition: all 0.25s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 0;
}
.grade-option .grade-num { font-size: 1.45em; font-weight: bold; color: #6a3fa0; line-height: 1; }
.grade-option .grade-word { font-size: 0.56em; color: #9b7fc7; line-height: 1; }
.grade-option:hover { transform: translateY(-3px) scale(1.06); border-color: #b39ddb; box-shadow: 0 6px 14px rgba(106,63,160,0.25); }
.grade-option.selected {
  background: linear-gradient(145deg, #ede7f6, #d1c4e9);
  border-color: #8e5aa8; box-shadow: 0 0 16px rgba(142,90,168,0.5);
  transform: scale(1.1);
}
.grade-option.selected .grade-num { color: #4a148c; }
.grade-option.selected .grade-word { color: #6a3fa0; }
/* Подсветка, если ученик забыл выбрать класс */
.grade-picker.attention { animation: gradeShake 0.6s ease 2; }
@keyframes gradeShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.score-rules { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; flex-wrap: wrap; }
.score-rules span { font-size: 0.82em; font-weight: bold; padding: 6px 14px; border-radius: 50px; }
.score-rules .plus { background: #e8f5e9; color: #2e7d32; border: 2px solid #4caf50; }
.score-rules .minus { background: #ffebee; color: #c62828; border: 2px solid #f44336; }
.btn-start { background: linear-gradient(45deg, #ff6b9d, #c44569); color: white; border: none; padding: 18px 45px; font-size: clamp(1em, 2.5vw, 1.3em); border-radius: 50px; cursor: pointer; font-family: inherit; transition: all 0.3s; box-shadow: 0 5px 20px rgba(255,107,157,0.5); animation: pulse 2s infinite; }
.btn-start:hover { transform: scale(1.1); box-shadow: 0 10px 30px rgba(255,107,157,0.7); }
.btn-ghost {
  display: block; margin: 12px auto 0;
  background: transparent; color: #c44569;
  border: 2px solid #ffb3d1; padding: 10px 24px;
  font-size: 0.95em; font-weight: bold; border-radius: 50px;
  cursor: pointer; font-family: inherit; transition: all 0.3s;
}
.btn-ghost:hover { background: #fff0f6; border-color: #ff6b9d; transform: translateY(-2px); }

/* ===== КАРТА ПРИКЛЮЧЕНИЙ — карта занимает почти ВЕСЬ экран ===== */
/* Фон страницы — мягкий волшебный лес; сама карта показывается ЦЕЛИКОМ в рамке (без кадрирования).
   Заголовок/ингредиенты — стеклянные чипы поверх карты: на широких экранах они НЕ съедают
   место у карты, и она растягивается на всю высоту и ширину окна */
#map-screen { position: relative; background: linear-gradient(180deg, #10331f 0%, #1d5c3a 50%, #10331f 100%); }
.map-overlay { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(255,255,255,0.10), transparent 55%); }
/* Центрируем сцену по вертикали; сверху — место под фиксированный HUD */
.map-content {
  position: relative; z-index: 10;
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 70px 14px 12px;
  text-align: center;
}
/* Сцена повторяет размер карты — чипы позиционируются по её углам.
   Ширина карты упирается в СВОБОДНУЮ высоту окна (пропорция картинки 1280×853) */
.map-stage {
  position: relative;
  width: min(100%, calc((100vh - 96px) * 1.5006));
}
@supports (height: 100dvh) {
  .map-stage { width: min(100%, calc((100dvh - 96px) * 1.5006)); }
}
/* Заголовок и ингредиенты: на узких экранах — обычный поток над картой */
.map-float-title h2 { color: #fff; font-size: clamp(1.4em, 3.4vw, 2.1em); margin: 10px auto 4px; text-shadow: 2px 2px 4px rgba(0,0,0,0.7); }
.map-subtitle { color: rgba(255,255,255,0.85); font-size: clamp(0.85em, 2vw, 1em); margin: 0 auto 10px; text-shadow: 1px 1px 3px rgba(0,0,0,0.6); }
.ingredients-display { background: rgba(255,255,255,0.92); padding: 9px 14px; border-radius: 15px; max-width: 520px; margin: 0 auto 8px; font-size: 1.3em; display: flex; justify-content: space-around; flex-wrap: wrap; gap: 8px; }
.ingredient-slot { opacity: 0.3; transition: all 0.5s; filter: grayscale(1); cursor: default; }
.ingredient-slot:hover { transform: scale(1.2) rotate(-6deg); }
.ingredient-slot.collected { opacity: 1; filter: none; animation: bounceIn 0.6s; }
@keyframes bounceIn { 0% { transform: scale(0); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
/* Счётчик собранных ингредиентов (в чипе ингредиентов) */
.ingredients-count {
  display: inline-block;
  background: rgba(255,255,255,0.16); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.4);
  padding: 5px 16px; border-radius: 50px;
  font-size: 0.9em; font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  transition: all 0.4s;
}
.ingredients-count.all {
  background: linear-gradient(45deg, #ffd700, #ffb300);
  border-color: #e6a817; color: #5d4037; text-shadow: none;
  box-shadow: 0 0 18px rgba(255,193,7,0.7);
}
/* Мини-легенда статусов локаций (на карте снизу по центру; на мобиле скрыта) */
.map-legend {
  display: none;
  color: rgba(255,255,255,0.9); font-size: 0.82em; font-weight: bold;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.6);
  background: rgba(12, 30, 18, 0.55);
  border: 1.5px solid rgba(255,255,255,0.3);
  padding: 7px 14px; border-radius: 50px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

/* Живые светлячки над картой — мягкий мерцающий декор */
.map-magic { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.map-magic span {
  position: absolute; width: 7px; height: 7px; border-radius: 50%;
  background: radial-gradient(circle, #fff9c4 0%, #ffe082 45%, transparent 75%);
  filter: blur(0.5px);
  opacity: 0;
  animation: magicDrift 11s ease-in-out infinite;
}
.map-magic span:nth-child(1) { left: 8%;  top: 62%; animation-delay: 0s;   transform: scale(1); }
.map-magic span:nth-child(2) { left: 22%; top: 24%; animation-delay: 1.8s; transform: scale(0.7); }
.map-magic span:nth-child(3) { left: 38%; top: 68%; animation-delay: 3.1s; transform: scale(1.2); }
.map-magic span:nth-child(4) { left: 52%; top: 18%; animation-delay: 5s;   transform: scale(0.8); }
.map-magic span:nth-child(5) { left: 66%; top: 58%; animation-delay: 6.2s; transform: scale(1.1); }
.map-magic span:nth-child(6) { left: 79%; top: 30%; animation-delay: 2.4s; transform: scale(0.6); }
.map-magic span:nth-child(7) { left: 88%; top: 66%; animation-delay: 7.5s; transform: scale(0.9); }
.map-magic span:nth-child(8) { left: 45%; top: 40%; animation-delay: 8.7s; transform: scale(1.3); }
@keyframes magicDrift {
  0%, 100% { opacity: 0; transform: translate(0, 0) scale(0.8); }
  15% { opacity: 0.9; }
  50% { opacity: 0.5; transform: translate(14px, -26px) scale(1.15); }
  85% { opacity: 0.8; }
}
@media (prefers-reduced-motion: reduce) {
  .map-magic span { animation: none; opacity: 0.25; }
}

/* Сама карта: рамка с картинкой — видны все края, ничего не срезается.
   aspect-ratio повторяет пропорции картинки 1280×853, иконки ставятся по долям из data.js.
   КАРТА ПОЧТИ НА ВЕСЬ ЭКРАН: занимает всю свободную высоту окна. */
.map-path {
  --icon: 84px; /* фактический размер задаётся из JS под ширину картинки */
  position: relative;
  width: 100%;
  margin: 0 auto;
  aspect-ratio: 1280 / 853;
  background: #f2e8cf;
  border: 6px solid #8b4513;
  border-radius: 18px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(255,224,160,0.55);
  overflow: hidden;
  text-align: left;
}

/* ШИРОКИЙ ЭКРАН: заголовок/ингредиенты становятся стеклянными чипами ПОВЕРХ карты
   (в углах, где нет пинов), а карта растягивается почти на весь экран */
@media (min-width: 1100px) {
  .map-content { padding: 64px 14px 10px; }
  .map-stage { width: min(100%, calc((100vh - 84px) * 1.5006)); }
  @supports (height: 100dvh) {
    .map-stage { width: min(100%, calc((100dvh - 84px) * 1.5006)); }
  }
  /* Чип-заголовок: левый верхний угол карты.
     Компактный ОДНОстрочный — раньше с подзаголовком он был ~500px
     и накрывал рисованный свиток «Карта Волшебного леса».
     Теперь подзаголовок на широких экранах скрыт: свиток на карте сам
     называет карту, а чип занимает угол, где нет рисунка */
  .map-float-title {
    position: absolute; top: 14px; left: 14px; z-index: 20;
    text-align: left;
    background: rgba(12, 32, 18, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1.5px solid rgba(255,255,255,0.28);
    border-radius: 16px;
    padding: 8px 16px 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  }
  .map-float-title h2 { margin: 0; font-size: clamp(1.0em, 1.45vw, 1.3em); white-space: nowrap; }
  #map-screen .map-float-title .map-subtitle { display: none; }
  /* Чип-ингредиенты: правый верхний угол карты */
  .map-float-ing {
    position: absolute; top: 14px; right: 14px; z-index: 20;
    display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
  }
  .map-float-ing .ingredients-display {
    margin: 0; padding: 7px 12px; gap: 6px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 1.15em;
  }
  .map-float-ing .ingredients-count { margin: 0; font-size: 0.82em; background: rgba(12, 32, 18, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
  .map-float-ing .ingredients-count.all { background: linear-gradient(45deg, #ffd700, #ffb300); }
  /* Легенда — снизу по центру карты */
  .map-legend {
    display: inline-block;
    position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
    z-index: 20;
  }
}
.map-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }

/* Пунктирная тропа и её золотое свечение */
.map-svg { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 1; }
.map-svg .trail-dots {
  fill: none; stroke: #6d4423; stroke-width: 5;
  stroke-dasharray: 1 16; stroke-linecap: round; opacity: 0.9;
}
.map-svg .trail-glow {
  fill: none; stroke: #ffd700; stroke-width: 1.6;
  opacity: 0.35; filter: drop-shadow(0 0 4px #ffd700);
}
/* Золотая лента ПРОЙДЕННОГО пути — растёт вслед за героем */
.map-svg .trail-done {
  fill: none; stroke: #ffca28; stroke-width: 4.5;
  stroke-linecap: round; opacity: 0.95;
  filter: drop-shadow(0 0 5px rgba(255,202,40,0.85));
}

/* Иконка локации — стоит ровно на пине, нарисованном на картинке.
   Размеры считаются от --icon, поэтому пропорционально уменьшаются вместе с картой. */
.location-btn {
  position: absolute; z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  background: none; border: none; padding: 0;
  cursor: pointer; font-family: inherit;
  transition: filter 0.3s;
}
.location-emoji {
  position: relative; /* для искорки на собранной локации */
  width: var(--icon); height: var(--icon); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--icon) * 0.42); line-height: 1;
  background: linear-gradient(145deg, rgba(255,224,130,0.96), rgba(255,179,0,0.96));
  border: max(3px, calc(var(--icon) * 0.05)) solid #8b4513;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), inset 0 2px 6px rgba(255,255,255,0.5);
  transition: transform 0.3s, box-shadow 0.3s;
}
/* Названия и статусы пинов УБРАНЫ: они накладывались на подписи,
   нарисованные на самой карте («Башня» + «Башня Магии» друг на друге).
   Теперь карта — источник имён: у пина только эмодзи-иконка,
   а статус виден по цвету (зелёный/оранжевый/серый) и легенде снизу.
   Иконка чуть меньше и приподнята, чтобы рисованные таблички читались */
.location-btn:hover:not(.locked) .location-emoji { transform: scale(1.12) rotate(-4deg); box-shadow: 0 10px 24px rgba(0,0,0,0.45); }
.location-btn.locked { cursor: not-allowed; }
.location-btn.locked .location-emoji { filter: grayscale(0.85); opacity: 0.55; }
.location-btn.current .location-emoji {
  background: linear-gradient(145deg, #ffcc80, #ef6c00);
  animation: currentPulse 1.8s infinite;
}
@keyframes currentPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 16px rgba(0,0,0,0.35), 0 0 0 0 rgba(255,152,0,0.7); }
  50% { transform: scale(1.07); box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 14px rgba(255,152,0,0); }
}
.location-btn.completed .location-emoji { background: linear-gradient(145deg, #a5d6a7, #43a047); border-color: #2e7d32; }
/* Искорка-магия над собранной локацией */
.location-btn.completed .location-emoji::after {
  content: '✨';
  position: absolute; top: -0.28em; right: -0.34em;
  font-size: calc(var(--icon) * 0.3); line-height: 1;
  animation: sparkleTwinkle 1.6s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sparkleTwinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
  50% { transform: scale(1.3) rotate(20deg); opacity: 1; }
}

/* Наш герой идёт по тропе ровно через иконки локаций */
.map-walker {
  position: absolute; z-index: 2;
  width: calc(var(--icon) * 0.52); height: calc(var(--icon) * 0.52);
  margin: calc(var(--icon) * -0.52) 0 0 calc(var(--icon) * -0.26); /* ноги на тропе */
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.45));
}
/* Слой для «стояния» у иконки — отдельно от анимации шага.
   Стоящая фея — ПОВЕРХ пина (иначе пин закрывает её половину) */
.map-walker .walker-stand { display: block; transition: transform 0.35s ease; }
.map-walker.stand-front { z-index: 4; }
.map-walker .walker-body { font-size: calc(var(--icon) * 0.52); line-height: 1; display: block; }
.map-walker.walking .walker-body { animation: walkBob 0.42s ease-in-out infinite alternate; }
@keyframes walkBob {
  from { transform: translateY(0) rotate(-7deg) scale(1); }
  to { transform: translateY(-9px) rotate(7deg) scale(1.05); }
}
.map-walker.idle .walker-body { animation: idlePulse 2.2s ease-in-out infinite; }
@keyframes idlePulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.06); }
}

/* ===== ФИНАЛ ===== */
#final-screen { background: url('../img/final-bg.jpg') center/cover; position: relative; }
.final-overlay { position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,105,180,0.3)); }
.final-content { position: relative; z-index: 10; text-align: center; padding: 84px 20px 60px; color: white; }
.final-animation { font-size: 4em; margin: 30px 0; }
.final-animation span { display: inline-block; animation: transformAnim 3s ease-in-out infinite; }
@keyframes transformAnim { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3) rotate(10deg); } }
.final-content h2 { font-size: clamp(1.8em, 5vw, 3em); margin-bottom: 20px; text-shadow: 3px 3px 6px rgba(0,0,0,0.7); }
.final-content p { font-size: clamp(1em, 2.5vw, 1.3em); max-width: 700px; margin: 0 auto 30px; line-height: 1.8; text-shadow: 2px 2px 4px rgba(0,0,0,0.7); }
/* Золотой кубок победителя — покачивается и светится */
.final-trophy {
  font-size: clamp(3.2em, 9vw, 5.5em); line-height: 1.15;
  display: inline-block;
  filter: drop-shadow(0 8px 18px rgba(255,193,7,0.65));
  animation: trophyGlow 2.4s ease-in-out infinite;
}
@keyframes trophyGlow {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.13) rotate(5deg); }
}
.btn-restart { background: linear-gradient(45deg, #ff6b9d, #c44569); color: white; border: none; padding: 18px 45px; font-size: 1.2em; border-radius: 50px; cursor: pointer; font-family: inherit; transition: all 0.3s; box-shadow: 0 5px 20px rgba(255,107,157,0.5); }
.btn-restart:hover { transform: scale(1.1); box-shadow: 0 10px 30px rgba(255,107,157,0.7); }
.btn-restart.ghost {
  background: rgba(255,255,255,0.9); color: #c44569;
  border: 3px solid #ff6b9d; box-shadow: 0 5px 20px rgba(0,0,0,0.25);
}
.btn-restart.ghost:hover { box-shadow: 0 10px 30px rgba(255,107,157,0.55); }
.final-buttons { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ===== Диплом (превью в модалке + печать) ===== */
.diploma-sheet {
  position: relative;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 215, 64, 0.14), transparent 34%),
    radial-gradient(circle at 88% 92%, rgba(255, 215, 64, 0.12), transparent 34%),
    linear-gradient(180deg, #fffdf5, #fff6e0);
  border: 4px solid #c9a227;
  outline: 1px solid rgba(201, 162, 39, 0.55); outline-offset: -9px;
  border-radius: 10px;
  padding: 12px;
  box-shadow: inset 0 0 34px rgba(201, 162, 39, 0.14), 0 10px 30px rgba(90, 60, 10, 0.25);
}
.diploma-border {
  position: relative; overflow: hidden;
  border: 2px dashed #d4af37; border-radius: 6px;
  padding: 26px 22px 20px; text-align: center;
}
.diploma-corner { position: absolute; font-size: 1.25em; line-height: 1; opacity: 0.9; z-index: 2; }
.diploma-corner.tl { top: 8px; left: 10px; }
.diploma-corner.tr { top: 8px; right: 10px; }
.diploma-corner.bl { bottom: 8px; left: 10px; }
.diploma-corner.br { bottom: 8px; right: 10px; }
.diploma-watermark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 8.5em; opacity: 0.07; pointer-events: none; z-index: 0;
  transform: rotate(-10deg); filter: saturate(0.8);
}
.diploma-crest { position: relative; z-index: 1; font-size: 2em; letter-spacing: 10px; }
.diploma-kind {
  position: relative; z-index: 1;
  color: #8b6914; font-size: 0.72em; letter-spacing: 3px;
  margin-top: 8px; font-weight: bold;
}
.diploma-title {
  position: relative; z-index: 1;
  color: #c44569; font-size: 1.7em; margin: 10px 0 4px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}
.diploma-sub { position: relative; z-index: 1; color: #999; font-style: italic; margin-bottom: 8px; }
.diploma-name {
  position: relative; z-index: 1;
  font-size: 1.6em; font-weight: bold; color: #4a2c6d;
  background: linear-gradient(135deg, #fff3b0, #ffe082 55%, #ffd54f);
  border: 2px solid #d4af37; border-radius: 12px;
  display: inline-block; padding: 8px 30px; margin-bottom: 10px;
  box-shadow: 0 3px 10px rgba(212, 175, 55, 0.35);
}
.diploma-name-avatar { font-size: 0.95em; }
.diploma-grade { position: relative; z-index: 1; color: #8e5aa8; font-weight: bold; margin-bottom: 12px; }
.diploma-text { position: relative; z-index: 1; color: #666; line-height: 1.7; font-size: 0.92em; margin-bottom: 12px; }
.diploma-stats {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 8px;
}
.diploma-stat {
  background: #fff; border: 1.5px solid #e3c766; border-radius: 50px;
  padding: 4px 12px; font-size: 0.88em; font-weight: bold; color: #8b6914;
  box-shadow: 0 2px 5px rgba(201, 162, 39, 0.18);
}
.diploma-stars { position: relative; z-index: 1; font-size: 1.5em; letter-spacing: 6px; margin: 2px 0; }
.diploma-rank { position: relative; z-index: 1; color: #2e7d32; font-weight: bold; margin-bottom: 16px; }
.diploma-seal {
  position: absolute; right: 26px; bottom: 44px; z-index: 2;
  width: 86px; height: 86px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 34% 30%, #ff8a80, #e53935 60%, #b71c1c);
  box-shadow: 0 4px 12px rgba(183, 28, 28, 0.45), inset 0 0 10px rgba(255, 255, 255, 0.25);
  transform: rotate(-8deg); opacity: 0.92;
}
.diploma-seal span { font-size: 1.7em; line-height: 1.15; }
.diploma-seal em {
  font-style: normal; font-size: 0.42em; font-weight: bold; letter-spacing: 1px;
  color: #fff; text-align: center; line-height: 1.25; margin-top: 2px;
}
.diploma-footer {
  position: relative; z-index: 1;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  color: #888; font-size: 0.82em;
  border-top: 1px solid #e6d9a8; padding-top: 12px; margin-top: 6px;
}
.diploma-sign { font-style: italic; color: #7a5c9e; font-weight: bold; }
.diploma-actions { text-align: center; margin-top: 16px; }

/* На узких экранах печать меньше и не наезжает на текст */
@media (max-width: 600px) {
  .diploma-seal { width: 62px; height: 62px; right: 10px; bottom: 34px; }
  .diploma-seal span { font-size: 1.15em; }
  .diploma-seal em { font-size: 0.32em; }
  .diploma-border { padding: 22px 14px 16px; }
  .diploma-name { font-size: 1.3em; padding: 6px 18px; }
}

/* ===== Итоговая карточка результата ===== */
.final-score-card {
  background: rgba(255,255,255,0.94);
  max-width: 430px; margin: 0 auto 30px;
  padding: 22px; border-radius: 22px;
  box-shadow: 0 10px 35px rgba(0,0,0,0.4);
  border-top: 5px solid #ffd700;
  color: #333;
  animation: bounceIn 0.8s;
}
.final-score-name { font-weight: bold; color: #c44569; font-size: 1.25em; margin-bottom: 4px; }
.final-score-name span:first-child { font-size: 1.3em; }
.final-score-grade { color: #8e5aa8; font-weight: bold; font-size: 0.95em; margin-bottom: 8px; min-height: 1.2em; }
.final-score-value { font-size: 2em; font-weight: bold; color: #5d4037; }
.final-score-stars { font-size: 2.2em; margin: 8px 0; letter-spacing: 6px; }
.final-score-title { color: #8b4513; font-weight: bold; margin-bottom: 8px; font-size: 1.05em; }
.final-score-best { font-size: 0.88em; color: #666; }
/* Строка достижений на финальной карточке */
.final-ach {
  margin-top: 10px; font-size: 0.9em; color: #8b6914;
  background: linear-gradient(135deg, #fff8e1, #ffecb3);
  border: 1px solid #e6c25a; border-radius: 12px;
  padding: 8px 10px;
}
.final-ach-row { display: inline-flex; gap: 4px; margin-left: 6px; font-size: 1.25em; vertical-align: middle; }
/* Строка достижений кликабельна: открывает медальницу в профиле */
.final-ach.clickable { cursor: pointer; transition: all 0.25s; }
.final-ach.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(230,194,90,0.45); border-color: #d4a72c; }
.final-ach-hint { margin-top: 4px; font-size: 0.82em; color: #b58900; opacity: 0.85; }

/* ===== Адаптивность ===== */
@media (max-width: 600px) {
  .main-content { padding: 76px 14px 50px; }
  .player-card { padding: 18px; }
  .grade-option { width: 50px; height: 50px; }
  .grade-option .grade-num { font-size: 1.2em; }
  .btn-start { padding: 15px 30px; }
  .map-content { padding: 64px 8px 10px; }
  .map-float-title h2 { margin-top: 4px; font-size: clamp(1.15em, 5.5vw, 1.5em); }
  .map-subtitle { font-size: 0.8em; margin-bottom: 8px; }
  .ingredients-display { font-size: 1.1em; padding: 7px 10px; margin-bottom: 6px; }
  .map-path { border-width: 4px; border-radius: 12px; }
  /* Названия пинов убраны и на десктопе — рисованные таблички читаются сами */
  .final-content { padding: 76px 14px 50px; }
  .final-animation { font-size: 2.8em; }
}
