:root {
  --bg-color: #282828;
  --term-bg: #1d2021;
  --text-color: #ebdbb2;
  --prompt-color: #b8bb26;
  --cmd-color: #fabd2f;
  --link-color: #83a598;
  --font-stack: 'JetBrains Mono', 'Courier New', Courier, monospace;
  --table-border: #504945;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-stack);
  height: 100vh;
  display: block;
  padding: 0;
  overflow: hidden;
  /* Prevents scrollbars if window is dragged partially offscreen */
}

.container {
  width: 100%;
  max-width: 800px;
}

.terminal-window {
  background-color: var(--term-bg);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border: 1px solid #3c3836;

  position: absolute;
  top: 0;
  left: 0;

  /* Center immediately on load using calc() - JS will override this */
  transform: translate3d(calc(50vw - 400px), calc(50vh - 225px), 0);
  width: 800px;
  height: 450px;
  min-width: 300px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

.resizer {
  position: absolute;
  z-index: 100;
}

.resizer-n {
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  cursor: ns-resize;
}

.resizer-e {
  top: 0;
  right: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
}

.resizer-s {
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  cursor: ns-resize;
}

.resizer-w {
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  cursor: ew-resize;
}

.resizer-ne {
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
  z-index: 101;
}

.resizer-nw {
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
  z-index: 101;
}

.resizer-se {
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  cursor: nwse-resize;
  z-index: 101;
}

.resizer-sw {
  bottom: 0;
  left: 0;
  width: 10px;
  height: 10px;
  cursor: nesw-resize;
  z-index: 101;
}

.terminal-header {
  background-color: #32302f;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #3c3836;
  cursor: grab;
  flex-shrink: 0;
  /* Header shouldn't shrink */
}

.terminal-header:active {
  cursor: grabbing;
}

.button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.red {
  background-color: #cc241d;
}

.yellow {
  background-color: #d79921;
}

.green {
  background-color: #98971a;
}

.title {
  margin-left: 10px;
  font-size: 0.9rem;
  color: #a89984;
  flex-grow: 1;
  text-align: center;
}

.terminal-content {
  padding: 20px;
  flex-grow: 1;
  min-height: 0;
  /* Crucial for scrolling in flex container */
  overflow-y: auto;
  /* Enable scrollbar */
  font-size: 1rem;
  line-height: 1.5;
}

.line {
  margin-bottom: 5px;
  display: flex;
  flex-wrap: wrap;
}

.prompt {
  color: var(--prompt-color);
  margin-right: 10px;
  font-weight: bold;
}

.command-text {
  white-space: pre;
}

.output {
  margin-bottom: 15px;
  color: var(--text-color);
  padding-left: 0;
}

a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px dashed var(--link-color);
}

a:hover {
  background-color: var(--link-color);
  color: var(--term-bg);
}

.nu-table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.nu-table th {
  text-align: left;
  border: 1px solid var(--table-border);
  padding: 5px 10px;
  color: #98971a;
  /* Green for headers */
}

.nu-table td {
  border: 1px solid var(--table-border);
  padding: 5px 10px;
  color: var(--text-color);
}

.nu-type {
  color: #83a598;
  /* Blue */
}

.nu-size {
  color: #d3869b;
  /* Purple */
}

.nu-date {
  color: #fabd2f;
  /* Yellow */
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  background-color: var(--text-color);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
}

.cursor.typing {
  animation: none;
  opacity: 1;
}

.nu-error {
  color: #cc241d;
  font-family: var(--font-stack);
  margin-bottom: 3px;
  line-height: 0.6;
}

.nu-error-title {
  font-weight: bold;
  margin-bottom: 10px;
}

.nu-error-code {
  color: #cc241d;
}

.nu-error-body {
  margin-left: 10px;
  padding-left: 10px;
}

.nu-error-source {
  margin-left: 10px;
  color: #fabd2f;
  /* Using yellow for source lines */
  white-space: pre;
  font-family: var(--font-stack);
}

.nu-error-source-header {
  color: #83a598;
  /* Blue/Green for file loc */
}

.nu-error-message {
  color: #fb4934;
  /* Light red */
  font-weight: bold;
}

.nu-error-help {
  margin-top: 1px;
  color: #8ec07c;
  /* Aqua/Green */
}

.nu-gray {
  color: #a89984;
}

.nu-text {
  color: var(--text-color);
}

.nu-x {
  color: #cc241d;
  font-weight: bold;
  margin-right: 5px;
}

.nu-error-msg {
  margin-bottom: 3px;
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  body {
    padding: 10px;
    /* Add padding back on mobile */
  }

  .terminal-window {
    /* Override desktop absolute positioning */
    position: static !important;
    transform: none !important;

    /* Fill available space with some margin */
    width: calc(100vw - 20px) !important;
    height: calc(100vh - 20px) !important;
    min-width: unset;
    min-height: unset;
    max-width: 100%;
    max-height: 100%;
  }

  /* Hide resizers on mobile - they're too small for touch */
  .resizer {
    display: none;
  }

  .terminal-header {
    cursor: default;
    /* Disable drag cursor on mobile */
  }

  .terminal-content {
    padding: 10px;
    font-size: 0.9rem;
  }

  .nu-table th,
  .nu-table td {
    padding: 2px 5px;
  }
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  50.1%,
  100% {
    opacity: 0;
  }
}