/* Mission Implausible Blue Theme */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Share+Tech+Mono:wght@400&display=swap');

body {
  background: #000;
  color: #2a9df4;
  font-family: 'Share Tech Mono', 'Courier Prime', monospace;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Blue Digital Rain Background */
#matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  opacity: 0.1;
}

.matrix-column {
  position: absolute;
  color: #2a9df4;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  white-space: pre;
  animation: matrix-fall linear infinite;
}

@keyframes matrix-fall {
  0% { transform: translateY(-100vh); opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

header {
  background: #001133;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 2px solid #2a9df4;
  position: relative;
  z-index: 10;
}

.logo {
  height: 48px;
  filter: 
    grayscale(100%) 
    brightness(0) 
    sepia(100%) 
    hue-rotate(200deg) 
    saturate(3) 
    brightness(1.5)
    drop-shadow(0 0 5px #2a9df4);
}

h1 {
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  letter-spacing: 3px;
  color: #2a9df4;
  margin: 0;
  text-shadow: 0 0 10px #2a9df4;
  font-size: clamp(1.2rem, 4vw, 2rem);
  line-height: 1.2;
  word-wrap: break-word;
}

#mission-timer {
  margin-left: auto;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  color: #2a9df4;
  text-shadow: 0 0 5px #2a9df4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
main {
  display: flex;
  flex-direction: row;
  gap: 2rem;
  padding: 2rem;
  position: relative;
  z-index: 5;
}

#game-board {
  flex: 2;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  min-width: 320px;
}

.tile {
  background: #001133;
  border: 2px solid #2a9df4;
  border-radius: 5px;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(42, 157, 244, 0.2);
  position: relative;
  overflow: hidden;
  font-family: 'Share Tech Mono', monospace;
}

.tile:not(.locked):hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(42, 157, 244, 0.4);
  background: #002255;
}

.tile.locked {
  filter: brightness(0.3);
  cursor: not-allowed;
  opacity: 0.4;
  border-color: #1a5f8f;
}

.tile.revealed {
  background: #002255;
  color: #2a9df4;
  transform: scale(1.02);
  box-shadow: 0 0 25px rgba(42, 157, 244, 0.7);
  border-color: #2a9df4;
  animation: blue-glow 2s ease-in-out;
}

.tile.completed {
  background: #003320;
  border-color: #00ff00;
  box-shadow: 0 0 15px #00ff0055;
}

@keyframes blue-glow {
  0%, 100% { box-shadow: 0 0 25px rgba(42, 157, 244, 0.7); }
  50% { box-shadow: 0 0 40px #2a9df4; }
}

.tile .tile-title {
  font-weight: 700;
  font-size: clamp(0.8rem, 2.5vw, 1rem);
  margin-bottom: 0.5rem;
  text-align: center;
  text-shadow: 0 0 5px #2a9df4;
  letter-spacing: 1px;
  line-height: 1.3;
  word-wrap: break-word;
  hyphens: auto;
  padding: 0 0.5rem;
}

.tile .tile-content {
  display: none;
  font-size: clamp(0.75rem, 2vw, 0.85rem);
  text-align: center;
  padding: 0.5rem;
  line-height: 1.4;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
}

.tile.revealed .tile-content {
  display: block;
  animation: fadeIn 0.5s;
}

.tile .hint-btn, .tile .deploy-btn, .tile .watch-btn {
  margin-top: 0.5rem;
  background: #002255;
  color: #2a9df4;
  border: 1px solid #2a9df4;
  border-radius: 3px;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'Share Tech Mono', monospace;
  transition: all 0.2s;
}

.tile .hint-btn:hover, .tile .deploy-btn:hover, .tile .watch-btn:hover {
  background: #2a9df4;
  color: #000;
  box-shadow: 0 0 10px #2a9df4;
}

.tile .watch-btn {
  background: #003366;
  border-color: #66ccff;
  color: #66ccff;
}

.tile .watch-btn:hover {
  background: #66ccff;
  color: #000;
  box-shadow: 0 0 10px #66ccff;
}

.setup-link {
  display: inline-block;
  background: #003366;
  color: #66ccff;
  padding: 8px 16px;
  text-decoration: none;
  border: 2px solid #66ccff;
  border-radius: 4px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  margin: 5px 0;
  transition: all 0.3s ease;
}

.setup-link:hover {
  background: #66ccff;
  color: #000;
  box-shadow: 0 0 10px #66ccff;
  text-decoration: none;
}

.tile .deploy-btn {
  background: #1a5f8f;
}

.tile .deploy-btn:disabled {
  background: #222;
  color: #444;
  cursor: not-allowed;
  border-color: #444;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#intel-panel {
  flex: 1;
  background: #001133;
  border-radius: 5px;
  padding: 1rem;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 0 15px rgba(42, 157, 244, 0.2);
  border: 2px solid #2a9df4;
  font-family: 'Share Tech Mono', monospace;
}

#intel-panel h3 {
  color: #2a9df4;
  text-shadow: 0 0 5px #2a9df4;
  margin-top: 0;
  font-family: 'Courier Prime', monospace;
  letter-spacing: 2px;
}

#intel-panel.hidden {
  display: none;
}

