/* ════════════════════════════════════════
   onHTML.com v2.0 — Main Stylesheet
   ════════════════════════════════════════ */

:root {
  --bg-0:    #0d0d10;
  --bg-1:    #141417;
  --bg-2:    #1c1c22;
  --bg-3:    #242432;
  --bg-4:    #2e2e3e;
  --bg-5:    #383850;
  --border:  #30304a;
  --border2: #3e3e58;
  --text-1:  #e4e4f2;
  --text-2:  #8888aa;
  --text-3:  #4e4e6e;
  --accent:  #7c6af7;
  --accent-h:#9882ff;
  --green:   #3ecf8e;
  --red:     #ff5f6d;
  --yellow:  #f7c948;
  --blue:    #38bdf8;
  --header-h:   52px;
  --statusbar-h: 0px;
  --sidebar-w:   48px;
  --tool-w:      290px;
  --radius:   6px;
  --radius-lg: 10px;
  --font-ui:  'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:'Cascadia Code','Fira Code','Consolas','Courier New',monospace;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,.5);
  --mobile-nav-h: 0px;
}

/* ── LIGHT MODE ── */
body.light {
  --bg-0:   #f0f0f6;
  --bg-1:   #ffffff;
  --bg-2:   #f5f5fb;
  --bg-3:   #eaeaf4;
  --bg-4:   #e0e0ee;
  --bg-5:   #d4d4e8;
  --border: #d0d0e8;
  --border2:#c0c0d8;
  --text-1: #1a1a30;
  --text-2: #5a5a7a;
  --text-3: #9898b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow: hidden; }
body { height: 100%; overflow: hidden; display: flex; flex-direction: column; font-family: var(--font-ui); background: var(--bg-0); color: var(--text-1); font-size: 13px; -webkit-text-size-adjust: 100%; touch-action: manipulation; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ════ ACCENT LINE ════ */
#accent-line {
  height: 2px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
#accent-line::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 400%; height: 100%;
  background: linear-gradient(90deg, #7c6af7, #3ecf8e, #f7c948, #ff5f6d, #38bdf8, #7c6af7);
  will-change: transform;
  transform: translateZ(0);
  animation: accentShift 8s linear infinite;
}
@keyframes accentShift {
  from { transform: translateX(0); }
  to   { transform: translateX(-25%); }
}

/* ════ HEADER ════ */
#header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--header-h);
  padding: 0 10px 0 12px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  flex-shrink: 0;
  user-select: none;
}

.hd-left  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; min-width: 0; }
.hd-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* Logo */
.logo { font-size: 18px; font-weight: 800; letter-spacing: -0.5px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.lo-angle { color: var(--text-3); font-size: 15px; font-weight: 400; }
.lo-on    { color: var(--accent); }
.lo-html  { color: var(--text-1); }

/* Hide editor-only controls until editor loads */
body:not(.editor-active) .editor-tabs,
body:not(.editor-active) #btn-run,
body:not(.editor-active) #btn-format,
body:not(.editor-active) .hd-actions,
body:not(.editor-active) .autorun-label,
body:not(.editor-active) #status-bar { display: none !important; }

/* Smooth appear when editor activates */
@keyframes hd-appear { from { opacity:0; transform:translateY(-3px); } to { opacity:1; transform:none; } }
body.editor-active .editor-tabs,
body.editor-active #btn-run,
body.editor-active #btn-format,
body.editor-active .hd-actions,
body.editor-active .autorun-label { animation: hd-appear .22s ease both; }

/* Editor Tabs */
.editor-tabs { display: flex; gap: 2px; background: var(--bg-2); border-radius: var(--radius); padding: 3px; border: 1px solid var(--border); }
.tab-btn {
  background: transparent; border: none; color: var(--text-2);
  padding: 4px 14px; border-radius: 4px; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all .15s;
  font-family: var(--font-mono); letter-spacing: .3px;
}
.tab-btn:hover { color: var(--text-1); }
.tab-btn.active { background: var(--bg-4); color: var(--text-1); box-shadow: var(--shadow-sm); }
.tab-btn[data-tab="html"].active { color: #f28c7a; }
.tab-btn[data-tab="css"].active  { color: #56c2c2; }
.tab-btn[data-tab="js"].active   { color: var(--yellow); }

/* Header Buttons */
.hd-actions { display: flex; gap: 5px; }
.hd-btn {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-1); padding: 5px 11px; border-radius: var(--radius);
  cursor: pointer; font-size: 11.5px; font-weight: 600;
  transition: all .15s; white-space: nowrap; font-family: var(--font-ui);
}
.hd-btn:hover { background: var(--bg-4); border-color: var(--border2); }
.hd-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hd-btn.primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.hd-btn.danger  { background: var(--red); border-color: var(--red); color: #fff; }
.hd-btn.danger:hover { opacity: .85; }
.icon-btn { padding: 5px 9px; }

/* Language select */
.lang-dd {
  position: relative;
  display: flex; align-items: center; gap: 5px;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-1); padding: 5px 8px; border-radius: var(--radius);
  cursor: pointer; font-size: 12px; user-select: none; outline: none;
  min-width: 64px;
}
.lang-dd:hover, .lang-dd:focus { border-color: var(--border2); background: var(--bg-4); }
.lang-dd[aria-expanded="true"] { border-color: var(--accent); }
.lang-dd-cur { display: flex; align-items: center; gap: 5px; }
.lang-dd-flag { width: 16px; height: 12px; border-radius: 1px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.lang-dd-menu li img { width: 16px; height: 12px; border-radius: 1px; display: inline-block; vertical-align: middle; flex-shrink: 0; }
.lang-dd-code { font-size: 11.5px; font-weight: 600; }
.lang-dd-arrow { color: var(--text-3); flex-shrink: 0; transition: transform .15s; }
.lang-dd[aria-expanded="true"] .lang-dd-arrow { transform: rotate(180deg); }
.lang-dd-menu {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px; list-style: none; margin: 0;
  min-width: 160px; z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.lang-dd[aria-expanded="true"] .lang-dd-menu { display: block; }
.lang-dd-menu li {
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text-1); white-space: nowrap;
  display: flex; align-items: center; gap: 2px;
}
.lang-dd-menu li:hover { background: var(--bg-3); }
.lang-dd-menu li[aria-selected="true"] { background: rgba(124,106,247,.15); color: var(--accent); font-weight: 600; }

/* Auto-run toggle (custom checkbox) */
.autorun-label {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 11px; color: var(--text-2); user-select: none;
}
.autorun-label input { display: none; }
.autorun-track {
  width: 28px; height: 15px; background: var(--bg-4); border-radius: 8px;
  position: relative; transition: background .2s; border: 1px solid var(--border);
}
.autorun-thumb {
  position: absolute; top: 1px; left: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--text-3); transition: all .2s;
}
.autorun-label input:checked ~ .autorun-track { background: var(--accent); border-color: var(--accent); }
.autorun-label input:checked ~ .autorun-track .autorun-thumb { transform: translateX(13px); background: #fff; }

/* ── Tagline ── */
.tagline {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  pointer-events: none; overflow: hidden;
}
.tl-main {
  font-size: 13.5px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; letter-spacing: -.1px;
}
.tl-hl {
  background: linear-gradient(90deg, var(--accent), var(--green));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.tl-sub {
  font-size: 10.5px; color: var(--text-3);
  white-space: nowrap; letter-spacing: .1px;
}
@media (max-width: 1100px) { .tl-sub { display: none; } }
@media (max-width: 860px)  { .tagline { display: none; } }

/* ════ APP LAYOUT ════ */
#app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* ════ SIDEBAR ════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 3px; flex-shrink: 0; z-index: 10;
}

.sb-btn {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent;
  cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; color: var(--text-2);
  position: relative;
}
.sb-btn:hover  { background: var(--bg-3); border-color: var(--border); color: var(--text-1); }
.sb-btn.active { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 0 12px rgba(124,106,247,.4); }

/* CSS tooltip on hover */
.sb-btn::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: var(--bg-4); border: 1px solid var(--border2);
  color: var(--text-1); font-size: 11px; white-space: nowrap;
  padding: 4px 9px; border-radius: var(--radius);
  opacity: 0; pointer-events: none; transition: opacity .15s;
  z-index: 200; box-shadow: var(--shadow-md);
  font-family: var(--font-ui);
}
.sb-btn:hover::after { opacity: 1; }

/* ════ TOOL PANEL ════ */
#tool-panel {
  width: var(--tool-w); background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; flex-shrink: 0;
  transition: width .22s cubic-bezier(.4,0,.2,1);
}
#tool-panel.closed { width: 0; }

#tool-panel-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg-1);
}
#tool-panel-title { font-size: 13px; font-weight: 700; color: var(--text-1); }
#tool-close {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 14px; padding: 2px 6px;
  border-radius: 4px; transition: all .15s; line-height: 1;
}
#tool-close:hover { background: var(--bg-4); color: var(--red); }

