:root{
  --bg:#0b1020;
  --panel:#0f1630;
  --panel2:#0c132a;
  --text:#e7ecff;
  --muted:#aab4e6;
  --border:rgba(255,255,255,.10);
  --btn:#16224a;
  --btnHover:#1a2a5a;
  --primary:#3b82f6;
  --primaryHover:#2563eb;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius:14px;
}

[data-theme="light"]{
  --bg:#f5f7ff;
  --panel:#ffffff;
  --panel2:#ffffff;
  --text:#101428;
  --muted:#4a587a;
  --border:rgba(16,20,40,.12);
  --btn:#eef2ff;
  --btnHover:#e6ebff;
  --primary:#2563eb;
  --primaryHover:#1d4ed8;
  --shadow: 0 10px 30px rgba(16,20,40,.12);
}

*{box-sizing:border-box}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.topbar{
  position: sticky;
  top: var(--site-shell-offset, 0px);
  z-index: 10;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(0,0,0,.22), rgba(0,0,0,0));
  backdrop-filter: blur(10px);
}

.brand{display:flex; align-items:center; gap:10px}
.logo{
  width:40px; height:40px; border-radius: 12px;
  display:grid; place-items:center;
  background: var(--panel);
  border:1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight:800;
}
.title{font-weight:800; letter-spacing:.2px}
.sub{font-size:12px; color:var(--muted)}

.actions{display:flex; gap:8px; align-items:center}
.btn{
  border:1px solid var(--border);
  background: var(--btn);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor:pointer;
  transition: .15s;
}
.btn:hover{background: var(--btnHover)}
.btn.primary{
  background: var(--primary);
  border-color: rgba(255,255,255,.15);
  font-weight:700;
}
.btn.primary:hover{background: var(--primaryHover)}

.layout{
  max-width: 1200px;
  margin: 14px auto;
  padding: 0 14px 18px;
  display:grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 14px;
}

.panel{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
  min-height: 70vh;
  display:flex;
  flex-direction:column;
}

.panelHeader{
  padding: 10px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
}
.panelHeader.compact{padding: 8px 10px}
.panelTitle{font-weight:800}
.panelTools{display:flex; gap:8px; align-items:center}
.small{font-size:12px; color:var(--muted); display:flex; gap:6px; align-items:center}
.small input{
  width:64px;
  padding:6px 8px;
  border-radius:10px;
  border:1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.editor{flex:1; min-height: 50vh}
.hint{
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.tabs{
  display:flex;
  gap:6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel2);
}
.tab{
  flex:1;
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor:pointer;
}
.tab.active{
  background: var(--btn);
  font-weight:800;
}

.tabBody{display:none; flex:1}
.tabBody.active{display:flex; flex-direction:column; flex:1}

.output{
  flex:1;
  margin:0;
  padding: 12px;
  overflow:auto;
  background: #00000020;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.4;
}

.field{
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.field label{font-weight:800}
textarea, input{
  border:1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  outline:none;
}
textarea{min-height: 180px; resize: vertical}

.about{padding: 12px; color: var(--muted)}
.about ul{margin: 8px 0 0 18px}

@media (max-width: 980px){
  .layout{grid-template-columns: 1fr}
  .panel{min-height: 55vh}
}

.related-links{
  max-width: 1200px;
  margin: 0 auto 24px;
  padding: 0 14px 24px;
}
.related-links-card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.related-links-card h2{
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.related-links-grid{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.related-links-grid a{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--btn);
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}
.related-links-grid a:hover{
  background: var(--btnHover);
  border-color: var(--primary);
}
