/* ========== Base Reset ========== */
html {
  box-sizing: border-box;
  font-size: 100%;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* ========== Body Styling ========== */
body {
  background-color: #0f0f0f;
  color: #e0e0e0;
  font-family: "Courier New", Courier, monospace;
  font-size: 1rem;
  margin: 0;
  padding: 2rem;
}

/* ========== Main Content Layout ========== */
main {
  max-width: 1200px;
  margin: auto;
  white-space: pre-wrap; /* Preserve whitespace formatting */
  word-wrap: break-word; /* Wrap long words */
}

/* ========== Code Editor Box ========== */
pre.editor {
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 2rem;
  position: relative;
}

/* ========== Line Number Styling ========== */
.line-number {
  display: inline-block;
  width: 3em; /* Enough for up to 999 lines */
  user-select: none;
  opacity: 0.4;
  text-align: right;
  padding-right: 1em;
  color: #858585;
  font-family: monospace;
}

/* ========== Code Font Settings ========== */
pre.editor,
.line-number,
code {
  font-family: "Courier New", monospace;
}

code {
  display: inline;
  font-size: 1rem;
  line-height: 1.6;
}

/* ========== Syntax Highlighting ========== */
.keyword {
  color: #569cd6;
  font-weight: bold;
}

.type {
  color: #4ec9b0;
}

.string {
  color: #d69d85;
}

.comment {
  color: #6a9955;
  font-style: italic;
}

.enum {
  color: #c586c0;
}

.identifier {
  color: #9cdcfe;
}

/* ========== Text Selection Highlight ========== */
::selection {
  background: #82e0aa44;
  color: #ffffff;
}

/* ========== Blinking Cursor Animation ========== */
#codeDisplay::after {
  content: '_';
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  to { visibility: hidden; }
}

/* ========== Responsive Design ========== */
@media (max-width: 600px) {
  body {
    padding: 1rem !important;
    font-size: 0.85rem !important;
  }

  main {
    max-width: 100% !important;
    word-break: break-word;
    overflow-x: auto;
  }

  .line-number {
    width: 2em !important;
    padding-right: 0.5em;
    font-size: 0.8rem !important;
  }

  pre.editor {
    padding: 0.5rem !important;
    font-size: 0.85rem !important;
    white-space: pre-wrap !important;
    overflow-x: auto;
  }

  code {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    word-break: break-word;
  }
}
