/* ============================================
   ELIT Beauty Salon — Catch the Egg Game
   ============================================ */

* { margin: 0; }

html, body { height: 100%; }

body {
  margin: 0;
  padding: 0;
  background: #1a1a1a;
  color: #ffccff;
  font-size: 14px;
  line-height: 1.2em;
  font-family: 'Alegreya Sans SC', Tahoma, Arial, sans-serif;
  overflow-x: hidden;
}

a { color: #ff69b4; font-size: 16px; text-decoration: none; }
a:hover { color: #ffffff; }

h1, h2, h3 { line-height: 1.5em; font-weight: normal; }
h3 { font-size: 28px; }

/* ============================================
   ПЕРЕКЛЮЧАТЕЛЬ РЕЖИМОВ
   ============================================ */
.mode-switcher {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 5px;
  flex-wrap: wrap;
  background: #1a1a1a;
}

.mode-btn {
  padding: 8px 14px;
  background: #2a1a3a;
  color: #ff69b4;
  border: 2px solid #ff69b4;
  border-radius: 20px;
  font-family: 'Alegreya Sans SC', Tahoma, Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mode-btn:hover { background: #ff69b4; color: #fff; }

.mode-btn.active {
  background: linear-gradient(135deg, #ff69b4 0%, #8a2be2 100%);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 105, 180, 0.6);
}

/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */
.page {
  width: 100%;
  max-width: 100vw;
  margin: 0 auto;
  text-align: center;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.page a.logo {
  margin: 15px auto;
  display: block;
  font-size: 48px;
  letter-spacing: 8px;
  color: #ff69b4;
  font-family: Georgia, serif;
  font-weight: bold;
  text-shadow: 0 0 20px rgba(255, 105, 180, 0.6);
  width: 100%;
}

.footer {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 20px 10px;
}
.footer a { color: #ff69b4; }

/* ============================================
   ИГРОВОЕ ПОЛЕ
   ============================================ */
#game-wrap {
  width: 572px;
  height: 350px;
  margin: 0 auto;
  background: transparent url('../img/game-bg.jpg') center center no-repeat;
  background-size: cover;
  position: relative;
  border: 6px solid #ff69b4;
  border-radius: 16px;
  box-shadow:
    0 0 20px rgba(255, 105, 180, 0.8),
    0 0 40px rgba(255, 105, 180, 0.5);
  overflow: hidden;
  transform-origin: top center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

  #game-wrap .basket { width: 80px; height: 80px; position: absolute; }
    #game-wrap[data-bx="0"][data-by="1"] .basket {
      width: 82px; height: 78px;
      background: transparent url('../img/basket/basket-p-0-1.png') center center no-repeat;
      top: 158px; left: 126px;
    }
    #game-wrap[data-bx="1"][data-by="1"] .basket {
      width: 82px; height: 78px;
      background: transparent url('../img/basket/basket-p-1-1.png') center center no-repeat;
      top: 165px; right: 123px;
    }
    #game-wrap[data-bx="0"][data-by="0"] .basket {
      width: 85px; height: 65px;
      background: transparent url('../img/basket/basket-p-0-0.png') center center no-repeat;
      left: 124px; bottom: 50px;
    }
    #game-wrap[data-bx="1"][data-by="0"] .basket {
      width: 85px; height: 65px;
      background: transparent url('../img/basket/basket-p-1-0.png') center center no-repeat;
      right: 126px; bottom: 44px;
    }

  #game-wrap .wolf { width: 50px; height: 140px; position: absolute; }
    #game-wrap[data-bx="0"] .wolf {
      width: 98px; height: 152px; top: 164px; left: 179px;
      background: transparent url('../img/wolf/wolf-p-0.png') center center no-repeat;
    }
    #game-wrap[data-bx="1"] .wolf {
      width: 90px; height: 146px; top: 166px; right: 186px;
      background: transparent url('../img/wolf/wolf-p-1.png') center center no-repeat;
    }

  #game-wrap .egg {
    width: 15px; height: 15px;
    background: transparent url('../img/egg/egg.png') center center no-repeat;
    position: absolute;
  }
    #game-wrap[data-egg-0="0"] .egg.e-0,
    #game-wrap[data-egg-1="0"] .egg.e-1,
    #game-wrap[data-egg-2="0"] .egg.e-2,
    #game-wrap[data-egg-3="0"] .egg.e-3 { display: none; }

    #game-wrap[data-egg-0="1"] .egg.e-0 { top: 195px; left: 47px;  transform: rotate(65deg); }
    #game-wrap[data-egg-0="2"] .egg.e-0 { top: 205px; left: 62px;  transform: rotate(118deg); }
    #game-wrap[data-egg-0="3"] .egg.e-0 { top: 215px; left: 79px;  transform: rotate(162deg); }
    #game-wrap[data-egg-0="4"] .egg.e-0 { top: 223px; left: 96px;  transform: rotate(-93deg); }
    #game-wrap[data-egg-0="5"] .egg.e-0 { top: 235px; left: 108px; transform: rotate(-7deg); }

    #game-wrap[data-egg-1="1"] .egg.e-1 { top: 122px; left: 47px;  transform: rotate(56deg); }
    #game-wrap[data-egg-1="2"] .egg.e-1 { top: 132px; left: 62px;  transform: rotate(108deg); }
    #game-wrap[data-egg-1="3"] .egg.e-1 { top: 142px; left: 80px;  transform: rotate(192deg); }
    #game-wrap[data-egg-1="4"] .egg.e-1 { top: 151px; left: 95px;  transform: rotate(-62deg); }
    #game-wrap[data-egg-1="5"] .egg.e-1 { top: 160px; left: 110px; }

    #game-wrap[data-egg-2="1"] .egg.e-2 { top: 122px; right: 51px;  transform: rotate(-10deg); }
    #game-wrap[data-egg-2="2"] .egg.e-2 { top: 132px; right: 66px;  transform: rotate(-56deg); }
    #game-wrap[data-egg-2="3"] .egg.e-2 { top: 142px; right: 84px;  transform: rotate(-128deg); }
    #game-wrap[data-egg-2="4"] .egg.e-2 { top: 149px; right: 99px;  transform: rotate(140deg); }
    #game-wrap[data-egg-2="5"] .egg.e-2 { top: 160px; right: 113px; transform: rotate(58deg); }

    #game-wrap[data-egg-3="1"] .egg.e-3 { top: 195px; right: 50px;  transform: rotate(-14deg); }
    #game-wrap[data-egg-3="2"] .egg.e-3 { top: 204px; right: 66px;  transform: rotate(-53deg); }
    #game-wrap[data-egg-3="3"] .egg.e-3 { top: 215px; right: 83px;  transform: rotate(-96deg); }
    #game-wrap[data-egg-3="4"] .egg.e-3 { top: 223px; right: 100px; transform: rotate(152deg); }
    #game-wrap[data-egg-3="5"] .egg.e-3 { top: 235px; right: 112px; transform: rotate(68deg); }

  #game-wrap #score { position: absolute; top: 48px; left: 326px; }
    #game-wrap #score ul { margin: 0; padding: 0; list-style: none; display: inline-block; }
      #game-wrap #score ul > li {
        width: 31px; height: 47px; margin: 0 0 0 -2px;
        background: transparent url('../img/score/num-bg.png');
        display: inline-block; vertical-align: top;
      }
      #game-wrap #score ul > li span {
        width: 100%; height: 100%;
        background: transparent url('../img/score/nums.png');
        background-position: 0px 0px;
        text-indent: -200px; display: block; overflow: hidden;
      }
      #game-wrap #score ul > li.n-0 span { background-position: 0px 0px; }
      #game-wrap #score ul > li.n-1 span { background-position: -31px 0px; }
      #game-wrap #score ul > li.n-2 span { background-position: -62px 0px; }
      #game-wrap #score ul > li.n-3 span { background-position: -93px 0px; }
      #game-wrap #score ul > li.n-4 span { background-position: -124px 0px; }
      #game-wrap #score ul > li.n-5 span { background-position: -155px 0px; }
      #game-wrap #score ul > li.n-6 span { background-position: -186px 0px; }
      #game-wrap #score ul > li.n-7 span { background-position: -217px 0px; }
      #game-wrap #score ul > li.n-8 span { background-position: -248px 0px; }
      #game-wrap #score ul > li.n-9 span { background-position: -279px 0px; }

  #game-wrap #loss {
    width: 114px; height: 32px;
    background: transparent url('../img/loss/loss.png') left top no-repeat;
    position: absolute; top: 114px; left: 326px;
  }
    #game-wrap[data-loss="0"] #loss { width: 0; }
    #game-wrap[data-loss="1"] #loss { width: 40px; }
    #game-wrap[data-loss="2"] #loss { width: 80px; }
    #game-wrap[data-loss="3"] #loss { width: 120px; }

  #message {
    width: 100%; height: 100%;
    background: rgba(26, 26, 26, 0.92);
    position: absolute; top: 0; left: 0;
    display: none; overflow: hidden; z-index: 10;
  }
    #message > div {
      margin-top: 40px; padding: 15px 20px;
      color: #fff; background: #2a1a3a;
      box-shadow: 0 0 40px rgba(255, 105, 180, 0.4);
    }
      #message h3 { color: #ff69b4; font-size: 26px; margin-bottom: 8px; }
      #message p { font-size: 15px; margin: 6px 0; color: #fff; }
      #message b { color: #ff69b4; }

