/* ============================================================
   File Editor — core styles
   Palette: #121212 base (95% coverage).
   Only two other shades: #0e0e0e (darkest) and #161616 (lightest).
   Single restrained accent for caret + selection.
   ============================================================ */

.fe {
  --fe-bg:        #121212;
  --fe-bg-dark:   #0e0e0e;
  --fe-bg-light:  #161616;

  --fe-fg:        rgba(255, 255, 255, 0.87);
  --fe-fg-dim:    rgba(255, 255, 255, 0.58);
  --fe-fg-faint:  rgba(255, 255, 255, 0.34);
  --fe-divider:   rgba(255, 255, 255, 0.07);
  --fe-hover:     rgba(255, 255, 255, 0.05);

  --fe-accent:    #a8c7fa;
  --fe-sel:       rgba(168, 199, 250, 0.20);

  --fe-line-h:    20px;
  --fe-font-size: 13px;
  --fe-gutter-w:  52px;
  --fe-mono: "Roboto Mono", "SFMono-Regular", "SF Mono", Menlo,
             Consolas, "Liberation Mono", monospace;

  position: relative;
  overflow: hidden;
  background: var(--fe-bg);
  color: var(--fe-fg);
  font-family: var(--fe-mono);
  font-size: var(--fe-font-size);
  line-height: var(--fe-line-h);
  contain: layout style paint;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.fe,
.fe *,
.fe *::before,
.fe *::after { box-sizing: border-box; }

/* ------------------------------------------------------------
   Scroll surface
   ------------------------------------------------------------ */
.fe-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  outline: none;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.fe-scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.fe-scroll::-webkit-scrollbar-track { background: transparent; }
.fe-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border: 3px solid transparent;
  border-radius: 8px;
  background-clip: content-box;
}
.fe-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.24);
  background-clip: content-box;
}
.fe-scroll::-webkit-scrollbar-corner { background: transparent; }

/* ------------------------------------------------------------
   Virtual canvas — its size drives the real scrollbars
   ------------------------------------------------------------ */
.fe-content {
  position: relative;
  min-width: 100%;
  will-change: transform;
}

/* ------------------------------------------------------------
   Row stack — one transform moves the whole visible block
   z-index 2 keeps the sticky gutter above the selection layer
   ------------------------------------------------------------ */
.fe-rows {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  will-change: transform;
}

.fe-row {
  display: flex;
  height: var(--fe-line-h);
  line-height: var(--fe-line-h);
  white-space: pre;
  contain: layout style;
}

.fe-gutter {
  position: sticky;
  left: 0;
  z-index: 2;
  flex: 0 0 auto;
  min-width: var(--fe-gutter-w);
  padding: 0 12px;
  text-align: right;
  color: var(--fe-fg-faint);
  background: var(--fe-bg);
  font-variant-numeric: tabular-nums;
  user-select: none;
  pointer-events: none;
  transition: color 120ms ease;
}

.fe-row:hover .fe-gutter { color: var(--fe-fg-dim); }

.fe-text {
  flex: 1 0 auto;
  padding-right: 32px;
  white-space: pre;
  color: var(--fe-fg);
}

/* ------------------------------------------------------------
   Selection layer
   ------------------------------------------------------------ */
.fe-selection {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.fe-sel-rect {
  position: absolute;
  top: 0;
  left: 0;
  height: var(--fe-line-h);
  background: var(--fe-sel);
  border-radius: 2px;
  will-change: transform, width;
}

/* ------------------------------------------------------------
   Caret
   ------------------------------------------------------------ */
.fe-caret {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: var(--fe-line-h);
  background: var(--fe-accent);
  border-radius: 1px;
  pointer-events: none;
  z-index: 3;
  will-change: transform;
  opacity: 1;
}

.fe.is-focused .fe-caret {
  animation: fe-blink 1.1s steps(1, end) infinite;
}

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

.fe:not(.is-focused) .fe-caret {
  animation: none;
  background: var(--fe-fg-faint);
}

/* ------------------------------------------------------------
   Hidden input sink — used for IME, paste, copy, cut
   ------------------------------------------------------------ */
.fe-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  outline: none;
  resize: none;
  opacity: 0.01;
  color: transparent;
  background: transparent;
  caret-color: transparent;
  font: inherit;
  overflow: hidden;
  white-space: pre;
  pointer-events: none;
  z-index: 0;
}

/* ------------------------------------------------------------
   Active line — only the gutter marker changes; the row itself
   stays on the base surface so #121212 keeps its 95% coverage.
   ------------------------------------------------------------ */
.fe-row.fe-row-active .fe-gutter {
  color: var(--fe-accent);
  background: var(--fe-bg);
}

.fe-row.fe-row-active .fe-text {
  background: var(--fe-bg-light);
}

/* ------------------------------------------------------------
   Token colors — muted, monochrome-leaning, one warm accent
   ------------------------------------------------------------ */
.fe-tk-p    { color: var(--fe-fg); }
.fe-tk-id   { color: var(--fe-fg); }
.fe-tk-num  { color: #d7b9a8; }
.fe-tk-str  { color: #b8c9a8; }
.fe-tk-kw   { color: #a8c7fa; }
.fe-tk-fn   { color: #d8c8a8; }
.fe-tk-op   { color: var(--fe-fg-dim); }
.fe-tk-punc { color: var(--fe-fg-dim); }
.fe-tk-com  { color: var(--fe-fg-faint); font-style: italic; }

/* ------------------------------------------------------------
   Degrade modes — set from JS when a file is too big
   ------------------------------------------------------------ */
.fe.fe-lite .fe-tk-id,
.fe.fe-lite .fe-tk-num,
.fe.fe-lite .fe-tk-str,
.fe.fe-lite .fe-tk-kw,
.fe.fe-lite .fe-tk-fn,
.fe.fe-lite .fe-tk-op,
.fe.fe-lite .fe-tk-punc,
.fe.fe-lite .fe-tk-com { color: var(--fe-fg); font-style: normal; }

.fe.fe-no-gutter .fe-gutter { display: none; }

/* ------------------------------------------------------------
   Modifiers
   ------------------------------------------------------------ */
.fe.fe-readonly .fe-caret { background: var(--fe-fg-faint); }