/* castled.codes – ServerManager site (LuckPerms-inspired dark theme) – v3 */
:root {
  --bg-dark: #0d1117;
  --bg-card: #161b22;
  --bg-hover: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #3fb950;
  --accent-hover: #56d364;
  --accent-dim: #238636;
  /* Softer option when accent is used as text/border only; avoid large green fills */
  --btn-bg: #21262d;
  --btn-border: #30363d;
  --btn-hover-bg: #30363d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ----- Header ----- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--bg-dark);
  font-size: 0.9rem;
}
/* Wrapper: dark circle so the logo’s built-in green isn’t the background */
.logo-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-dark);
  overflow: hidden;
  flex-shrink: 0;
}
.logo-icon-wrap--hero {
  width: 80px;
  height: 80px;
}
.logo-icon-wrap .logo-icon {
  width: 100%;
  height: 100%;
}
img.logo-icon {
  object-fit: contain;
  background: transparent;
  width: 100%;
  height: 100%;
  display: block;
}
.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.sponsor-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}
.sponsor-text a { color: var(--accent); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.header-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: 6px;
}
.header-icon-link:hover {
  color: var(--text);
  background: var(--bg-hover);
  text-decoration: none;
}
.header-icon-link svg {
  width: 20px;
  height: 20px;
  display: block;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  text-decoration: none;
}
.nav-link:hover {
  background: var(--bg-hover);
  color: var(--accent-hover);
  text-decoration: none;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Tools dropdown */
.tools-wrap {
  position: relative;
}
.tools-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  background: none;
  font-family: inherit;
}
.tools-trigger:hover {
  background: var(--bg-hover);
  color: var(--accent-hover);
}
.tools-trigger .tools-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.tools-trigger .chevron {
  transition: transform 0.2s;
}
.tools-wrap.open .tools-trigger .chevron {
  transform: rotate(180deg);
}

.tools-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 2px;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 0.25rem;
  display: none;
}
.tools-wrap.open .tools-dropdown {
  display: block;
}

.tools-dropdown a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  color: var(--accent);
  font-size: 0.9rem;
  border-radius: 6px;
  text-decoration: none;
}
.tools-dropdown a:hover {
  background: var(--bg-hover);
  color: var(--accent-hover);
  text-decoration: none;
}
.tools-dropdown a svg {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.header-icons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}
.header-icons a {
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: 6px;
}
.header-icons a:hover {
  color: var(--text);
  background: var(--bg-hover);
}

/* ----- Layout ----- */
.main-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}
@media (max-width: 900px) {
  .main-wrap { grid-template-columns: 1fr; }
}

/* ----- Hero ----- */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.hero-brand {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.hero .logo-icon {
  width: 80px;
  height: 80px;
  font-size: 2rem;
}
.hero h1 {
  margin: 0 0 0.25rem 0;
  font-size: 2.5rem;
  font-weight: 700;
}
.hero .tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.download-block {
  text-align: right;
}
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.btn-download:hover {
  background: var(--btn-hover-bg);
  border-color: var(--accent);
  color: var(--accent);
}
.download-meta {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ----- Content card ----- */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.content-card h2 {
  margin: 0 0 0.75rem 0;
  font-size: 1.35rem;
}
.content-card ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}
.content-card li {
  margin-bottom: 0.35rem;
}
.content-card li strong {
  color: var(--accent);
}

/* ----- Sidebar ----- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
}
.sidebar-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--accent);
}
.sidebar-card h3 svg {
  width: 20px;
  height: 20px;
}
.sidebar-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ----- Editor landing ----- */
.editor-landing {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.editor-card .logo-icon-wrap {
  width: 72px;
  height: 72px;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
}
.editor-card .logo-icon-wrap .logo-icon,
.editor-card img.logo-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
.editor-card h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.75rem;
}
.editor-card .subtitle {
  margin: 0 0 1.5rem 0;
  color: var(--text-muted);
  font-size: 1rem;
}
.editor-card .btn-demo {
  margin-bottom: 1.5rem;
}
.editor-card .instructions {
  text-align: left;
  width: 100%;
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.editor-card .command-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9rem;
}
.editor-card .command-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.editor-card .command-list li:last-child {
  border-bottom: none;
}
.editor-card .command-list code {
  color: var(--accent);
}

/* ----- Editor session (token page) ----- */
.editor-session-view {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}
.editor-session-view h1 {
  margin-bottom: 0.5rem;
}
.editor-session-view .token-badge {
  display: inline-block;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.editor-session-view .help-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ----- Editor workspace (file tree + editor) ----- */
.editor-workspace {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  padding: 0 1rem 1rem;
}
.editor-trust-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.editor-trust-banner .trust-command {
  background: var(--bg-dark);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.85rem;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.editor-toolbar-main {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1 1 480px;
  min-width: 0;
}
.editor-breadcrumb {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 0;
  flex: 0 1 auto;
}
.editor-breadcrumb .breadcrumb-item {
  cursor: pointer;
  color: var(--accent);
}
.editor-breadcrumb .breadcrumb-item:hover {
  text-decoration: underline;
}
.editor-breadcrumb .breadcrumb-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}
.editor-folder-jump {
  position: relative;
  flex: 1 1 340px;
  min-width: 220px;
  max-width: 460px;
}
.editor-folder-jump-input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.editor-folder-jump-input::placeholder {
  color: var(--text-muted);
}
.editor-folder-jump-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.16);
}
.editor-folder-jump-results {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.35rem;
  background: rgba(22, 27, 34, 0.98);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}
