/* style.css - Styling for NES emulator */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f5f5;
  margin: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  color: #333;
}

h1 {
  color: #333;
  margin-bottom: 20px;
  text-align: center;
}

h2,
h3 {
  margin-top: 15px;
  margin-bottom: 10px;
}

.emulator-container {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
  width: 100%;
  max-width: 600px;
}

#emulator-mount {
  position: relative;
  margin-bottom: 15px;
}

canvas {
  border: 1px solid #ddd;
  margin: 0 auto 15px;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  height: auto;
  background-color: black;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

button {
  background-color: #4caf50;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #45a049;
}

button:active {
  background-color: #3d8b3d;
}

#reset {
  background-color: #f44336;
}

#reset:hover {
  background-color: #e53935;
}

#load-rom {
  background-color: #2196f3;
}

#load-rom:hover {
  background-color: #1e88e5;
}

.instruction-container {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 20px;
  max-width: 600px;
  width: 100%;
  margin-bottom: 20px;
}

.instructions {
  text-align: left;
}

.instructions h2 {
  color: #333;
  margin-top: 0;
}

.instructions ol,
.instructions ul {
  padding-left: 20px;
  margin-bottom: 15px;
}

.instructions li {
  margin-bottom: 8px;
}

.key-mapping {
  margin-top: 15px;
  margin-bottom: 20px;
  border-collapse: collapse;
  width: 100%;
}

.key-mapping th,
.key-mapping td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
}

.key-mapping th {
  background-color: #f2f2f2;
}

.key-mapping tr:nth-child(even) {
  background-color: #f9f9f9;
}

.status-info {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background-color: #f9f9f9;
  text-align: left;
  font-family: monospace;
  font-size: 14px;
  overflow-x: auto;
  white-space: nowrap;
}

.fps-counter {
  position: absolute;
  top: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}

/* Fullscreen styles */
#emulator-mount:fullscreen {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: black;
}

#emulator-mount:fullscreen canvas {
  width: auto;
  height: 100%;
  max-height: 100vh;
  max-width: 100vw;
  object-fit: contain;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .controls {
    flex-direction: column;
    align-items: center;
  }

  button {
    width: 100%;
    margin-bottom: 5px;
  }

  .key-mapping th,
  .key-mapping td {
    padding: 4px;
    font-size: 14px;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #121212;
    color: #eee;
  }

  h1,
  h2,
  h3 {
    color: #eee;
  }

  .emulator-container,
  .instruction-container {
    background-color: #1e1e1e;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  }

  canvas {
    border-color: #444;
  }

  .status-info {
    background-color: #2a2a2a;
    border-color: #444;
    color: #ddd;
  }

  .key-mapping th,
  .key-mapping td {
    border-color: #444;
  }

  .key-mapping th {
    background-color: #333;
  }

  .key-mapping tr:nth-child(even) {
    background-color: #2a2a2a;
  }
}

.credits {
  text-align: center;
  margin-top: 3rem;
  padding: 1rem;
}

.credits ul {
  list-style: none;
  padding: 0;
}

.credits li {
  margin: 0.5rem 0;
}
