:root {
  --crt-primary: #00ff00;
  --crt-secondary: #000000;
  --crt-error: #ff5555;
  --crt-glow: rgba(0, 255, 0, 0.3);
  --crt-scanline: rgba(0, 255, 0, 0.05);
  --accent-blue: #00ffff;
  --accent-yellow: #ffff00;
  --accent-purple: #ff00ff;
  --accent-orange: #ff8800;
  --bg-dark: #0a0a0a;
  --bg-panel: #1a1a1a;

  /* Memory color themes */
  --memory-free: #003300;
  --memory-page-table: #006600;
  --memory-instructions: #1c3d5e;
  --memory-data: #006666;
  --memory-allocated: #333333;
  --memory-highlight: #00ff00;
}


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


body {
  font-family: "Courier New", monospace;
  background: var(--crt-secondary);
  color: var(--crt-primary);
  padding: 20px;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--bg-panel);
  border: 2px solid var(--crt-primary);
  padding: 15px 25px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 0 20px var(--crt-glow);
}

.header h1 {
  font-size: 1.5em;
  letter-spacing: 3px;
  text-shadow: 0 0 10px var(--crt-glow);
}

.header-controls {
  display: flex;
  gap: 15px;
}

.btn {
  background: transparent;
  border: 2px solid var(--crt-primary);
  color: var(--crt-primary);
  padding: 8px 20px;
  cursor: pointer;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
  font-size: 12px;
}

.btn:hover {
  background: var(--crt-primary);
  color: var(--crt-secondary);
  box-shadow: 0 0 15px var(--crt-glow);
}

.btn-execute {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-execute:hover {
  background: var(--accent-blue);
  color: var(--crt-secondary);
}

.btn-reset {
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
}

.btn-reset:hover {
  background: var(--accent-yellow);
  color: var(--crt-secondary);
}

/* Main Layout */
.container {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel {
  background: var(--bg-panel);
  border: 2px solid var(--crt-primary);
  padding: 15px;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.1);
}

.panel-title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--crt-primary);
  text-transform: uppercase;
  letter-spacing: 2px;
}

#paragraphInput {
  width: 100%;
  min-height: 250px;
  background: var(--bg-dark);
  border: 1px solid var(--crt-primary);
  color: var(--crt-primary);
  padding: 10px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  resize: vertical;
}

#paragraphInput::placeholder {
  color: #006600;
}

/* Process Control Block */
.pcb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12px;
}

.pcb-item {
  background: var(--bg-dark);
  padding: 8px;
  border: 1px solid var(--crt-primary);
}

.pcb-label {
  color: var(--accent-blue);
  font-size: 10px;
  margin-bottom: 3px;
}

.pcb-value {
  font-size: 14px;
  font-weight: bold;
}

/* Register */
#Rregister {
  background: var(--bg-dark);
  padding: 15px;
  border: 1px solid var(--crt-primary);
  font-size: 14px;
  min-height: 60px;
  word-break: break-all;
}

/* Memory Visualization */
.memory-section {
  background: var(--bg-panel);
  border: 2px solid var(--crt-primary);
  padding: 15px;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.1);
}


.memory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.memory-legend {
  display: flex;
  gap: 15px;
  font-size: 11px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color {
  width: 15px;
  height: 15px;
  border: 1px solid var(--crt-primary);
}

.legend-page-table {
  background: var(--memory-page-table);
}
.legend-instructions {
  background: var(--memory-instructions);
}
.legend-allocated {
  background: var(--memory-allocated);
}
.legend-data {
  background: var(--memory-data);
}

#memory {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 700px;
  overflow-y: auto;
  padding: 5px;
}

.byte-container {
  background: var(--bg-dark);
  border: 1px solid #333;
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}

.byte {
  width: 50px;
  height: 50px;
  background: var(--memory-free);
  border: 1px solid #444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.3s;
  color: #cccccc;
}

.byte:hover {
  border-color: var(--crt-primary);
  box-shadow: 0 0 10px var(--crt-glow);
}

/* Output Section */
.output-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.output-panel {
  background: var(--bg-panel);
  border: 2px solid var(--crt-primary);
  padding: 15px;
  min-height: 150px;
}

#error {
  border-color: var(--crt-error);
  color: var(--crt-error);
}

#datablock {
  border-color: var(--accent-blue);
}

/* Instructions Modal */
.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-panel);
  border: 3px solid var(--crt-primary);
  padding: 30px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 0 50px rgba(0, 255, 0, 0.5);
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 999;
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  cursor: pointer;
  font-size: 20px;
  color: var(--crt-error);
}

.modal h2 {
  margin-bottom: 20px;
  text-align: center;
  color: var(--accent-blue);
}

