@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500;700&display=swap');

:root {
  --bg: #0a0e14;
  --bg-lighter: #0f1419;
  --text: #b3b1ad;
  --green: #00ff9c;
  --green-dim: #00cc7a;
  --cyan: #39bae6;
  --orange: #ff8f40;
  --red: #ff3333;
  --yellow: #e6b450;
  --purple: #d2a6ff;
  --blue: #59c2ff;
  --pink: #f07178;
  --gray: #475a6e;
  --border: #1a1f29;
  --selection: rgba(0, 255, 156, 0.12);
  --glow: rgba(0, 255, 156, 0.08);
  --font-mono: 'Fira Code', 'JetBrains Mono', 'Cascadia Code', 'SF Mono', monospace;
}

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

::selection {
  background: var(--selection);
  color: var(--green);
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 1000;
}

body::after {
  content: '';
  position: fixed;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at center, var(--glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 1000px;
  margin: 0 auto;
}

.title-bar {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.title-bar-dots { display: flex; gap: 6px; }

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.title-bar-text {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.title-bar-text .title-short { display: none; }

.title-bar-langs { display: flex; gap: 6px; align-items: center; user-select: none; }

.lang-btn {
  background: transparent;
  border: none;
  font: inherit;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--gray);
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s;
}

.lang-btn:hover:not(.active) { color: var(--text); }
.lang-btn.active { color: var(--green); }
.lang-btn:focus-visible { outline: 1px solid var(--green); outline-offset: 1px; }
.lang-sep { color: var(--gray); opacity: 0.5; font-size: 11px; user-select: none; }

.terminal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.terminal-body::-webkit-scrollbar { width: 6px; }
.terminal-body::-webkit-scrollbar-track { background: transparent; }
.terminal-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.terminal-body::-webkit-scrollbar-thumb:hover { background: var(--gray); }

.output-line {
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 2px;
  animation: fadeInLine 0.15s ease;
}

@keyframes fadeInLine {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

.prompt-prefix { color: var(--green); font-weight: 500; }
.prompt-path { color: var(--cyan); font-weight: 400; }
.prompt-symbol { color: var(--yellow); font-weight: 700; }
.cmd-text { color: #e6e1cf; }

.ascii-art {
  color: var(--green);
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0;
}

.info-label { color: var(--cyan); font-weight: 500; }
.info-value { color: var(--text); }
.highlight { color: var(--green); font-weight: 500; }

.link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.2s;
}

.link:hover { color: var(--cyan); }

.error-text { color: var(--red); }

.cmd-link {
  color: var(--yellow);
  cursor: pointer;
  border-bottom: 1px dashed rgba(230, 180, 80, 0.3);
  padding-bottom: 1px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.cmd-link:hover {
  color: var(--green);
  border-bottom-color: var(--green);
  text-shadow: 0 0 8px rgba(0, 255, 156, 0.3);
}

.warning-text { color: var(--yellow); }
.success-text { color: var(--green); }
.muted { color: var(--gray); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  background: rgba(0, 255, 156, 0.06);
  border: 1px solid rgba(0, 255, 156, 0.15);
  border-radius: 3px;
  font-size: 12px;
  color: var(--green-dim);
}

.input-area {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-lighter);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 0;
}

.input-prompt { white-space: nowrap; flex-shrink: 0; }

#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #e6e1cf;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 0;
  caret-color: var(--green);
  line-height: 1.6;
}

#cmd-input::placeholder { color: var(--gray); opacity: 0.5; }

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 16px;
  background: var(--bg-lighter);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--gray);
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.status-left, .status-right { display: flex; align-items: center; gap: 12px; }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.autocomplete {
  position: fixed;
  background: var(--bg-lighter);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 500;
  display: none;
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--selection);
  color: var(--green);
}

.autocomplete-desc { color: var(--gray); font-size: 11px; }

@media (max-width: 600px) {
  body { font-size: 11px; line-height: 1.5; }
  .title-bar { padding: 6px 10px; gap: 8px; }
  .title-bar-text { font-size: 11px; }
  .title-bar-text .title-full { display: none; }
  .title-bar-text .title-short { display: inline; }
  .title-bar-langs { gap: 4px; }
  .lang-btn { padding: 1px 5px; font-size: 10px; }
  .terminal-body { padding: 8px 10px; }
  .input-area { padding: 8px 10px; }
  #cmd-input { font-size: 13px; }
  .status-bar { padding: 3px 10px; font-size: 10px; }
  .status-right .hide-mobile { display: none; }
  .ascii-art { font-size: 6.5px; line-height: 1.2; }
  .tag { font-size: 10px; padding: 1px 5px; margin: 1px 3px 1px 0; }
  /* Welcome box: hide right border + padding so content can wrap freely */
  .box-end, .box-pad { display: none; }
}

@media (max-width: 380px) {
  body { font-size: 10px; }
  .ascii-art { font-size: 5.5px; }
  .terminal-body { padding: 6px 8px; }
  .input-area { padding: 6px 8px; }
  #cmd-input { font-size: 12px; }
  .status-bar { font-size: 9px; padding: 3px 8px; }
}

@media print {
  body::before, body::after { display: none; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: backdropFade 0.2s ease;
}

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

@keyframes backdropFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-window {
  width: 80vw;
  height: 80vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 255, 156, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title-bar {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg-lighter);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-shrink: 0;
  user-select: none;
}

.modal-title-bar .dot.red { cursor: pointer; }
.modal-title-bar .dot.red:hover { box-shadow: 0 0 0 2px rgba(255, 95, 87, 0.4); }

.modal-title-text {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
  letter-spacing: 0.5px;
}

.modal-close-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--gray);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close-btn:hover { border-color: var(--red); color: var(--red); }

.modal-body {
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.modal-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}

.modal-status-bar {
  display: flex;
  justify-content: space-between;
  padding: 4px 14px;
  background: var(--bg-lighter);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--gray);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .modal-window { width: 94vw; height: 88vh; }
}