#tool-content {
  padding: 14px; overflow-y: auto; flex: 1; font-size: 12.5px;
}

/* ─ Tool internals ─ */
.tool-title { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 14px; }
.tool-row   { margin-bottom: 11px; }
.tool-row label { display: block; font-size: 10.5px; color: var(--text-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.tool-row input[type=range]  { width: 100%; accent-color: var(--accent); height: 4px; cursor: pointer; }
.tool-row input[type=color]  { width: 48px; height: 32px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; background: none; padding: 2px; }
.tool-row input[type=text],
.tool-row input[type=number],
.tool-row textarea,
.tool-row select {
  width: 100%; padding: 6px 9px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-1); font-size: 12px; font-family: var(--font-mono);
  outline: none; transition: border-color .15s;
}
.tool-row input:focus, .tool-row textarea:focus { border-color: var(--accent); }
.tool-row textarea { min-height: 80px; resize: vertical; font-family: var(--font-mono); }
.tool-row select { font-family: var(--font-ui); }

.tool-preview-box {
  width: 100%; height: 80px; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent), var(--green));
  transition: background .2s;
}

.code-output {
  background: var(--bg-0); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--green);
  word-break: break-all; margin-bottom: 8px;
  min-height: 36px; max-height: 100px; overflow-y: auto; line-height: 1.5;
}