#controls { display: none; }

/* ============================================
   ОПИСАНИЕ ИГРЫ
   ============================================ */
.game-page {
  display: block;
  max-width: 720px;
  width: calc(100% - 20px);
  margin: 30px auto 60px auto;
  padding: 25px 20px;
  background: rgba(255, 105, 180, 0.06);
  border-radius: 20px;
  border: 2px solid #ff69b4;
  box-shadow: 0 0 30px rgba(255, 105, 180, 0.2);
  color: #f0e6f6;
  font-family: 'Alegreya Sans SC', Tahoma, Arial, sans-serif;
  text-align: left;
  line-height: 1.7;
  box-sizing: border-box;
}

.game-page h1 { color: #ff69b4; font-size: 26px; text-align: center; margin-bottom: 18px; text-shadow: 0 0 15px rgba(255, 105, 180, 0.6); }
.game-page h2 { color: #ff69b4; font-size: 20px; margin: 22px 0 10px; border-bottom: 1px solid rgba(255, 105, 180, 0.3); padding-bottom: 6px; }
.game-page p { font-size: 15px; color: #e0d0e8; margin: 8px 0; }
.game-page ul, .game-page ol { padding-left: 22px; margin: 8px 0; font-size: 15px; color: #e0d0e8; }
.game-page li { margin: 5px 0; }
.game-page b { color: #ff69b4; }
.game-page table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.game-page table th { background: linear-gradient(135deg, #ff69b4 0%, #8a2be2 100%); color: #fff; padding: 8px 10px; text-align: left; font-weight: bold; }
.game-page table td { padding: 7px 10px; border-bottom: 1px solid rgba(255, 105, 180, 0.2); color: #e0d0e8; }

/* ============================================
   РЕЖИМ 1: СТАНДАРТ
   ============================================ */
body.mode-standard #controls { display: none; }

/* ============================================
   РЕЖИМ 2: МОБИЛЬНЫЙ
   ============================================ */
body.mode-mobile #controls {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 20px 60px;
  width: 100%;
  max-width: 340px;
  height: auto;
  margin: 20px auto 25px auto;
  padding: 0;
  box-sizing: border-box;
  justify-items: center;
}

body.mode-mobile #controls a {
  width: 100%;
  max-width: 100px;
  height: 60px;
  background: linear-gradient(135deg, #ff69b4 0%, #8a2be2 100%);
  color: #fff !important;
  font-size: 24px;
  font-weight: bold;
  line-height: 60px;
  text-align: center;
  border-radius: 14px;
  box-shadow: 0 4px 15px rgba(255, 105, 180, 0.6);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: block;
}

body.mode-mobile #controls a[data-x="0"][data-y="1"] { order: 1; }
body.mode-mobile #controls a[data-x="1"][data-y="1"] { order: 2; }
body.mode-mobile #controls a[data-x="0"][data-y="0"] { order: 3; }
body.mode-mobile #controls a[data-x="1"][data-y="0"] { order: 4; }

/* ============================================
   РЕЖИМ 3: ПОЛНЫЙ ЭКРАН
   ============================================ */
body.mode-fullscreen {
  overflow: hidden;
}

body.mode-fullscreen .mode-switcher {
  position: fixed;
  top: 5px;
  right: 5px;
  z-index: 1000;
  background: rgba(0,0,0,0.5);
  padding: 5px;
  border-radius: 20px;
  gap: 4px;
  flex-wrap: nowrap;
}

body.mode-fullscreen .mode-btn {
  font-size: 11px;
  padding: 4px 8px;
}

body.mode-fullscreen .page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

body.mode-fullscreen .page a.logo { display: none; }

body.mode-fullscreen #game-wrap {
  width: 572px;
  height: 350px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  transform-origin: center center;
  position: relative;
}

body.mode-fullscreen #controls {
  display: block !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
}

body.mode-fullscreen #controls a {
  position: absolute;
  width: 70px;
  height: 70px;
  background: rgba(255, 105, 180, 0.55);
  color: #fff !important;
  font-size: 28px;
  font-weight: bold;
  line-height: 70px;
  text-align: center;
  border-radius: 50%;
  text-decoration: none;
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

body.mode-fullscreen #controls a[data-x="0"][data-y="1"] {
  left: 25px;
  top: calc(50% - 50px);
  transform: translateY(-50%);
}

body.mode-fullscreen #controls a[data-x="0"][data-y="0"] {
  left: 25px;
  top: calc(50% + 50px);
  transform: translateY(-50%);
}

body.mode-fullscreen #controls a[data-x="1"][data-y="1"] {
  right: 25px;
  left: auto;
  top: calc(50% - 50px);
  transform: translateY(-50%);
}

body.mode-fullscreen #controls a[data-x="1"][data-y="0"] {
  right: 25px;
  left: auto;
  top: calc(50% + 50px);
  transform: translateY(-50%);
}

body.mode-fullscreen .game-page { display: none; }
body.mode-fullscreen .footer { display: none; }

/* ============================================
   АДАПТИВ
   ============================================ */
@media only screen and (max-width: 768px) {
  .game-page { padding: 20px 15px; }
  .game-page h1 { font-size: 20px; }
  .game-page h2 { font-size: 17px; }
  .game-page table { font-size: 12px; }
  .game-page table th, .game-page table td { padding: 6px 8px; }

  .mode-switcher { padding: 8px 5px; gap: 6px; }
  .mode-btn { font-size: 12px; padding: 6px 10px; }
}