:root {
  --orange: #E67E22;
  --orange-dark: #D35400;
  --orange-light: #FDEBD0;
  --orange-lighter: #FEF5E7;
  --bg: #FAFAFA;
  --bg-card: #FFFFFF;
  --text: #2C3E50;
  --text-muted: #7F8C8D;
  --border: #E8E8E8;
  --sidebar-bg: #FFFFFF;
  --code-bg: #1E1E2E;
  --success: #27AE60;
  --info-bg: #EBF5FB;
  --info-border: #3498DB;
  --exam-bg: #FFF9E6;
  --exam-border: #E67E22;
  --memo-bg: #EBF5FB;
  --memo-border: #5DADE2;
}

.dark {
  --bg: #0F0F1A;
  --bg-card: #1A1A2E;
  --text: #E8E8E8;
  --text-muted: #95A5A6;
  --border: #2C2C3E;
  --sidebar-bg: #16162A;
  --code-bg: #0D0D1A;
  --orange-light: #3D2A1A;
  --orange-lighter: #2A1F15;
  --info-bg: #1A2A3E;
  --info-border: #2980B9;
  --exam-bg: #2A2515;
  --exam-border: #D35400;
  --memo-bg: #1A2A3E;
  --memo-border: #3498DB;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.3s, color 0.3s;
  line-height: 1.7;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--orange-dark); }

.font-mono { font-family: 'IBM Plex Mono', monospace; }

.progress-bar-track {
  height: 3px;
  background: var(--border);
  position: sticky;
  top: 48px;
  z-index: 40;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-dark));
  transition: width 0.15s ease-out;
}

.sidebar-item.active { background: var(--orange-light); color: var(--orange-dark); font-weight: 600; }
.sidebar-item:hover { background: var(--orange-lighter); }

.concept-block {
  border-left: 4px solid var(--orange);
  background: var(--orange-lighter);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}

.exam-tip {
  border: 2px dashed var(--exam-border);
  background: var(--exam-bg);
  padding: 12px 16px;
  border-radius: 8px;
  margin: 12px 0;
}

.memo-tip {
  border-left: 4px solid var(--memo-border);
  background: var(--memo-bg);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
}

.code-block {
  background: var(--code-bg);
  color: #CDD6F4;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  margin: 12px 0;
}
.code-block .keyword { color: #CBA6F7; }
.code-block .type { color: #89B4FA; }
.code-block .string { color: #A6E3A1; }
.code-block .comment { color: #6C7086; font-style: italic; }
.code-block .number { color: #FAB387; }
.code-block .func { color: #89DCEB; }
.code-block .preprocessor { color: #F38BA8; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
}
table.data-table th {
  background: var(--orange);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
table.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
table.data-table tr:nth-child(even) td {
  background: var(--orange-lighter);
}

.float-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 16px;
}
.float-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.section-enter { animation: fadeSlideIn 0.3s ease-out; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.lut-cell {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: inline-block;
  margin: 1px;
}

@media (max-width: 768px) {
  .float-btn { width: 36px; height: 36px; font-size: 14px; }
}

.search-highlight {
  background: #F1C40F;
  color: #000;
  padding: 0 2px;
  border-radius: 2px;
}