.copy-btn {
  width: 100%; padding: 8px; background: var(--accent);
  border: none; border-radius: var(--radius); color: #fff;
  cursor: pointer; font-size: 12px; font-weight: 700;
  transition: all .15s; font-family: var(--font-ui);
}
.copy-btn:hover   { background: var(--accent-h); }
.copy-btn.success { background: var(--green) !important; }

/* Snippets */
.snippet-btn {
  display: block; width: 100%; text-align: left;
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-1); padding: 9px 11px; border-radius: var(--radius);
  cursor: pointer; font-size: 12px; margin-bottom: 6px;
  transition: all .15s; font-family: var(--font-ui);
}
.snippet-btn:hover { background: var(--bg-4); border-color: var(--accent); }
.snippet-btn strong { display: block; margin-bottom: 2px; }
.snippet-sub { font-size: 10.5px; color: var(--text-3); }

/* Gradient presets */
.grad-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 12px; }
.grad-preset {
  height: 30px; border-radius: 5px; border: 1px solid transparent;
  cursor: pointer; font-size: 9.5px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.5); transition: all .15s;
}
.grad-preset:hover { transform: scale(1.05); border-color: var(--border2); }

/* Shadow demo box */
#shadow-demo-wrap { display: flex; justify-content: center; align-items: center; height: 120px; margin-bottom: 14px; background: var(--bg-0); border-radius: var(--radius); border: 1px solid var(--border); }
#shadow-demo { width: 70px; height: 70px; border-radius: var(--radius); background: var(--accent); transition: box-shadow .1s; }

/* PX converter */
.conv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.conv-result-box { background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; text-align: center; }
.conv-result-box .val { font-size: 18px; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.conv-result-box .unit { font-size: 10px; color: var(--text-3); display: block; margin-top: 2px; }

/* ════ EDITOR ════ */
#editor-wrap { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.editor-pane { display: none; position: absolute; inset: 0; }
.editor-pane.active { display: block; }

.CodeMirror {
  height: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: 13.5px !important;
  line-height: 1.65 !important;
}

/* ════ RESIZER ════ */
#resizer {
  width: 4px; background: var(--border); cursor: col-resize; flex-shrink: 0;
  transition: background .15s; position: relative;
}
#resizer:hover, #resizer.active { background: var(--accent); }
#resizer::before {
  content: ''; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 40px; background: var(--border2);
  border-radius: 2px;
}

/* ════ PREVIEW AREA ════ */
#preview-wrap {
  width: 45%; min-width: 220px; display: flex;
  flex-direction: column; background: #fff; flex-shrink: 0;
}
body.light #preview-wrap { background: #fafafa; }

#preview-bar {
  height: 34px; background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; flex-shrink: 0;
}
.pb-left, .pb-right { display: flex; align-items: center; gap: 8px; }
.pb-dots { display: flex; gap: 5px; }
.pb-dots span { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; } .dot-y { background: #febc2e; } .dot-g { background: #28c840; }
#preview-label { font-size: 11.5px; color: var(--text-2); }

.pb-btn {
  background: none; border: none; color: var(--text-2);
  cursor: pointer; font-size: 11px; padding: 3px 9px;
  border-radius: 4px; transition: all .15s; display: flex; align-items: center; gap: 5px;
  font-family: var(--font-ui);
}
.pb-btn:hover { background: var(--bg-3); color: var(--text-1); }
.pb-btn.active { color: var(--accent); }

/* Preview loading bar */
#preview-loader {
  width: 60px; height: 2px; background: var(--accent);
  border-radius: 1px; opacity: 0; transition: opacity .2s;
  overflow: hidden;
}
#preview-loader.running {
  opacity: 1;
  animation: loaderPulse .8s ease infinite alternate;
}
@keyframes loaderPulse { from { opacity: .3; } to { opacity: 1; } }

#preview-frame { flex: 1; border: none; width: 100%; display: block; }

/* Console badge */
.badge {
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 800;
  border-radius: 9px; padding: 1px 5px;
  min-width: 16px; text-align: center;
}
.badge.hidden { display: none; }
.badge.warn { background: var(--yellow); color: #000; }

/* ── Console Panel ── */
#console-panel {
  background: var(--bg-0); border-top: 1px solid var(--border);
  height: 170px; display: flex; flex-direction: column; flex-shrink: 0;
  overflow: hidden; transition: height .22s cubic-bezier(.4,0,.2,1);
}
#console-panel.closed { height: 0; }
#console-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 12px; border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--text-2); flex-shrink: 0;
  background: var(--bg-1);
}
#console-hdr button {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 11px; padding: 2px 6px; border-radius: 4px; transition: all .15s;
  font-family: var(--font-ui);
}
#console-hdr button:hover { background: var(--bg-3); color: var(--text-1); }
#console-output { flex: 1; overflow-y: auto; padding: 4px 0; }
.console-entry {
  display: flex; align-items: baseline; gap: 8px; padding: 3px 12px;
  border-bottom: 1px solid var(--border); font-size: 11.5px; font-family: var(--font-mono);
  transition: background .1s;
}
.console-entry:hover { background: var(--bg-1); }
.console-entry.log   { color: var(--text-1); }
.console-entry.warn  { color: var(--yellow); background: rgba(247,201,72,.04); }
.console-entry.error { color: var(--red);    background: rgba(255,95,109,.06); }
.console-entry.info  { color: var(--blue); }
.con-time  { font-size: 9.5px; color: var(--text-3); flex-shrink: 0; min-width: 60px; }
.con-level {
  font-size: 9px; font-weight: 800; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; flex-shrink: 0;
}
.log   .con-level { background: var(--bg-3);              color: var(--text-2); }
.warn  .con-level { background: rgba(247,201,72,.15);     color: var(--yellow); }
.error .con-level { background: rgba(255,95,109,.15);     color: var(--red); }
.info  .con-level { background: rgba(56,189,248,.15);     color: var(--blue); }
.con-msg { flex: 1; word-break: break-word; }
.console-empty { padding: 14px 12px; font-size: 11px; color: var(--text-3); font-style: italic; }

