html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at center, #1b1b1b, #0f0f0f);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

canvas { background: url('assets/game.jpg') no-repeat center center;
  background-size: cover;
  display: block;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle, #2e2e2e, #0a0a0a);
}

.main-menu {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: url("assets/menu.jpg") no-repeat center center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.neon-title {
  font-size: 8vw;
  max-font-size: 120px;
  min-font-size: 40px;
  font-weight: bold;
  color: #f5f5f5;
  text-align: center;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff, #d0d0d0, #a0a0a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.2px #333;
  text-stroke: 1.2px #333;
  text-shadow:
    1px 1px 0 #000,
    2px 2px 1px rgba(0,0,0,0.5),
    0 0 8px rgba(255,255,255,0.4),
    0 0 20px rgba(255,255,255,0.15);
  margin-bottom: 40px;
}

.neon-button {
  font-size: 24px;
  padding: 15px 30px;
  background: linear-gradient(to bottom, #cccccc, #888888);
  color: #111;
  border: 2px solid #666;
  border-radius: 8px;
  font-weight: bold;
  box-shadow: inset 0 1px 0 #fff, 0 4px 8px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.neon-button:hover {
  background: linear-gradient(to bottom, #eeeeee, #aaaaaa);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  margin-top: 30px;
}

/* ✅ Адаптивное окно проигрыша */
.game-over-ui {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(50, 50, 50, 0.95);
  padding: 3vh 4vw;
  border-radius: 2vh;
  text-align: center;
  color: #ffffff;
  font-size: 2.5vw;
  max-width: 80vw;
  box-shadow: 0 0 3vw rgba(255,255,255,0.2);
  z-index: 9999;
}

.game-over-ui button {
  margin: 1vh;
  padding: 1.5vh 3vw;
  background: linear-gradient(to bottom, #cccccc, #999999);
  border: 1px solid #444;
  border-radius: 1vh;
  font-size: 2vw;
  font-weight: bold;
  cursor: pointer;
  color: #222;
  box-shadow: inset 0 1px 0 #fff, 0 3px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, background 0.3s;
}

.game-over-ui button:hover {
  transform: scale(1.05);
  background: linear-gradient(to bottom, #eeeeee, #bbbbbb);
}

/* ✅ Таймер */
.countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

#countdownText {
  font-size: 14vw;
  font-weight: bold;
  color: #e0e0e0;
  text-shadow: 0 0 10px #aaa, 0 0 30px #fff;
}

/* ✅ Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.modal-content {
  background-color: #333;
  padding: 3vw 4vw;
  border-radius: 2vw;
  color: #f0f0f0;
  width: 70vw;
  max-width: 90vw;
  min-width: 50vw;
  max-height: 80vh;
  overflow-y: auto;
  font-size: 2vw;
  text-align: left;
  box-shadow: 0 0 2vw rgba(255,255,255,0.15);
}

.close-button {
  float: right;
  font-size: 32px;
  font-weight: bold;
  color: #ccc;
  cursor: pointer;
}

#highScoreContainer {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10001;
}

.highscore-box {
  background: linear-gradient(to bottom, #cccccc, #999999);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #111;
  font-family: Arial, sans-serif;
  border: 2px solid #666;
  box-shadow: 0 0 12px rgba(255,255,255,0.2);
  width: 8vw;
  height: 8vw;
  font-size: 2.5vw;
  max-width: 100px;
  max-height: 100px;
  min-width: 40px;
  min-height: 40px;
}

body, canvas, button, div, p, h1, h2, h3, h4, h5, h6 {
  user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -moz-user-select: none;
  -webkit-touch-callout: none;
}

.loading-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1b1b1b, #0e0e0e);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  flex-direction: column;
  animation: fadeIn 0.3s ease-in-out;
}

.loader-animation {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 6px solid #ccc;
  border-top: 6px solid #ffffff;
  border-bottom: 6px solid #888;
  animation: spin 1.2s linear infinite;
  box-shadow: 0 0 20px #aaa, 0 0 40px #fff;
  margin-bottom: 20px;
}

.loading-text {
  font-size: 22px;
  color: #f0f0f0;
  font-weight: bold;
  text-shadow: 0 0 6px #aaa;
  animation: blink 1.2s infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ✅ Треугольная кнопка */
.btn-triangle {
  position: relative;
  width: 10vw;
  height: 10vw;
  max-width: 100px;
  max-height: 100px;
  background: #cccccc;
  border: 0.3vw solid #666;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 4vw;
  font-weight: bold;
  color: #111;
}

.btn-triangle span {
  display: inline-block;
  transform: translateY(60%);
}

/* ✅ Квадратная кнопка — общий стиль (по центру) */
.btn-square {
  width: 10vw;
  height: 10vw;
  max-width: 100px;
  max-height: 100px;
  background: #cccccc;
  border: 0.3vw solid #666;
  border-radius: 1vw;
  font-size: 4vw;
  cursor: pointer;
  margin: 1vw;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ✅ Левая квадратная кнопка (правила) */
#rulesBtn { text-align:center; justify-content:center; padding-left:0; }

/* ✅ Круглая кнопка */
.btn-circle {
  width: 10vw;
  height: 10vw;
  max-width: 100px;
  max-height: 100px;
  background: #cccccc;
  border: 0.3vw solid #666;
  border-radius: 50% !important;
  font-size: 4vw;
  cursor: pointer;
  margin: 1vw;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ✅ Адаптивность для телефонов */
@media (max-width: 600px) {
  .game-over-ui {
    font-size: 4vw;
    padding: 4vh 5vw;
  }
  .game-over-ui button {
    font-size: 4vw;
    padding: 2vh 4vw;
  }
  .btn-triangle,
  .btn-square,
  .btn-circle {
    width: 14vw;
    height: 14vw;
    font-size: 5vw;
  }
}



/* === Minecraft style for Main Menu buttons === */
.mc-menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(70vw, 420px);
  margin: 0 auto;
  align-items: stretch;
  justify-content: center;
}

.main-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* === Minecraft style Game Over window (центр + пропорционально экрану) === */
.mc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
}

.mc-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(250px, 50vw, 500px);
  padding: 2vh 2vw;
  border: 4px solid #000;
  background: #2b2b2b;
  box-shadow: 0 8px 0 #000, 0 0 0 4px #5a5a5a inset;
  image-rendering: pixelated;
}


.mc-title{
  color: #fff;
  font-size: clamp(20px, 4vw, 32px);
  text-align: center;
  margin-bottom: 1em;
  text-shadow: 2px 2px 0 #000;
}


.mc-body{
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: stretch;
}


.mc-button{
  display: block;
  width: 100%;
  padding: 1em;
  font-size: clamp(14px, 2vw, 20px);
  color: #ddd;
  border: 2px solid #000;
  background: linear-gradient(#c6c6c6, #8b8b8b);
  box-shadow: 0 3px 0 #000, 0 0 0 3px #373737 inset, 0 0 0 1px #fff inset;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
  user-select: none;
}
.mc-button:hover{ background: linear-gradient(#e0e0e0, #a0a0a0); }
.mc-button:active{
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000, 0 0 0 3px #373737 inset, 0 0 0 1px #fff inset;
}


/* ===== Minecraft-styled modal (centered, no inner scrollbars, compact fit) ===== */
.mc-overlay {
  position: fixed;
  inset: 0;
  display: none;                 /* JS sets to flex to show */
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.85);
  z-index: 10010;
}

.mc-dialog {
  box-sizing: border-box;
  /* Slightly smaller base to fit on tiny screens */
  width: clamp(260px, 52vw, 520px);
  max-height: clamp(260px, 70vh, 560px);
  padding: clamp(10px, 2vh, 18px) clamp(12px, 2.4vw, 20px);
  background: #3b3b3b;
  color: #e8e6e3;
  border: 2px solid #000;
  box-shadow:
    0 0 0 3px #2e2e2e inset,
    0 0 0 5px #63a06b inset,
    0 0 0 7px #1d3b22 inset,
    0 8px 0 #000;
  text-shadow: 1px 1px 0 #000;
  image-rendering: pixelated;
  border-radius: 6px;
  overflow: hidden;              /* никаких внутренних полос */
}

.mc-title {
  margin: 0 0 clamp(6px, 1.2vh, 12px);
  font-size: clamp(15px, 2.4vw, 22px);
  font-weight: 700;
  color: #b7ffb4;
  text-align: center;
}

.mc-body {
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 1vh, 10px);
  font-size: clamp(12px, 1.9vw, 17px);
  line-height: 1.3;
  /* Без прокрутки: текст адаптируется и переносится */
  overflow: hidden;
}

.mc-body p { 
  margin: 0;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;       /* защищаемся от экстремально длинных слов */
}

.mc-button {
  align-self: center;
  display: inline-block;
  padding: clamp(6px, 1.6vh, 10px) clamp(10px, 2vw, 14px);
  font-size: clamp(12px, 1.8vw, 16px);
  color: #ddd;
  border: 2px solid #000;
  background: linear-gradient(#c6c6c6, #8b8b8b);
  box-shadow: 0 3px 0 #000, 0 0 0 3px #373737 inset, 0 0 0 1px #fff inset;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
  user-select: none;
}
.mc-button:hover { background: linear-gradient(#e0e0e0, #a0a0a0); }
.mc-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #000, 0 0 0 3px #373737 inset, 0 0 0 1px #fff inset;
}

/* Дополнительная компрессия для совсем маленьких экранов */
@media (max-width: 360px), (max-height: 420px) {
  .mc-dialog {
    width: min(92vw, 440px);
    max-height: 66vh;
    padding: 10px 12px;
  }
  .mc-title { font-size: 14px; margin-bottom: 6px; }
  .mc-body { gap: 4px; font-size: 12px; line-height: 1.22; }
  .mc-button { font-size: 12px; padding: 6px 10px; }
}


@media (max-width: 768px) {
  canvas {
    background: url('assets/game.png') no-repeat center center;
    background-size: cover;
  }
}

