/* Erthiox Code Lab – Ghost UI V2 dark theme */

:root {
  --ide-bg: #111622;
  --ide-surface: #171d2e;
  --ide-surface-2: #1e2539;
  --ide-border: rgba(197, 168, 128, 0.16);
  --ide-border-strong: rgba(197, 168, 128, 0.32);
  --ide-gold: #c5a880;
  --ide-gold-dim: rgba(197, 168, 128, 0.12);
  --ide-text: #eef1f7;
  --ide-muted: #9aa3b8;
  --ide-danger: #ea6a6a;
  --ide-ok: #7bc98a;
  --ide-radius: 14px;
}

/* ---------- Hero ---------- */
.ide-hero { padding: 40px 24px 4px; }
.ide-hero-inner { max-width: 1400px; margin: 0 auto; }
.ide-hero-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ide-text);
  margin: 0 0 8px;
}
.ide-hero-sub { color: var(--ide-muted); margin: 0; font-size: 1rem; max-width: 760px; }

/* ---------- Toolbar ---------- */
.ide-toolbar {
  max-width: 1400px;
  margin: 18px auto 0;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.ide-toolbar-left, .ide-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ide-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ide-surface-2);
  border: 1px solid var(--ide-border);
  color: var(--ide-text);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  white-space: nowrap;
}
.ide-btn:hover { border-color: var(--ide-border-strong); background: #232b45; }
.ide-btn:disabled { opacity: .45; cursor: not-allowed; }
.ide-btn .material-symbols-outlined { font-size: 18px; }
.ide-btn-run { background: var(--ide-gold); border-color: var(--ide-gold); color: #111622; }
.ide-btn-run:hover { background: #d4b78f; border-color: #d4b78f; }
.ide-btn-primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.ide-btn-primary:hover { background: #2b82f0; border-color: #2b82f0; }
.ide-btn-sm { padding: 7px 10px; font-size: 12.5px; }

.ide-lang-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  max-width: 52vw;
  padding: 2px;
  scrollbar-width: thin;
}
.ide-lang-tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ide-muted);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ide-lang-tab:hover { color: var(--ide-text); background: var(--ide-surface-2); }
.ide-lang-tab.active { color: var(--ide-gold); background: var(--ide-gold-dim); border-color: var(--ide-border-strong); }

.ide-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ide-muted);
  font-size: 12.5px;
}
.ide-sync .material-symbols-outlined { font-size: 16px; }
.ide-sync.live { color: var(--ide-ok); }
.ide-peers { display: flex; align-items: center; }
.ide-peer-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #111622;
  border: 2px solid var(--ide-bg);
  margin-left: -8px;
}
.ide-peer-dot:first-child { margin-left: 0; }

/* ---------- Mobile tabs ---------- */
.ide-mobile-tabs { display: none; }

/* ---------- Layout ---------- */
.ide-layout {
  max-width: 1400px;
  margin: 12px auto 0;
  padding: 0 24px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 12px;
  height: 72vh;
  min-height: 520px;
  position: relative;
}
.ide-editor-pane {
  display: flex;
  flex-direction: column;
  background: var(--ide-surface);
  border: 1px solid var(--ide-border);
  border-radius: var(--ide-radius);
  overflow: hidden;
  min-width: 0;
}
.ide-editor { flex: 1; min-height: 0; }
.ide-editor-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-top: 1px solid var(--ide-border);
  font-size: 12px;
  color: var(--ide-muted);
}
.ide-lang-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ide-side-pane {
  display: flex;
  flex-direction: column;
  background: var(--ide-surface);
  border: 1px solid var(--ide-border);
  border-radius: var(--ide-radius);
  overflow: hidden;
  min-width: 0;
}
.ide-side-pane.collapsed { display: none; }
.ide-side-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.ide-side-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--ide-muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}
.ide-side-tab .material-symbols-outlined { font-size: 17px; }
.ide-side-tab.active { color: var(--ide-gold); border-bottom-color: var(--ide-gold); }
.ide-side-collapse { margin-left: auto; }
.ide-side-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.ide-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ide-preview { flex: 1; width: 100%; border: 0; background: #fff; min-height: 0; }
.ide-preview-empty {
  position: absolute;
  inset: 48px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ide-muted);
  text-align: center;
  padding: 24px;
}
.ide-preview-empty .material-symbols-outlined { font-size: 40px; opacity: .5; }
.ide-preview-empty p { margin: 0; font-size: 13.5px; }