.modal ul {
  margin-left: 20px;
  line-height: 1.8;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--crt-primary);
  border: 1px solid var(--crt-secondary);
}

/* CRT Effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}
.hover-instruction {
  margin-top: 20px;
  color: var(--crt-error);
}
.job-example-list p {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Log section */

.log-section {
  margin-top: 20px;
}

.log-entry {
  margin-bottom: 15px;
  font-size: 15px;
  line-height: 1.4;
}

.speed-control {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.speed-control input {
  width: 80%;
  accent-color: var(--crt-primary);
  border: 1px solid var(--crt-primary);
  color: var(--crt-primary);
  padding: 5px;
  font-family: "Courier New", monospace;
  font-size: 13px;
  text-align: center;
}

/* Execution control panel */

/* Main execution control panel container */
.execution-control-panel {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 20px;
}

/* Controls container with buttons and speed slider */
.execution-controls {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

/* Pause button styling */
.btn-pause {
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

.btn-pause:hover:not(:disabled) {
  background: var(--accent-orange);
  color: var(--crt-secondary);
}

/* Resume button styling */
.btn-resume {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.btn-resume:hover:not(:disabled) {
  background: var(--accent-blue);
  color: var(--crt-secondary);
}

/* Disabled button state */
.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Speed control container */
.speed-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--crt-primary);
  font-size: 12px;
}

/* Speed range slider */
#speedRange {
  width: 150px;
  accent-color: var(--crt-primary);
  cursor: pointer;
}

/* Speed value display */
#speedValue {
  min-width: 50px;
  font-weight: bold;
}

/* Current stage display box */
.current-stage {
  background: var(--bg-dark);
  padding: 15px;
  border: 1px solid var(--accent-yellow);
  font-size: 14px;
  min-height: 60px;
  color: var(--accent-yellow);
  font-weight: bold;
  display: flex;
  align-items: center;
}

/* Execution logs  */

/* Log section container */
.log-section {
  margin-top: 20px;
}

/* Scrollable log area */
.execution-log {
  background: var(--bg-dark);
  padding: 15px;
  border: 1px solid var(--crt-primary);
  max-height: 500px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
}

/* Individual log entry */
.log-entry {
  padding: 5px 0;
  border-bottom: 1px solid #333;
  animation: fadeIn 0.3s ease-in;
}

.log-entry:last-child {
  border-bottom: none;
}

/* Log entry type colors */
.log-stage {
  color: var(--accent-blue);
  font-weight: bold;
}

.log-action {
  color: var(--accent-yellow);
}

.log-data {
  color: var(--accent-purple);
}

.log-error {
  color: var(--crt-error);
  font-weight: bold;
}

.log-success {
  color: var(--crt-primary);
}

/* Fade-in animation for log entries */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Pulsing highlight for active memory blocks */
.memory-highlight {
    animation: pulse 0.5s ease-in-out;
    box-shadow: 0 0 5px #a8f5f5, 0 0 5px a8f5f5 !important;
    border: 2px dotted var(--accent-blue) !important;
    transform: scale(1.05);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}


/* Job example paragraphs */
.job-example-list p {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 30px;
}

/* Job example headings */
.job-example-list h4 {
  color: var(--accent-yellow);
  margin-top: 15px;
  font-size: 14px;
}

.job-example-list div {
  margin-bottom: 20px;
}


@media (max-width: 1200px) {
  .execution-control-panel {
    grid-template-columns: 1fr;
  }

  .execution-controls {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .speed-control {
    width: 100%;
    justify-content: space-between;
  }

  #speedRange {
    flex: 1;
    min-width: 100px;
  }

  .execution-log {
    max-height: 200px;
    font-size: 11px;
  }
}

.btn:focus,
#speedRange:focus {
  outline: 2px solid var(--crt-primary);
  outline-offset: 2px;
}

.execution-log {
  scroll-behavior: smooth;
}

.current-stage {
  text-shadow: 0 0 5px rgba(255, 255, 0, 0.3);
}

.log-entry {
  transition: background-color 0.2s;
}

.log-entry:hover {
  background-color: rgba(0, 255, 0, 0.05);
}


/* Footer Styles */
footer {
    background-color: var(--panel-bg);
    padding: 1rem;
    text-align: center;
    margin-top: 2rem;
    border-top: 1px solid var(--crt-primary);
}

footer p {
    color: var(--text-color);
    font-size: 0.9rem;
    margin: 0;
}

footer a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent-yellow);
    text-decoration: underline;
}

.footer-tagline {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--accent-purple);
    font-style: italic;
    letter-spacing: 1px;
    text-transform: uppercase;
}