/* ── Tools Hub ── */
#tools-hub {
  flex-shrink: 0;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.th-header {
  display: flex; align-items: center; justify-content: space-between;
}
.th-title {
  font-size: 11.5px; font-weight: 700;
  color: var(--text-1); letter-spacing: .3px;
}
.th-all {
  font-size: 10.5px; color: var(--accent);
  text-decoration: none; font-weight: 700;
  transition: opacity .15s;
}
.th-all:hover { opacity: .7; }
.th-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.th-cat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 4px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; text-decoration: none;
  transition: all .15s;
}
.th-cat:hover {
  background: rgba(124,106,247,.12);
  border-color: rgba(124,106,247,.4);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124,106,247,.2);
}
.th-icon { font-size: 16px; line-height: 1; font-family: var(--font-ui); }
.th-name {
  font-size: 10px; font-weight: 700;
  color: var(--text-2); letter-spacing: .3px;
}
.th-cat:hover .th-name { color: var(--accent); }
.th-links {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px;
}
.th-link {
  font-size: 11px; color: var(--text-2); text-decoration: none;
  padding: 4px 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; transition: color .15s;
  display: flex; align-items: center; gap: 4px;
}
.th-link::before {
  content: '→'; color: var(--accent); opacity: .6;
  font-size: 10px; flex-shrink: 0;
}
.th-link:hover { color: var(--accent); }
.th-cta {
  display: block; text-align: center; padding: 9px;
  background: linear-gradient(135deg, rgba(124,106,247,.12), rgba(62,207,142,.08));
  border: 1px solid rgba(124,106,247,.28);
  border-radius: 8px; font-size: 12px; font-weight: 700;
  color: var(--accent); text-decoration: none; transition: all .2s;
}
.th-cta:hover {
  background: linear-gradient(135deg, rgba(124,106,247,.22), rgba(62,207,142,.15));
  border-color: rgba(124,106,247,.5);
  transform: translateY(-1px);
}

/* ════ STATUS BAR ════ */
#status-bar { display: none !important; }
.stb-left, .stb-right { display: flex; align-items: center; gap: 6px; }
.stb-item { font-size: 11px; color: rgba(255,255,255,.75); cursor: default; }
.stb-mode { font-weight: 800; color: #fff; }
.stb-sep  { color: rgba(255,255,255,.25); font-size: 10px; }
.st-save  { color: rgba(255,255,255,.65); }
.st-save.dirty { color: #ffe082; }
.stb-right .stb-item:last-child { color: rgba(255,255,255,.5); }
body.light #status-bar { background: #5a4ed4; }

/* ════ MODAL ════ */
#modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.65); backdrop-filter: blur(3px);
}
#modal-overlay.open { display: block; }

.modal {
  display: none; position: fixed; z-index: 600;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(960px, 93vw); max-height: 82vh;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  flex-direction: column; box-shadow: var(--shadow-md);
}
.modal.open { display: flex; }
.modal-sm { width: min(420px, 90vw); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--bg-1);
}
.modal-header h2 { font-size: 15px; font-weight: 700; }
.modal-close {
  background: var(--bg-4); border: 1px solid var(--border);
  color: var(--text-2); width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; font-size: 13px; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui);
}
.modal-close:hover { background: var(--red); border-color: var(--red); color: #fff; }

.modal-tabs {
  display: flex; border-bottom: 1px solid var(--border); padding: 0 18px;
  flex-shrink: 0; background: var(--bg-1); gap: 2px;
}
.mtab {
  background: none; border: none; color: var(--text-2);
  padding: 9px 14px; cursor: pointer; font-size: 12.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: all .15s; font-weight: 600; font-family: var(--font-ui);
}
.mtab:hover { color: var(--text-1); }
.mtab.active { color: var(--accent); border-bottom-color: var(--accent); }

.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.modal-desc { color: var(--text-2); margin-bottom: 16px; font-size: 13px; }
.modal-actions { display: flex; gap: 10px; }

/* Cheatsheet */
.cs-section { margin-bottom: 24px; }
.cs-section h3 { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 10px; font-weight: 800; }
.cs-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cs-table th { background: var(--bg-3); color: var(--text-2); padding: 7px 12px; text-align: left; font-weight: 700; font-size: 11px; }
.cs-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); }
.cs-table tr:hover td { background: var(--bg-3); }
.cs-table code { font-family: var(--font-mono); color: var(--accent); font-size: 11.5px; }

