:root {
  --bg: #070a0e;
  --panel: #0b1016;
  --panel-2: #0e141c;
  --line: #1b2530;
  --text: #c8d3de;
  --dim: #5d6b7a;
  --green: #4ade80;
  --cyan: #67e8f9;
  --amber: #fbbf24;
  --red: #fb7185;
  --magenta: #c084fc;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(74, 222, 128, .07), transparent 60%),
    radial-gradient(700px 400px at 95% 0%, rgba(103, 232, 249, .05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .022) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(74, 222, 128, .22); color: #eafff1; }
.hidden { display: none !important; }

.c-dim, .muted { color: var(--dim); }
.c-ok { color: var(--green); }
.c-cmd { color: var(--green); }
.c-flag { color: var(--magenta); }
.c-warn { color: var(--amber); }

/* ---------- window chrome ---------- */
.chrome {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  flex-wrap: wrap;
}
.dots { display: flex; gap: 7px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #3a2226; border: 1px solid #5b2f34; }
.dots i:nth-child(2) { background: #3a3322; border-color: #5b512f; }
.dots i:nth-child(3) { background: #223a2a; border-color: #2f5b3d; }

.tabs { display: flex; gap: 2px; }
.tab {
  font-size: 12.5px;
  color: var(--dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 3px 11px;
  cursor: pointer;
}
.tab:hover { color: var(--text); border-color: #24313d; }
.tab.active {
  color: var(--green);
  border-color: #2b5a3d;
  background: #05100a;
  box-shadow: inset 0 -2px 0 var(--green), 0 0 14px -6px rgba(74, 222, 128, .6);
}
.tab:focus-visible { outline: 2px solid rgba(74, 222, 128, .5); outline-offset: 2px; }

.chrome .title { flex: 1; text-align: center; color: var(--dim); }
.session { display: flex; align-items: center; gap: 8px; }
#session-label { color: var(--dim); }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; max-width: 940px; margin: 0 auto; padding: 46px 20px 40px; }

/* ---------- hero ---------- */
.hero { text-align: center; }

.hero-prompt {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .04em;
  font-size: clamp(26px, 7.5vw, 68px);
  font-weight: 700;
  line-height: 1;
  color: var(--green);
  text-shadow: 0 0 30px rgba(74, 222, 128, .35);
  margin-bottom: 18px;
}
.caret {
  display: inline-block;
  width: .48em;
  height: .8em;
  background: var(--green);
  box-shadow: 0 0 26px rgba(74, 222, 128, .5);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.sub { margin: 0 auto 28px; max-width: 640px; color: var(--dim); font-size: 14px; }

/* ---------- terminal ---------- */
.terminal {
  text-align: left;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4), 0 30px 60px -30px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .03);
  overflow: hidden;
  cursor: text;
}
.terminal:focus-within { border-color: #27424f; }

.scrollback {
  padding: 16px 18px 4px;
  max-height: 46vh;
  min-height: 180px;
  overflow-y: auto;
  font-size: 13.5px;
  scrollbar-width: thin;
  scrollbar-color: #24313d transparent;
}
.scrollback::-webkit-scrollbar { width: 9px; }
.scrollback::-webkit-scrollbar-thumb { background: #1d2733; border-radius: 6px; }

.line { white-space: pre-wrap; word-break: break-word; }
.line.cmd { color: var(--text); }
.line.dim { color: var(--dim); }
.line.ok { color: var(--green); }
.line.err { color: var(--red); }
.line.warn { color: var(--amber); }
.line.head { color: var(--cyan); }
.line a { color: var(--cyan); }
.line.gap { height: 10px; }

.cmdline {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
}
.prompt { white-space: nowrap; font-size: 13.5px; }
.prompt b { color: var(--green); font-weight: 600; }
.prompt .path { color: var(--cyan); }
#input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  caret-color: var(--green);
}

.hint { color: var(--dim); font-size: 12.5px; margin: 16px 0 0; }

/* ---------- buttons ---------- */
.chip,
.btn,
.tab,
.wtab,
.x {
  font-family: var(--mono);
  transition: color .12s ease, background-color .12s ease, border-color .12s ease,
    box-shadow .12s ease, transform .06s ease;
}

.chip {
  font-size: 12.5px;
  color: var(--green);
  background: #05080b;
  border: 1px solid #24313d;
  border-radius: 3px;
  padding: 2px 9px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.chip:hover {
  color: #04140a;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 16px rgba(74, 222, 128, .25);
}
.chip:active { transform: translateY(1px); }
.chip[data-cmd]::before { content: "$ "; color: rgba(93, 107, 122, .85); }
.chip[data-cmd]:hover::before { color: rgba(4, 20, 10, .55); }

.btn {
  font-size: 13px;
  letter-spacing: .01em;
  color: var(--green);
  background: linear-gradient(180deg, rgba(74, 222, 128, .1), rgba(74, 222, 128, .03));
  border: 1px solid #2b5a3d;
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 1px 0 rgba(0, 0, 0, .45);
}
.btn:hover {
  color: #04140a;
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 20px rgba(74, 222, 128, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid rgba(74, 222, 128, .55); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.ghost { color: var(--dim); background: transparent; border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { color: var(--text); border-color: #33475a; background: rgba(255, 255, 255, .035); box-shadow: none; }
.btn.danger {
  color: var(--red);
  border-color: #5b2f34;
  background: linear-gradient(180deg, rgba(251, 113, 133, .1), rgba(251, 113, 133, .03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 1px 0 rgba(0, 0, 0, .45);
}
.btn.danger:hover {
  color: #1a0508;
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 20px rgba(251, 113, 133, .3);
}
.btn.wide { width: 100%; }
.btn.small { font-size: 12px; padding: 3px 9px; border-radius: 3px; }

/* ---------- panes ---------- */
.pane {
  margin-top: 46px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.pane-head {
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--dim);
  font-size: 13px;
  white-space: nowrap;
  overflow-x: auto;
}
.pane-body { padding: 16px 18px; }

.feat {
  display: grid;
  grid-template-columns: 22px minmax(150px, 210px) 1fr;
  gap: 10px;
  padding: 5px 0;
  font-size: 13.5px;
  align-items: baseline;
}
.feat b { color: var(--cyan); font-weight: 600; }
.feat span:last-child { color: var(--dim); }
.feat .ok { color: var(--green); }

.sect {
  margin: 28px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--cyan);
  border-bottom: 1px solid var(--line);
  padding-bottom: 7px;
}
.sect.first { margin-top: 4px; }

/* ---------- tables ---------- */
.kv { border-collapse: collapse; font-size: 13.5px; }
.kv th { text-align: left; color: var(--dim); font-weight: 400; padding: 4px 22px 4px 0; vertical-align: top; }
.kv td { color: var(--text); padding: 4px 0; }

.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th {
  text-align: left;
  color: var(--dim);
  font-weight: 500;
  padding: 4px 12px 8px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.grid td { padding: 8px 12px 8px 0; border-bottom: 1px solid #121a22; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid td:last-child { text-align: right; white-space: nowrap; }
.grid .actions { display: flex; gap: 6px; justify-content: flex-end; }

.code {
  color: var(--amber);
  background: rgba(251, 191, 36, .07);
  border: 1px solid rgba(251, 191, 36, .18);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 12.5px;
  user-select: all;
  cursor: copy;
  transition: background-color .12s ease, border-color .12s ease;
}
.code:hover { background: rgba(251, 191, 36, .14); border-color: rgba(251, 191, 36, .4); }
.badge {
  font-size: 11.5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px;
  color: var(--dim);
}
.badge.admin { color: var(--magenta); border-color: #4a3260; }
.badge.used { color: var(--dim); }
.badge.open { color: var(--green); border-color: #2b5a3d; }

/* ---------- files ---------- */
.upload-guest {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  margin-bottom: 10px;
  border: 1px dashed #2b3a49;
  border-radius: 8px;
  background: #05080b;
  color: var(--dim);
  font-size: 13px;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}
.dropzone.dragover {
  border-color: var(--green);
  color: var(--green);
  background: rgba(74, 222, 128, .06);
  box-shadow: inset 0 0 30px -12px rgba(74, 222, 128, .5);
}

.drop-limit {
  color: var(--dim);
  font-size: 11.5px;
  opacity: .75;
}

.upload-status { display: grid; gap: 7px; margin-bottom: 14px; font-size: 12.5px; }
.upload-status:empty { display: none; }
.up-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  color: var(--dim);
}
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-row.ok .up-name { color: var(--green); }
.up-row.err .up-name { color: var(--red); }
.up-bar {
  grid-column: 1 / -1;
  height: 5px;
  background: #0d151d;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.up-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  box-shadow: 0 0 12px rgba(74, 222, 128, .5);
  transition: width .15s ease;
}

.files .fname { color: var(--cyan); word-break: break-all; }
.files .fname:hover { text-decoration: underline; }
.files .size { color: var(--dim); white-space: nowrap; }
.files .empty { color: var(--dim); padding: 10px 0; }

/* ---------- forms ---------- */
.form-grid { display: grid; gap: 10px; max-width: 460px; margin: 0 0 8px; }
.form-grid label, .auth-form label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--dim);
}
input:not([type="checkbox"]):not([type="radio"]) {
  font: inherit;
  font-size: 13.5px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
  background: #05080b;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 10px;
  width: 100%;
  caret-color: var(--green);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5);
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}
input:not([type="checkbox"]):not([type="radio"])::placeholder { color: #3d4956; }
input:not([type="checkbox"]):not([type="radio"]):hover { border-color: #263543; }
input:not([type="checkbox"]):not([type="radio"]):focus {
  outline: none;
  background: #071019;
  border-color: #2f7a4b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4), 0 0 0 3px rgba(74, 222, 128, .09),
    0 0 18px -6px rgba(74, 222, 128, .4);
}
input:not([type="checkbox"]):not([type="radio"]):focus-visible { outline: none; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #05080b inset;
  caret-color: var(--green);
}
label.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: normal;
  font-size: 12.5px;
}
label.checkbox input { width: auto; accent-color: #2b5a3d; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg { font-size: 12.5px; color: var(--dim); min-height: 1.2em; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }

/* ---------- footer ---------- */
footer {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.foot-line { white-space: pre-wrap; }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-top: 14px; }
.foot-links span { margin-left: auto; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text); font: inherit; font-size: 12px; }

/* ---------- auth / modals ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 5, 8, .72);
  backdrop-filter: blur(3px);
  animation: fade .14s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.window {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .95);
  overflow: hidden;
  animation: pop .16s ease-out;
}
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--dim);
}
.x {
  font: inherit;
  color: var(--dim);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0 2px;
}
.x:hover { color: var(--red); }
.x:focus-visible { outline: 2px solid rgba(74, 222, 128, .5); outline-offset: 1px; }

.window-tabs { display: flex; gap: 4px; padding: 12px 18px 0; }
.wtab {
  font: inherit;
  font-size: 13px;
  color: var(--dim);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 2px 4px 7px;
  cursor: pointer;
}
.wtab:hover { color: var(--text); }
.wtab.active {
  color: var(--green);
  border-bottom-color: var(--green);
  text-shadow: 0 0 12px rgba(74, 222, 128, .5);
}
.wtab:focus-visible { outline: 2px solid rgba(74, 222, 128, .5); outline-offset: 2px; }

.auth-form { display: grid; gap: 12px; padding: 16px 18px 18px; }
.auth-form.register-mode .register-only { display: grid; }
.auth-form .register-only { display: none; }
.auth-form .register-only.window-foot { display: none; }
.auth-form.register-mode .register-only.window-foot { display: block; }
.window-foot { font-size: 12px; color: var(--dim); margin: 0; text-align: center; }

@media (max-width: 620px) {
  .chrome .title { display: none; }
  .tabs { order: 3; width: 100%; }
  .session { margin-left: auto; }
  .feat { grid-template-columns: 22px 1fr; }
  .feat span:last-child { grid-column: 2; }
  .foot-links span { margin-left: 0; width: 100%; }
  main { padding-top: 30px; }
}
