/* =========================================================
   SIMPLE RAINSFALL TUTORIAL
========================================================= */

.lobby .tutorial-launch-btn {
  margin-top: 10px;
  border: 1px solid rgba(155, 117, 255, 0.45);
  background: linear-gradient(120deg, #251d43, #472b7d 45%, #1b5970);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.lobby .tutorial-launch-btn:hover {
  background: linear-gradient(120deg, #322458, #5c36a2 45%, #22768e);
}

.tutorial-launch-spark {
  display: inline-block;
  animation: tutorialSparkSpin 4s linear infinite;
}

@keyframes tutorialSparkSpin {
  to {
    transform: rotate(360deg);
  }
}

body.tutorial-open {
  overflow: hidden;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 20% 10%, rgba(76, 55, 145, 0.3), transparent 32%),
    radial-gradient(circle at 80% 90%, rgba(28, 128, 160, 0.22), transparent 35%),
    rgba(4, 6, 10, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tutorial-shell {
  position: relative;
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(24, 28, 36, 0.99), rgba(13, 15, 22, 0.99));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.72);
}

.tutorial-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-size: 1.55rem;
}

.tutorial-header {
  padding: 22px 72px 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.tutorial-kicker {
  color: #9e81ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tutorial-header h2 {
  margin: 5px 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.tutorial-header p {
  margin: 0;
  color: #aeb6c2;
  line-height: 1.45;
}

.tutorial-content {
  padding: 20px;
}

.tutorial-status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tutorial-turn,
.tutorial-reserve {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 800;
}

.tutorial-turn {
  color: #9cffaa;
}

.tutorial-reserve {
  color: #c7ccd5;
}

.tutorial-message {
  min-height: 58px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  color: #e9edf2;
  line-height: 1.5;
  font-size: 0.92rem;
}

.tutorial-message-info {
  border-color: rgba(89, 165, 255, 0.27);
}

.tutorial-message-success {
  border-color: rgba(93, 214, 116, 0.35);
  background: rgba(62, 163, 80, 0.09);
  color: #bcffc8;
}

.tutorial-message-computer {
  border-color: rgba(176, 129, 255, 0.32);
  background: rgba(121, 77, 183, 0.09);
  color: #decfff;
}

.tutorial-message-danger {
  border-color: rgba(255, 103, 103, 0.36);
  background: rgba(180, 48, 48, 0.11);
  color: #ffc2c2;
}

.tutorial-board-stage {
  width: min(680px, 100%);
  margin: 0 auto;
}

.tutorial-board {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  overflow: hidden;
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
}

.tutorial-board.computer-turn {
  opacity: 0.86;
  pointer-events: none;
}

.tutorial-square {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
}

.tutorial-square.light {
  background: #d8d2c4;
}

.tutorial-square.dark {
  background: #70777e;
}

.tutorial-square.selected::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  box-shadow: inset 0 0 0 4px #ffe45c;
}

.tutorial-square.legal::before {
  content: "";
  position: absolute;
  z-index: 6;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(54, 196, 82, 0.82);
  pointer-events: none;
}

.tutorial-square.legal:has(.tutorial-piece)::before {
  width: 78%;
  height: 78%;
  border: 4px solid rgba(54, 196, 82, 0.85);
  background: transparent;
}

.tutorial-square.deployable::before {
  content: "";
  position: absolute;
  inset: 8%;
  z-index: 5;
  border: 3px dashed rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  pointer-events: none;
}

.tutorial-star {
  position: absolute;
  z-index: 1;
  font-size: clamp(1rem, 4vw, 2.7rem);
  opacity: 0.45;
  pointer-events: none;
}

.tutorial-star.south {
  color: #111;
}

.tutorial-star.north {
  color: #fff;
}

.tutorial-piece {
  position: relative;
  z-index: 7;
  width: 82%;
  height: 82%;
  padding: 2px;
  border-radius: 50%;
  border: 3px solid #555;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.tutorial-piece.owner-N {
  background: rgba(18, 20, 24, 0.94);
}

.tutorial-piece img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.tutorial-piece.class-spring,
.tutorial-tray-piece.class-spring {
  border-color: #ff1493;
}

.tutorial-piece.class-fall,
.tutorial-tray-piece.class-fall {
  border-color: #ff8c00;
}

.tutorial-piece.class-rain,
.tutorial-tray-piece.class-rain {
  border-color: #1e90ff;
}

.tutorial-piece.class-hurricane,
.tutorial-tray-piece.class-hurricane {
  border-color: #8c4bc2;
}

.tutorial-piece.class-tornado,
.tutorial-tray-piece.class-tornado {
  border-color: #111;
}

.tutorial-coordinate {
  position: absolute;
  left: 2px;
  bottom: 1px;
  z-index: 10;
  font-size: 0.48rem;
  font-weight: 850;
  opacity: 0.64;
  pointer-events: none;
}

.tutorial-square.light .tutorial-coordinate {
  color: #333;
}

.tutorial-square.dark .tutorial-coordinate {
  color: #fff;
}

.tutorial-deploy {
  width: min(680px, 100%);
  margin: 14px auto 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.tutorial-deploy-title {
  margin-bottom: 10px;
  color: #c8ced8;
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tutorial-demo-tray {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.tutorial-tray-piece {
  min-width: 0;
  min-height: 68px;
  padding: 5px;
  border: 2px solid #555;
  border-radius: 11px;
  background: #292e34;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-tray-piece:hover:not(:disabled) {
  background: #383f46;
  transform: translateY(-1px);
}

.tutorial-tray-piece.selected {
  background: #424a51;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.92);
}

.tutorial-tray-piece:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.tutorial-tray-piece img {
  width: 52px;
  height: 52px;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.tutorial-footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 20px 20px;
}

.tutorial-footer button {
  min-width: 150px;
  padding: 11px 16px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
}

.tutorial-restart-btn {
  background: #343a40;
  color: #fff;
}

.tutorial-online-btn {
  background: #5db467;
  color: #fff;
}

@media (max-width: 700px) {
  .tutorial-overlay {
    padding: 8px;
    align-items: flex-start;
  }

  .tutorial-shell {
    max-height: none;
    border-radius: 16px;
  }

  .tutorial-header {
    padding: 18px 58px 14px 16px;
  }

  .tutorial-content {
    padding: 12px;
  }

  .tutorial-message {
    font-size: 0.84rem;
  }

  .tutorial-demo-tray {
    gap: 5px;
  }

  .tutorial-tray-piece {
    min-height: 54px;
    padding: 3px;
  }

  .tutorial-tray-piece img {
    width: 42px;
    height: 42px;
  }

  .tutorial-piece {
    width: 86%;
    height: 86%;
    border-width: 2px;
  }

  .tutorial-footer {
    padding: 0 12px 14px;
    flex-direction: column;
  }

  .tutorial-footer button {
    width: 100%;
  }
}