/* Category header rows in cheatsheet tables */
.cs-cat-row td {
  background: var(--bg-4); color: var(--accent);
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.5px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
/* Wide 3-column CSS props table */
.cs-wide th:nth-child(2), .cs-wide td:nth-child(2) { width: 34%; }
.cs-example { color: var(--green) !important; font-size: 10.5px; display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 6px; }
.color-swatch {
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); transition: all .15s;
}
.color-swatch:hover { transform: scale(1.06); border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.swatch-box { height: 38px; }
.swatch-info { background: var(--bg-3); padding: 4px 6px; }
.swatch-name { font-size: 9.5px; color: var(--text-2); display: block; }
.swatch-hex  { font-size: 9.5px; color: var(--text-1); font-family: var(--font-mono); display: block; }

/* ════ TOAST ════ */
#toast {
  position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%);
  background: var(--bg-4); border: 1px solid var(--border2);
  color: var(--text-1); padding: 8px 20px; border-radius: 20px;
  font-size: 12.5px; z-index: 9999; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  transform: translateX(-50%) translateY(6px);
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ════════════════════════════════════════
   RESPONSIVE — DESKTOP BREAKPOINTS
   ════════════════════════════════════════ */
@media (max-width: 960px)  {
  #btn-new, #btn-cheatsheet, #btn-share, #btn-download { display: none; }
  .hd-btn { padding: 5px 9px; font-size: 11px; }
}
@media (max-width: 820px) {
  #preview-wrap { min-width: 180px; }
  .tagline { display: none; }
}

/* ════════════════════════════════════════
   MOBILE ( ≤ 768px )
   ════════════════════════════════════════ */
#mobile-nav  { display: none; }
#sheet-title { display: none; }

/* Hide mobile nav until editor actually loads */
body:not(.editor-active) #mobile-nav { display: none !important; }

@media (max-width: 768px) {
  :root { --mobile-nav-h: 58px; }

  /* ── APP: fills viewport minus header and nav ── */
  #app {
    flex: none;
    height: calc(100dvh - var(--header-h) - var(--mobile-nav-h));
    overflow: hidden;
    flex-direction: row;
  }
  /* Before editor loads, nav doesn't exist — give #app full height */
  body:not(.editor-active) #app {
    height: calc(100dvh - var(--header-h));
  }
  /* Footer: visible on landing, hidden when editor active on mobile */
  body.editor-active #lc-footer { display: none !important; }
  #sidebar    { display: none; }
  #tool-panel { display: none; }
  #resizer    { display: none; }

  /* Editor fills #app; panes are absolutely positioned inside it */
  #editor-wrap {
    flex: 1;
    width: 100% !important;
    min-width: 0;
    position: relative;
    overflow: hidden;
  }
  /* Preview hidden by default; shown when body gets .m-preview */
  #preview-wrap {
    display: none;
    width: 100% !important;
    min-width: 0;
    flex: 1;
    flex-direction: column;
  }
  body.m-preview #editor-wrap  { display: none; }
  body.m-preview #preview-wrap { display: flex; }

  /* ── HEADER ── */
  #header { gap: 5px; padding: 0 8px; }
  .hd-left { gap: 5px; flex-wrap: nowrap; }
  .hd-actions  { display: none; }
  .editor-tabs { display: none; }
  .tagline     { display: none; }
  .autorun-label { display: none; }
  .logo { font-size: 15px; }
  .lang-dd { font-size: 11px; padding: 4px 6px; min-width: unset; }
  .lang-dd-code { display: none; }
  #btn-run, #btn-format {
    padding: 6px 12px; font-size: 12px;
    min-height: 34px; flex-shrink: 0;
    touch-action: manipulation;
  }
  #status-bar { display: none; }

  /* ── MOBILE BOTTOM NAV ── */
  #mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-1);
    border-top: 2px solid var(--border);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mnav-btn {
    flex: 1;
    height: var(--mobile-nav-h);
    background: none; border: none; border-top: 3px solid transparent;
    color: var(--text-3); font-size: 10px; font-weight: 700;
    letter-spacing: .2px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 0; min-width: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    transition: color .15s, background .15s, border-color .15s;
  }
  .mnav-icon {
    font-size: 16px; line-height: 1;
    font-family: var(--font-mono); font-weight: 900;
    display: block;
  }
  .mnav-label { display: block; font-size: 9.5px; letter-spacing: .3px; }
  .mnav-btn.active {
    color: var(--accent);
    border-top-color: var(--accent);
    background: rgba(124,106,247,.07);
  }
  .mnav-btn:active { background: var(--bg-3); }

  /* Preview tab: green accent */
  .mnav-preview.active { color: var(--green); border-top-color: var(--green); background: rgba(62,207,142,.07); }

  /* Menu tab: always slightly brighter to invite tapping */
  .mnav-menu { border-left: 1px solid var(--border); }
  .mnav-menu .mnav-icon { font-family: var(--font-ui); }
  .mnav-chevron {
    display: inline-block;
    transition: transform .28s cubic-bezier(.4,0,.2,1);
  }
  /* When sheet is open, chevron points down (closed) */
  #mnav-tools.sheet-open .mnav-chevron { transform: rotate(180deg); }
  #mnav-tools.sheet-open { color: var(--accent); border-top-color: var(--accent); }

  /* ── PREVIEW on mobile ── */
  #preview-bar { height: 40px; flex-shrink: 0; }
  #preview-frame { flex: 1; min-height: 0; }
  #preview-wrap #tools-hub { display: none; }
  #console-panel { height: 130px; flex-shrink: 0; }

  /* ── EDITOR: CodeMirror fills the absolute pane ── */
  .CodeMirror { font-size: 13px !important; height: 100% !important; }

  /* ── iOS: prevent auto-zoom on input focus (min 16px) ── */
  input, select, textarea { font-size: 16px !important; }
  .tool-row input[type=text],
  .tool-row input[type=number],
  .tool-row textarea,
  .tool-row select { font-size: 16px; }

  /* ── TOAST: sits above nav bar ── */
  #toast { bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 10px); }

  /* ── MODALS: slide up from bottom ── */
  .modal {
    width: 100% !important; max-width: 100% !important;
    height: 88dvh; max-height: 88dvh;
    top: auto !important; bottom: 0 !important;
    left: 0 !important; transform: none !important;
    border-radius: 16px 16px 0 0; margin: 0;
  }
  .modal-sm { height: auto; max-height: 72dvh; }
  .modal-header { padding: 12px 14px; }
  .modal-header h2 { font-size: 14px; }
  .modal-tabs { padding: 0 10px; }
  .mtab { padding: 8px 10px; font-size: 12px; }
  .modal-body { padding: 12px 14px; }

  /* ── CHEATSHEET TABLE on mobile ── */
  .cs-table { font-size: 11px; }
  .cs-table td, .cs-table th { padding: 7px 8px; }
  .cs-example { font-size: 10px; }
  .cs-wide th:nth-child(3), .cs-wide td:nth-child(3) { display: none; }
}