.editor-folder-jump-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.editor-folder-jump-option:hover,
.editor-folder-jump-option.active {
  background: var(--bg-hover);
}
.editor-folder-jump-option-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.editor-folder-jump-option-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
}
.editor-folder-jump-option-path {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-folder-jump-option-kind {
  flex-shrink: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.editor-folder-jump-empty {
  padding: 0.65rem 0.7rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.editor-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.editor-node-toggle {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
}
.editor-node-toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.editor-node-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.editor-apply-btn {
  flex-shrink: 0;
}
.editor-apply-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
@media (max-width: 900px) {
  .editor-toolbar-main {
    flex-direction: column;
    align-items: stretch;
  }
  .editor-folder-jump {
    max-width: none;
    width: 100%;
  }
}
.editor-node-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}
.editor-node-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 400px;
  min-width: 0;
}
.editor-node-sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.editor-node-sidebar-panel {
  padding: 0.75rem 1rem;
  flex: 1;
}
.editor-node-sidebar-panel.hidden { display: none; }
.editor-node-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem 0;
}
.editor-node-library-section {
  margin-bottom: 1rem;
}
.editor-node-library-heading {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.35rem 0;
}
.editor-node-palette-btn {
  display: block;
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text);
  cursor: grab;
  text-align: left;
}
.editor-node-palette-btn:active { cursor: grabbing; }
.editor-node-palette-trigger { border-left: 3px solid #7ee787; }
.editor-node-palette-condition { border-left: 3px solid #79c0ff; }
.editor-node-palette-effect { border-left: 3px solid #ffa657; }
.editor-node-addons-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0 0;
}
.editor-node-inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.editor-node-clear-btn {
  font-size: 0.75rem;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0.2rem 0;
}
.editor-node-clear-btn:hover { text-decoration: underline; }
.editor-node-inspector-search {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text);
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}
.editor-node-inspector-section {
  margin-bottom: 0.75rem;
}
.editor-node-inspector-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.editor-node-type-pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
}
.editor-node-inspector-select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text);
  box-sizing: border-box;
}
.editor-node-inspector-textarea {
  width: 100%;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text);
  resize: vertical;
  font-family: ui-monospace, monospace;
  box-sizing: border-box;
}
.editor-node-canvas {
  flex: 1;
  position: relative;
  overflow: auto;
  background: var(--bg-dark);
  min-height: 200px;
  min-width: 0;
}
.editor-node-box.selected {
  box-shadow: 0 0 0 2px var(--accent);
}
.editor-node-box-cog {
  position: absolute;
  top: 0.35rem;
  right: 0.5rem;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  z-index: 2;
}
.editor-node-box-cog:hover { color: var(--text); background: var(--bg-hover); }
.editor-node-conn.disconnect-mode {
  background: #c00;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  line-height: 12px;
  text-align: center;
}
.editor-node-conn.disconnect-mode::after {
  content: "×";
}
.editor-node-canvas-inner {
  position: relative;
  min-width: 2000px;
  min-height: 1500px;
}
.editor-node-canvas-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  max-width: 320px;
  pointer-events: none;
}
.editor-node-connections {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.editor-node-connections line {
  stroke: var(--accent);
  stroke-width: 2;
  fill: none;
  pointer-events: stroke;
}
.editor-node-connections line.pending {
  stroke-dasharray: 6 4;
  pointer-events: none;
}
.editor-node-nodes {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}
.editor-node-box {
  position: absolute;
  min-width: 180px;
  max-width: 280px;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: grab;
  user-select: none;
}
.editor-node-box:active { cursor: grabbing; }
.editor-node-box[data-type="trigger"] { border-left: 4px solid #7ee787; }
.editor-node-box[data-type="condition"] { border-left: 4px solid #79c0ff; }
.editor-node-box[data-type="effect"] { border-left: 4px solid #ffa657; }
.editor-node-box-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.editor-node-box-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-muted);
}
.editor-node-box-body {
  font-size: 0.85rem;
  color: var(--text);
  word-break: break-word;
}
.editor-node-command-opts {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  padding-top: 0.35rem;
}
.editor-node-command-opts summary {
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.editor-node-command-opts-inner {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.editor-node-opt {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.editor-node-opt-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
}
.editor-node-opt-value {
  font-size: 0.8rem;
  color: var(--text);
  word-break: break-word;
}
.editor-node-conn {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-dark);
  border: 2px solid var(--accent);
  top: 50%;
  transform: translateY(-50%);
  cursor: crosshair;
  z-index: 2;
}
.editor-node-conn.input { left: -6px; }
.editor-node-conn.output { right: -6px; }
.editor-node-conn:hover { background: var(--accent); }
.editor-node-box[data-type="trigger"] .editor-node-conn.input { display: none; }
.editor-node-list-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.editor-node-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.editor-node-item {
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.editor-node-item[data-indent="1"] { padding-left: 1rem; }
.editor-node-item[data-indent="2"] { padding-left: 2rem; }
.editor-node-type {
  display: inline-block;
  min-width: 4.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--accent);
}
.editor-node-raw-preview {
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-dark);
  border-radius: 8px;
  font-size: 0.8rem;
  white-space: pre-wrap;
  max-height: 200px;
  overflow: auto;
}
.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.editor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.editor-modal-box {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.editor-modal-box p {
  margin: 0 0 1rem;
  color: var(--text);
}
.editor-modal-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.editor-modal-input:focus {
  outline: none;
  border-color: var(--accent);
}
.editor-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.editor-panes {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.editor-sidebar {
  width: 260px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.file-tree-header {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.file-tree-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}
.file-tree-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
}
.file-tree-row:hover {
  background: var(--bg-hover);
}
.file-tree-icon {
  flex-shrink: 0;
}
.file-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-tree-loading,
.file-tree-empty,
.file-tree-error {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.file-tree-error {
  color: #f85149;
}
.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.editor-pane-header {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.editor-path {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.editor-content {
  width: 100%;
  height: 100%;
  padding: 0.75rem 1rem;
  margin: 0;
  border: none;
  background: var(--bg-dark);
  color: var(--text);
  caret-color: #3fb950;
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-sizing: border-box;
  overflow: auto;
}

.editor-content::placeholder {
  color: var(--text-muted);
}

.editor-content-wrap { 
  flex: 1; 
  position: relative; 
  overflow: auto; 
  background: var(--bg-dark);
  transform: translateZ(0);
}

/* CodeMirror integration */
.editor-content-wrap .CodeMirror {
  height: calc(100vh - 200px);
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
}

.editor-content-wrap .CodeMirror-gutters {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}

.editor-content-wrap .CodeMirror-linenumber {
  color: var(--text-muted);
  padding: 0 0.75rem 0 0.5rem;
}

/* Hide the original textarea since CodeMirror replaces it */
.editor-content {
  display: none;
}

/* Basic syntax highlighting for YAML */
.editor-content.yaml-key { color: #9cdcfe; }
.editor-content.yaml-colon { color: #d4d4d4; }
.editor-content.yaml-value { color: #dcdcaa; }
.editor-content.yaml-comment { color: #6a9955; }
.editor-content.yaml-string { color: #ce9178; }
.editor-content.yaml-number { color: #b5cea8; }
.editor-content.yaml-boolean { color: #569cd6; }

/* Editor toast */
.editor-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
}
.editor-context-menu {
  position: fixed;
  min-width: 140px;
  padding: 0.25rem 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}

/* ----- Profile page ----- */
.profile-page .main-wrap { display: none; }
.profile-page .site-footer { margin-top: 0; }

.profile-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #0d1117 0%, #161b22 40%, #0d1117 100%);
  background-size: 400% 400%;
  animation: profile-bg-shift 12s ease infinite;
}
.profile-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 20%, rgba(63, 185, 80, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse 60% 80% at 80% 80%, rgba(63, 185, 80, 0.05) 0%, transparent 45%);
  pointer-events: none;
}
@keyframes profile-bg-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.profile-main {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1rem 4rem;
  box-sizing: border-box;
}

.axion-banner {
  position: relative;
  width: min(1100px, 100%);
  margin: 0 auto 2rem;
  border: 1px solid rgba(115, 133, 255, 0.22);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(8, 10, 20, 0.98), rgba(17, 22, 42, 0.94));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}
.axion-banner-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.34;
}
.axion-banner-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 7, 14, 0.94) 0%, rgba(5, 7, 14, 0.82) 44%, rgba(5, 7, 14, 0.55) 100%),
    radial-gradient(circle at top right, rgba(77, 99, 255, 0.28), transparent 34%),
    radial-gradient(circle at bottom left, rgba(32, 242, 255, 0.16), transparent 30%);
}
.axion-banner-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding: 2rem;
}
.axion-banner-head {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.axion-banner-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.34));
}
.axion-banner-copy {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.axion-banner-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(97, 241, 255, 0.14);
  border: 1px solid rgba(97, 241, 255, 0.26);
  color: #8ef7ff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.axion-banner-copy h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}
.axion-banner-desc {
  margin: 0;
  max-width: 700px;
  color: #dbe6ff;
  font-size: 1.05rem;
}
.axion-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.axion-download-btn {
  background: rgba(14, 18, 34, 0.92);
  border-color: rgba(133, 145, 255, 0.28);
  color: var(--text);
}
.axion-download-btn:hover {
  border-color: #61f1ff;
  color: #61f1ff;
  background: rgba(20, 26, 48, 0.96);
}
.axion-download-btn--plugin:hover {
  border-color: #ffd966;
  color: #ffd966;
}
.axion-download-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}
.axion-showcase {
  width: 100%;
  background: rgba(9, 12, 24, 0.78);
  border: 1px solid rgba(116, 132, 192, 0.26);
  border-radius: 18px;
  overflow: hidden;
}
.axion-showcase summary {
  cursor: pointer;
  list-style: none;
  padding: 0.9rem 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.axion-showcase summary::-webkit-details-marker {
  display: none;
}
.axion-showcase summary::after {
  content: "+";
  color: #61f1ff;
  font-size: 1.25rem;
  line-height: 1;
}
.axion-showcase[open] summary::after {
  content: "−";
}
.axion-showcase-video {
  padding: 0 1rem 1rem;
}
.axion-showcase-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 14px;
  background: #000;
}

.profile-avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.profile-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--border);
}
.profile-pic-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  background: var(--bg-card);
}
.profile-pic-wrap .profile-pic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-pic-wrap .profile-pic-img {
  display: block;
}

.profile-modal {
  max-width: 420px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.profile-quote-wrap {
  text-align: center;
  margin-bottom: 1.5rem;
  min-height: 3em;
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-quote {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
  font-style: italic;
  line-height: 1.5;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
}
.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-size: 0.95rem;
  text-decoration: none;
}
.profile-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.profile-link svg {
  flex-shrink: 0;
}

.profile-download {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.profile-download-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.profile-download-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.profile-download-select {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
}
.profile-download-select:focus {
  outline: none;
  border-color: var(--accent);
}
.profile-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
  text-decoration: none;
}
.profile-download-btn:hover { text-decoration: none; }
.profile-download-logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .profile-main {
    padding-top: 1.25rem;
  }

  .axion-banner {
    border-radius: 22px;
  }

  .axion-banner-content {
    padding: 1.25rem;
  }

  .axion-banner-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .axion-banner-logo {
    width: 72px;
    height: 72px;
  }

  .axion-banner-desc {
    font-size: 0.98rem;
  }

  .axion-banner-actions {
    flex-direction: column;
  }

  .axion-download-btn {
    justify-content: center;
    width: 100%;
  }
}

/* ----- Footer ----- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  margin-top: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Utility: hide */
.hidden { display: none !important; }
