/* ============================================
   TubeCraft — terminal-window aesthetic
   Palette: void black / bone white / burnt
   orange signal / muted green confirm.
   No blue, no purple, on purpose.
   ============================================ */

:root {
  --void:        #0a0a09;
  --panel:       #121211;
  --panel-raised:#161614;
  --line:        #26241f;
  --line-soft:   #1c1b17;
  --bone:        #f3f1e7;
  --bone-dim:    #8a8779;
  --bone-faint:  #56544a;

  --signal:      #ff6a39;
  --signal-dim:  #c9551f;
  --confirm:     #8fae6e;
  --confirm-dim: #5f7a47;
  --error:       #d9694a;

  --radius:      3px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* faint grain so the black isn't dead-flat */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='90' height='90'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.app {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: 0 auto;
  padding: 9vh 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Terminal window ---------- */

.term {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.02) inset,
    0 30px 60px -25px rgba(0,0,0,0.7);
  overflow: hidden;
  animation: term-rise 0.5s cubic-bezier(.16,1,.3,1);
}

@keyframes term-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  background: var(--panel-raised);
  border-bottom: 1px solid var(--line);
}

.term-dots { display: flex; gap: 7px; }
.term-dots span {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: none;
}
.term-dots span:nth-child(1) { background: #ff5f57; }
.term-dots span:nth-child(2) { background: #febc2e; }
.term-dots span:nth-child(3) { background: #28c840; }

.term-path {
  flex: 1;
  font-size: 12.5px;
  color: var(--bone-dim);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-path-dim { color: var(--bone-faint); }

.term-status {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--bone-faint);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--confirm-dim);
  transition: background 0.25s, box-shadow 0.25s;
}
.term-status.busy .status-dot {
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(255,106,57,0.5);
  animation: status-pulse 1s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,106,57,0.45); }
  50% { box-shadow: 0 0 0 4px rgba(255,106,57,0); }
}

.term-body {
  padding: 22px 20px 20px;
}

.boot-line {
  font-size: 13px;
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--line-soft);
}
.boot-prompt { color: var(--signal); font-weight: 600; }
.boot-dim { color: var(--bone-faint); }

/* ---------- Prompt row ---------- */

.prompt-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-glyph {
  color: var(--signal);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.prompt-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  position: relative;
  min-width: 0;
}

.prompt-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  padding: 4px 0;
  caret-color: var(--signal);
}

.prompt-input::placeholder {
  color: var(--bone-faint);
}

/* custom blinking caret block shown only while empty & unfocused-ish hint;
   real text caret is native, this is just decorative emphasis */
.caret {
  display: none;
}

.run-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--signal);
  color: #1a0d05;
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.run-btn:hover {
  background: #ff7c4f;
  box-shadow: 0 0 0 3px rgba(255,106,57,0.12);
}

.run-btn:active {
  transform: scale(0.96);
}

.run-key {
  opacity: 0.65;
  font-size: 11px;
}

.run-btn.firing {
  animation: fire 0.28s ease;
}
@keyframes fire {
  0% { transform: scale(1); }
  40% { transform: scale(0.93); }
  100% { transform: scale(1); }
}

/* ---------- Inline error ---------- */

.inline-error {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--error);
  padding-left: 24px;
}

/* ---------- Results ---------- */

.results {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.results.hidden, .inline-error.hidden { display: none; }

.line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 11px 10px;
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(4px);
  animation: line-in 0.32s ease forwards;
}

.line-url   { animation-delay: 0.02s; }
.line-title { animation-delay: 0.10s; }
.line-sheet { animation-delay: 0.18s; }

@keyframes line-in {
  to { opacity: 1; transform: translateY(0); }
}

.line:hover {
  background: var(--line-soft);
}

.line-tag {
  font-size: 11px;
  color: var(--bone-faint);
  letter-spacing: 0.06em;
  padding-top: 3px;
  user-select: none;
}

.line-value {
  margin: 0;
  font-size: 13.5px;
  color: var(--bone);
  word-break: break-word;
  line-height: 1.5;
  min-height: 1.5em;
}

.line-value.is-loading {
  color: var(--bone-faint);
}

.line-value.is-error {
  color: var(--error);
}

.line-sheet .line-value {
  color: var(--confirm);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--bone-dim);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
}

.copy-btn:hover {
  border-color: var(--bone-faint);
  color: var(--bone);
  background: var(--panel-raised);
}

.copy-btn:active {
  transform: scale(0.92);
}

.copy-btn:focus-visible,
.prompt-input:focus-visible,
.run-btn:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.icon-copy, .icon-check {
  width: 14px;
  height: 14px;
}

.icon-check { display: none; }

.copy-btn.copied {
  border-color: var(--confirm-dim);
  color: var(--confirm);
  background: rgba(143,174,110,0.08);
}
.copy-btn.copied .icon-copy { display: none; }
.copy-btn.copied .icon-check { display: block; }

/* ---------- Hint / footer ---------- */

.hint {
  margin: 20px 0 0;
  font-size: 11.5px;
  color: var(--bone-faint);
  padding-left: 1px;
}

.hint kbd {
  font-family: var(--mono);
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10.5px;
  color: var(--bone-dim);
}

.footer {
  margin-top: 26px;
  text-align: center;
  font-size: 11px;
  color: var(--bone-faint);
  letter-spacing: 0.02em;
}

/* ---------- Toasts ---------- */

.toast-root {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

.toast {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--bone);
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-left: 2px solid var(--confirm);
  padding: 9px 14px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toast-in 0.22s cubic-bezier(.16,1,.3,1), toast-out 0.22s ease forwards;
  animation-delay: 0s, 1.3s;
}

.toast.error { border-left-color: var(--error); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-4px); }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .term, .line, .run-btn.firing, .toast {
    animation: none !important;
  }
  .line { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
  .app { padding-top: 6vh; }
  .term-path { font-size: 11.5px; }
  .term-status span.label { display: none; }
  .line {
    grid-template-columns: 1fr auto;
  }
  .line-tag {
    grid-row: 1;
    grid-column: 1 / -1;
    padding-top: 0;
  }
  .line-value {
    grid-column: 1;
  }
  .copy-btn {
    grid-column: 2;
  }
  .hint { display: none; }
}
