/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --bg-2: #16161d;
  --bg-3: #1c1c26;
  --bg-4: #22222f;
  --border: #2a2a3a;
  --border-light: #33334a;
  --primary: #6366f1;
  --primary-hover: #7577f5;
  --primary-dim: rgba(99,102,241,0.15);
  --purple: #8b5cf6;
  --text: #e2e2f0;
  --text-2: #9494b0;
  --text-3: #5a5a78;
  --success: #22c55e;
  --success-dim: rgba(34,197,94,0.12);
  --error: #f43f5e;
  --error-dim: rgba(244,63,94,0.12);
  --warning: #f59e0b;
  --warning-dim: rgba(245,158,11,0.12);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-w: 220px;
  --transition: 0.15s ease;
}

html, body {
  height: 100%;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Layout ===== */
.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ===== Navbar ===== */
.navbar {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 24px;
  position: relative;
  z-index: 100;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 9px;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(135deg, #6366f1, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

/* ===== Navbar Nav ===== */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

/* ===== Menu Item (with dropdown) ===== */
.menu-item {
  position: relative;
}

.menu-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.menu-trigger:hover,
.menu-item.open .menu-trigger {
  background: var(--bg-4);
  color: var(--text);
}

.menu-item.open .menu-trigger {
  color: #a5b4fc;
}

.menu-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.menu-item.open .chevron {
  transform: rotate(180deg);
}

/* ===== Dropdown ===== */
.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 170px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px;
  animation: dropIn 0.15s ease;
}

.menu-item.open .dropdown {
  display: block;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.dropdown-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.dropdown-item:hover {
  background: var(--bg-4);
  color: var(--text);
}

.dropdown-item.active {
  background: var(--primary-dim);
  color: #a5b4fc;
}

.dropdown-item.active svg {
  opacity: 1;
}

/* ===== Navbar Right ===== */
.navbar-right {
  display: flex;
  align-items: center;
}

.version-badge {
  font-size: 11.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ===== Main ===== */
.main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ===== Tool Panel ===== */
.tool-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  gap: 16px;
  overflow: hidden;
}

.tool-panel.active {
  display: flex;
}

/* ===== Tool Header ===== */
.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tool-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.tool-desc {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}

.tool-actions {
  display: flex;
  gap: 8px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-ui);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}

.btn-ghost:hover {
  background: var(--bg-4);
  border-color: var(--border-light);
  color: var(--text);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn:hover {
  background: var(--bg-4);
  border-color: var(--border-light);
  color: var(--text);
}

/* ===== Editor Layout ===== */
.editor-layout {
  display: flex;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
  flex-shrink: 0;
}

.panel-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.panel-controls {
  display: flex;
  gap: 6px;
}

.editor-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.code-editor {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  padding: 14px 16px 32px;
  caret-color: var(--primary);
}

.code-editor::placeholder {
  color: var(--text-3);
}

.code-output {
  width: 100%;
  height: 100%;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  padding: 14px 16px 32px;
  outline: none;
}

.char-count {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: var(--text-3);
  pointer-events: none;
  font-family: var(--font-mono);
}

/* ===== Action Column ===== */
.action-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 68px;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

.action-btn:hover {
  background: var(--bg-4);
  border-color: var(--border-light);
  color: var(--text);
}

.action-btn.primary {
  background: var(--primary-dim);
  border-color: rgba(99,102,241,0.4);
  color: #a5b4fc;
}

.action-btn.primary:hover {
  background: rgba(99,102,241,0.25);
  border-color: var(--primary);
  color: #c7d2fe;
}

.action-btn:active {
  transform: scale(0.96);
}

/* ===== Status Bar ===== */
.status-bar {
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
}

.status-idle {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-3);
}

.status-idle svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.status-success {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
}

.status-success svg { width: 14px; height: 14px; flex-shrink: 0; }

.status-error {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--error);
}

.status-error svg { width: 14px; height: 14px; flex-shrink: 0; }


/* ===== JSON Syntax Highlighting ===== */
.json-key    { color: #93c5fd; }
.json-string { color: #86efac; }
.json-number { color: #fdba74; }
.json-bool   { color: #c084fc; }
.json-null   { color: #94a3b8; }
.json-punct  { color: #64748b; }

/* ===== JSON Tree View ===== */
.code-output {
  white-space: normal;
  word-break: break-all;
}

.jt-collapsible {
  display: inline;
}

/* Each child entry: block-level, indented */
.jt-body {
  display: block;
  padding-left: 20px;
  border-left: 1px solid var(--border);
  margin-left: 3px;
}

.jt-entry {
  display: block;
  line-height: 1.8;
}

/* Closing bracket sits on its own line when expanded */
.jt-close-br {
  display: block;
}

/* Closing bracket is inline when collapsed */
.jt-close-inline {
  display: inline !important;
}

/* Collapsed summary: "… 3 keys " */
.jt-summary {
  color: var(--text-3);
  font-style: italic;
  cursor: pointer;
  user-select: none;
}

/* Toggle button */
.jt-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 3px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-3);
  vertical-align: middle;
  transition: transform 0.18s ease, color 0.15s ease;
  flex-shrink: 0;
  position: relative;
  top: -1px;
}

.jt-toggle svg {
  width: 8px;
  height: 8px;
  transition: transform 0.18s ease;
}

.jt-toggle:hover {
  color: var(--text);
}

/* Rotate arrow when collapsed */
.jt-toggle.collapsed svg {
  transform: rotate(-90deg);
}

/* ===== Options Bar ===== */
.options-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.opt-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.opt-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
}

.opt-input {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 4px 10px;
  width: 110px;
  outline: none;
  transition: border-color var(--transition);
}

.opt-input:focus {
  border-color: var(--primary);
}

.opt-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.opt-check {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  user-select: none;
  transition: color var(--transition);
}

.opt-check:hover { color: var(--text); }

.opt-check input[type="checkbox"] {
  display: none;
}

.opt-check-box {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--border-light);
  background: var(--bg-4);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.opt-check input:checked + .opt-check-box {
  background: var(--primary);
  border-color: var(--primary);
}

.opt-check input:checked + .opt-check-box::after {
  content: '';
  display: block;
  width: 8px;
  height: 5px;
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.panel-hint {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
}

/* MD5 output: monospace, large, centered */
.md5-output {
  font-size: 18px;
  letter-spacing: 0.08em;
  color: #a5b4fc;
  cursor: default;
  user-select: all;
}

.opt-code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-4);
  border-radius: 3px;
  padding: 0 4px;
  font-style: normal;
}

/* ===== Java Syntax Highlight ===== */
.java-kw         { color: #c084fc; }
.java-type       { color: #67e8f9; }
.java-class      { color: #93c5fd; }
.java-annotation { color: #fbbf24; }
.java-string     { color: #86efac; }
.java-number     { color: #fdba74; }
.java-comment    { color: #6b7a99; font-style: italic; }

/* pre-mode: Java/Go/Python/C++/C# code needs preserved whitespace */
.code-output.pre-mode {
  white-space: pre;
}

/* ===== Go Syntax Highlight ===== */
.go-kw      { color: #c084fc; }
.go-type    { color: #67e8f9; }
.go-struct  { color: #93c5fd; }
.go-string  { color: #86efac; }
.go-number  { color: #fdba74; }
.go-comment { color: #6b7a99; font-style: italic; }
.go-tag     { color: #94a3b8; }
.go-tag-key { color: #fbbf24; }
.go-tag-val { color: #f9a8d4; }

/* ===== Python Syntax Highlight ===== */
.py-kw        { color: #c084fc; }
.py-type      { color: #67e8f9; }
.py-class     { color: #93c5fd; }
.py-decorator { color: #fbbf24; }
.py-string    { color: #86efac; }
.py-number    { color: #fdba74; }
.py-comment   { color: #6b7a99; font-style: italic; }

/* ===== C++ Syntax Highlight ===== */
.cpp-kw      { color: #c084fc; }
.cpp-type    { color: #67e8f9; }
.cpp-class   { color: #93c5fd; }
.cpp-ns      { color: #7dd3fc; }
.cpp-preproc { color: #fbbf24; }
.cpp-string  { color: #86efac; }
.cpp-number  { color: #fdba74; }
.cpp-comment { color: #6b7a99; font-style: italic; }

/* ===== C# Syntax Highlight ===== */
.cs-kw      { color: #c084fc; }
.cs-type    { color: #67e8f9; }
.cs-class   { color: #93c5fd; }
.cs-attr    { color: #fbbf24; }
.cs-string  { color: #86efac; }
.cs-number  { color: #fdba74; }
.cs-comment { color: #6b7a99; font-style: italic; }

/* ===== SQL Syntax Highlight ===== */
.sql-kw      { color: #c084fc; font-weight: 500; }
.sql-type    { color: #67e8f9; }
.sql-string  { color: #86efac; }
.sql-ident   { color: #93c5fd; }
.sql-comment { color: #6b7a99; font-style: italic; }
.sql-number  { color: #fdba74; }

/* ===== Lang Converter arrow icon ===== */
.lc-arrow-icon {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* Inline option group inside options-bar (Java / Go toggles) */
.opt-inline-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

[hidden] { display: none !important; }

/* ===== Options Select ===== */
.opt-select {
  background: var(--bg-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 4px 28px 4px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235a5a78' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.opt-select:focus {
  border-color: var(--primary);
}

.opt-select option {
  background: var(--bg-3);
  color: var(--text);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  min-width: 200px;
}

.toast svg { width: 15px; height: 15px; flex-shrink: 0; }

.toast.success { border-color: rgba(34,197,94,0.4); color: #86efac; }
.toast.error   { border-color: rgba(244,63,94,0.4);  color: #fda4af; }
.toast.info    { border-color: rgba(99,102,241,0.4);  color: #a5b4fc; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(6px); }
}

.toast.removing {
  animation: fadeOut 0.2s ease forwards;
}

/* ===== Navbar visit counter ===== */
.stat-total-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  cursor: pointer;
  margin-right: 8px;
}
.stat-total-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.stat-total-btn:hover { background: var(--bg-4); color: var(--text-2); }
.stat-total-btn #stat-total-count { font-weight: 600; font-family: var(--font-mono); }

/* ===== Visit badge on dropdown items ===== */
.visit-badge {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--primary-dim);
  color: #a5b4fc;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  line-height: 1.6;
}

/* ===== Stats Panel ===== */
.stats-summary {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.stats-card {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stats-card-label {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.stats-card-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #a5b4fc;
  letter-spacing: -0.5px;
}
.stats-card-date {
  font-size: 14px;
  letter-spacing: 0;
  color: var(--text-2);
}
.stats-table-wrap {
  flex: 1;
  overflow: auto;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.stats-table th {
  padding: 10px 20px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3);
}
.stats-row td {
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.stats-row:last-child td { border-bottom: none; }
.stats-name {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  width: 160px;
}
.stats-bar-cell { width: 100%; }
.stats-bar-track {
  height: 8px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}
.stats-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a78bfa);
  border-radius: 99px;
  transition: width 0.4s ease;
  min-width: 2px;
}
.stats-count {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: #a5b4fc;
  white-space: nowrap;
  padding-left: 16px !important;
  width: 60px;
}
.btn-danger:hover { background: var(--error-dim); border-color: var(--error); color: var(--error); }

.stats-report-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-3);
  flex-shrink: 0;
}
.stats-report-bar svg { width: 13px; height: 13px; flex-shrink: 0; }
.stats-report-ok   { color: var(--success); font-weight: 500; }
.stats-report-err  { color: var(--error);   font-weight: 500; }
.stats-report-idle { color: var(--text-3); }

/* ===== Language Toggle Button ===== */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 8px;
  flex-shrink: 0;
}

.lang-toggle:hover {
  background: var(--bg-4);
  border-color: var(--border-light);
  color: var(--text);
}

.lang-label {
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-ui);
  letter-spacing: 0.03em;
  line-height: 1;
}

/* ===== Theme Toggle Button ===== */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 10px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-4);
  border-color: var(--border-light);
  color: var(--text);
}

.theme-toggle svg { width: 15px; height: 15px; }

/* 暗色模式显示月亮，亮色模式显示太阳 */
.icon-sun  { display: none;  }
.icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: block; }
[data-theme="light"] .icon-moon { display: none;  }

/* ===== Light Theme Variables ===== */
[data-theme="light"] {
  --bg:           #ffffff;
  --bg-2:         #f4f5f9;
  --bg-3:         #ecedf4;
  --bg-4:         #e2e3ee;
  --border:       #d0d1e6;
  --border-light: #b8bad0;
  --primary:      #5558e3;
  --primary-hover:#4346d0;
  --primary-dim:  rgba(85,88,227,0.1);
  --text:         #14142b;
  --text-2:       #424264;
  --text-3:       #8080a8;
  --shadow:       0 4px 24px rgba(0,0,0,0.1);
}

/* Overrides for hardcoded accent colors in light mode */
[data-theme="light"] .menu-item.open .menu-trigger        { color: #5558e3; }
[data-theme="light"] .dropdown-item.active                { color: #5558e3; }
[data-theme="light"] .action-btn.primary                  { color: #5558e3; border-color: rgba(85,88,227,0.35); background: rgba(85,88,227,0.08); }
[data-theme="light"] .action-btn.primary:hover            { color: #4346d0; background: rgba(85,88,227,0.16); border-color: var(--primary); }
[data-theme="light"] .md5-output                          { color: #5558e3; }

/* Toast in light mode */
[data-theme="light"] .toast                { background: #fff; }
[data-theme="light"] .toast.success        { color: #16a34a; border-color: rgba(22,163,74,0.4); }
[data-theme="light"] .toast.error          { color: #dc2626; border-color: rgba(220,38,38,0.4); }
[data-theme="light"] .toast.info           { color: #5558e3; border-color: rgba(85,88,227,0.4); }

/* opt-select arrow in light mode */
[data-theme="light"] .opt-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238080a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ===== Light Theme – JSON Syntax ===== */
[data-theme="light"] .json-key    { color: #2563eb; }
[data-theme="light"] .json-string { color: #15803d; }
[data-theme="light"] .json-number { color: #c2410c; }
[data-theme="light"] .json-bool   { color: #7c3aed; }
[data-theme="light"] .json-null   { color: #64748b; }
[data-theme="light"] .json-punct  { color: #94a3b8; }

/* ===== Light Theme – Java Syntax ===== */
[data-theme="light"] .java-kw         { color: #7c3aed; }
[data-theme="light"] .java-type       { color: #0e7490; }
[data-theme="light"] .java-class      { color: #2563eb; }
[data-theme="light"] .java-annotation { color: #b45309; }
[data-theme="light"] .java-string     { color: #15803d; }
[data-theme="light"] .java-number     { color: #c2410c; }
[data-theme="light"] .java-comment    { color: #6b7280; }

/* ===== Light Theme – Go Syntax ===== */
[data-theme="light"] .go-kw      { color: #7c3aed; }
[data-theme="light"] .go-type    { color: #0e7490; }
[data-theme="light"] .go-struct  { color: #2563eb; }
[data-theme="light"] .go-string  { color: #15803d; }
[data-theme="light"] .go-number  { color: #c2410c; }
[data-theme="light"] .go-comment { color: #6b7280; }
[data-theme="light"] .go-tag     { color: #64748b; }
[data-theme="light"] .go-tag-key { color: #b45309; }
[data-theme="light"] .go-tag-val { color: #be185d; }

/* ===== Light Theme – Python Syntax ===== */
[data-theme="light"] .py-kw        { color: #7c3aed; }
[data-theme="light"] .py-type      { color: #0e7490; }
[data-theme="light"] .py-class     { color: #2563eb; }
[data-theme="light"] .py-decorator { color: #b45309; }
[data-theme="light"] .py-string    { color: #15803d; }
[data-theme="light"] .py-number    { color: #c2410c; }
[data-theme="light"] .py-comment   { color: #6b7280; }

/* ===== Light Theme – C++ Syntax ===== */
[data-theme="light"] .cpp-kw      { color: #7c3aed; }
[data-theme="light"] .cpp-type    { color: #0e7490; }
[data-theme="light"] .cpp-class   { color: #2563eb; }
[data-theme="light"] .cpp-ns      { color: #0369a1; }
[data-theme="light"] .cpp-preproc { color: #b45309; }
[data-theme="light"] .cpp-string  { color: #15803d; }
[data-theme="light"] .cpp-number  { color: #c2410c; }
[data-theme="light"] .cpp-comment { color: #6b7280; }

/* ===== Light Theme – C# Syntax ===== */
[data-theme="light"] .cs-kw      { color: #7c3aed; }
[data-theme="light"] .cs-type    { color: #0e7490; }
[data-theme="light"] .cs-class   { color: #2563eb; }
[data-theme="light"] .cs-attr    { color: #b45309; }
[data-theme="light"] .cs-string  { color: #15803d; }
[data-theme="light"] .cs-number  { color: #c2410c; }
[data-theme="light"] .cs-comment { color: #6b7280; }

/* ===== Light Theme – SQL Syntax ===== */
[data-theme="light"] .sql-kw      { color: #7c3aed; }
[data-theme="light"] .sql-type    { color: #0e7490; }
[data-theme="light"] .sql-string  { color: #15803d; }
[data-theme="light"] .sql-ident   { color: #1d4ed8; }
[data-theme="light"] .sql-comment { color: #6b7280; }
[data-theme="light"] .sql-number  { color: #c2410c; }

/* ===== Site Footer ===== */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 28px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-3);
  flex-shrink: 0;
}
.site-footer a {
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--transition);
}
.site-footer a:hover { color: var(--primary); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-sep { color: var(--border-light); }

/* ===== Static Page Layout ===== */
.static-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.static-main {
  flex: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 32px 64px;
  width: 100%;
}
.static-main h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.static-main .subtitle {
  color: var(--text-2);
  font-size: 15px;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.static-main h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
}
.static-main p {
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 12px;
}
.static-main ul {
  color: var(--text-2);
  padding-left: 20px;
  line-height: 1.9;
  margin-bottom: 12px;
}
.static-main a {
  color: var(--primary);
  text-decoration: none;
}
.static-main a:hover { text-decoration: underline; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 16px 0 24px;
}
.feature-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.feature-card .fc-icon {
  font-size: 22px;
  margin-bottom: 8px;
}
.feature-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.feature-card p {
  font-size: 12px;
  color: var(--text-3);
  margin: 0;
}
.contact-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 24px 0;
}
.contact-box .contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.contact-box .contact-row:last-child { border-bottom: none; }
.contact-box .contact-icon {
  width: 40px; height: 40px;
  background: var(--primary-dim);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
}
.contact-box .contact-label {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 2px;
}
.contact-box .contact-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.contact-box .contact-value a {
  color: var(--primary);
  text-decoration: none;
}
.contact-box .contact-value a:hover { text-decoration: underline; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ===== Hamburger Button ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-4); }
.ham-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.hamburger.open .ham-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open .ham-bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open .ham-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Mobile Overlay ===== */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 98;
}
.mobile-overlay.active { display: block; }

/* ===== Responsive — Tablet & Mobile ===== */
@media (max-width: 768px) {
  /* Navbar */
  .navbar { padding: 0 14px; gap: 8px; height: 52px; }
  .hamburger { display: flex; }
  .version-badge { display: none; }
  .navbar-right { gap: 4px; }

  /* Mobile nav drawer */
  .navbar-nav {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    width: 80%;
    max-width: 300px;
    height: calc(100vh - 52px);
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    z-index: 99;
    overflow-y: auto;
    padding: 8px 0 24px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    animation: slideIn 0.22s ease;
  }
  @keyframes slideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
  }
  .navbar-nav.mobile-open { display: flex; }

  /* Mobile menu items — always expanded */
  .menu-item { position: static; }
  .menu-trigger {
    width: 100%;
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 0;
    justify-content: space-between;
  }
  .menu-trigger .chevron { display: none; }
  .dropdown {
    display: block;
    position: static;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    animation: none;
  }
  .dropdown-item {
    padding: 10px 18px 10px 38px;
    font-size: 13px;
    border-radius: 0;
  }
  .dropdown-item:hover { background: var(--bg-4); }
  .menu-item + .menu-item {
    border-top: 1px solid var(--border);
  }

  /* Tool panel */
  .tool-panel { padding: 14px 12px; gap: 10px; }
  .tool-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tool-title { font-size: 18px; }
  .tool-title-group { flex-direction: column; align-items: flex-start; gap: 8px; }
  .tool-actions { flex-wrap: wrap; gap: 6px; }

  /* Editor layout — stack vertically */
  .editor-layout { flex-direction: column; gap: 8px; }
  .editor-panel { min-height: 160px; }
  .code-editor { font-size: 12px; padding: 10px 12px 28px; }
  .code-output { font-size: 12px; padding: 10px 12px 28px; }

  /* Action column — horizontal row */
  .action-column {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 4px 0;
  }
  .action-btn {
    flex-direction: row;
    width: auto;
    padding: 7px 14px;
    font-size: 12px;
    gap: 5px;
  }
  .action-btn svg { width: 15px; height: 15px; }

  /* Status bar */
  .status-bar { font-size: 12px; padding: 7px 12px; }

  /* Tool options */
  .tool-options { flex-wrap: wrap; gap: 8px; }

  /* Lang converter */
  .lc-row { flex-direction: column; gap: 6px; }
  .lc-arrow-icon { transform: rotate(90deg); }

  /* MySQL/Go option rows */
  .option-row { flex-wrap: wrap; gap: 8px; }

  /* Footer */
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 10px;
  }
  .footer-links { gap: 12px; flex-wrap: wrap; }

  /* Static pages */
  .static-main { padding: 28px 16px 48px; }
  .static-main h1 { font-size: 22px; }
  .feature-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .contact-box { padding: 20px 16px; }
}

/* ===== Responsive — Small phones ===== */
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .tool-title { font-size: 16px; }
  .navbar { height: 50px; }
  .navbar-nav { top: 50px; height: calc(100vh - 50px); }
  .editor-panel { min-height: 140px; }
}