/* ---------- Console ---------- */
.ide-console-lines {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  min-height: 0;
}
.ide-cline { white-space: pre-wrap; word-break: break-word; color: var(--ide-text); padding: 1px 0; }
.ide-cline.info { color: var(--ide-muted); }
.ide-cline.ok { color: var(--ide-ok); }
.ide-cline.err { color: var(--ide-danger); }
.ide-cline.warn { color: #e0a35e; }
.ide-stdin { border-top: 1px solid var(--ide-border); padding: 10px 14px; flex-shrink: 0; }
.ide-stdin label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ide-muted);
  margin-bottom: 6px;
}
.ide-stdin label .material-symbols-outlined { font-size: 15px; }
.ide-hint-inline { font-weight: 400; opacity: .75; }
.ide-stdin textarea {
  width: 100%;
  background: var(--ide-bg);
  border: 1px solid var(--ide-border);
  border-radius: 8px;
  color: var(--ide-text);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  padding: 8px 10px;
  resize: vertical;
}
.ide-console-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.ide-exec-time { font-size: 12px; color: var(--ide-muted); }

/* ---------- Chat ---------- */
.ide-chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.ide-chat-empty { color: var(--ide-muted); font-size: 13px; text-align: center; margin: auto 0; }
.ide-chat-msg { max-width: 85%; display: flex; flex-direction: column; gap: 2px; align-self: flex-start; }
.ide-chat-msg.own { align-self: flex-end; align-items: flex-end; }
.ide-chat-head { display: flex; gap: 8px; font-size: 11.5px; color: var(--ide-muted); }
.ide-chat-body {
  background: var(--ide-surface-2);
  border: 1px solid var(--ide-border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: var(--ide-text);
  word-break: break-word;
  white-space: pre-wrap;
}
.ide-chat-msg.own .ide-chat-body { background: var(--ide-gold-dim); border-color: var(--ide-border-strong); }
.ide-chat-sys {
  align-self: center;
  font-size: 12px;
  color: var(--ide-muted);
  background: rgba(154, 163, 184, 0.08);
  border-radius: 20px;
  padding: 4px 12px;
}
.ide-chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--ide-border);
  flex-shrink: 0;
}
.ide-chat-input input {
  flex: 1;
  background: var(--ide-bg);
  border: 1px solid var(--ide-border);
  border-radius: 10px;
  color: var(--ide-text);
  padding: 10px 12px;
  font-size: 13.5px;
  min-width: 0;
}
.ide-chat-input input:disabled { opacity: .5; }
.ide-chat-note { font-size: 11.5px; color: var(--ide-muted); padding: 0 14px 10px; margin: 0; flex-shrink: 0; }
.ide-chat-badge {
  background: var(--ide-danger);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 2px;
}

/* ---------- Room modal ---------- */
.ide-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 22, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.ide-modal {
  background: var(--ide-surface);
  border: 1px solid var(--ide-border-strong);
  border-radius: 18px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.ide-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: 0;
  color: var(--ide-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
}
.ide-modal-close:hover { color: var(--ide-text); background: var(--ide-surface-2); }
.ide-modal-title { margin: 0 0 6px; font-size: 1.4rem; color: var(--ide-text); }
.ide-modal-sub { margin: 0 0 20px; color: var(--ide-muted); font-size: 13.5px; }
.ide-field { margin-bottom: 16px; }
.ide-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ide-muted); margin-bottom: 6px; }
.ide-field input {
  width: 100%;
  background: var(--ide-bg);
  border: 1px solid var(--ide-border);
  border-radius: 10px;
  color: var(--ide-text);
  padding: 10px 12px;
  font-size: 14px;
}
.ide-room-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ide-room-card {
  background: var(--ide-surface-2);
  border: 1px solid var(--ide-border);
  border-radius: var(--ide-radius);
  padding: 18px;
  text-align: center;
}
.ide-room-card .material-symbols-outlined { font-size: 30px; color: var(--ide-gold); }
.ide-room-card h3 { margin: 8px 0 4px; font-size: 15px; color: var(--ide-text); }
.ide-room-card p { margin: 0 0 12px; font-size: 12.5px; color: var(--ide-muted); }
.ide-join-row { display: flex; gap: 8px; }
.ide-join-row input {
  flex: 1;
  min-width: 0;
  background: var(--ide-bg);
  border: 1px solid var(--ide-border);
  border-radius: 10px;
  color: var(--ide-text);
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 4px;
  text-align: center;
  text-transform: uppercase;
}
.ide-room-status { min-height: 20px; font-size: 13px; color: var(--ide-muted); margin: 14px 0 0; }
.ide-room-status.err { color: var(--ide-danger); }
.ide-code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--ide-bg);
  border: 1px dashed var(--ide-border-strong);
  border-radius: var(--ide-radius);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.ide-code-label { font-size: 12.5px; color: var(--ide-muted); }
