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

body {
  background: #0c0c0c;
  font-family: 'Cascadia Code', 'Consolas', 'Courier New', monospace;
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #0c0c0c;
}

/*  Title bar  */
#titlebar {
  height: 32px;
  min-height: 32px;
  background: #1c1c1c;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #3a3a3a;
  user-select: none;
  flex-shrink: 0;
}

#titlebar-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #ccc;
}

#tabs {
  display: flex;
  align-items: flex-end;
  height: 100%;
  flex: 1;
  overflow: hidden;
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 28px;
  background: #0c0c0c;
  color: #cccccc;
  font-size: 12px;
  border-radius: 4px 4px 0 0;
  border: 1px solid #3a3a3a;
  border-bottom: none;
  margin-right: 2px;
  margin-top: 4px;
  cursor: default;
}

.tab-icon {
  font-size: 11px;
  opacity: 0.7;
}


/*  Toolbar  */
#toolbar {
  height: 36px;
  min-height: 36px;
  background: #1c1c1c;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
  border-bottom: 1px solid #2d2d2d;
  flex-shrink: 0;
}

.toolbar-btn {
  background: transparent;
  border: none;
  color: #cccccc;
  font-size: 12px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

.toolbar-btn:hover {
  background: #2d2d2d;
}

#pauseBtn.paused {
  color: #5af78e;
}

.toolbar-sep {
  width: 1px;
  height: 16px;
  background: #3a3a3a;
  margin: 0 4px;
}

#score-display {
  margin-left: auto;
  color: #7ec8e3;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
}

/*  Terminal body  */
#terminal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #0c0c0c;
  width: 100%;
}

#prompt-header {
  padding: 8px 14px 2px;
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1.4;
}

#prompt-header .muted {
  color: #888;
}

#prompt-header .path {
  color: #5af78e;
}

#prompt-header .cmd {
  color: #ebebeb;
}

#game-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  position: relative;
  overflow: hidden;
  width: 100%;
}

#canvas-wrapper {
  position: relative;
  width: fit-content;
  height: fit-content;
  border: 1px solid #3a3a3a;
  background: #0c0c0c;
  display: block;
}

canvas {
  display: block;
  background: #0c0c0c;
  image-rendering: pixelated;
}

#canvas-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom,
      transparent 0px, transparent 3px,
      rgba(0, 0, 0, 0.08) 3px, rgba(0, 0, 0, 0.08) 4px);
  pointer-events: none;
}

/*  Game overlay  */
#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#overlay-box {
  background: rgba(12, 12, 12, 1);
  border: 1px solid #3ab5e8;
  padding: 16px 26px;
  text-align: center;
  font-size: 13px;
  box-shadow: 0 0 15px rgba(58, 181, 232, 0.2);
}

#overlay-title {
  color: #5af78e;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

#overlay-sub {
  color: #888;
  font-size: 11px;
  line-height: 1.7;
}

.green {
  color: #5af78e;
}

/*  Status bar  */
#statusbar {
  height: 24px;
  min-height: 24px;
  background: #007acc;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  flex-shrink: 0;
}

.sb-item {
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

#sb-right {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

/*  Modals Shared Layout (Help & Settings)  */
.modal-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-popup.open {
  display: flex;
}

.popup-box {
  background: #1c1c1c;
  border: 1px solid #3a3a3a;
  width: 440px;
  max-width: 92vw;
  font-size: 13px;
  color: #ccc;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.popup-header {
  background: #007acc;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  color: #fff;
}

.popup-close-btn {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.popup-close-btn:hover {
  background: #c42b1c;
}

.popup-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.popup-footer {
  padding: 10px 20px;
  border-top: 1px solid #2d2d2d;
  font-size: 11px;
  color: #666;
  text-align: center;
}

/*  Settings Controls Configuration  */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid #2d2d2d;
}

.setting-row label {
  font-size: 12px;
  color: #e0e0e0;
}

.setting-row select {
  background: #0c0c0c;
  border: 1px solid #444;
  color: #fff;
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
  outline: none;
  border-radius: 3px;
  width: 200px;
}

.setting-row select:focus {
  border-color: #007acc;
}

.setting-row input[type="checkbox"] {
  accent-color: #007acc;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.check-row {
  justify-content: space-between;
}

/*  Help Configuration  */
.help-section-title {
  color: #5af78e;
  font-size: 11px;
  letter-spacing: 1.5px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.help-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 12px;
}

.help-row:last-child {
  border-bottom: none;
}

.help-keys {
  display: flex;
  gap: 4px;
}

kbd {
  background: #2d2d2d;
  border: 1px solid #444;
  border-bottom: 2px solid #555;
  border-radius: 3px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 11px;
  color: #eee;
}
