/* Mobile warning — phone-frame on desktop, full-screen on mobile */

/* Mobile warning — hidden on desktop, phone-frame styled on small screens */
#mobile-warning {
  display: none;
}

@media (max-width: 768px) {
  #mobile-warning {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(17, 17, 17, 0.92);
    z-index: 400;
    align-items: center;
    justify-content: center;
    font-family: monospace;
  }

  /* Phone-frame card */
  #mobile-warning .phone-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    padding: 2.5rem 1.8rem;
    width: calc(100% - 40px);
    max-width: 340px;
    background: #111;
    border: 2px solid #ffaa44;
    border-radius: 36px;
    box-shadow: 0 0 40px rgba(255, 170, 68, 0.15);
    position: relative;
  }

  /* Decorative notch */
  #mobile-warning .phone-frame::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: #ffaa44;
    border-radius: 3px;
    opacity: 0.4;
  }

  #mobile-warning h2 {
    font-size: 1.6rem;
    color: #ffaa44;
    letter-spacing: 4px;
    text-shadow: 0 0 16px #ffaa4488;
    margin-bottom: 0.5rem;
  }

  #mobile-warning p {
    color: #8888cc;
    font-size: 0.9rem;
    letter-spacing: 1px;
    line-height: 1.6;
  }

  #mobile-warning a {
    margin-top: 1rem;
    color: #ffaa44;
    text-decoration: none;
    letter-spacing: 2px;
    font-size: 0.85rem;
    border: 1px solid #ffaa44;
    padding: 0.5rem 1.2rem;
    transition: background 0.2s;
  }

  #mobile-warning a:hover {
    background: rgba(255, 170, 68, 0.1);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #111;
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: monospace;
}

#bg-tooltip {
  position: fixed;
  display: none;
  font-family: monospace;
  font-size: 13px;
  color: #aaaacc;
  pointer-events: none;
  z-index: 10;
  letter-spacing: 1px;
}

#start-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
  z-index: 200;
  cursor: pointer;
  gap: 20px;
}

#start-title {
  font-family: monospace;
  font-size: 2.4rem;
  letter-spacing: 4px;
  color: #ffaa44;
  text-shadow: 0 0 24px #ffaa4488;
}

#start-prompt {
  font-family: monospace;
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: #8888cc;
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

#game-container {
  position: relative;
}

#fill-bar-container {
  width: 100%;
  height: 4px;
  background: #222;
  margin-bottom: 4px;
}

#fill-bar {
  height: 100%;
  width: 0%;
  background: #ffaa44;
  transition: width 0.05s linear;
}

#piece-info {
  margin-top: 8px;
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  color: #8888cc;
  letter-spacing: 1px;
}

#piece-degrees {
  color: #ffaa44;
  font-weight: bold;
  font-size: 18px;
}

#game-canvas {
  display: block;
  border: 2px solid #444;
}

#tetromino-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.tet-preview {
  cursor: pointer;
  border: 2px solid #444;
  background: #1a1a2e;
  border-radius: 4px;
  display: block;
}

.tet-preview:hover {
  border-color: #8888cc;
}

.tet-preview.selected {
  border-color: #ffaa44;
  box-shadow: 0 0 8px #ffaa4488;
}

#back-to-haphazard {
  min-height: 58px;
  padding: 0 14px;
  border: 2px solid #444;
  border-radius: 4px;
  background: #151526;
  color: #ffaa44;
  font-family: monospace;
  font-size: 0.78rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

#back-to-haphazard:hover {
  border-color: #ffaa44;
  color: #fff2cc;
  box-shadow: 0 0 10px #ffaa4460;
}

/* Menu button — fixed top-right corner */
#menu-btn {
  position: fixed;
  top: 12px;
  right: 14px;
  z-index: 350;
  font-family: monospace;
  font-size: 0.8rem;
  letter-spacing: 2px;
  color: #8888cc;
  background: transparent;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

#menu-btn:hover {
  color: #ffaa44;
  border-color: #ffaa44;
}

/* Menu modal */
#menu-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 350;
  align-items: center;
  justify-content: center;
}

#menu-modal.open {
  display: flex;
}

#menu-modal-box {
  background: #12122a;
  border: 2px solid #5555cc;
  border-radius: 10px;
  padding: 28px 32px;
  box-shadow: 0 0 40px #5555cc88;
  min-width: 320px;
}

#menu-modal-title {
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 4px;
  color: #ffaa44;
  text-align: center;
  margin-bottom: 20px;
}

#menu-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ctrl-key {
  font-family: monospace;
  font-size: 0.8rem;
  color: #ffaa44;
  background: #1e1e3a;
  border: 1px solid #5555cc;
  border-radius: 4px;
  padding: 3px 8px;
  min-width: 130px;
  text-align: center;
  letter-spacing: 1px;
}

.ctrl-desc {
  font-family: monospace;
  font-size: 0.85rem;
  color: #aaaacc;
  letter-spacing: 1px;
}

#menu-modal-hint {
  margin-top: 20px;
  font-family: monospace;
  font-size: 0.75rem;
  color: #5555cc;
  text-align: center;
  letter-spacing: 1px;
  font-style: italic;
}

#color-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

#color-modal.open {
  display: flex;
}

#color-modal-box {
  background: #12122a;
  border: 2px solid #5555cc;
  border-radius: 10px;
  padding: 24px 28px;
  box-shadow: 0 0 40px #5555cc88;
}

#color-modal-title {
  font-family: monospace;
  font-size: 1rem;
  letter-spacing: 3px;
  color: #8888cc;
  text-align: center;
  margin-bottom: 16px;
}

#color-modal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.color-btn {
  font-family: monospace;
  font-size: 11px;
  letter-spacing: 1px;
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  color: #000;
  font-weight: bold;
  text-align: center;
  min-width: 80px;
}

.color-btn:hover {
  border-color: #fff;
  filter: brightness(1.2);
}

#cell-tooltip {
  position: fixed;
  display: none;
  background: #12122a;
  border: 2px solid #5555cc;
  border-radius: 8px;
  padding: 12px 20px;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 0 20px #5555cc88;
  text-align: center;
}

#cell-tooltip .cell-number {
  font-family: monospace;
  font-size: 48px;
  font-weight: bold;
  color: #e0e0ff;
  line-height: 1;
}

#cell-tooltip .cell-coords {
  font-family: monospace;
  font-size: 11px;
  color: #7777aa;
  margin-top: 4px;
}
