/* ================================
   中文字符编码表 - 自定义样式
   配色与 Leowh 主页统一
   ================================ */

:root {
  --bg: #FAFAF9;
  --bg-alt: #F5F5F4;
  --surface: #FFFFFF;
  --border: #E7E5E4;
  --border-strong: #D6D3D1;
  --text: #1E293B;
  --text-secondary: #52525B;
  --text-muted: #71717A;
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --primary-light: rgba(79, 70, 229, 0.08);
  --secondary: #F97316;
  --accent: #EC4899;
  --success: #059669;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 24px; right: 24px;
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 100px;
  font-size: 14px; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  z-index: 1000;
  transform: translateX(calc(100% + 40px));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { transform: translateX(0); }
.toast-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

/* ── Page ── */
.page { max-width: 960px; margin: 0 auto; padding: 0 32px; }

/* ── Header scroll effect ── */
#header.scrolled {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.06);
}

/* ── Charset Tab Bar ── */
.charset-tabs-section { padding: 24px 0 0; }

.charset-tab-bar {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
}

.charset-tab {
  padding: 12px 22px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit; font-size: 14px; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}
.charset-tab:hover { color: var(--primary); }
.charset-tab.active { color: var(--text); border-bottom-color: #ec4899; font-weight: 600; }

/* ── Query Panel ── */
.charset-query { padding: 24px 0 16px; }

.query-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.query-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.panel-title {
  font-size: 16px; font-weight: 700;
  color: var(--text);
}

.query-body { padding: 20px; }

.query-input-row {
  display: flex; gap: 8px; align-items: stretch;
  margin-bottom: 16px;
}

.query-input {
  flex: 1; min-width: 0;
  padding: 12px 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit; font-size: 18px; color: var(--text);
  transition: all 0.2s ease;
  outline: none;
}
.query-input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.query-input::placeholder { color: #9CA3AF; font-size: 14px; }

.btn-query {
  padding: 12px 22px;
  background: #ec4899;
  border: 1px solid transparent;
  border-radius: 100px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: white; cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.btn-query:hover { background: #db2777; box-shadow: 0 4px 12px rgba(0,0,0,0.10); transform: translateY(-1px); }
.btn-query:active { transform: translateY(0); }

.query-placeholder {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Query Result Table ── */
.query-result { }

.result-char-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.result-char-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.result-char-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.result-char-table td.char-cell {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.result-char-table td.code-cell {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

.result-char-table td.code-cell.na {
  color: #D4D4D8;
}

.result-char-table tr:last-child td {
  border-bottom: none;
}

.result-char-table tr:hover td {
  background: rgba(79, 70, 229, 0.03);
}

/* ── Info Panel ── */
.charset-info { padding: 8px 0 16px; }

.info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.info-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.info-body { padding: 20px; }

.info-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px;
}

.info-content { }

.info-content h3 {
  font-size: 18px; font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

.info-content p {
  font-size: 14px; color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 8px;
}

.info-range-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 14px;
}

.info-range-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}

.info-range-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-secondary);
}

.info-range-table tr:hover td { background: rgba(79,70,229,0.03); }

/* ── Compare Panel ── */
.charset-compare { padding: 8px 0 32px; }

.compare-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.compare-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.compare-body { padding: 20px; }

.compare-table-wrap { overflow-x: auto; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 600px;
}

.compare-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg-alt);
  border-bottom: 2px solid var(--border);
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted);
}

.compare-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.compare-table td strong {
  color: var(--text);
}

.compare-table tr:hover td {
  background: rgba(79, 70, 229, 0.03);
}

.compare-table tr:last-child td {
  border-bottom: none;
}

/* ══════════════════════════════════════════
   Custom scrollbar
   ══════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #A5B4FC; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4F46E5; }

::selection { background: rgba(79, 70, 229, 0.2); color: #1E293B; }

/* ══════════════════════════════════════════
   Guide Section (accordion)
   ══════════════════════════════════════════ */
.guide-section {
  margin-top: 16px;
  margin-bottom: 64px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.guide-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}
.guide-toggle:hover {
  background: var(--bg-alt);
}
.guide-toggle-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1E293B;
}
.guide-toggle.open .toggle-arrow {
  transform: rotate(180deg);
}
.toggle-arrow {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}
.guide-list {
  padding: 0 20px 20px;
}
.guide-list.hidden {
  display: none;
}
.guide-item {
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.guide-item:first-child {
  border-top: 1px solid var(--border);
}
.guide-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 6px;
}
.guide-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
}
.guide-item-body kbd {
  padding: 1px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  .page { padding: 0 16px; }

  .charset-tab-bar { flex-wrap: wrap; gap: 0; }
  .charset-tab { padding: 10px 14px; font-size: 13px; }

  .query-input-row { flex-wrap: wrap; }
  .query-input { min-width: 100%; }

  .result-char-table { font-size: 12px; }
  .result-char-table th, .result-char-table td { padding: 8px 10px; }

  .info-range-table { font-size: 12px; }
  .info-range-table th, .info-range-table td { padding: 6px 8px; }
}
