/* ==========================================================================
   GRUB2 Theme Tutorial Interactive Experience - Modern Dark Theme
   Design System & Styling
   ========================================================================== */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: rgba(22, 27, 34, 0.85);
  --bg-card-hover: rgba(33, 38, 45, 0.95);
  --border-color: rgba(240, 246, 252, 0.1);
  --border-highlight: rgba(56, 189, 248, 0.4);
  
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-link: #58a6ff;
  
  --accent-cyan: #38bdf8;
  --accent-blue: #2563eb;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --grub-bg: #0a0e14;
  --grub-terminal: #000000;
  --grub-font: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(56, 189, 248, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans TC", sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  
  --nav-height: 68px;
}

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

/* 全域現代科技風捲軸 (Webkit: Chrome, Edge, Safari) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(13, 17, 23, 0.6);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

::-webkit-scrollbar-thumb:active {
  background: var(--accent-cyan);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-button,
::-webkit-scrollbar-button:single-button,
::-webkit-scrollbar-button:vertical:decrement,
::-webkit-scrollbar-button:vertical:increment {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) rgba(13, 17, 23, 0.6);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.65;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.07) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.07) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background: rgba(13, 17, 23, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: linear-gradient(90deg, #fff, var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-action-btn {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.5);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero {
  padding: 4.5rem 2rem 3rem;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 40%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 820px;
  margin: 0 auto 2rem;
}

.hero-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: transform 0.2s, border-color 0.2s;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-highlight);
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ==========================================================================
   Main Layout & Chapter Structure
   ========================================================================== */

.main-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2.5rem;
}

/* Sidebar TOC */
.sidebar-toc {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  height: calc(100vh - var(--nav-height) - 40px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 0.75rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.35) rgba(15, 23, 42, 0.4);
}

/* 側邊欄專屬纖細科技風捲軸 */
.sidebar-toc::-webkit-scrollbar {
  width: 5px;
}

.sidebar-toc::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 999px;
  margin: 8px 0;
}

.sidebar-toc::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.4), rgba(37, 99, 235, 0.4));
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.2);
  transition: all 0.2s ease;
}

.sidebar-toc::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #38bdf8, #2563eb);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
  border-color: #38bdf8;
}

.sidebar-toc::-webkit-scrollbar-button,
.sidebar-toc::-webkit-scrollbar-button:single-button,
.sidebar-toc::-webkit-scrollbar-button:vertical:decrement,
.sidebar-toc::-webkit-scrollbar-button:vertical:increment {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.toc-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.toc-link.active {
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.08);
  border-left-color: var(--accent-cyan);
  font-weight: 600;
}

.toc-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-tertiary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

/* Chapter Cards */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.chapter-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s;
  position: relative;
}

.chapter-section:hover {
  border-color: rgba(56, 189, 248, 0.25);
}

.chapter-header {
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1.5rem;
}

.chapter-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.chapter-title {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* Alerts / Notes */
.callout {
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  gap: 1rem;
  font-size: 0.92rem;
  line-height: 1.6;
}

.callout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.callout-title {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
  font-weight: 700;
}

.callout-content {
  color: inherit;
}

.callout-content strong {
  color: #ffffff;
}

.callout-info {
  background: rgba(56, 189, 248, 0.08);
  border-left: 4px solid var(--accent-cyan);
  color: #bae6fd;
}

.callout-warning {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--accent-amber);
  color: #fde68a;
}

.callout-tip {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--accent-emerald);
  color: #a7f3d0;
}

.callout-danger {
  background: rgba(244, 63, 94, 0.08);
  border-left: 4px solid var(--accent-rose);
  color: #fecdd3;
}

/* ==========================================================================
   Slice Rules Visual Grid Cards
   ========================================================================== */

.slice-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.slice-rule-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}

.slice-rule-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.rule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.rule-zone-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.rule-zone-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.badge-fixed {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.badge-stretch-h {
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.badge-stretch-v {
  background: rgba(16, 185, 129, 0.2);
  color: #86efac;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-stretch-both {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.rule-desc-text {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.55;
}

.rule-formula-chip {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
  margin-top: auto;
}

.slice-constraint-banner {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(180, 83, 9, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-left: 5px solid var(--accent-amber);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 1rem;
}

.constraint-banner-title {
  color: #fef08a;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.constraint-banner-body {
  font-size: 0.88rem;
  color: #fde68a;
  line-height: 1.6;
}

/* 切片相依與相等性圖形輔助說明 */
.slice-diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.slice-diagram-card {
  background: rgba(10, 15, 29, 0.85);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.slice-diagram-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slice-diagram-badge {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.slice-diagram-svg-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #080c16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 0.75rem 0.5rem;
  overflow: hidden;
}

.slice-diagram-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.5;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border-left: 3px solid #38bdf8;
}

/* ==========================================================================
   Syntax Trap Table (Chapter 4.1)
   ========================================================================== */

.syntax-trap-box {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.12), rgba(136, 19, 55, 0.08));
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-left: 5px solid var(--accent-rose);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.syntax-trap-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.syntax-trap-title {
  color: #fecdd3;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.syntax-trap-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.syntax-trap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(10, 15, 29, 0.85);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.86rem;
}

.syntax-trap-table th {
  background: rgba(30, 41, 59, 0.9);
  color: #fca5a5;
  font-weight: 700;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(244, 63, 94, 0.2);
  font-size: 0.82rem;
  letter-spacing: 0.4px;
}

.syntax-trap-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  vertical-align: middle;
  line-height: 1.5;
}

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

.syntax-trap-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.syntax-tag-global {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.syntax-tag-comp {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.symbol-badge {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: bold;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: #050811;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.symbol-badge.hyphen {
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.symbol-badge.colon {
  color: #facc15;
  border: 1px solid rgba(250, 204, 21, 0.4);
}

.symbol-badge.underscore {
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.4);
}

.symbol-badge.equals {
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.4);
}

.syntax-code-good {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #86efac;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.syntax-code-bad {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #fca5a5;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  text-decoration: line-through;
}

.syntax-trap-tip {
  font-size: 0.82rem;
  color: #fecdd3;
  background: rgba(244, 63, 94, 0.1);
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  border-left: 3px solid var(--accent-rose);
  line-height: 1.5;
}

/* ==========================================================================
   Parrots Circular Progress Feature Cards
   ========================================================================== */

.parrots-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.parrots-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.parrots-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.parrots-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.parrots-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.parrots-card-badge {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  white-space: nowrap;
  flex-shrink: 0;
}

.parrots-card-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.parrots-table-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.parrots-pill {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.35rem 0.55rem;
  font-size: 0.73rem;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #94a3b8;
  white-space: nowrap;
}

.parrots-pill strong {
  color: var(--accent-cyan);
}

/* ==========================================================================
   Boundary Clipping Rules Cards (Chapter 5)
   ========================================================================== */

.clip-rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin: 1.25rem 0 1.5rem;
}

@media (max-width: 768px) {
  .clip-rules-grid {
    grid-template-columns: 1fr;
  }
}

.clip-rule-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.2s, border-color 0.2s;
}