/* ════ MOBILE SIDE DRAWER ════ */
#mobile-sheet { display: none; }
#sheet-title  { display: none; }
#sheet-header { display: none; }

@media (max-width: 768px) {
  /* Backdrop: full-screen dim layer */
  #mobile-sheet {
    display: block;
    position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .28s;
  }
  #mobile-sheet.open {
    opacity: 1;
    pointer-events: all;
  }
  /* Hide the old backdrop child — the parent IS the backdrop now */
  #sheet-backdrop { display: none; }

  /* Drawer panel: fixed to viewport directly, slides from RIGHT */
  #sheet-panel {
    position: fixed;
    top: 0; right: 0;
    height: 100dvh;
    width: min(300px, 82vw);
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -8px 0 32px rgba(0,0,0,.45);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 501;
    pointer-events: all;
  }
  #mobile-sheet.open #sheet-panel { transform: translateX(0); }

  /* Drawer header */
  #sheet-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; background: var(--bg-1);
  }
  #sheet-title {
    display: block;
    font-size: 10px; font-weight: 800; letter-spacing: 2px;
    color: var(--accent); text-transform: uppercase;
  }
  #sheet-close {
    background: var(--bg-3); border: 1px solid var(--border);
    color: var(--text-2); width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s; font-family: var(--font-ui);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #sheet-close:active { background: var(--red); border-color: var(--red); color: #fff; }

  /* Drawer tool list */
  #sheet-tool-btns {
    display: flex; flex-direction: column;
    overflow-y: auto;
    flex: 1;
    padding: 8px 0;
  }
  .stb-divider {
    height: 1px; background: var(--border);
    margin: 6px 16px;
    flex-shrink: 0;
  }
  .sheet-tool-btn {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px;
    background: none; border: none;
    color: var(--text-1); font-size: 14px; font-weight: 600;
    text-align: left; cursor: pointer;
    font-family: var(--font-ui);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px; flex-shrink: 0;
    transition: background .12s;
    border-left: 3px solid transparent;
  }
  .stb-icon  { font-size: 20px; flex-shrink: 0; width: 26px; text-align: center; }
  .stb-label { flex: 1; }
  .sheet-tool-btn:active,
  .sheet-tool-btn:hover  { background: var(--bg-3); border-left-color: var(--accent); }

  /* ── TOOL PANEL: full-screen overlay on mobile ── */
  #tool-panel.mobile-open {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; right: 0;
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom));
    z-index: 600;
    width: 100% !important; max-width: 100%;
    flex-direction: column;
    background: var(--bg-2);
  }
  #tool-panel.mobile-open #tool-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ════ TOUCH TARGETS ════ */
@media (pointer: coarse) {
  .tab-btn, .hd-btn, .sb-btn, .copy-btn, .snippet-btn {
    min-height: 40px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  input[type=range] { height: 28px; }
  .snippet-btn { min-height: 48px; }
  .copy-btn { min-height: 44px; }
  .modal-close { width: 36px; height: 36px; font-size: 15px; }
}

/* ════ COMPACT HEADER BUTTONS on mobile ════
   Hide button text, show only icon via ::after so TR/long translations don't overflow */
@media (max-width: 768px) {
  #btn-run, #btn-format {
    font-size: 0;           /* hides translated text */
    min-width: 38px;
    width: 38px;
    padding: 0;
    justify-content: center;
    align-items: center;
    overflow: hidden;
  }
  #btn-run::after    { content: '▶';  font-size: 15px; }
  #btn-format::after { content: '⚡'; font-size: 15px; }
}

