:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --panel: #111316;
  --panel-2: #15181c;
  --line: #25292f;
  --soft-line: #1c2025;
  --text: #f4f5f3;
  --muted: #8c939d;
  --dim: #565d67;
  --accent: #b7f34a;
  --accent-soft: rgba(183, 243, 74, 0.12);
  --purple: #b58cff;
  --blue: #72a7ff;
  --orange: #ffb86c;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); }
html.workspace-mode,
body.workspace-mode {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.workspace-mode main {
  height: calc(100dvh - 74px);
  min-height: 0;
  overflow: hidden;
}
button, input { font: inherit; }
button { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
}

.site-header {
  height: 74px;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--soft-line);
  position: relative;
  z-index: 2;
}

.brand {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  letter-spacing: -.02em;
}
.brand strong { font-weight: 700; }
.brand-mark {
  width: 28px;
  height: 28px;
  border: 1px solid #343940;
  border-radius: 7px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding-bottom: 7px;
  transform: rotate(-2deg);
}
.brand-mark i { width: 3px; border-radius: 2px; background: var(--accent); display: block; }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 11px; }
.brand-mark i:nth-child(3) { height: 5px; }
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  font: 500 11px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.status-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

main { min-height: calc(100vh - 74px); position: relative; z-index: 1; }
.hero {
  width: min(780px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(70px, 10vh, 116px) 0 60px;
  text-align: center;
}
.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .17em;
  font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.eyebrow span { color: var(--accent); }
h1 {
  font-size: clamp(55px, 8vw, 92px);
  line-height: .94;
  letter-spacing: -.07em;
  margin: 24px 0;
  font-weight: 720;
}
h1 em { color: var(--accent); font-style: normal; }
.intro {
  max-width: 575px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.6;
  letter-spacing: -.015em;
}
.drop-zone { margin-top: 46px; }
.drop-action {
  width: 100%;
  min-height: 132px;
  border: 1px solid #30353b;
  border-radius: 15px;
  background: rgba(18, 20, 23, .88);
  display: flex;
  align-items: center;
  padding: 25px 28px;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, background .2s, transform .2s;
}
.drop-action::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed #282d32;
  border-radius: 10px;
  pointer-events: none;
}
.drop-action:hover, .drop-zone.dragover .drop-action {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.upload-icon {
  width: 54px; height: 54px; border-radius: 12px; background: var(--accent);
  color: #10120d; display: grid; place-items: center; flex: 0 0 auto; z-index: 1;
  box-shadow: 0 8px 28px rgba(183, 243, 74, .13);
}
.upload-icon svg { width: 24px; }
.drop-copy { display: flex; flex-direction: column; margin-left: 20px; gap: 7px; z-index: 1; }
.drop-copy strong { font-size: 17px; letter-spacing: -.02em; }
.drop-copy small { color: var(--muted); font-size: 13px; }
.drop-copy u { color: var(--accent); text-underline-offset: 3px; text-decoration-color: rgba(183,243,74,.4); }
.file-badge {
  margin-left: auto; margin-right: 5px; color: var(--muted); border: 1px solid #34393f;
  border-radius: 6px; padding: 7px 9px; font: 700 10px ui-monospace, monospace; z-index: 1;
}
.trust-row {
  margin-top: 23px; display: flex; justify-content: center; gap: 30px;
  color: var(--dim); text-transform: uppercase; letter-spacing: .08em;
  font: 600 9px ui-monospace, monospace;
}
.trust-row span { display: flex; align-items: center; gap: 7px; }
.trust-row svg { width: 15px; color: #737b85; }

.progress-panel {
  width: min(700px, calc(100% - 40px)); margin: 0 auto; padding: clamp(70px, 12vh, 140px) 0;
}
.progress-top { display: flex; align-items: center; gap: 38px; }
.progress-panel .eyebrow { justify-content: flex-start; }
.progress-panel h2 { font-size: clamp(30px, 5vw, 52px); letter-spacing: -.05em; margin: 14px 0 10px; }
.progress-panel p { color: var(--muted); margin: 0; }
.file-orbit { width: 115px; height: 115px; position: relative; display: grid; place-items: center; flex: 0 0 auto; }
.orbit-ring { position: absolute; inset: 0; border: 1px solid #2e343a; border-radius: 50%; animation: spin 2s linear infinite; }
.orbit-ring::before { content: ""; position: absolute; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; top: 9px; left: 18px; box-shadow: 0 0 15px var(--accent); }
.jar-cube { width: 60px; height: 70px; border-radius: 8px; background: var(--panel-2); border: 1px solid #394048; display: grid; place-items: center; color: var(--accent); font: 800 13px ui-monospace, monospace; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 3px; background: #1e2227; margin-top: 48px; overflow: hidden; }
.progress-track i { display: block; width: 15%; height: 100%; background: var(--accent); box-shadow: 0 0 18px var(--accent); transition: width .8s ease; }
.progress-steps { display: flex; justify-content: space-between; margin-top: 15px; color: var(--dim); font: 600 9px ui-monospace, monospace; text-transform: uppercase; letter-spacing: .1em; }
.progress-steps .active { color: var(--accent); }

.workspace {
  overflow: hidden;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  border-top: 1px solid var(--line);
}
.sidebar { min-width: 0; background: #0e1012; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.project-head { height: 74px; display: flex; align-items: center; gap: 11px; padding: 0 17px; border-bottom: 1px solid var(--soft-line); }
.project-icon { width: 34px; height: 34px; background: var(--accent); color: #11150a; border-radius: 8px; display: grid; place-items: center; font-weight: 800; }
.project-head > div:nth-child(2) { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
.project-head strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.project-head span { color: var(--dim); font: 10px ui-monospace, monospace; }
.icon-button { margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; color: var(--muted); }
.icon-button:hover { color: var(--accent); border-color: #4a5537; }
.icon-button svg { width: 16px; }
.file-search { margin: 13px; height: 37px; position: relative; display: flex; align-items: center; }
.file-search svg { width: 15px; position: absolute; left: 11px; color: var(--dim); }
.file-search input { width: 100%; height: 100%; border: 1px solid var(--line); background: #131619; border-radius: 7px; outline: none; color: var(--text); padding: 0 48px 0 34px; font-size: 12px; }
.file-search input:focus { border-color: #53603d; }
.file-search kbd { position: absolute; right: 8px; color: var(--dim); border: 1px solid #30353b; background: #191c20; padding: 3px 5px; border-radius: 4px; font: 9px ui-monospace, monospace; }
.file-tree {
  flex: 1 1 0;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 0 8px 15px;
  scrollbar-color: #30353b transparent;
}
.tree-folder > button, .tree-file {
  width: 100%; border: 0; background: transparent; border-radius: 5px; min-height: 28px;
  display: flex; align-items: center; gap: 7px; color: #9ca3ad; font-size: 11px;
  cursor: pointer; text-align: left; padding-right: 8px; white-space: nowrap;
}
.tree-folder > button:hover, .tree-file:hover { background: #171a1e; color: var(--text); }
.tree-folder > button::before { content: "›"; width: 10px; color: var(--dim); font-size: 16px; transform-origin: center; transition: transform .15s; }
.tree-folder.open > button::before { transform: rotate(90deg); }
.tree-folder > button::after { content: ""; width: 13px; height: 10px; border: 1px solid #69717c; border-radius: 2px; order: -1; margin-left: 1px; opacity: .6; }
.tree-folder > .tree-children { display: none; }
.tree-folder.open > .tree-children { display: block; }
.tree-file { padding-left: calc(11px + var(--depth) * 15px); }
.tree-folder > button { padding-left: calc(8px + var(--depth) * 15px); }
.tree-file::before { content: "J"; width: 14px; height: 14px; border-radius: 3px; background: rgba(183,243,74,.1); color: var(--accent); display: grid; place-items: center; font: 700 8px ui-monospace, monospace; flex: 0 0 auto; }
.tree-file.kt::before { content: "K"; color: var(--purple); background: rgba(181,140,255,.1); }
.tree-file.active { color: var(--text); background: var(--accent-soft); }
.tree-file.pending { opacity: .48; }
.tree-file.failed { color: #ff9a9a; }
.tree-file.pending::before { content: "⌛"; font-size: 9px; color: #8d96a1; background: rgba(141,150,161,.08); }
.empty-state { color: var(--muted); padding: 18px 20px; font-size: 14px; }
.sidebar-foot { height: 41px; flex: 0 0 auto; border-top: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; padding: 0 15px; color: var(--dim); font: 9px ui-monospace, monospace; text-transform: uppercase; }
.sidebar-foot span { display: flex; align-items: center; gap: 6px; }
.sidebar-foot i, .safe-label i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.sidebar-foot b { font-weight: 500; color: #929a88; }

.editor { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #0c0e10; }
.editor-head { height: 55px; border-bottom: 1px solid var(--soft-line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px 0 23px; }
.breadcrumbs { display: flex; align-items: center; gap: 7px; min-width: 0; color: var(--dim); font: 11px ui-monospace, monospace; white-space: nowrap; overflow: hidden; }
.breadcrumbs b { color: #c9cdd2; font-weight: 500; }
.breadcrumbs i { color: #464c54; font-style: normal; }
.copy-button { display: flex; align-items: center; gap: 7px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; cursor: pointer; font-size: 10px; }
.copy-button:hover { color: var(--text); }
.copy-button svg { width: 13px; }
.editor-body { flex: 1; min-height: 0; overflow: auto; scrollbar-color: #30353b transparent; }
.editor-empty { height: 100%; display: grid; place-content: center; justify-items: center; color: var(--dim); gap: 10px; }
.editor-empty span { font: 700 38px ui-monospace, monospace; color: #282d33; }
.editor-empty p { font-size: 12px; }
.code-table { margin: 0; min-width: 100%; width: max-content; border-spacing: 0; padding: 17px 0 50px; font: 12px/1.72 "Cascadia Code", "SFMono-Regular", Consolas, monospace; tab-size: 4; }
.code-table td { vertical-align: top; }
.line-number { width: 63px; padding: 0 17px 0 10px; text-align: right; color: #3f464f; user-select: none; border-right: 1px solid #171a1e; }
.code-line { padding: 0 28px 0 19px; white-space: pre; color: #c9ced5; }
.tok-key { color: var(--purple); }
.tok-type { color: #79d5ff; }
.tok-string { color: var(--orange); }
.tok-comment { color: #59636d; font-style: italic; }
.tok-number { color: #f69bc5; }
.tok-annotation { color: #c9db71; }
.editor-status { height: 29px; flex: 0 0 auto; display: flex; align-items: center; gap: 22px; border-top: 1px solid var(--soft-line); padding: 0 16px; color: var(--dim); font: 9px ui-monospace, monospace; text-transform: uppercase; }
.safe-label { margin-left: auto; display: flex; align-items: center; gap: 7px; color: #717a69; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #e9ece4; color: #171a14; padding: 11px 16px; border-radius: 7px;
  font-size: 12px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 20; box-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ff9a91; color: #2b0e0a; }

@media (max-width: 760px) {
  .site-header { height: 64px; }
  .status-pill { display: none; }
  main { min-height: calc(100vh - 64px); }
  .hero { padding-top: 62px; }
  .drop-action { min-height: 116px; padding: 20px; }
  .upload-icon { width: 44px; height: 44px; }
  .file-badge { display: none; }
  .trust-row { gap: 14px; flex-wrap: wrap; }
  .progress-top { flex-direction: column; text-align: center; }
  .progress-panel .eyebrow { justify-content: center; }
  .workspace {
    overflow: hidden;
    height: 100%;
    grid-template-columns: 1fr;
  }
  body.workspace-mode main { height: calc(100dvh - 64px); }
  .sidebar { position: absolute; z-index: 4; width: min(88vw, 330px); height: 100%; box-shadow: 20px 0 50px rgba(0,0,0,.4); }
  .editor { grid-column: 1; }
}