#intel-content {
  font-size: 0.9rem;
  color: #2a9df4;
  line-height: 1.5;
  text-shadow: 0 0 3px rgba(42, 157, 244, 0.4);
}

footer {
  background: #001133;
  color: #2a9df4;
  text-align: center;
  padding: 1rem;
  border-top: 2px solid #2a9df4;
  font-size: 0.9rem;
  font-family: 'Share Tech Mono', monospace;
  position: relative;
  z-index: 10;
}
.modal {
  position: fixed;
  z-index: 1000;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #001133;
  border-radius: 5px;
  padding: 2rem 2.5rem;
  box-shadow: 0 0 30px rgba(42, 157, 244, 0.5);
  text-align: center;
  min-width: 320px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  border: 2px solid #2a9df4;
  font-family: 'Share Tech Mono', monospace;
  word-wrap: break-word;
  hyphens: auto;
}

.modal-content h2 {
  color: #2a9df4;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px #2a9df4;
  font-family: 'Courier Prime', monospace;
  letter-spacing: 2px;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  line-height: 1.3;
}

.modal-content p {
  color: #2a9df4;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  word-wrap: break-word;
  hyphens: auto;
}

.modal-content .hint {
  color: #2a9df4;
  margin-top: 0.7rem;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  text-shadow: 0 0 5px rgba(42, 157, 244, 0.4);
  word-wrap: break-word;
}

.modal-content .error {
  color: #ff0000;
  margin-top: 0.7rem;
  font-size: clamp(0.8rem, 2vw, 0.9rem);
  text-shadow: 0 0 5px #ff000066;
  word-wrap: break-word;
}

.modal-content label {
  color: #2a9df4;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  display: block;
  margin-bottom: 0.5rem;
}

input[type="password"] {
  padding: 0.7rem;
  border-radius: 3px;
  border: 2px solid #2a9df4;
  margin: 0.7rem 0;
  font-size: clamp(0.9rem, 3vw, 1rem);
  width: min(80%, 300px);
  max-width: 100%;
  background: #002255;
  color: #2a9df4;
  font-family: 'Share Tech Mono', monospace;
  box-shadow: inset 0 0 10px rgba(42, 157, 244, 0.2);
  box-sizing: border-box;
}

input[type="password"]:focus {
  outline: none;
  box-shadow: inset 0 0 10px rgba(42, 157, 244, 0.2), 0 0 10px rgba(42, 157, 244, 0.4);
}

input[type="text"] {
  padding: 0.7rem;
  border-radius: 3px;
  border: 2px solid #2a9df4;
  margin: 0.7rem 0;
  font-size: clamp(0.9rem, 3vw, 1rem);
  width: min(80%, 300px);
  max-width: 100%;
  background: #002255;
  color: #2a9df4;
  font-family: 'Share Tech Mono', monospace;
  box-shadow: inset 0 0 10px rgba(42, 157, 244, 0.2);
  box-sizing: border-box;
}

