/* =========================================================
   fayza.idea — IntelliJ Darcula × 2000s web
   ========================================================= */

/* ---------- tokens ---------- */
:root {
  --bg-0: #1e1f22;      /* outer chrome */
  --bg-1: #2b2b2b;      /* editor */
  --bg-2: #3c3f41;      /* panels */
  --bg-3: #4e5254;      /* hover */
  --bg-tab: #3c3f41;
  --bg-tab-active: #2b2b2b;
  --border: #323232;
  --border-strong: #555;
  --text: #a9b7c6;
  --text-bright: #bbbbbb;
  --text-dim: #808080;
  --text-muted: #6a737d;

  /* darcula syntax */
  --kw: #cc7832;        /* orange */
  --str: #6a8759;       /* green */
  --num: #6897bb;       /* blue */
  --fn:  #ffc66d;       /* yellow */
  --type:#a9b7c6;
  --com: #808080;
  --link:#287bde;
  --link-hover:#589df6;
  --purple:#9876aa;

  /* 2000s pops */
  --hot-pink:#ff00aa;
  --acid-green:#39ff14;
  --warn-yellow:#ffe600;
  --warn-black:#111;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; }
.hidden { display: none !important; }

/* ============= SPLASH GATE (2000s) ============= */
#splash {
  position: fixed; inset: 0;
  z-index: 9999;
  background:
    radial-gradient(ellipse at center, #1a0033 0%, #000 70%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 3px);
  display: flex; align-items: center; justify-content: center;
  cursor: crosshair;
  overflow: hidden;
}
.splash-stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 60%, #fff, transparent),
    radial-gradient(2px 2px at 40% 80%, #ff00aa, transparent),
    radial-gradient(1px 1px at 85% 20%, #39ff14, transparent),
    radial-gradient(1px 1px at 10% 70%, #ffe600, transparent),
    radial-gradient(2px 2px at 55% 45%, #fff, transparent);
  animation: twinkle 1.5s steps(2) infinite;
  opacity: .8;
}
@keyframes twinkle { 50% { opacity: .3; } }

.splash-inner {
  position: relative; z-index: 1;
  text-align: center;
  padding: 32px;
  border: 4px ridge #ff00aa;
  background: rgba(0,0,0,.6);
  max-width: 560px;
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
}
.splash-title {
  margin: 6px 0 10px;
  font-size: 32px;
  color: #ffe600;
  text-shadow: 3px 3px 0 #ff00aa, 6px 6px 0 #000;
  font-weight: 700;
}
.splash-sub {
  font-size: 18px;
  color: #39ff14;
  letter-spacing: 1px;
  margin: 6px 0 16px;
}
.splash-badges {
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  margin-bottom: 14px;
}
.badge {
  font-family: 'VT323', monospace;
  font-size: 16px;
  background: #000; color: #39ff14;
  padding: 3px 8px;
  border: 1px solid #39ff14;
}
.splash-marquee {
  display: block;
  background: #000;
  color: #ffe600;
  border-top: 2px dashed #ff00aa;
  border-bottom: 2px dashed #ff00aa;
  padding: 4px 0;
  font-family: 'Comic Neue', cursive;
}

.blink { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============= IDE SHELL ============= */
#ide {
  display: grid;
  grid-template-rows: 28px 24px 36px 1fr 200px 24px;
  height: 100vh;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
}

/* ---- title bar ---- */
.title-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #4b4f52, #2f3134);
  border-bottom: 1px solid #1a1a1a;
  padding: 0 8px;
  user-select: none;
}
.tb-left { display: flex; align-items: center; gap: 8px; }
.tb-logo {
  background: linear-gradient(135deg, #f97a12 0%, #ed3d8a 45%, #1a98ff 100%);
  color: #fff; font-weight: 700;
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 2px;
  letter-spacing: 1px;
}
.tb-title { color: #c8c8c8; font-size: 12px; }
.tb-right { display: flex; gap: 2px; }
.tb-btn {
  width: 24px; height: 20px;
  background: transparent; border: 0; color: #aaa;
  font-size: 14px; cursor: pointer;
}
.tb-btn:hover { background: #5a5d60; }
.tb-btn.close:hover { background: #e81123; color: #fff; }

/* ---- menu bar ---- */
.menu-bar {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  user-select: none;
}
.menu-item {
  padding: 2px 7px; cursor: default;
  font-size: 12px;
  color: var(--text-bright);
}
.menu-item u { text-decoration: underline; }
.menu-item:hover { background: #2675bf; color: #fff; }
.menu-spacer { flex: 1; }
.menu-hit {
  font-family: 'VT323', monospace;
  font-size: 16px;
  color: #39ff14;
  background: #000;
  padding: 0 8px;
  border: 1px inset #555;
  letter-spacing: 2px;
}

/* ---- toolbar ---- */
.toolbar {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 4px 8px;
}
.tool-btn {
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  color: var(--text-bright);
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tool-btn:hover { background: #4c5052; border-color: #5a5d60; }
.tool-btn.run { color: #6cba3a; }
.tool-btn.debug { filter: hue-rotate(0deg); }
.tool-btn.stop { color: #e74848; }
.tool-sep {
  width: 1px; height: 18px; background: #555; margin: 0 4px;
}
.run-config {
  display: inline-flex; align-items: center; gap: 6px;
  background: #45494a;
  border: 1px solid #5a5d60;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 12px;
  min-width: 130px;
  cursor: pointer;
}
.run-config:hover { background: #4f5354; }
.rc-icon { color: #6cba3a; }
.rc-caret { margin-left: auto; color: #888; }
.toolbar-spacer { flex: 1; }
.toolbar-badge {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--hot-pink);
  border: 1px dashed var(--hot-pink);
  padding: 0 6px;
}

/* ---- main: sidebar + editor ---- */
.main {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
  background: var(--bg-1);
}

/* ---- sidebar ---- */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.sidebar-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  background: #313335;
}
.side-tab {
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--text-dim);
}
.side-tab.active { color: var(--text-bright); background: var(--bg-2); }
.sidebar-toolbar {
  display: flex; gap: 2px; padding: 4px;
  border-bottom: 1px solid var(--border);
}
.sidebar-toolbar button {
  width: 22px; height: 22px;
  background: transparent; border: 1px solid transparent;
  color: var(--text); cursor: pointer; border-radius: 3px;
}
.sidebar-toolbar button:hover { background: var(--bg-3); border-color: #5a5d60; }

.tree {
  flex: 1; overflow: auto;
  padding: 4px 0;
  font-size: 13px;
}
.tree-node {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.tree-node:hover { background: #2f65ca22; }
.tree-node.selected { background: #2f65ca; color: #fff; }
.tree-children { padding-left: 18px; }
.tree-children.collapsed { display: none; }
.chevron { width: 10px; display: inline-block; font-size: 9px; color: var(--text-dim); }
.icon { width: 16px; text-align: center; font-size: 11px; }
.icon.folder { color: #e8bf6a; }
.icon.md { color: #287bde; font-size: 10px; font-weight: 700; }
.label { font-size: 12px; }
.label .muted, .muted { color: var(--text-muted); font-size: 11px; }

/* under construction banner */
.uc-banner {
  border-top: 1px solid var(--border);
  padding: 8px;
  text-align: center;
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
  background: #000;
  position: relative;
  overflow: hidden;
}
.uc-stripes {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    45deg,
    var(--warn-yellow) 0 10px,
    var(--warn-black) 10px 20px
  );
  opacity: .25;
}
.uc-text {
  position: relative;
  color: var(--warn-yellow);
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}
.uc-sub {
  position: relative;
  font-size: 11px; color: var(--hot-pink);
  margin-top: 2px;
}

.webring {
  border-top: 1px solid var(--border);
  padding: 6px;
  font-family: 'Comic Neue', cursive;
  background: #2a1438;
  text-align: center;
}
.wr-title { color: #ff00aa; font-size: 11px; margin-bottom: 4px; }
.wr-btn {
  background: #000; color: #39ff14;
  border: 1px outset #39ff14;
  padding: 2px 6px;
  font-family: 'VT323', monospace;
  font-size: 13px;
  margin: 0 2px;
  cursor: pointer;
}
.wr-btn:active { border-style: inset; }

/* ---- editor column ---- */
.editor-column {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--bg-1);
}

/* tab strip */
.tabs {
  display: flex;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  min-height: 28px;
  overflow-x: auto;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-right: 1px solid var(--border);
  background: var(--bg-tab);
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  border-top: 2px solid transparent;
}
.tab:hover { color: var(--text-bright); }
.tab.active {
  background: var(--bg-tab-active);
  color: var(--text-bright);
  border-top-color: var(--hot-pink);
}
.tab .tab-icon { color: #287bde; font-weight: 700; font-size: 10px; }
.tab .tab-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px;
  border-radius: 2px; color: var(--text-dim);
  font-size: 12px;
}
.tab .tab-close:hover { background: #5a5d60; color: #fff; }
.tab.dragging { opacity: .4; }
.tab.drag-over { box-shadow: inset 2px 0 0 var(--hot-pink); }

.breadcrumbs {
  padding: 3px 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.bc-sep { margin: 0 4px; color: var(--text-muted); }

/* editor split */
.editor-split {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 4px 1fr;
  min-height: 0;
}
.pane { min-height: 0; min-width: 0; overflow: auto; background: var(--bg-1); }
.pane-divider {
  background: var(--border);
  cursor: col-resize;
}

/* code pane */
.code-pane {
  display: grid;
  grid-template-columns: 44px 1fr;
}
.gutter {
  background: #313335;
  color: var(--text-muted);
  text-align: right;
  padding: 8px 8px 8px 0;
  font-size: 12px;
  user-select: none;
  border-right: 1px solid var(--border);
  white-space: pre;
  line-height: 1.55;
}
.code {
  margin: 0;
  padding: 8px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
/* markdown syntax tokens */
.tok-h1, .tok-h2, .tok-h3 { color: var(--fn); font-weight: 700; }
.tok-hash { color: var(--kw); }
.tok-bullet { color: var(--kw); }
.tok-bold { color: var(--purple); font-weight: 700; }
.tok-italic { color: var(--num); font-style: italic; }
.tok-code { color: var(--str); background: #2f3133; padding: 0 3px; border-radius: 2px; }
.tok-link-text { color: var(--num); text-decoration: underline; }
.tok-link-url { color: var(--str); }
.tok-quote { color: var(--com); font-style: italic; }
.tok-bracket { color: var(--text-muted); }

/* preview pane */
.preview-pane { background: var(--bg-1); display: flex; flex-direction: column; }
.preview-toolbar {
  display: flex; align-items: center;
  padding: 4px 10px;
  background: #313335;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.pv-badge {
  background: var(--hot-pink); color: #000;
  font-family: 'Comic Neue', cursive;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 2px;
}
.pv-spacer { flex: 1; }
.preview {
  padding: 24px 28px;
  overflow: auto;
  color: var(--text-bright);
  font-family: 'Comic Neue', 'Comic Sans MS', cursive;
  font-size: 15px;
  line-height: 1.7;
  background:
    linear-gradient(180deg, rgba(255,0,170,.04), transparent 200px),
    var(--bg-1);
}
.preview h1, .preview h2, .preview h3 {
  font-family: 'Comic Neue', cursive;
  color: var(--warn-yellow);
  text-shadow: 2px 2px 0 var(--hot-pink);
  border-bottom: 2px dashed var(--hot-pink);
  padding-bottom: 4px;
  margin: 24px 0 12px;
}
.preview h1 { font-size: 32px; }
.preview h2 { font-size: 22px; color: var(--acid-green); text-shadow: 2px 2px 0 #000; border-bottom-color: var(--acid-green); }
.preview h3 { font-size: 17px; color: #1a98ff; text-shadow: 1px 1px 0 #000; }
.preview p { margin: 8px 0 14px; }
.preview ul { padding-left: 24px; }
.preview li { margin: 4px 0; }
.preview li::marker { color: var(--hot-pink); }
.preview a {
  color: #1a98ff;
  text-decoration: underline wavy;
}
.preview a:hover {
  color: #ff00aa;
  background: #ffe600;
}
.preview a:visited { color: #9876aa; }
.preview strong {
  color: var(--warn-yellow);
  background: linear-gradient(90deg, #ff00aa, #1a98ff, #39ff14, #ffe600);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow 3s linear infinite;
}
@keyframes rainbow { to { background-position: 300% 0; } }
.preview em { color: var(--acid-green); }
.preview code {
  background: #000;
  color: var(--acid-green);
  padding: 1px 5px;
  border: 1px solid var(--acid-green);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}
.preview blockquote {
  border-left: 4px ridge var(--hot-pink);
  background: #2a1438;
  margin: 12px 0;
  padding: 8px 14px;
  color: #ffb8e1;
  font-style: italic;
}
.preview hr { border: 0; border-top: 2px dashed var(--hot-pink); margin: 16px 0; }

/* ---- bottom panel ---- */
.bottom-panel {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  min-height: 0;
}
.bp-tabs {
  display: flex; align-items: center; gap: 0;
  background: #313335;
  border-bottom: 1px solid var(--border);
  padding: 0 4px;
}
.bp-tab {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border-top: 2px solid transparent;
}
.bp-tab.active {
  background: var(--bg-2);
  color: var(--text-bright);
  border-top-color: var(--hot-pink);
}
.bp-tab:hover { color: var(--text-bright); }
.bp-spacer { flex: 1; }
.bp-mini {
  width: 22px; height: 22px;
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
}
.bp-mini:hover { background: var(--bg-3); color: var(--text-bright); }

.terminal {
  flex: 1;
  background: #1e1f22;
  color: #cfd2d6;
  padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow: auto;
}
.term-line .prompt { color: #6cba3a; font-weight: 700; }
.term-line .path { color: #287bde; }
.term-line .cmd { color: var(--text-bright); }
.term-line.out { color: #c0c0c0; }
.term-line.err { color: #e74848; }
.term-line.info { color: var(--fn); }
.cursor { animation: blink 1s steps(2) infinite; color: #6cba3a; }

/* ---- status bar ---- */
.status-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 0 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.sb-item { padding: 0 8px; }
.sb-sep { width: 1px; height: 14px; background: #555; }
.sb-spacer { flex: 1; }
.sb-item.visitor {
  font-family: 'VT323', monospace;
  font-size: 14px;
  color: var(--warn-yellow);
  text-shadow: 0 0 4px var(--hot-pink);
}
.sb-item.lock { color: #6cba3a; }

/* ---- toasts ---- */
#toast-layer {
  position: fixed;
  right: 16px; bottom: 240px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: #2b2b2b;
  border: 1px solid var(--hot-pink);
  border-left-width: 4px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-bright);
  min-width: 220px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
  animation: toastIn .25s ease-out;
}
.toast.run { border-left-color: #6cba3a; }
.toast.debug { border-left-color: #ffc66d; }
.toast.stop { border-left-color: #e74848; }
.toast.info { border-left-color: var(--link); }
.toast .t-title { color: var(--fn); font-weight: 700; margin-bottom: 2px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ---- sparkle canvas ---- */
#sparkles {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9998;
}

/* ---- scrollbars (darcula-ish) ---- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: #4a4d4f; border: 2px solid var(--bg-1); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #5a5d60; }
::selection { background: #2f65ca; color: #fff; }

/* ---- responsive (tablets) ---- */
@media (max-width: 900px) and (min-width: 769px) {
  .main { grid-template-columns: 200px 1fr; }
  .editor-split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .pane-divider { display: none; }
  #ide { grid-template-rows: 28px 24px 36px 1fr 160px 24px; }
}

/* ============= MOBILE: preview-only with tabs ============= */
@media (max-width: 768px) {
  /* hide ide chrome entirely */
  .title-bar,
  .menu-bar,
  .toolbar,
  .sidebar,
  .breadcrumbs,
  .bottom-panel,
  .status-bar,
  .code-pane,
  .pane-divider,
  .preview-toolbar {
    display: none !important;
  }

  /* collapse ide grid to just tabs + preview */
  #ide {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    border: 0;
  }
  .main {
    flex: 1;
    min-height: 0;
    display: block;
    grid-template-columns: 1fr;
  }
  .editor-column {
    height: 100%;
  }
  .editor-split {
    display: block;
    height: calc(100% - 40px); /* minus tab strip */
  }
  .preview-pane {
    height: 100%;
    overflow: hidden;
  }

  /* tabs become the primary navigation */
  .tabs {
    min-height: 40px;
    background: var(--bg-2);
    border-bottom: 2px solid var(--hot-pink);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 0;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    padding: 10px 14px;
    font-size: 13px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
  }
  .tab.active {
    border-top-width: 3px;
  }
  .tab .tab-close { display: none; } /* can't close on mobile */
  .tab .tab-icon { font-size: 11px; }

  /* preview fills screen */
  .preview {
    padding: 18px 18px 80px;
    font-size: 16px;
    line-height: 1.75;
    height: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .preview h1 { font-size: 26px; margin-top: 8px; }
  .preview h2 { font-size: 20px; }
  .preview h3 { font-size: 16px; }

  /* splash sizing */
  .splash-inner {
    padding: 22px 18px;
    max-width: 92%;
    border-width: 3px;
  }
  .splash-title { font-size: 22px; }
  .splash-sub { font-size: 14px; }
  .badge { font-size: 13px; }
  .splash-marquee { font-size: 13px; }

  /* disable sparkles canvas on mobile (perf + irrelevant for touch) */
  #sparkles { display: none; }

  /* hide toast layer offset (no terminal underneath) */
  #toast-layer {
    right: 12px;
    bottom: 12px;
    left: 12px;
  }
  .toast { min-width: 0; width: 100%; }
}

/* konami rainbow mode */
body.konami #ide {
  animation: konami 1s linear infinite;
}
@keyframes konami {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