.ide-code-value { font-size: 26px; font-weight: 800; letter-spacing: 8px; color: var(--ide-gold); }
.ide-participants { display: flex; flex-direction: column; gap: 8px; }
.ide-participant {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ide-text);
}
.ide-participant .ide-peer-dot { margin-left: 0; }
.ide-participant .ide-you { font-size: 11.5px; color: var(--ide-muted); }

/* ---------- Side expand ---------- */
.ide-side-expand {
  position: absolute;
  right: 24px;
  top: 0;
  background: var(--ide-surface-2);
  border: 1px solid var(--ide-border);
  color: var(--ide-text);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
}

/* ---------- Remote cursors ---------- */
.remote-cursor { border-left: 2px solid; }

/* ---------- Utility ---------- */
.d-none { display: none !important; }

/* ---------- Mobile ---------- */
@media (max-width: 900px) {
  .ide-hero { padding: 28px 16px 0; }
  .ide-toolbar { padding: 0 16px; flex-direction: column; align-items: stretch; }
  .ide-toolbar-left, .ide-toolbar-right { justify-content: flex-start; }
  .ide-lang-tabs { max-width: 100%; }
  .ide-btn .ide-btn-label { display: none; }
  .ide-btn { padding: 9px 10px; }
  .ide-sync #ide-sync-label { display: none; }

  .ide-mobile-tabs {
    display: flex;
    gap: 4px;
    max-width: 1400px;
    margin: 12px auto 0;
    padding: 0 16px;
  }
  .ide-mtab {
    flex: 1;
    background: var(--ide-surface);
    border: 1px solid var(--ide-border);
    color: var(--ide-muted);
    border-radius: 10px;
    padding: 10px 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
  }
  .ide-mtab .material-symbols-outlined { font-size: 17px; }
  .ide-mtab.active { color: var(--ide-gold); border-color: var(--ide-border-strong); background: var(--ide-surface-2); }

  .ide-layout {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px 16px 40px;
  }
  .ide-editor-pane, .ide-side-pane { display: none; }
  .ide-side-tabs { display: none; }
  .ide-layout[data-mview="editor"] .ide-editor-pane { display: flex; height: 68vh; min-height: 420px; }
  .ide-layout[data-mview="preview"] .ide-side-pane,
  .ide-layout[data-mview="console"] .ide-side-pane,
  .ide-layout[data-mview="chat"] .ide-side-pane { display: flex; height: 68vh; min-height: 420px; }
  .ide-layout[data-mview="preview"] [data-wrap="preview"],
  .ide-layout[data-mview="console"] [data-wrap="console"],
  .ide-layout[data-mview="chat"] [data-wrap="chat"] { display: flex; }
  .ide-layout[data-mview="preview"] [data-wrap="console"],
  .ide-layout[data-mview="preview"] [data-wrap="chat"],
  .ide-layout[data-mview="console"] [data-wrap="preview"],
  .ide-layout[data-mview="console"] [data-wrap="chat"],
  .ide-layout[data-mview="chat"] [data-wrap="preview"],
  .ide-layout[data-mview="chat"] [data-wrap="console"] { display: none; }
  .ide-side-expand { display: none; }

  .ide-room-grid { grid-template-columns: 1fr; }
  .ide-modal { padding: 22px 18px; }
}
