:root {
  color-scheme: dark;
  --bg: #07101f;
  --bg-soft: #0b1628;
  --panel: #0d192b;
  --panel-2: #101e33;
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef8;
  --muted: #94a3b8;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --cyan: #22d3ee;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% -10%, rgba(37, 99, 235, .22), transparent 30%),
    radial-gradient(circle at 100% 20%, rgba(34, 211, 238, .09), transparent 25%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, select { color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: 74px;
  padding: 0 clamp(18px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 31, .83);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .25);
}
.brand strong { display: block; letter-spacing: .09em; font-size: .94rem; }
.brand small { display: block; color: var(--muted); margin-top: 2px; font-size: .74rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.connection-pill {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .78rem;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 10px;
}
.connection-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.connection-pill[data-state="ok"] .dot { background: var(--success); box-shadow: 0 0 12px rgba(34,197,94,.55); }
.connection-pill[data-state="error"] .dot { background: var(--danger); }
.ghost-btn, .secondary-btn, .icon-btn, .select-button, select {
  border: 1px solid var(--line);
  background: rgba(15, 29, 49, .72);
  border-radius: 10px;
}
.ghost-btn { padding: 9px 12px; font-size: .82rem; color: #d8e4f5; }
.ghost-btn:hover, .secondary-btn:hover, .icon-btn:hover, .select-button:hover, select:hover { border-color: rgba(96,165,250,.55); }

.workspace {
  width: min(1540px, calc(100% - 32px));
  margin: 24px auto;
  flex: 1;
}
.toolbar {
  min-height: 76px;
  border: 1px solid var(--line);
  background: rgba(11, 22, 40, .88);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: end;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 30;
}
.control-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.control-group.grow { width: 315px; }
.control-group.compact { width: 132px; }
.control-group label { color: var(--muted); font-size: .69rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding-left: 2px; }
select, .select-button {
  width: 100%; height: 40px; padding: 0 11px; outline: none;
}
.select-button { display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.language-picker { position: relative; }
.language-menu {
  position: absolute; top: calc(100% + 8px); left: 0; width: min(420px, 88vw);
  background: #0b1728; border: 1px solid var(--line-strong); border-radius: 13px;
  box-shadow: 0 22px 60px rgba(0,0,0,.48); overflow: hidden; z-index: 100;
}
.language-menu input {
  width: calc(100% - 20px); height: 40px; margin: 10px;
  border-radius: 9px; border: 1px solid var(--line); background: #091322; color: var(--text);
  outline: none; padding: 0 12px;
}
.language-menu input:focus { border-color: var(--blue); }
.language-list { max-height: 340px; overflow: auto; padding: 0 6px 8px; }
.language-option {
  width: 100%; border: 0; background: transparent; color: #dbe7f7; text-align: left;
  padding: 10px 11px; border-radius: 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px;
}
.language-option small { color: var(--muted); }
.language-option:hover, .language-option.active { background: rgba(59,130,246,.14); }
.toolbar-spacer { flex: 1; }
.secondary-btn, .run-btn { height: 40px; padding: 0 14px; cursor: pointer; font-weight: 700; }
.secondary-btn { color: #c8d5e7; }
.run-btn {
  border: 1px solid rgba(96,165,250,.55); border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9); color: white;
  display: inline-flex; align-items: center; gap: 9px; box-shadow: 0 8px 24px rgba(37,99,235,.25);
}
.run-btn:hover { filter: brightness(1.07); }
.run-btn:disabled { opacity: .55; cursor: not-allowed; }
.run-btn kbd { background: rgba(5,15,35,.32); padding: 3px 6px; border-radius: 6px; font-size: .65rem; font-family: inherit; font-weight: 600; }
.run-icon { font-size: .73rem; }

.main-grid {
  display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(360px, .8fr);
  gap: 14px; margin-top: 14px; min-height: 640px;
}
.right-column { display: grid; grid-template-rows: minmax(210px, .38fr) minmax(390px, .62fr); gap: 14px; min-height: 0; }
.panel {
  min-width: 0; min-height: 0; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(9, 20, 36, .92); box-shadow: var(--shadow);
}
.editor-panel, .input-panel, .console-panel { display: flex; flex-direction: column; }
.panel-header {
  min-height: 52px; padding: 10px 13px; display: flex; align-items: center; gap: 12px;
  justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(14,27,46,.82);
}
.panel-header > div:first-child { min-width: 0; }
.panel-header strong { display: block; font-size: .83rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-kicker { font-size: .61rem; letter-spacing: .12em; color: var(--blue-2); font-weight: 800; }
.icon-btn { padding: 7px 9px; color: var(--muted); cursor: pointer; font-size: .72rem; white-space: nowrap; }
.editor { flex: 1; min-height: 580px; }
.editor-fallback {
  flex: 1; min-height: 580px; resize: none; border: 0; outline: 0; color: #e5edf8; background: #07101f;
  padding: 18px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; line-height: 1.55;
}
.stdin {
  flex: 1; width: 100%; min-height: 130px; resize: none; border: 0; outline: 0;
  background: transparent; color: #dce8f7; padding: 14px; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  line-height: 1.5;
}
.stdin::placeholder { color: #607089; }
.console-header { justify-content: flex-start; }
.console-header .execution-meta { margin-left: auto; }
.execution-meta { display: flex; gap: 6px; }
.execution-meta span { color: var(--muted); background: rgba(148,163,184,.08); padding: 5px 7px; border-radius: 7px; font-size: .66rem; }
.status-line { min-height: 43px; padding: 8px 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.status-badge { flex: 0 0 auto; display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status-badge.idle { background: rgba(148,163,184,.12); color: #b7c4d5; }
.status-badge.running { background: rgba(59,130,246,.15); color: #93c5fd; }
.status-badge.success { background: rgba(34,197,94,.13); color: #86efac; }
.status-badge.error { background: rgba(239,68,68,.13); color: #fca5a5; }
.status-badge.warning { background: rgba(245,158,11,.13); color: #fcd34d; }
.console-output {
  flex: 1; min-height: 0; margin: 0; padding: 15px; overflow: auto;
  background: #050c16; color: #d9e5f5; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: .79rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.console-output .muted { color: #64748b; }

.info-strip {
  margin-top: 14px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: grid; grid-template-columns: repeat(3, 1fr); background: rgba(9,20,36,.72);
}
.info-strip div { padding: 14px 16px; border-right: 1px solid var(--line); }
.info-strip div:last-child { border-right: 0; }
.info-strip strong { display: block; font-size: .76rem; margin-bottom: 4px; }
.info-strip span { color: var(--muted); font-size: .72rem; line-height: 1.45; }
.footer { width: min(1540px, calc(100% - 32px)); margin: 0 auto; padding: 10px 2px 24px; display: flex; justify-content: space-between; color: #62728a; font-size: .72rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 10px 14px; border-radius: 10px; background: #14243a; border: 1px solid var(--line-strong); color: #e7eef8;
  font-size: .78rem; box-shadow: var(--shadow); transition: .2s ease; z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .toolbar { flex-wrap: wrap; align-items: end; }
  .control-group.grow { width: calc(100% - 276px); min-width: 240px; }
  .toolbar-spacer { display: none; }
  .main-grid { grid-template-columns: 1fr; min-height: auto; }
  .editor { min-height: 520px; }
  .right-column { grid-template-rows: 230px 400px; }
  .info-strip { grid-template-columns: 1fr; }
  .info-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .info-strip div:last-child { border-bottom: 0; }
}

@media (max-width: 670px) {
  .topbar { height: auto; min-height: 68px; padding: 10px 14px; }
  .brand small, .connection-pill, .ghost-btn { display: none; }
  .workspace { width: min(100% - 18px, 1540px); margin: 10px auto; }
  .toolbar { padding: 10px; }
  .control-group.grow, .control-group.compact { width: 100%; }
  .secondary-btn { flex: 1; }
  .run-btn { width: 100%; justify-content: center; }
  .main-grid { gap: 10px; margin-top: 10px; }
  .editor { min-height: 480px; }
  .right-column { grid-template-rows: 220px 390px; gap: 10px; }
  .execution-meta { display: none; }
  .footer { width: calc(100% - 18px); flex-direction: column; gap: 5px; }
}


/* Integrated THECOFISOL compiler page */
.compiler-page{background:radial-gradient(circle at 10% 0%,rgba(37,99,235,.2),transparent 30%),radial-gradient(circle at 100% 24%,rgba(34,211,238,.08),transparent 25%),#07101f}.compiler-page .site-header{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}.compiler-page .site-nav .nav-link{color:#c8d6e6}.compiler-page .site-nav .nav-link:hover,.compiler-page .site-nav .nav-link.active{color:#fff}.compiler-page .nav-dropdown-menu{color:#0c1d35}.compiler-main{min-height:calc(100vh - 78px)}.compiler-page-head{width:min(1540px,calc(100% - 32px));margin:0 auto;padding:40px 0 4px;display:flex;align-items:end;justify-content:space-between;gap:28px}.compiler-page-head h1{font-size:clamp(2.3rem,5vw,4.8rem);letter-spacing:-.055em;line-height:.96;margin:8px 0 10px;color:#fff}.compiler-page-head p{margin:0;color:#9fb2c8;font-size:1rem}.compiler-kicker{color:#5bd9ee;text-transform:uppercase;letter-spacing:.14em;font-size:.72rem;font-weight:900}.compiler-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}.embedded-compiler-shell{min-height:auto}.embedded-compiler-shell .workspace{margin-top:20px;margin-bottom:46px}.compiler-site-footer{margin-top:0}.compiler-page .site-footer a{color:inherit}.compiler-page .footer-brand img{width:205px}
@media(max-width:1080px){.compiler-page-head{padding-top:32px;align-items:flex-start;flex-direction:column}.compiler-head-actions{justify-content:flex-start}.compiler-main{min-height:auto}}
@media(max-width:720px){.compiler-page-head{width:min(calc(100% - 20px),1540px);padding-top:26px}.embedded-compiler-shell .workspace{width:calc(100% - 18px);margin-top:16px}}
