.tools-intro {
  text-align: center;
  margin-bottom: 30px;
  color: #ccc;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}
.tool-card {
  background: #111;
  border: 1px solid #333;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tool-card:hover { border-color: #666; background: #1a1a1a; }
.tool-card.active { border-color: #00ffff; background: rgba(0, 255, 255, 0.05); }
.tool-card.locked { opacity: 0.5; cursor: default; border-style: dashed; }
.tool-icon { font-size: 1.5em; }
.tool-info h3 { margin: 0; font-size: 1em; color: #fff; }
.tool-info p { margin: 0; font-size: 0.8em; color: #888; }
.separator { border: 0; border-top: 1px solid #333; margin: 30px 0; }
.tool-header h2 { margin-top: 0; color: #00ffff; }
.loopover-layout {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 40px;
  align-items: flex-start;
}
.loopover-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  margin: 20px 0;
}
.grid-middle-row { display: flex; align-items: center; gap: 5px; }
.loopover-grid {
  display: grid;
  grid-template-columns: repeat(5, 50px);
  grid-template-rows: repeat(5, 50px);
  gap: 4px;
  background: #000;
  border: 2px solid #333;
  padding: 4px;
  border-radius: 4px;
}
.tile {
  background: #222;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: monospace;
  font-weight: bold;
  font-size: 1.2em;
  border-radius: 2px;
  user-select: none;
}
.tile.correct { background: #004400; color: #00ff00; border: 1px solid #00ff00; }
.arrow-btn {
  background: #111;
  border: 1px solid #444;
  color: #00ffff;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 10px;
  transition: 0.2s;
  user-select: none;
}
.arrow-btn:hover { background: #00ffff; color: #000; }
.col-controls { display: flex; gap: 4px; }
.row-controls { display: flex; flex-direction: column; gap: 4px; }
.col-controls .arrow-btn { width: 50px; height: 25px; }
.row-controls .arrow-btn { width: 25px; height: 50px; }
.tool-actions { display: flex; justify-content: center; gap: 15px; margin-top: 20px; }
.cyber-btn {
  background: transparent;
  border: 1px solid #00ffff;
  color: #00ffff;
  padding: 8px 16px;
  font-family: monospace;
  cursor: pointer;
  transition: 0.2s;
}
.cyber-btn:hover { background: #00ffff; color: #000; }
.solver-panel {
  width: 300px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  height: 400px;
}
.solver-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.solver-header h3 { margin: 0; font-size: 1em; color: #00ffff; }
.solver-log {
  flex-grow: 1;
  background: #000;
  border: 1px solid #222;
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #00ff00;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.4;
}
.placeholder-text { color: #555; font-style: italic; }
.solver-footer {
  margin-top: 10px;
  text-align: right;
  color: #666;
  font-size: 0.8em;
}
.cyber-btn.warning { border-color: #ffaa00; color: #ffaa00; }
.cyber-btn.warning:hover { background: #ffaa00; color: #000; }
.cyber-btn.small {
  padding: 5px 10px;
  font-size: 0.8em;
  background: #222;
  border-color: #555;
  color: #fff;
}
.cyber-btn.small:hover { border-color: #fff; background: #333; }
.header-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 5px;
}
.loopover-grid.editing .tile { cursor: pointer; border-color: #555; }
.loopover-grid.editing .tile:hover { background: #333; }
.tile.selected {
  background: #00ffff !important;
  color: #000 !important;
  box-shadow: 0 0 10px #00ffff;
  transform: scale(1.1);
  z-index: 10;
}
.solver-log.error { color: #ff4444; }
.step-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #222;
  padding: 5px;
  margin-top: 10px;
  border-radius: 4px;
}
.step-btn {
  background: #000;
  border: 1px solid #444;
  color: #fff;
  cursor: pointer;
  padding: 2px 8px;
  font-size: 0.8em;
}
.step-btn:hover { background: #333; }
#step-counter { font-family: monospace; font-size: 0.9em; color: #00ffff; }
.arrow-btn.suggested-move {
  background-color: #ff00ff !important;
  color: #fff !important;
  box-shadow: 0 0 15px #ff00ff, 0 0 5px #fff;
  z-index: 10;
  animation: pulse-guide 0.8s infinite alternate;
  border-color: #fff;
}
.arrow-btn.wrong-move {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
  background-color: #ff0000 !important;
  color: #fff !important;
  border-color: #ff0000;
}
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}
@keyframes pulse-guide {
  from { transform: scale(1); box-shadow: 0 0 10px #ff00ff; }
  to { transform: scale(1.15); box-shadow: 0 0 20px #ff00ff, 0 0 10px #fff; }
}
.log-line.active {
  background: #222;
  color: #ff00ff;
  font-weight: bold;
  border-left: 3px solid #ff00ff;
  padding-left: 5px;
}
.category-header {
  border-bottom: 1px solid #333;
  padding-bottom: 10px;
  color: #00ffff;
  font-size: 1.2em;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 0;
}
.prime-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
}
.prime-input-area {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
  justify-content: center;
}
.cyber-input {
  background: #000;
  border: 1px solid #444;
  color: #fff;
  padding: 10px;
  font-family: monospace;
  font-size: 1.2em;
  width: 200px;
  text-align: center;
}
.cyber-input:focus {
  outline: none;
  border-color: #00ffff;
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}
.prime-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.prime-cell {
  background: #000;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}
.prime-cell.active {
  border-color: #00ffff;
  background: rgba(0,255,255,0.1);
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}
.p-label {
  font-size: 0.8em;
  color: #888;
  margin-bottom: 5px;
}
.p-val {
  font-size: 1.5em;
  font-weight: bold;
  color: #fff;
}
.prime-cell.active .p-val { color: #00ffff; }
.prime-footer {
  text-align: center;
  color: #888;
  font-family: monospace;
  min-height: 1.2em;
}
.binary-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  background: #0b0b0b;
  border: 1px solid #333;
  border-radius: 8px;
}
.binary-controls {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
}
.input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.input-group label {
  color: #00ffff;
  font-size: 0.8em;
  margin-bottom: 5px;
  letter-spacing: 1px;
}
.cyber-input.small {
  width: 100px;
}

.binary-solver-layout {
  display: grid;
  grid-template-columns: 20px auto; 
  grid-template-rows: 20px auto;    
  gap: 5px;
  justify-content: center;
}

.bin-labels-top {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(7, 40px); 
  gap: 2px;
}

.bin-labels-left {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-rows: repeat(7, 40px); 
  gap: 2px;
}

.binary-grid {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(7, 40px);
  grid-template-rows: repeat(7, 40px);
  gap: 2px;
  background: #000;
  border: 1px solid #333;
  padding: 2px;
}

.bin-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: monospace;
  font-size: 0.8em;
  color: #666;
}
.bin-label.on { color: #fff; font-weight: bold; }

.bin-cell {
  width: 100%;
  height: 100%;
  background-color: #111; 
  border: 1px solid #222;
  transition: background-color 0.2s;
}
.bin-cell.active {
  background-color: #ff0000;
  border-color: #ff4444;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}
.morse-container {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.morse-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.panel-label {
  font-family: monospace;
  font-size: 0.8em;
  color: #00ffff;
  letter-spacing: 1px;
}

.cyber-textarea {
  background: #080808;
  border: 1px solid #333;
  color: #00ff00;
  padding: 15px;
  font-family: 'Courier New', monospace;
  font-size: 1.1em;
  min-height: 120px;
  resize: vertical;
  border-radius: 4px;
  outline: none;
  transition: all 0.3s;
}

.cyber-textarea:focus {
  border-color: #00ffff;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);
}

.morse-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px;
}

.direction-indicator {
  color: #666;
  font-size: 1.5em;
  animation: pulse-dim 2s infinite;
}

@keyframes pulse-dim {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}