/* ════ VERY SMALL SCREENS ( ≤ 360px ) ════ */
@media (max-width: 360px) {
  .logo { font-size: 13px; }
  .lang-dd { display: none; }
  #btn-theme { display: none; }
  .mnav-label { font-size: 8.5px; }
  #sheet-tool-btns { grid-template-columns: 1fr 1fr; }
  #header { overflow: hidden; }
  .hd-left { gap: 4px; min-width: 0; overflow: hidden; }
  .hd-right { gap: 4px; flex-shrink: 0; }
}

/* ════ iOS SCROLL / TOUCH FIXES ════ */
@supports (-webkit-overflow-scrolling: touch) {
  #tool-content, #sheet-tool-btns, .modal-body, #console-output {
    -webkit-overflow-scrolling: touch;
  }
  #preview-frame { -webkit-overflow-scrolling: touch; }
}

/* ════ TOOLS FAB ════ */
#tools-fab {
  position: fixed;
  bottom: calc(var(--statusbar-h) + 14px);
  right: 24px;
  z-index: 800;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 20px;
  background: linear-gradient(135deg, #7c6af7 0%, #9882ff 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .2px;
  box-shadow: 0 4px 20px rgba(124,106,247,.55);
  transition: transform .22s cubic-bezier(.16,1,.3,1), box-shadow .22s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  isolation: isolate;
}
#tools-fab::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 56px;
  background: radial-gradient(ellipse at center, rgba(124,106,247,.55) 0%, transparent 70%);
  z-index: -1;
  will-change: opacity;
  transform: translateZ(0);
  animation: fab-glow 2.8s ease-in-out infinite;
}
@keyframes fab-glow {
  0%, 100% { opacity: 0.2; }
  50%       { opacity: 1; }
}
#tools-fab:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 10px 40px rgba(124,106,247,.85);
}
#tools-fab:hover::before { animation: none; opacity: 0.8; }
#tools-fab:active { transform: scale(.96); }
.fab-icon { font-size: 15px; line-height: 1; }
.fab-txt  { font-size: 12.5px; white-space: nowrap; }

@media (max-width: 768px) {
  #tools-fab {
    bottom: calc(var(--mobile-nav-h) + env(safe-area-inset-bottom) + 14px);
    right: 14px;
    padding: 10px 16px;
    gap: 6px;
  }
  .fab-txt { font-size: 12px; }
}

/* ════ LANDING CARD ════ */
#landing-card {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; will-change: opacity; transition: opacity .4s ease;
  background: var(--bg-0); padding: 24px 32px;
}
#landing-card.fade-out { opacity: 0; pointer-events: none; }
#landing-card.hidden   { display: none; }

.lc-orb {
  position: absolute; border-radius: 50%; pointer-events: none;
  will-change: transform; transform: translateZ(0);
}
.lc-orb-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,106,247,.14) 0%, transparent 65%);
  top: -200px; right: 0; animation: lc-float 8s ease-in-out infinite;
}
.lc-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(62,207,142,.10) 0%, transparent 65%);
  bottom: -150px; left: -60px; animation: lc-float 10s ease-in-out infinite reverse;
}
@keyframes lc-float {
  0%, 100% { transform: translateY(0) translateZ(0); opacity: .6; }
  50%       { transform: translateY(-24px) translateZ(0); opacity: 1; }
}

.lc-inner {
  display: grid;
  grid-template-columns: 400px 1fr;
  grid-template-rows: auto auto;
  column-gap: 52px; row-gap: 20px;
  max-width: 1080px; width: 100%; position: relative; z-index: 1;
}
.lc-left  { grid-column: 1; grid-row: 1; min-width: 0; }
.lc-right { grid-column: 2; grid-row: 1 / 3; min-width: 0; align-self: center; }

.lc-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.lc-logo-link {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px;
  font-family: var(--font-mono); text-decoration: none; line-height: 1;
}
.lc-logo-link .lo-angle { color: var(--text-3); font-weight: 400; }
.lc-logo-link .lo-on    { color: var(--accent); }
.lc-logo-link .lo-html  { color: var(--text-1); }
.lc-free-tag {
  font-size: 11px; color: #4ade80; font-weight: 600;
  background: rgba(74,222,128,.1); border: 1px solid rgba(74,222,128,.25);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}

.lc-heading {
  font-size: 28px; font-weight: 800; line-height: 1.25;
  color: var(--text-1); margin: 0 0 12px;
}
.lc-subtitle { font-size: 14px; color: var(--text-2); line-height: 1.6; margin: 0 0 18px; }

.lc-bullets { list-style: none; margin: 0 0 22px; display: flex; flex-direction: column; gap: 8px; }
.lc-bullets li { font-size: 13px; color: var(--text-2); display: flex; align-items: flex-start; gap: 6px; line-height: 1.4; }

.lc-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.lc-cta-btn {
  background: linear-gradient(135deg, var(--accent), #9882ff);
  color: #fff; border: none; padding: 12px 24px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: var(--font-ui);
  box-shadow: 0 4px 18px rgba(124,106,247,.4); white-space: nowrap;
  transition: transform .15s, box-shadow .15s;
}
.lc-cta-btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(124,106,247,.55); }
.lc-cta-btn:active { transform: scale(.97); }
.lc-tools-btn {
  background: var(--bg-3); border: 1px solid var(--border);
  color: var(--text-2); padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.lc-tools-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(124,106,247,.06); }

