/* Screen & Terminal Container */
.screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--bg-soft) 0%, var(--bg) 80%);
}

.terminal {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-shadow: 0 0 1px rgba(126, 231, 135, 0.7), 0 0 4px rgba(126, 231, 135, 0.25);
}

/* Title Bar */
.title-bar {
  flex-shrink: 0;
  height: 30px;
  background: rgba(126, 231, 135, 0.05);
  border-bottom: 1px solid rgba(126, 231, 135, 0.18);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--gray);
  letter-spacing: 0.4px;
  z-index: 2;
}

.title-bar .left,
.title-bar .right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-bar .left {
  flex: 1;
  min-width: 0;
}

.title-bar .session-info {
  color: var(--phosphor-dim);
  font-weight: 500;
}

.title-bar .path-display {
  color: var(--blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-bar .right {
  font-variant-numeric: tabular-nums;
  gap: 14px;
}

.title-bar .indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--phosphor);
}

.title-bar .led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 6px var(--phosphor);
  animation: pulse-led 2.4s ease-in-out infinite;
}

@keyframes pulse-led {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.title-bar .clock {
  color: var(--phosphor-dim);
}

/* Terminal Body & Output */
.terminal-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 12px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

.terminal-body::-webkit-scrollbar {
  width: 6px;
}

.terminal-body::-webkit-scrollbar-track {
  background: rgba(126, 231, 135, 0.04);
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(126, 231, 135, 0.25);
}

.terminal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(126, 231, 135, 0.5);
}

.output-line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.45em;
}

.output-line:empty::before {
  content: '\00a0';
}

/* Interactive Input Line */
.input-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.45em;
}

.prompt {
  color: var(--phosphor);
  white-space: pre;
}

.prompt .user {
  color: var(--cyan);
  font-weight: 500;
}

.prompt .at {
  color: var(--gray);
}

.prompt .host {
  color: var(--phosphor);
  font-weight: 500;
}

.prompt .colon {
  color: var(--gray);
}

.prompt .path {
  color: var(--blue);
  font-weight: 500;
}

.prompt .symbol {
  color: var(--gray);
  margin-right: 7px;
}

.input-text {
  color: var(--phosphor-bright);
  white-space: pre-wrap;
  word-break: break-all;
}

.ghost-text {
  color: var(--gray-dim);
  text-shadow: none;
  font-style: italic;
  animation: ghost-appear 0.18s ease-out;
  opacity: 0.55;
}

@keyframes ghost-appear {
  0% {
    opacity: 0;
  }
  40% {
    opacity: 0.9;
  }
  50% {
    opacity: 0.3;
  }
  60% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.55;
  }
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--phosphor);
  vertical-align: text-bottom;
  margin: 0 -1px;
  position: relative;
  top: 1px;
  animation: blink 1.06s infinite;
  box-shadow: 0 0 4px var(--phosphor), 0 0 8px rgba(126, 231, 135, 0.4);
}

@keyframes blink {
  0%, 49% {
    opacity: 1;
  }
  50%, 100% {
    opacity: 0;
  }
}

/* Status & Syntax Highlighting */
.ok {
  color: var(--phosphor);
  font-weight: 700;
}

.err {
  color: var(--red);
  font-weight: 700;
}

.warn {
  color: var(--amber);
}

.dim {
  color: var(--gray);
}

.hl {
  color: var(--cyan);
  font-weight: 500;
}

.welcome {
  color: var(--phosphor-bright);
  font-weight: 700;
}

.accent {
  color: var(--amber);
  font-weight: 500;
}

.dir {
  color: var(--cyan);
  font-weight: 500;
}

.project {
  color: var(--phosphor);
}

.post {
  color: var(--phosphor-bright);
}

.private {
  color: var(--red);
  font-weight: 500;
}

.tag {
  color: var(--amber);
}

/* Markdown Formatted Elements */
.md-h1 {
  color: var(--phosphor-bright);
  font-size: 1.2em;
  font-weight: 700;
  margin: 14px 0 8px;
  border-bottom: 1px solid rgba(126, 231, 135, 0.3);
  padding-bottom: 5px;
  text-shadow: 0 0 5px var(--phosphor);
}