.clip-rule-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-highlight);
  border-left-color: var(--accent-cyan);
}

.clip-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.clip-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  white-space: nowrap;
}

.clip-condition-box {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.6rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: #fde047;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.clip-action-arrow {
  color: #94a3b8;
  font-weight: bold;
}

.clip-action-result {
  color: #86efac;
  font-weight: bold;
}

.clip-rule-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
}

/* ==========================================================================
   Code Blocks & Formulas
   ========================================================================== */

.code-container {
  background: #090d13;
  border: 1px solid rgba(240, 246, 252, 0.12);
  border-radius: var(--radius-md);
  margin: 1.25rem 0;
  overflow: hidden;
}

.code-header {
  background: rgba(22, 27, 34, 0.9);
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(240, 246, 252, 0.08);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

pre code {
  display: block;
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  color: #e6edf3;
  overflow-x: auto;
}

.token-comment { color: #8b949e; font-style: italic; }
.token-prop { color: #79c0ff; }
.token-val { color: #a5d6ff; }
.token-str { color: #a5d6ff; }
.token-num { color: #f2cc60; }
.token-cmd { color: #7ee787; }
.token-kw { color: #ff7b72; }

/* Mathematical Formula Card */
/* Mathematical Formula Card */
.formula-box {
  background: linear-gradient(145deg, #0d121f, #151d2e);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.formula-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.formula-content {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: #f9fafb;
  padding: 1rem 1.25rem;
  background: rgba(3, 7, 18, 0.8);
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  overflow-x: auto;
  line-height: 1.6;
}

/* 公式中各項分色 */
.term-pad { color: #38bdf8; font-weight: 700; }
.term-menu { color: #fb923c; font-weight: 700; }
.term-n { color: #f472b6; font-weight: 700; }
.term-item { color: #4ade80; font-weight: 700; }
.term-space { color: #a78bfa; font-weight: 700; }
.term-sel { color: #fcd34d; font-weight: 700; }
.term-minus { color: #f43f5e; font-weight: 700; }

/* 選單高度幾何垂直堆疊圖解容器 */
.menu-formula-diagram-wrap {
  background: #080c16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.menu-diagram-legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.78rem;
  color: #94a3b8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.menu-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.menu-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* 選單高度參數規格表格 */
.menu-params-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.5rem;
}

.menu-params-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(10, 15, 29, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.85rem;
}

.menu-params-table th {
  background: rgba(15, 23, 42, 0.95);
  color: #94a3b8;
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.2);
  font-size: 0.8rem;
  letter-spacing: 0.3px;
}

.menu-params-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  vertical-align: middle;
  line-height: 1.45;
}

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

.menu-params-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.param-var-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  white-space: nowrap;
}

.param-tip-banner {
  font-size: 0.82rem;
  color: #cbd5e1;
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--accent-cyan);
  padding: 0.65rem 0.9rem;
  border-radius: 6px;
  line-height: 1.5;
}

/* 選中項目高度與 -1px 原理圖解卡片 */
.sel-item-diagram-box {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-left: 5px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sel-item-diagram-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sel-item-diagram-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sel-item-svg-wrap {
  width: 100%;
  background: #080c16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.5rem;
  overflow: hidden;
}

.sel-item-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.sel-item-point-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.sel-item-point-card strong {
  color: #38bdf8;
  display: block;
  margin-bottom: 0.2rem;
}

/* ==========================================================================
   Interactive Component Playgrounds
   ========================================================================== */

.interactive-card {
  background: linear-gradient(180deg, rgba(26, 32, 44, 0.9) 0%, rgba(17, 24, 39, 0.95) 100%);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
  position: relative;
}

.interactive-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.interactive-badge {
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.interactive-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.interactive-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  background: rgba(13, 17, 23, 0.7);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 150px;
  flex: 1;
}

.control-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.control-value {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

input[type="range"] {
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

input[type="number"], select, input[type="text"] {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  outline: none;
}

input[type="number"]:focus, select:focus, input[type="text"]:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.btn {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover {
  background: rgba(240, 246, 252, 0.1);
  border-color: var(--text-secondary);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #fff;
  border: none;
}

.btn-primary:hover {
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.4);
}

/* 9-Slice Visualizer Specifics */
.nine-slice-container {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 1.25fr);
  gap: 1.5rem;
  align-items: center;
}

@media (max-width: 960px) {
  .nine-slice-container {
    grid-template-columns: 1fr;
  }
}

.nine-slice-preview-stage {
  background: #080c14;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  height: 380px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-image: 
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 20px 20px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

.nine-slice-box {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto 1fr auto;
  position: relative;
  border-radius: 6px;
  transition: width 0.1s, height 0.1s;
  user-select: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}

/* 九宮格實驗室專屬各分區高對比鮮明色彩 */
.nine-slice-box .slice-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  transition: opacity 0.2s, background-color 0.2s;
  box-sizing: border-box;
}

/* 1. 四角區：高亮珊瑚紅 */
.nine-slice-box .slice-nw,
.nine-slice-box .slice-ne,
.nine-slice-box .slice-sw,
.nine-slice-box .slice-se {
  background: #ef4444 !important;
  border: 2px solid #fca5a5 !important;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

/* 2. 南北區：鮮豔琥珀橙 */
.nine-slice-box .slice-n,
.nine-slice-box .slice-s {
  background: #f97316 !important;
  border: 2px dashed #fdba74 !important;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

/* 3. 東西區：翠綠翡翠綠 */
.nine-slice-box .slice-w,
.nine-slice-box .slice-e {
  background: #10b981 !important;
  border: 2px dashed #86efac !important;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

/* 4. 中心區：電光皇家藍 */
.nine-slice-box .slice-c {
  background: #3b82f6 !important;
  border: 2px dotted #93c5fd !important;
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.4);
}

/* 標籤文字徽章樣式 (清晰高對比深底白字) */
.nine-slice-box .slice-cell span {
  background: rgba(10, 15, 29, 0.88);
  color: #ffffff;
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.15;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  z-index: 2;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nine-slice-box .slice-cell span.cell-sub {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  font-size: 0.6rem;
  color: #93c5fd;
  font-weight: 500;
  display: block;
}

/* 右側資訊規格表格 */
.nine-slice-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.nine-slice-spec-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.84rem;
}

.nine-slice-spec-table th {
  background: rgba(30, 41, 59, 0.8);
  color: #94a3b8;
  font-weight: 600;
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  letter-spacing: 0.3px;
}

.nine-slice-spec-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  vertical-align: middle;
  line-height: 1.4;
}

.nine-slice-spec-table tr:last-child td {
  border-bottom: none;
}

.nine-slice-spec-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.zone-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
}

.zone-tag::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.tag-corner {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.tag-corner::before { background: #ef4444; }

.tag-north-south {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.4);
}
.tag-north-south::before { background: #f97316; }

.tag-east-west {
  background: rgba(16, 185, 129, 0.18);
  color: #86efac;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
.tag-east-west::before { background: #10b981; }

.tag-center {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
.tag-center::before { background: #3b82f6; }

.formula-tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #38bdf8;
  background: rgba(0, 0, 0, 0.45);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  white-space: nowrap;
}

.nine-slice-table-tip {
  font-size: 0.8rem;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  border-left: 3px solid #38bdf8;
  line-height: 1.45;
}

/* Boot Menu Interactive Calculator Visualizer */
.menu-calc-display {
  background: #090d14;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.menu-svg-container {
  width: 100%;
  height: 380px;
  background: #0d121c;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.05);
}

.calc-status-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.status-ok { color: var(--accent-emerald); font-weight: bold; }
.status-err { color: var(--accent-rose); font-weight: bold; }

/* Circular Progress Parrots Canvas */
.circular-progress-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
}

.canvas-wrapper {
  position: relative;
  background: #0a0e17;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.circular-info-card {
  max-width: 320px;
  background: rgba(13, 17, 23, 0.8);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

/* Containers Comparison (vbox, hbox, canvas) */
.container-demo-area {
  min-height: 260px;
  background: #090d14;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.box-item {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.7), rgba(56, 189, 248, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.box-item-1 { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.box-item-2 { background: linear-gradient(135deg, #10b981, #34d399); }
.box-item-3 { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

/* Virtual GRUB2 Full Screen Simulator */
.grub-simulator-wrapper {
  background: #000;
  border: 2px solid #30363d;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 50px rgba(0,0,0,0.8), 0 0 15px rgba(56, 189, 248, 0.2);
  overflow: hidden;
  margin: 2rem 0;
  position: relative;
}

.grub-screen-header {
  background: #161b22;
  padding: 0.6rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem 1.2rem;
  border-bottom: 1px solid #30363d;
  font-size: 0.82rem;
  color: #8b949e;
  min-height: 48px;
}

.sim-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.sim-header-title {
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
}

.sim-aspect-badge {
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  white-space: nowrap;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.sim-header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.grub-res-control {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.grub-res-label {
  font-size: 0.75rem;
  color: #8b949e;
  font-family: var(--font-mono);
}

.grub-res-select {
  background: #0d1117;
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.grub-res-select:hover, .grub-res-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.3);
}

.sim-btn-zip-load {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 95, 70, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.sim-btn-zip-load:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.3), rgba(6, 95, 70, 0.45));
  border-color: #10b981;
  color: #a7f3d0;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.sim-loaded-zip-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.76rem;
  font-family: var(--font-mono);
  max-width: 190px;
}

.zip-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  flex-shrink: 0;
}

.zip-badge-name {
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zip-btn-reset {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0 0.15rem;
  font-size: 0.8rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.zip-btn-reset:hover {
  color: #f87171;
}

/* ==========================================================================
   Virtual Scaled Viewport Stage (1:1 Native Screen Scaling Engine)
   ========================================================================== */
.grub-viewport-stage {
  width: 100%;
  position: relative;
  background-color: #030712;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8), 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* 縮放比與真實解析度指示徽章 */
.grub-viewport-scale-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.35);
  backdrop-filter: blur(8px);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.grub-viewport-scale-badge .scale-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px #34d399;
}

/* 拖曳圖片懸停於開機畫布時的提示層 */
.grub-viewport-drop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(6px);
  border: 3px dashed #38bdf8;
  border-radius: var(--radius-sm);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.grub-viewport-drop-overlay.active {
  display: flex;
}

.drop-overlay-box {
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(56, 189, 248, 0.6);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.4);
  padding: 1.5rem 2.5rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.drop-overlay-icon {
  font-size: 2.5rem;
}

.drop-overlay-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #38bdf8;
}

.drop-overlay-sub {
  font-size: 0.82rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

/* 自訂開機底圖檔名徽章 */
.sim-bg-filename-badge {
  font-size: 0.72rem;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

.grub-title-bar.is-hidden {
  display: none !important;
}

/* 內部虛擬世界畫布 (原生長寬由 JS 動態指定為目標解析度，如 1920x1080) */
.grub-viewport {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background-color: #0b0f19;
  background-size: cover;
  background-position: center;
  font-family: var(--grub-font);
  color: #fff;
  overflow: hidden;
  user-select: none;
  box-sizing: border-box;
}

.grub-title-bar {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 3px 6px rgba(0,0,0,0.9);
  letter-spacing: 1px;
  white-space: nowrap;
}

.grub-menu-box {
  position: absolute;
  background: rgba(15, 23, 42, 0.88);
  border: 2px solid rgba(56, 189, 248, 0.5);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75);
  border-radius: 8px;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 10px;
  gap: 8px;
  box-sizing: border-box;
  overflow: hidden !important;
}

.grub-menu-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

/* Scrollbar Track & Thumb in Virtual GRUB Menu */
.v-grub-scrollbar-track {
  width: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  position: relative;
  margin: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.v-grub-scrollbar-thumb {
  position: absolute;
  top: 0;
  left: 2px;
  right: 2px;
  height: 52px;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
  transition: top 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.grub-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px !important;
  height: 48px !important;
  min-height: 48px !important;
  max-height: 48px !important;
  box-sizing: border-box !important;
  font-size: 18px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.15s;
  white-space: nowrap !important;
  overflow: hidden !important;
}

.grub-menu-item > div:last-child {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1;
  min-width: 0;
}

.grub-menu-item.selected {
  background: rgba(37, 99, 235, 0.85);
  color: #ffffff;
  border: 1px solid rgba(147, 197, 253, 0.6);
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.5);
  font-weight: 600;
}

.grub-item-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.grub-progress-container {
  position: absolute;
  text-align: center;
  box-sizing: border-box;
}

.grub-progress-bar-track {
  height: 26px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.grub-progress-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #38bdf8 100%);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
  transition: width 1s linear;
}

.grub-progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #ffffff;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.grub-footer-help {
  font-size: 15px;
  color: #94a3b8;
  margin-top: 12px;
  line-height: 1.5;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}


.grub-progress-bar-fill {
  height: 100%;
  width: 65%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 1s linear;
}

.grub-progress-text {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

.grub-footer-help {
  margin-top: 8px;
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ==========================================================================
   Tables & Comparisons
   ========================================================================== */

.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.custom-table th, .custom-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.custom-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 3rem 2rem;
  margin-top: 5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.footer-link {
  color: var(--text-link);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
  }
  .sidebar-toc {
    display: none;
  }
  .hero-title {
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0 1rem;
  }
  .nav-links {
    display: none;
  }
  .hero {
    padding: 3rem 1rem 2rem;
  }
  .chapter-section {
    padding: 1.5rem;
  }
}

/* ==========================================================================
   Slice Gallery & Modal Styles
   ========================================================================== */

.btn-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35) !important;
  border: 1px solid #34d399 !important;
  transition: all 0.2s ease !important;
}

.btn-emerald:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5) !important;
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%) !important;
}

.btn-cyan {
  border-color: #38bdf8 !important;
  color: #38bdf8 !important;
  background: rgba(56, 189, 248, 0.08) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.btn-cyan:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #ffffff !important;
  border-color: #7dd3fc !important;
}

/* Modal Backdrop & Window */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 11, 20, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: #0d1527;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  width: 100%;
  max-width: 1120px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.15);
  transform: scale(0.96);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.modal-backdrop.show .modal-container {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.9);
}

.modal-close-btn {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #94a3b8;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: #f43f5e;
  color: #f43f5e;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.modal-alert-box {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid #10b981;
  padding: 0.9rem 1.2rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.slices-grid-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 1.25rem;
}

@media (max-width: 600px) {
  .slices-grid-showcase {
    grid-template-columns: 1fr;
  }
}

.slice-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: border-color 0.2s ease;
}

.slice-card:hover {
  border-color: rgba(56, 189, 248, 0.45);
}

.slice-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slice-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.slice-badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge-blue {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.slice-card-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

.slice-preview-container {
  background: rgba(3, 7, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 9-slice visual matrix */
.slice-matrix-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 240px;
}

.mini-matrix {
  width: 150px !important;
}

.slice-matrix-9 .slice-cell {
  background: rgba(30, 41, 59, 0.5);
  border: 1px dashed rgba(56, 189, 248, 0.25);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
  min-height: 48px;
}

.slice-matrix-9 .slice-cell img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.slice-matrix-9 .slice-cell span {
  font-size: 0.65rem;
  color: #64748b;
  font-family: var(--font-mono);
  margin-top: 3px;
}

.center-cell {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.08);
}

.center-cell span {
  color: #38bdf8;
  font-weight: 600;
}

/* 3-slice thumb visual */
.slice-matrix-3 {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 85px;
}

.slice-cell-3 {
  background: rgba(30, 41, 59, 0.5);
  border: 1px dashed rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 4px;
}

.slice-cell-3 img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  image-rendering: pixelated;
}

.slice-cell-3 span {
  font-size: 0.65rem;
  color: #94a3b8;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.center-cell-3 {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.1);
}

.center-cell-3 span {
  color: #fbbf24;
  font-weight: 600;
}

.slice-code-hint {
  background: #070b14;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  color: #38bdf8;
  font-family: var(--font-mono);
  line-height: 1.4;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid rgba(56, 189, 248, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.9);
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================================================
   Theme Palette Switcher
   ========================================================================== */
.theme-palette-switcher {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.palette-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.palette-btn {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.palette-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: #94a3b8;
  color: #fff;
}

.palette-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Simulator dynamic themes */
.grub-viewport.theme-cyber_blue {
  background: #0a0f1d;
}
.grub-viewport.theme-cyber_blue .grub-menu-box {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
}
.grub-viewport.theme-cyber_blue .grub-menu-item.selected {
  background: linear-gradient(90deg, #0284c7 0%, #0369a1 100%);
  border-left: 3px solid #38bdf8;
}
.grub-viewport.theme-cyber_blue .grub-progress-bar-fill {
  background: linear-gradient(90deg, #38bdf8 0%, #0284c7 100%);
}
.grub-viewport.theme-cyber_blue .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 50%, #0369a1 100%);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
  border-color: #bae6fd;
}

.grub-viewport.theme-matrix_emerald {
  background: #05140d;
}
.grub-viewport.theme-matrix_emerald .grub-menu-box {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.25);
}
.grub-viewport.theme-matrix_emerald .grub-menu-item.selected {
  background: linear-gradient(90deg, #059669 0%, #047857 100%);
  border-left: 3px solid #34d399;
}
.grub-viewport.theme-matrix_emerald .grub-progress-bar-fill {
  background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}
.grub-viewport.theme-matrix_emerald .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #34d399 0%, #059669 50%, #047857 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  border-color: #a7f3d0;
}

.grub-viewport.theme-cyberpunk_purple {
  background: #120b1f;
}
.grub-viewport.theme-cyberpunk_purple .grub-menu-box {
  border-color: #a855f7;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
}
.grub-viewport.theme-cyberpunk_purple .grub-menu-item.selected {
  background: linear-gradient(90deg, #9333ea 0%, #7e22ce 100%);
  border-left: 3px solid #f472b6;
}
.grub-viewport.theme-cyberpunk_purple .grub-progress-bar-fill {
  background: linear-gradient(90deg, #f472b6 0%, #a855f7 100%);
}
.grub-viewport.theme-cyberpunk_purple .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #f472b6 0%, #9333ea 50%, #7e22ce 100%);
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
  border-color: #fbcfe8;
}

.grub-viewport.theme-amber_sunset {
  background: #1a0e05;
}
.grub-viewport.theme-amber_sunset .grub-menu-box {
  border-color: #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}
.grub-viewport.theme-amber_sunset .grub-menu-item.selected {
  background: linear-gradient(90deg, #d97706 0%, #b45309 100%);
  border-left: 3px solid #fde68a;
}
.grub-viewport.theme-amber_sunset .grub-progress-bar-fill {
  background: linear-gradient(90deg, #fbbf24 0%, #d97706 100%);
}
.grub-viewport.theme-amber_sunset .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 50%, #b45309 100%);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  border-color: #fde68a;
}

.grub-viewport.theme-monochrome_slate {
  background: #0f1117;
}
.grub-viewport.theme-monochrome_slate .grub-menu-box {
  border-color: #94a3b8;
  box-shadow: 0 0 20px rgba(148, 163, 184, 0.2);
}
.grub-viewport.theme-monochrome_slate .grub-menu-item.selected {
  background: linear-gradient(90deg, #475569 0%, #334155 100%);
  border-left: 3px solid #e2e8f0;
}
.grub-viewport.theme-monochrome_slate .grub-progress-bar-fill {
  background: linear-gradient(90deg, #e2e8f0 0%, #94a3b8 100%);
}
.grub-viewport.theme-monochrome_slate .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #f1f5f9 0%, #94a3b8 50%, #64748b 100%);
  box-shadow: 0 0 8px rgba(148, 163, 184, 0.5);
  border-color: #ffffff;
}

/* ❄️ 北歐冰雪極光 (Nord Frost) */
.grub-viewport.theme-nord_frost {
  background: #242933;
}
.grub-viewport.theme-nord_frost .grub-menu-box {
  border-color: #88c0d0;
  box-shadow: 0 0 20px rgba(136, 192, 208, 0.3);
}
.grub-viewport.theme-nord_frost .grub-menu-item.selected {
  background: linear-gradient(90deg, #5e81ac 0%, #434c5e 100%);
  border-left: 3px solid #88c0d0;
}
.grub-viewport.theme-nord_frost .grub-progress-bar-fill {
  background: linear-gradient(90deg, #88c0d0 0%, #81a1c1 100%);
}
.grub-viewport.theme-nord_frost .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #88c0d0 0%, #81a1c1 50%, #5e81ac 100%);
  box-shadow: 0 0 8px rgba(136, 192, 208, 0.6);
  border-color: #eceff4;
}

/* 🧛 德古拉暗夜 (Dracula) */
.grub-viewport.theme-dracula_vampire {
  background: #21222c;
}
.grub-viewport.theme-dracula_vampire .grub-menu-box {
  border-color: #bd93f9;
  box-shadow: 0 0 20px rgba(189, 147, 249, 0.35);
}
.grub-viewport.theme-dracula_vampire .grub-menu-item.selected {
  background: linear-gradient(90deg, #ff79c6 0%, #bd93f9 100%);
  border-left: 3px solid #50fa7b;
}
.grub-viewport.theme-dracula_vampire .grub-progress-bar-fill {
  background: linear-gradient(90deg, #50fa7b 0%, #8be9fd 100%);
}
.grub-viewport.theme-dracula_vampire .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #ff79c6 0%, #bd93f9 50%, #6272a4 100%);
  box-shadow: 0 0 8px rgba(255, 121, 198, 0.6);
  border-color: #f8f8f2;
}

/* ☀️ 復古極客棕 (Gruvbox Dark) */
.grub-viewport.theme-gruvbox_dark {
  background: #1d2021;
}
.grub-viewport.theme-gruvbox_dark .grub-menu-box {
  border-color: #fe8019;
  box-shadow: 0 0 20px rgba(254, 128, 25, 0.3);
}
.grub-viewport.theme-gruvbox_dark .grub-menu-item.selected {
  background: linear-gradient(90deg, #d65d0e 0%, #3c3836 100%);
  border-left: 3px solid #fabd2f;
}
.grub-viewport.theme-gruvbox_dark .grub-progress-bar-fill {
  background: linear-gradient(90deg, #fabd2f 0%, #fe8019 100%);
}
.grub-viewport.theme-gruvbox_dark .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #fabd2f 0%, #fe8019 50%, #d65d0e 100%);
  box-shadow: 0 0 8px rgba(254, 128, 25, 0.6);
  border-color: #ebdbb2;
}

/* 🌊 貓普奇諾摩卡 (Catppuccin Mocha) */
.grub-viewport.theme-catppuccin_mocha {
  background: #181825;
}
.grub-viewport.theme-catppuccin_mocha .grub-menu-box {
  border-color: #b4befe;
  box-shadow: 0 0 20px rgba(180, 190, 254, 0.3);
}
.grub-viewport.theme-catppuccin_mocha .grub-menu-item.selected {
  background: linear-gradient(90deg, #cba6f7 0%, #313244 100%);
  border-left: 3px solid #f5c2e7;
}
.grub-viewport.theme-catppuccin_mocha .grub-progress-bar-fill {
  background: linear-gradient(90deg, #89dceb 0%, #cba6f7 100%);
}
.grub-viewport.theme-catppuccin_mocha .v-grub-scrollbar-thumb {
  background: linear-gradient(180deg, #f5c2e7 0%, #cba6f7 50%, #b4befe 100%);
  box-shadow: 0 0 8px rgba(203, 166, 247, 0.6);
  border-color: #cdd6f4;
}
/* ==========================================================================
   Boot Menu 座標與九宮格錨點定位機制專屬樣式 (boot_menu Coordinates & 9-Slice Anchor)
   ========================================================================== */
.menu-coords-box {
  background: linear-gradient(145deg, #0d121f, #151d2e);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-left: 5px solid var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin: 1.75rem 0;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.menu-coords-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.coords-qa-badge {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(37, 99, 235, 0.25));
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.coords-main-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.coords-main-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  margin-top: 0.35rem;
  line-height: 1.5;
}

.coords-conclusion-callout {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(6, 78, 59, 0.2));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.coords-conclusion-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.coords-conclusion-text {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.55;
}

.coords-conclusion-text strong {
  color: #34d399;
}

.coords-svg-wrap {
  background: #080c16;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.7);
  overflow-x: auto;
}

.coords-comp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .coords-comp-grid {
    grid-template-columns: 1fr;
  }
}

.coords-comp-card {
  padding: 1.15rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.coords-comp-card.inside {
  background: rgba(30, 58, 138, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.coords-comp-card.outside {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.coords-comp-tag {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  width: fit-content;
}

.coords-comp-tag.inside {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.coords-comp-tag.outside {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Chapter 6: Font Dropzone & .pf2 Bitmap Simulation Styles
   ========================================================================== */
.font-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.4);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.8), rgba(10, 15, 29, 0.95));
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.font-dropzone:hover,
.font-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: linear-gradient(145deg, rgba(56, 189, 248, 0.12), rgba(15, 23, 42, 0.95));
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  transform: translateY(-1px);
}

.font-dropzone-icon {
  font-size: 2rem;
  line-height: 1;
}

.font-dropzone-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
}

.font-dropzone-desc {
  font-size: 0.8rem;
  color: #94a3b8;
  line-height: 1.4;
}

.font-loaded-status {
  display: none;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 78, 59, 0.25));
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.font-loaded-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: #e2e8f0;
}

.font-loaded-name {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #34d399;
}

.font-reset-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.font-reset-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* 渲染模式切換列 */
.font-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.font-mode-options {
  display: flex;
  gap: 0.5rem;
}

.font-mode-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.font-mode-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent-cyan);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

/* 點陣模式文字樣式 */
.bitmap-mode {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  letter-spacing: 0.5px;
}

/* ==========================================================================
   Chapter 08: theme.txt 智慧語法校驗器專屬樣式 (Playground 08)
   ========================================================================== */
.linter-presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.linter-preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.linter-preset-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.linter-editor-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.linter-textarea {
  width: 100%;
  height: 280px;
  background: #080c16;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-md);
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  overflow-x: auto;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.linter-textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.25), inset 0 2px 10px rgba(0, 0, 0, 0.6);
}

.linter-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.linter-actions-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* 診斷結果報告面板 */
.linter-report-box {
  margin-top: 1.5rem;
  background: #090d18;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.linter-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.linter-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.linter-status-badge.pass {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.linter-status-badge.has-error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.linter-status-badge.has-warn {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.linter-issues-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.linter-issue-card {
  padding: 0.9rem 1.15rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.linter-issue-card.error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-left: 4px solid #ef4444;
}

.linter-issue-card.warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid #f59e0b;
}

.linter-issue-card.info {
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-left: 4px solid #38bdf8;
}

.linter-issue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.linter-line-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.4);
}

.linter-issue-snippet {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  color: #fca5a5;
  border: 1px dashed rgba(239, 68, 68, 0.3);
}

.linter-issue-fix {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(6, 78, 59, 0.3);
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Chapter 03: Playground 09 - Custom 9-Slice Canvas Studio
   ========================================================================== */
.slice-gen-card {
  position: relative;
  overflow: hidden;
}

.slice-gen-mode-selector {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.slice-gen-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
  flex-wrap: wrap;
}

.slice-gen-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slice-gen-tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.slice-gen-tab.active {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.slice-gen-presets-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.slice-gen-preset-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #38bdf8;
  white-space: nowrap;
}

.slice-gen-preset-btns {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

.slice-gen-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 41, 59, 0.7);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.slice-gen-preset-btn:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
}

.slice-gen-preset-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 5px currentColor;
}

.slice-gen-workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 992px) {
  .slice-gen-workspace {
    grid-template-columns: 1fr;
  }
}

.slice-gen-controls-panel {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.slice-gen-section-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.slice-gen-helper {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 0.25rem;
  line-height: 1.35;
}

.slice-gen-colors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.slice-gen-color-item label {
  display: block;
  font-size: 0.76rem;
  color: #94a3b8;
  margin-bottom: 0.3rem;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 3px 6px;
}

.color-picker-wrapper input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 24px;
  border-radius: 3px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.hex-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #cbd5e1;
}

.slice-gen-select {
  width: 100%;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.8rem;
  padding: 0.45rem 0.6rem;
  outline: none;
  cursor: pointer;
}

.slice-gen-preview-panel {
  display: flex;
  flex-direction: column;
}

.slice-gen-preview-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.slice-gen-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #e2e8f0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.slice-dim-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.slice-gen-stage-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 180px;
  background: radial-gradient(circle at center, rgba(14, 28, 48, 0.8) 0%, rgba(5, 10, 20, 0.95) 100%);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  overflow: auto;
  position: relative;
}

.slice-gen-scaled-box {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 0.15s ease, height 0.15s ease;
  box-sizing: border-box;
  position: relative;
}

.slice-gen-inner-content {
  text-align: center;
  padding: 0.5rem 1rem;
  pointer-events: none;
}

.slice-gen-mock-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.92rem;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.slice-gen-mock-sub {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.slice-gen-stage-controls {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* 9-Slice 與 3-Slice 微觀矩陣網格 */
.slice-gen-matrix-9 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  max-width: 480px;
  margin: 0 auto;
}

.slice-gen-matrix-3 {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 220px;
  margin: 0 auto;
}

.slice-gen-cell-card {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 0.5rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.slice-gen-cell-card:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.slice-gen-cell-thumb-wrap {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  margin-bottom: 0.4rem;
  overflow: hidden;
  position: relative;
  background-image: linear-gradient(45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
                    linear-gradient(-45deg, rgba(255,255,255,0.05) 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.05) 75%),
                    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.05) 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
}

.slice-gen-cell-thumb {
  max-width: 90%;
  max-height: 90%;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.slice-gen-cell-name {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slice-gen-cell-size {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #38bdf8;
  margin-top: 0.15rem;
}

.slice-gen-cell-dl-hint {
  font-size: 0.64rem;
  color: #94a3b8;
  margin-top: 0.15rem;
}

.slice-gen-actions-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.slice-gen-feedback {
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  font-size: 0.84rem;
  font-family: var(--font-mono);
  animation: fadeIn 0.3s ease;
}

.slice-gen-feedback.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.slice-gen-feedback.info {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
}

/* ==========================================================================
   Playground 09 Extension: Custom Image Upload & Slicing Studio Styles
   ========================================================================== */

/* 來源模式分頁切換按鈕 (Procedural vs Upload) */
.slice-gen-source-switch {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
  margin-bottom: 1.25rem;
}

.slice-gen-source-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.slice-gen-source-tab:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.slice-gen-source-tab.active {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

/* 拖曳上傳區域 (Dropzone) */
.slice-upload-dropzone {
  border: 2px dashed rgba(56, 189, 248, 0.35);
  background: rgba(10, 25, 47, 0.4);
  border-radius: var(--radius-sm);
  padding: 1.2rem 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.slice-upload-dropzone:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.15);
}

.slice-upload-dropzone.dragover {
  border-color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.25);
  transform: scale(1.01);
}

.slice-upload-icon {
  font-size: 1.6rem;
  margin-bottom: 0.35rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.slice-upload-prompt {
  font-size: 0.84rem;
  color: #e2e8f0;
  margin-bottom: 0.25rem;
}

.slice-upload-hint {
  font-size: 0.72rem;
  color: #64748b;
  font-family: var(--font-mono);
}

/* 上傳影像資訊條 */
.slice-upload-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 0.45rem 0.75rem;
  margin-top: 0.6rem;
  font-size: 0.78rem;
}

.slice-upload-filename {
  color: #cbd5e1;
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

/* 參考線視覺化畫布外框 (透明棋盤格) */
.slice-guide-canvas-wrap {
  background-color: #0b1120;
  background-image: 
    linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.04) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.slice-guide-canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  display: block;
}

.slice-guide-hint {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 0.5rem;
  text-align: center;
}

/* 連動選項與勾選 */
.slice-pad-options {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.slice-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.slice-checkbox-label input[type="checkbox"] {
  accent-color: #06b6d4;
  cursor: pointer;
}

/* 邊距調整網格 */
.slice-pad-controls-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* 防呆與錯誤警示 */
.slice-upload-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.76rem;
  margin-top: 0.75rem;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

/* ==========================================================================
   Playground 07 Master Extension: Visual Layout Studio (Drag & Drop Builder)
   ========================================================================== */

/* 模擬器頂部模式切換器 (Play vs Studio) */
.sim-mode-switch {
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 3px;
}

.sim-mode-tab {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.sim-mode-tab:hover {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.05);
}

.sim-mode-tab.active {
  background: linear-gradient(135deg, #0284c7, #06b6d4);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.35);
}

/* 視覺排版 Studio 工具列 */
.sim-studio-toolbar {
  background: rgba(10, 18, 32, 0.95);
  border-bottom: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.65rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  animation: fadeIn 0.25s ease;
}

.sim-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.sim-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sim-toolbar-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

.sim-toolbar-btns {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.sim-preset-btn, .sim-tool-btn {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.74rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.sim-preset-btn:hover, .sim-tool-btn:hover {
  border-color: #38bdf8;
  color: #ffffff;
  background: rgba(56, 189, 248, 0.15);
}

.sim-preset-btn.active {
  background: rgba(6, 182, 212, 0.25);
  border-color: #06b6d4;
  color: #22d3ee;
  font-weight: 600;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.3);
}

.sim-coord-select {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #e2e8f0;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  outline: none;
  font-family: var(--font-mono);
}

.sim-snap-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  color: #94a3b8;
  cursor: pointer;
  user-select: none;
}

.sim-snap-label input[type="checkbox"] {
  accent-color: #06b6d4;
}

.sim-studio-tip {
  font-size: 0.72rem;
  color: #38bdf8;
  font-family: var(--font-mono);
  margin-left: auto;
}

/* 畫布在 Studio 排版模式下的背景網格 */
.grub-viewport.studio-mode {
  background-image: 
    linear-gradient(rgba(56, 189, 248, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center center;
}

/* 可拖曳圖層通用樣式 (Studio Mode) */
.grub-viewport.studio-mode .studio-drag-item {
  cursor: grab;
  user-select: none;
  outline: 1.5px dashed rgba(56, 189, 248, 0.45);
  outline-offset: 2px;
  transition: outline 0.15s ease, box-shadow 0.15s ease;
}

.grub-viewport.studio-mode .studio-drag-item:hover {
  outline: 1.5px solid #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.grub-viewport.studio-mode .studio-drag-item.selected,
.grub-viewport.studio-mode .studio-drag-item.dragging {
  cursor: grabbing;
  outline: 2px solid #00f0ff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.45);
  z-index: 50 !important;
}

/* 拖曳手柄圖示 */
.studio-drag-handle {
  display: none;
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.8rem;
  color: rgba(56, 189, 248, 0.8);
  cursor: grab;
  z-index: 10;
  pointer-events: none;
}

.grub-viewport.studio-mode .studio-drag-handle {
  display: inline-block;
}

/* 座標浮水印 HUD 標籤 */
.studio-hud-tag {
  display: none;
  position: absolute;
  top: -24px;
  left: 0;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 60;
  box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.grub-viewport.studio-mode .studio-drag-item:hover .studio-hud-tag,
.grub-viewport.studio-mode .studio-drag-item.selected .studio-hud-tag,
.grub-viewport.studio-mode .studio-drag-item.dragging .studio-hud-tag {
  display: block;
}

/* 縮放手柄 (Resize Handle) */
.studio-resize-handle {
  display: none;
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  background: #00f0ff;
  border: 2px solid #0b1120;
  border-radius: 2px;
  cursor: se-resize;
  z-index: 55;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.8);
  transition: transform 0.15s ease;
}

.studio-resize-handle:hover {
  transform: scale(1.3);
}

.grub-viewport.studio-mode .studio-resize-handle {
  display: block;
}

/* 標題列在 Studio 模式下解除 pointer-events: none */
.grub-viewport.studio-mode .grub-title-bar {
  pointer-events: auto;
  display: inline-block;
  width: auto;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.2rem 1rem;
}

/* ==========================================================================
   Full-Screen Bootloader Preview Modal (滿版沉浸式開機預覽)
   ========================================================================== */
.sim-tool-btn-accent {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(99, 102, 241, 0.35)) !important;
  border-color: #38bdf8 !important;
  color: #e0f2fe !important;
  font-weight: 600 !important;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2) !important;
}

.sim-tool-btn-accent:hover {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.55), rgba(99, 102, 241, 0.55)) !important;
  border-color: #7dd3fc !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35) !important;
  transform: translateY(-1px);
}

.sim-tool-btn-zip {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.25)) !important;
  border-color: #10b981 !important;
  color: #a7f3d0 !important;
  font-weight: 600 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.2) !important;
}

.sim-tool-btn-zip:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.45), rgba(5, 150, 105, 0.45)) !important;
  border-color: #34d399 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-1px);
}

.sim-fullscreen-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background: #000000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.sim-fullscreen-modal.show {
  opacity: 1;
}

/* 頂部極簡懸浮控制條 (HUD Bar) */
.sim-fs-hud-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0.94) 0%, rgba(7, 11, 20, 0.75) 75%, transparent 100%);
  border-bottom: 1px solid rgba(56, 189, 248, 0.18);
  backdrop-filter: blur(10px);
  gap: 1rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sim-fs-hud-left,
.sim-fs-hud-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sim-fs-hud-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  letter-spacing: 0.02em;
}

.sim-fs-hud-res {
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.sim-fs-hud-center {
  flex: 1;
  text-align: center;
}

.sim-fs-hud-tip {
  color: #cbd5e1;
  font-size: 0.82rem;
}

.sim-fs-hud-tip kbd {
  display: inline-block;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: 0 1px 0 rgba(0,0,0,0.5);
  color: #38bdf8;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  margin: 0 2px;
}

.sim-fs-close-btn {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sim-fs-close-btn:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

/* 滿版舞台：置中且黑邊隔離 (支援所有解析度與寬高比) */
.sim-fs-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  overflow: hidden;
}

/* 滿版開機視窗 (1:1 虛擬解析度，藉由 translate(-50%, -50%) scale 置中適配) */
.sim-fs-viewport {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform-origin: center center !important;
  overflow: hidden !important;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.98);
  box-sizing: border-box;
  transition: transform 0.1s ease-out;
}

/* 滿版純淨模式：隱藏排版 Studio 的一切干擾把手與標籤 */
.sim-fullscreen-modal .studio-drag-handle,
.sim-fullscreen-modal .studio-resize-handle,
.sim-fullscreen-modal .studio-hud-tag,
.sim-fullscreen-modal .grub-viewport-scale-badge,
.sim-fullscreen-modal .grub-viewport-drop-overlay {
  display: none !important;
}

.sim-fullscreen-modal .studio-drag-item {
  cursor: default !important;
  border-color: transparent !important;
  box-shadow: none !important;
  pointer-events: auto;
}

.sim-fullscreen-modal .grub-title-bar {
  border-color: transparent !important;
  box-shadow: none !important;
}

.sim-fullscreen-modal .grub-title-bar.title-hidden {
  display: none !important;
}




