html {
  font-size: 13px;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f7f4ef;
}

.game {
  max-width: 700px;
  margin: 0 auto;
  min-height: 100svh;
  padding: 24px 16px;

  display: flex;
  flex-direction: column;
}

/* ===== ЗАГОЛОВОК ===== */
.title {
  font-family: "Oswald", sans-serif;
  text-align: center;
  color: #8a5a33;
  font-size: 3.8rem;
  margin-bottom: 24px;
}
@media (max-width: 768px) {
  .title {
    margin: 10px 0px;
  }
}

/* Для смартфонов */
@media (max-width: 768px) {
  .game {
    padding: 24px;
  }
}
@media (max-width: 768px) {
  .title {
    font-size: 2rem;
  }
}

/* ===== ПРОГРЕСС-БАР ===== */
.progress-wrap {
  position: relative;
  margin-bottom: 24px;
  margin-top: 24px;
}

@media (max-width: 768px) {
  .progress-wrap {
    margin-bottom: 4px;
    box-sizing: content-box;
  }
}
.bar {
  position: relative;
  height: 28px;
  border: 6px solid #8a5a33;
  border-radius: 14px;
  overflow: hidden;
}

.bar-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, #4ade80, #facc15, #ef4444);
}

.bar-cover {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  background: #f7f4ef;
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 2.1rem;
  margin-top: 6px;
  color: #8a5a33;
}
@media (max-width: 768px) {
  .bar-labels {
    font-size: 1.4rem;
  }
}
.tooltip {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  font-weight: bold;
  pointer-events: none;
}

.bar-hover {
  position: absolute;
  inset: 0;
}

.pie-wrapper {
  flex: 1;
  text-align: center;
  display: flex;
  justify-content: center;
}
@media (max-width: 768px) {
  .pie-wrapper {
    justify-content: flex-start;
  }
}

svg {
  width: 80vw;
  max-width: 560px;
}

@keyframes shake {
  0% {
    transform: translate(0, 0) rotate(0);
  }
  25% {
    transform: translate(2px, -2px) rotate(1deg);
  }
  50% {
    transform: translate(-2px, 2px) rotate(-1deg);
  }
  75% {
    transform: translate(2px, 2px) rotate(1deg);
  }
  100% {
    transform: translate(0, 0) rotate(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.shake {
  animation-name: shake;
  animation-iteration-count: infinite;
}

.pulse {
  animation-name: pulse;
  animation-iteration-count: infinite;
}

.brow {
  stroke: #000;
  stroke-width: 4;
  fill: none;
  stroke-linecap: round;
  animation: browMove 1.5s ease-in-out infinite;
}

@keyframes browMove {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
  100% {
    transform: translateY(0);
  }
}

#pieGroup {
  transform-origin: center;
  transform-box: fill-box;
}
/* базовый фон модалок */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

/* вторая модалка поверх первой */
.modal-backdrop--top {
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
}

.modal {
  width: 90vw;
  max-width: 700px;
  background: #fff8ee;
  border: 4px solid #8a5a33; /* как обводка пирожка */
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.modal--top {
  transform: scale(1.02);
}

.modal-text {
  font-size: 1.9rem;
  text-align: center;
  margin-top: 16px;
}
/* текст сверху */
.modal-content {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 24px;
  z-index: 3;
}

/* кнопка внизу */
.modal-actions {
  display: grid;
  justify-content: center;
  gap: 20px;

  grid-template-columns: repeat(auto-fit, minmax(300px, 200px));
}

.modal-btn {
  padding: 14px;
  font-size: 1.5rem;
  border-radius: 14px;

  background: #f4c28b; /* цвет пирожка */
  border: 3px solid #8a5a33; /* обводка пирожка */
  color: #000;

  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.modal-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

@media (max-width: 640px) {
  .modal {
    width: 92vw;
    max-height: 85svh;
    padding: 20px 16px;
    border-radius: 20px;
    overflow-y: auto;
  }

  .modal-text {
    font-size: 1.4rem;
    /* line-height: 1.4; */
  }

  .modal-actions {
    grid-template-columns: 1fr;
  }
  .modal-btn {
    font-size: 1.2rem;
  }
}

@keyframes modalPulse {
  0% {
    box-shadow: 0 0 0 rgba(138, 90, 51, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(138, 90, 51, 0.6);
  }
  100% {
    box-shadow: 0 0 0 rgba(138, 90, 51, 0.4);
  }
}
/* финальный бэкдроп */

.modal-backdrop--final {
  position: fixed;
  inset: 0;
  background: black;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;

  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.modal-backdrop--final.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* затемнение */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2;
}

/* финальная модалка */
.modal--final {
  position: relative;
  padding: 0;
  background: black;
  overflow: hidden;

  display: block;

  width: 90vw;
  max-width: 700px;
}

.modal-video {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  background: black;
}

/* текст и кнопка */
.modal-final-content {
  position: absolute;
  inset: 0;
  z-index: 3;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  text-align: center;
  color: #fff;
}
[x-cloak] {
  display: none !important;
}
@supports (-webkit-touch-callout: none) {
  .modal-video {
    max-height: 70svh;
  }
}
@media (max-width: 768px) {
  .modal-final-content {
    font-size: 0.85rem;
  }
}
.sound-toggle {
  position: fixed;
  top: env(safe-area-inset-top, 12px);
  right: env(safe-area-inset-right, 12px);
  z-index: 200;

  width: 52px;
  height: 52px;

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

  border: 3px solid #7a6a5a; /* темнее цвета пирожка */
  border-radius: 14px;

  cursor: pointer;

  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  background: none; /* без заливки */
}

.sound-toggle:active {
  transform: scale(0.96);
}

.sound-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  /* Для inline SVG можно управлять fill через CSS */
}

.sound-tooltip {
  position: absolute;
  top: 110%;
  right: 0;

  background: #fff8ee;
  border: 2px solid #7a6a5a;
  border-radius: 10px;

  padding: 6px 10px;
  font-size: 0.9rem;
  white-space: nowrap;

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* адаптация под мобильные */
@media (max-width: 640px) {
  .sound-toggle {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .sound-icon {
    width: 22px;
    height: 22px;
  }

  .sound-tooltip {
    font-size: 0.8rem;
  }
}

.action-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0 24px;
}

.action-btn {
  padding: 12px 24px;
  font-size: 1.4rem;

  background: transparent;
  border: 3px solid #8a5a33;
  border-radius: 14px;

  color: #8a5a33;
  opacity: 0.6;
  cursor: pointer;
}

.action-btn:hover {
  opacity: 0.8;
}