.md-h2 {
  color: var(--cyan);
  font-weight: 700;
  margin: 12px 0 5px;
}

.md-h3 {
  color: var(--amber);
  font-weight: 700;
  margin: 10px 0 4px;
  font-size: 1em;
}

.md-p {
  margin: 6px 0;
  color: var(--phosphor);
}

.md-blockquote {
  color: var(--amber);
  border-left: 2px solid var(--amber);
  padding-left: 12px;
  margin: 8px 0;
  font-style: italic;
  opacity: 0.95;
}

.md-li {
  margin: 3px 0;
  color: var(--phosphor);
}

.md-li::before {
  content: '•';
  color: var(--cyan);
  margin-right: 8px;
}

.md-code-block {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(126, 231, 135, 0.18);
  border-left: 2px solid var(--phosphor-dim);
  padding: 8px 12px;
  margin: 8px 0;
  color: var(--amber);
  font-size: 0.95em;
  overflow-x: auto;
  white-space: pre;
  font-family: 'JetBrains Mono', monospace;
}

.md-inline-code {
  background: rgba(126, 231, 135, 0.1);
  color: var(--amber);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.95em;
  border: 1px solid rgba(126, 231, 135, 0.15);
}

.md-strong {
  color: var(--phosphor-bright);
  font-weight: 700;
}

.md-link {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(86, 212, 221, 0.4);
  cursor: pointer;
}

.md-link:hover {
  text-decoration-color: var(--cyan);
  color: var(--phosphor-bright);
}

/* Manual Pages */
.man-page {
  border: 1px solid rgba(126, 231, 135, 0.25);
  padding: 14px 18px;
  margin: 8px 0 12px;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  color: var(--phosphor);
  font-size: 13px;
  line-height: 1.6;
}

.man-page .man-title {
  color: var(--phosphor-bright);
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(126, 231, 135, 0.2);
}

.man-page .man-section {
  color: var(--cyan);
  font-weight: 700;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.95em;
  letter-spacing: 0.5px;
}

.man-page .man-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 12px;
  padding: 4px 0;
  align-items: baseline;
  border-bottom: 1px solid rgba(126, 231, 135, 0.05);
}

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

.man-page .man-cmd {
  color: var(--phosphor-bright);
  font-weight: 600;
}

.man-page .man-desc {
  color: var(--phosphor);
  opacity: 0.9;
}

.man-page .man-example {
  color: var(--amber);
  font-size: 0.9em;
  font-style: italic;
  white-space: nowrap;
}

.man-page .man-example code {
  color: var(--amber);
  background: rgba(227, 179, 65, 0.1);
  padding: 1px 5px;
  border-radius: 2px;
  font-style: normal;
}

@media (max-width: 700px) {
  .man-page .man-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 6px 0;
  }
}

/* ASCII & System Art */
.neofetch-container {
  display: flex;
  gap: 24px;
  padding: 8px 0;
  align-items: flex-start;
}

.neofetch-container pre {
  margin: 0;
  color: var(--phosphor);
  white-space: pre;
  text-shadow: 0 0 4px var(--phosphor);
  font-size: 12px;
  line-height: 1.35;
}

.neofetch-avatar {
  width: 140px;
  height: 140px;
  border-radius: 4px;
  border: 1px solid rgba(126, 231, 135, 0.4);
  box-shadow: 0 0 10px rgba(126, 231, 135, 0.2);
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
  opacity: 0.85;
}

/* Off-screen Hidden Input */
.hidden-input {
  position: absolute;
  top: -100px;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  background: transparent;
  color: transparent;
  font-size: 16px;
  caret-color: transparent;
}

/* Responsive Media Queries */
@media (max-width: 600px) {
  .terminal-body {
    padding: 12px 10px 8px;
  }
  .title-bar {
    font-size: 10px;
    height: 26px;
    padding: 0 10px;
  }
  .title-bar .right {
    gap: 8px;
  }
  .cursor {
    width: 7px;
  }
  .md-code-block {
    font-size: 0.85em;
  }
  .neofetch-container {
    flex-direction: column;
    gap: 8px;
  }
  .neofetch-container pre {
    font-size: 9px;
  }
}

@media (max-width: 400px) {
  .title-bar .session-info {
    display: none;
  }
}