.lc-stats { display: flex; gap: 28px; }
.lc-stat  { display: flex; flex-direction: column; gap: 2px; }
.lc-stat-num { font-size: 22px; font-weight: 800; color: var(--accent); font-family: var(--font-mono); line-height: 1; }
.lc-stat-lbl { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .8px; white-space: nowrap; }

/* Tool showcase */
.lc-tool-showcase { grid-column: 1; grid-row: 2; padding-top: 16px; border-top: 1px solid var(--border); }
.lc-ts-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin-bottom: 10px; }
.lc-ts-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.lc-ts-card.lc-ts-mobile { display: none; }
.lc-ts-card {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 12px 6px 10px; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 12px; text-decoration: none; color: var(--text-1);
  position: relative; overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s cubic-bezier(.22,.68,0,1.2);
}
.lc-ts-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), #9882ff);
  opacity: 0; transition: opacity .2s;
}
.lc-ts-card:hover { border-color: rgba(124,106,247,.5); box-shadow: 0 6px 20px rgba(124,106,247,.18); transform: translateY(-3px); }
.lc-ts-card:hover::before { opacity: 1; }
.lc-ts-ico-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: rgba(124,106,247,.12); font-size: 16px; line-height: 1;
  font-family: var(--font-mono); font-weight: 900; color: var(--accent);
  transition: background .2s;
}
.lc-ts-card:hover .lc-ts-ico-wrap { background: rgba(124,106,247,.22); }
.lc-ts-icon { line-height: 1; }
.lc-ts-name { font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.25; color: var(--text-2); }
.lc-ts-more-wrap a:hover {
  background: linear-gradient(135deg,rgba(124,106,247,.28),rgba(152,130,255,.28)) !important;
  box-shadow: 0 4px 22px rgba(124,106,247,.35) !important;
}

/* Demo window */
.lc-demo-wrap {
  width: 100%; position: relative; z-index: 1;
  border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: 0 8px 40px rgba(0,0,0,.45);
  cursor: pointer; transition: box-shadow .2s, transform .2s;
}
.lc-demo-wrap:hover { box-shadow: 0 14px 52px rgba(124,106,247,.28); transform: translateY(-3px); }
.lc-demo-bar {
  background: var(--bg-2); padding: 9px 14px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--border);
}
.lc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lc-dot-r { background: #ff5f57; } .lc-dot-y { background: #febc2e; } .lc-dot-g { background: #28c840; }
.lc-demo-label { font-size: 11px; color: var(--text-3); margin: 0 auto; font-family: var(--font-mono); }
.lc-demo-frame { width: 100%; height: 280px; border: none; display: block; background: #08080f; pointer-events: none; }

/* ── Responsive ── */
@media (max-width: 960px) {
  .lc-inner { grid-template-columns: 340px 1fr; column-gap: 32px; }
  .lc-heading { font-size: 24px; }
}
@media (max-width: 768px) {
  #landing-card { padding: 16px; overflow-y: auto; align-items: flex-start; }
  .lc-inner { grid-template-columns: 1fr; grid-template-rows: auto auto auto; row-gap: 20px; }
  .lc-left  { grid-column: 1; grid-row: 1; }
  .lc-right { grid-column: 1; grid-row: 2; align-self: auto; }
  .lc-tool-showcase { grid-column: 1; grid-row: 3; border-top: 1px solid var(--border); }
  .lc-ts-cards { grid-template-columns: repeat(3,1fr); }
  .lc-ts-mobile { display: flex; }
  .lc-heading { font-size: 22px; }
  .lc-demo-frame { height: 200px; }
}
@media (max-width: 480px) {
  .lc-orb { display: none; }
  .lc-heading { font-size: 20px; }
  .lc-stats { gap: 16px; }
}
@media (max-width: 380px) { .lc-demo-wrap { display: none; } }


/* Respect motion preference */
@media (prefers-reduced-motion: reduce) {
  .lc-orb { animation: none; }
  body.editor-active .editor-tabs, body.editor-active #btn-run,
  body.editor-active #btn-format, body.editor-active .hd-actions,
  body.editor-active .autorun-label { animation: none; }
}

/* ── GitHub Star Link (shared) ── */
.gh-star-link {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none !important; color: var(--text-2) !important;
  font-size: 12px; opacity: .8;
  padding: 4px 11px; border: 1px solid var(--border);
  border-radius: 999px;
  transition: opacity .2s, transform .2s, border-color .2s, color .2s;
}
.gh-star-link:hover { opacity: 1 !important; transform: scale(1.02); border-color: #7c3aed !important; color: #7c6af7 !important; }
.gh-star-count { font-variant-numeric: tabular-nums; padding-left: 6px; border-left: 1px solid var(--border); margin-left: 2px; }
@media (max-width: 640px) { .gh-star-count { display: none !important; } }

/* ── Landing page footer ── */
.tool-footer {
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}
.tool-footer a { color: var(--text-3); text-decoration: none; }
.tool-footer a:hover { color: var(--accent); }
#lc-footer { flex-shrink: 0; }
