html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
}

.water-flow-page {
  background: #071827;
  color: white;
  font-family: Arial, sans-serif;
  overscroll-behavior: none;
}

.water-flow-container {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px;
  box-sizing: border-box;
  text-align: center;
}

.water-flow-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.wf-stat,
.wf-next-tile {
  flex: 1;
  background: #102f4a;
  border: 2px solid #2b90d9;
  border-radius: 10px;
  padding: 6px;
  box-sizing: border-box;
}

.wf-stat span,
.wf-next-tile span {
  display: block;
  font-size: 12px;
  opacity: 0.85;
}

.wf-stat strong {
  display: block;
  font-size: 24px;
}

.wf-tile-preview {
  width: 38px;
  height: 38px;
  margin: 4px auto 0;
  background: #d7ecff;
  color: #062033;
  border: 2px solid white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: bold;
}

.wf-hold-area {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid #2b90d9;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 10px;
}

.wf-hold-area h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.wf-queue-grid {
  width: 128px;
  height: 128px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 6px;
}

.wf-queue-cell {
  background: #d7ecff;
  color: #062033;
  border: 2px solid #ffffff;
  border-radius: 6px;
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wf-queue-cell.selected {
  background: #ffe680;
  border-color: #ffcc00;
  transform: scale(1.06);
}

.wf-game-area {
  display: flex;
  justify-content: center;
}

.wf-main-grid {
  width: min(94vw, 350px);
  aspect-ratio: 7 / 9;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 3px;
  background: #0b3a5a;
  border: 3px solid #2b90d9;
  border-radius: 10px;
  padding: 4px;
  box-sizing: border-box;
}

.wf-cell {
  background: #d7ecff;
  color: #062033;
  border-radius: 5px;
  border: 3px solid #ffffff;
  font-size: clamp(24px, 8vw, 38px);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.wf-cell.has-tile {
  background: #f4fbff;
}

.wf-cell.wf-start {
  outline: 3px solid #28ff87;
}

.wf-cell.wf-finish {
  outline: 3px solid #ffdd33;
}

.wf-cell.water {
  background: #d7ecff;
}
.pipe-symbol {
  display: inline-block;
  color: #062033;
  line-height: 1;
}

.pipe-symbol.pipe-water {
  color: #0099ff;
  text-shadow: 0 0 8px #00c8ff;
}

.wf-cell.water-passed {
  background: #eefaff;
}

.wf-message {
  min-height: 34px;
  margin: 10px 0;
  font-size: 14px;
  font-weight: bold;
}

.wf-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.wf-button {
  border: 3px solid #ffffff;
  border-radius: 12px;
  padding: 12px 18px;
  background: #28ff87;
  color: #062033;
  font-weight: bold;
  font-size: 16px;
  box-shadow: 0 4px 0 #0f8f4d;
}

.wf-button.secondary {
  background: #d7ecff;
}

.wf-button:disabled {
  opacity: 0.45;
}

.wf-home-link {
  margin-top: 10px;
}

.wf-home-link a {
  color: #8fd3ff;
  font-weight: bold;
}

/* Mobile screen lock feel */
@media (max-height: 760px) {
  .water-flow-container {
    padding: 6px;
  }

  .wf-hold-area {
    padding: 6px;
    margin-bottom: 6px;
  }

  .wf-queue-grid {
  width: 96px;
  height: 96px;
}

 .wf-queue-cell {
  background: #d7ecff;
  color: #062033;
  border: 3px solid #ffffff;
  border-radius: 6px;
  font-size: 28px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

  .wf-main-grid {
    width: min(92vw, 310px);
  }

  .wf-message {
    margin: 6px 0;
    font-size: 13px;
  }

  .wf-button {
    padding: 8px 12px;
  }
}
#startBtn {
  background: #28ff87;
  transform: scale(1.08);
}

.wf-buttons {
  margin-top: 6px;
}
.wf-rules-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(7, 24, 39, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.wf-rules-box {
  width: min(92vw, 390px);
  max-height: 88vh;
  overflow-y: auto;
  background: rgba(16, 47, 74, 0.82);
  border: 3px solid #2b90d9;
  border-radius: 18px;
  padding: 18px;
  box-sizing: border-box;
  color: white;
  text-align: left;
  backdrop-filter: blur(4px);
}

.wf-rules-box h1 {
  text-align: center;
  margin-top: 0;
}

.wf-rules-box p {
  font-size: 15px;
  line-height: 1.35;
}

#rulesPlayBtn {
  display: block;
  margin: 18px auto 0;
}

.timer-build {
  color: #ff4b4b;
}

.timer-flow {
  color: #28ff87;
}
.wf-start-indicator {
  font-size: 28px;
  color: #28ff87;
  margin-bottom: 4px;
  animation: bounceArrow 1s infinite;
}

@keyframes bounceArrow {
  0% { transform: translateY(0); }
  50% { transform: translateY(6px); }
  100% { transform: translateY(0); }
}
.wf-gameover-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;

  display: none;
  align-items: center;
  justify-content: center;
}

.wf-gameover-box {
  width: min(90vw, 360px);
  background: rgba(120, 0, 0, 0.95);
  border: 3px solid #ff3b3b;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  color: white;
}

.wf-gameover-box h1 {
  color: #ff3b3b;
  margin-top: 0;
}

.wf-gameover-box p {
  font-size: 16px;
  margin: 12px 0 18px;
}