input[type="text"]:focus {
  outline: none;
  box-shadow: inset 0 0 10px rgba(42, 157, 244, 0.2), 0 0 10px rgba(42, 157, 244, 0.4);
}

button {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
  padding: 0.7rem 1.5rem;
  border-radius: 3px;
  border: 2px solid #2a9df4;
  background: #002255;
  color: #2a9df4;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 120px;
}

button:hover {
  background: #2a9df4;
  color: #000;
  box-shadow: 0 0 15px #2a9df4;
}

@media (max-width: 900px) {
  main {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  #game-board {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
  }
  #intel-panel {
    min-width: 0;
    max-width: 100vw;
  }
  header {
    padding: 1rem;
    flex-wrap: wrap;
  }
  h1 {
    letter-spacing: 1px;
    text-align: center;
    flex: 1;
  }
  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  .tile {
    min-height: 100px;
  }
}

@media (max-width: 480px) {
  .modal-content {
    padding: 1rem;
    margin: 0.5rem;
  }
  #game-board {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  header {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
  #mission-timer {
    margin-left: 0;
  }
}

/* Video Modal Styles */
#video-modal {
  z-index: 1001 !important;
}

/* Terms Modal Styles */
#terms-modal {
  z-index: 1002 !important;
}

.terms-modal-content {
  max-width: 500px;
  width: 90vw;
  padding: 2rem;
  position: relative;
  text-align: center;
}

.terms-header h2 {
  color: #2a9df4;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 10px #2a9df4;
  font-family: 'Courier Prime', monospace;
  letter-spacing: 2px;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.terms-content {
  margin: 1.5rem 0;
}

.terms-content p {
  color: #2a9df4;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: clamp(0.9rem, 2.5vw, 1rem);
}

.terms-content em {
  color: #66ccff;
  font-style: italic;
  text-shadow: 0 0 5px rgba(102, 204, 255, 0.4);
}

.terms-footer {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 2rem;
}

.terms-btn {
  background: #001133;
  border: 2px solid #2a9df4;
  color: #2a9df4;
  padding: 1rem 2rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 100px;
}

.terms-btn:hover {
  background: #2a9df4;
  color: #000;
  box-shadow: 0 0 15px #2a9df4;
  text-shadow: none;
  transform: scale(1.05);
}

.video-modal-content {
  max-width: 70vw;
  max-height: 70vh;
  padding: 1.5rem;
  position: relative;
  margin: 12.5vh auto;
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid #2a9df4;
  padding-bottom: 0.5rem;
}

.video-header h2 {
  margin: 0;
  color: #2a9df4;
  text-shadow: 0 0 10px #2a9df4;
  font-family: 'Courier Prime', monospace;
  letter-spacing: 2px;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
}

.close-btn {
  background: transparent;
  border: 2px solid #2a9df4;
  color: #2a9df4;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-family: 'Share Tech Mono', monospace;
}

.close-btn:hover {
  background: #2a9df4;
  color: #000;
  box-shadow: 0 0 15px #2a9df4;
}

.video-container {
  margin: 1rem 0;
  border: 2px solid #2a9df4;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(42, 157, 244, 0.3);
}

.video-footer {
  text-align: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #2a9df4;
}

.continue-btn {
  background: #001133;
  border: 2px solid #2a9df4;
  color: #2a9df4;
  padding: 0.8rem 2rem;
  border-radius: 5px;
  cursor: pointer;
  font-family: 'Share Tech Mono', monospace;
  font-size: 1rem;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.continue-btn:hover {
  background: #2a9df4;
  color: #000;
  box-shadow: 0 0 15px #2a9df4;
  text-shadow: none;
}

/* Responsive video modal */
@media (max-width: 768px) {
  .video-modal-content {
    max-width: 85vw;
    max-height: 75vh;
    padding: 1rem;
    margin: 12.5vh auto;
  }
  
  .video-header h2 {
    font-size: 1rem;
  }
  
  .close-btn {
    width: 35px;
    height: 35px;
    font-size: 1.2rem;
  }
  
  .continue-btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .terms-modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .terms-footer {
    flex-direction: column;
    gap: 1rem;
  }
  
  .terms-btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }
}
