/* ==========================================================================
   AJI LEARNING - STYLESHEET
   Platform Pembelajaran Vokasi Teknik Komputer & Jaringan (SMK TKJ)
   ========================================================================== */

:root {
  --bg: #eef2f9;
  --surface: #ffffff;
  --surface2: #f6f8fc;
  --surface-hover: #f0f4fa;
  --ink: #0f1b33;
  --muted: #5b6882;
  --line: #dfe6f1;
  
  --accent: #2457d6;
  --accent-ink: #ffffff;
  --accent-soft: #e6edfd;
  --accent-hover: #1c46b5;
  
  --amber: #c96a00;
  --amber-soft: #fdf0d9;
  --amber-ink: #7a3e00;
  
  --ok: #0d7d56;
  --ok-soft: #dcf5ea;
  --ok-ink: #074e35;
  
  --bad: #b4233a;
  --bad-soft: #fde4e8;
  --bad-ink: #701020;
  
  --side: #0c1527;
  --side-ink: #b6c2d9;
  --side-hover: rgba(255, 255, 255, 0.08);
  --side-on: #2457d6;
  
  --shadow-sm: 0 1px 3px rgba(15, 27, 51, 0.06);
  --shadow: 0 4px 12px rgba(15, 27, 51, 0.05), 0 14px 28px -12px rgba(15, 27, 51, 0.12);
  --shadow-lg: 0 10px 30px rgba(15, 27, 51, 0.15);
  
  --head: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg: #080e1c;
  --surface: #111a2f;
  --surface2: #16213a;
  --surface-hover: #1d2a48;
  --ink: #e8eefb;
  --muted: #9aa8c4;
  --line: #24304c;
  
  --accent: #6b92ff;
  --accent-ink: #08122b;
  --accent-soft: #1a2a55;
  --accent-hover: #8eb0ff;
  
  --amber: #f5a524;
  --amber-soft: #3a2b0e;
  --amber-ink: #ffd480;
  
  --ok: #3ecf9b;
  --ok-soft: #0f3328;
  --ok-ink: #9bf3d2;
  
  --bad: #ff7a8e;
  --bad-soft: #3a141c;
  --bad-ink: #ffccd4;
  
  --side: #060b17;
  --side-ink: #9fb0cf;
  --side-hover: rgba(255, 255, 255, 0.05);
  --side-on: #2f5bd0;
  color-scheme: dark;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

h1, h2, h3, h4, h5 {
  font-family: var(--head);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.015em;
}

p {
  margin-bottom: 0.8rem;
}
p:last-child {
  margin-bottom: 0;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Icons */
.ic {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Shell Frame */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
}

/* Top Navigation Bar */
.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--head);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.brand .ic {
  width: 22px;
  height: 22px;
  color: var(--accent);
}

.toplinks {
  display: flex;
  gap: 6px;
  margin-left: 10px;
  flex: 1;
}

.toplinks a {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
}

.toplinks a:hover {
  color: var(--ink);
  background: var(--surface2);
}

.toplinks a.on {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface2);
  border-color: var(--muted);
}

.btn.pri {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.pri:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.amb {
  background: var(--amber);
  border-color: var(--amber);
  color: #ffffff;
}

.btn.amb:hover {
  filter: brightness(1.1);
}

.btn.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.btn.ok:hover {
  filter: brightness(1.1);
}

.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #ffffff;
}

.btn.danger:hover {
  filter: brightness(1.1);
}

.btn.outline-danger {
  color: var(--bad);
  border-color: var(--bad-soft);
  background: transparent;
}
.btn.outline-danger:hover {
  background: var(--bad-soft);
}

.btn.sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* App Layout with Sidebar */
.app {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 34px);
  flex: 1;
}

.side {
  background: var(--side);
  color: var(--side-ink);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.side .brand {
  color: #ffffff;
  padding: 6px 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 10px;
}

.side .brand .ic {
  color: #7da2ff;
}

.side nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.side a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--side-ink);
}

.side a:hover {
  background: var(--side-hover);
  color: #ffffff;
}

.side a.on {
  background: var(--side-on);
  color: #ffffff;
  font-weight: 600;
}

.side a.out {
  color: #ff94a5;
  padding: 9px 12px;
  border-radius: var(--radius);
}

.side a.out:hover {
  background: rgba(255, 122, 142, 0.15);
}

.main {
  padding: 24px 30px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--surface);
}

/* Page Header */
.pagehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.pagehead h2 {
  font-size: 22px;
}

.pagehead p {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13.5px;
}

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.av {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

/* Cards & Content Blocks */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.stat .bx {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stat b {
  font-family: var(--head);
  font-size: 24px;
  display: block;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.stat span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.bx.b { background: var(--accent-soft); color: var(--accent); }
.bx.a { background: var(--amber-soft); color: var(--amber); }
.bx.g { background: var(--ok-soft); color: var(--ok); }
.bx.r { background: var(--bad-soft); color: var(--bad); }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.row .grow {
  flex: 1;
  min-width: 180px;
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

/* Tile Badge for Courses */
.tile {
  --h: 215;
  background: linear-gradient(135deg, hsl(var(--h) 55% 24%), hsl(var(--h) 65% 44%));
  color: #ffffff;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 60px;
  height: 48px;
}

.tile .ic {
  width: 24px;
  height: 24px;
}

.tile.lg {
  width: 100%;
  height: 110px;
  border-radius: var(--radius);
}
.tile.lg .ic {
  width: 38px;
  height: 38px;
}

.tile.xl {
  width: 220px;
  height: 140px;
  border-radius: var(--radius-lg);
}
.tile.xl .ic {
  width: 52px;
  height: 52px;
}

/* Progress Bar */
.bar {
  height: 7px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.muted { color: var(--muted); }
.sm { font-size: 12px; }

/* Status Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill.w { background: var(--amber-soft); color: var(--amber-ink); }
.pill.g { background: var(--ok-soft); color: var(--ok-ink); }
.pill.b { background: var(--accent-soft); color: var(--accent); }
.pill.r { background: var(--bad-soft); color: var(--bad-ink); }

/* Catalog & Grid */
.tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}

.search .ic {
  position: absolute;
  left: 12px;
  top: 11px;
  color: var(--muted);
}

.search input, .field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--ink);
  transition: border-color 0.15s ease;
}

.search input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.search input {
  padding-left: 36px;
  border-radius: 99px;
}

.chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--surface2);
  color: var(--ink);
}

.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.cc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cc:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.cc h4 {
  font-size: 15px;
  line-height: 1.35;
}

.cc .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12.5px;
  gap: 8px;
}

.cc .btn {
  margin-top: auto;
}

/* Landing Page */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 44px 34px;
  background: linear-gradient(125deg, var(--accent-soft), var(--surface) 65%);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.hero h1 {
  font-size: clamp(28px, 4.2vw, 42px);
  max-width: 20ch;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  color: var(--muted);
  max-width: 50ch;
  margin: 12px 0 22px;
  font-size: 15.5px;
  line-height: 1.6;
}

.badgebox {
  width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 22px;
  text-align: center;
  box-shadow: var(--shadow);
}

.sec {
  padding: 26px 34px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sechead {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sechead a {
  color: var(--accent);
  font-weight: 600;
  font-size: 13.5px;
}

.cats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
  text-align: center;
}

.cat:hover {
  border-color: var(--accent);
  background: var(--surface2);
}

.cat .bx {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Footer */
.foot {
  margin-top: auto;
  background: var(--side);
  color: var(--side-ink);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.foot b {
  color: #ffffff;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 34px);
  flex: 1;
}

.pub {
  padding: 28px 34px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Course Detail */
.dhero {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.dhero h2 {
  font-size: 26px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.li:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.li .dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.li.done .dot {
  background: var(--ok-soft);
  color: var(--ok);
}

.li .t {
  flex: 1;
  min-width: 0;
}

.li .t b {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

/* Interactive Learn Workspace */
.learn {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 34px);
  flex: 1;
}

.drawer {
  background: var(--surface2);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.drawer h4 {
  font-size: 15px;
  padding: 0 8px;
}

.drawer a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.drawer a:hover {
  background: var(--line);
  color: var(--ink);
}

.drawer a.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.drawer a.d .ic {
  color: var(--ok);
}

/* Chapter Content / Prose Typography */
.prose {
  max-width: 78ch;
  line-height: 1.7;
  font-size: 14.5px;
}

.prose h3 {
  font-size: 18px;
  margin-top: 22px;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.prose h4 {
  font-size: 15.5px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.prose p {
  margin-bottom: 14px;
}

.prose ul, .prose ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.prose li {
  margin-bottom: 6px;
}

/* Note Boxes in Lessons */
.note-box {
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  background: var(--surface2);
  margin: 18px 0;
  font-size: 13.5px;
}

.note-box.info {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.note-box.success {
  border-left-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok-ink);
}

.note-box.alert {
  border-left-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber-ink);
}

/* Code Blocks in Lessons */
.code-block {
  font-family: var(--mono);
  background: #0d1527;
  color: #79c0ff;
  padding: 14px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  margin: 16px 0;
  border: 1px solid #1f2d4d;
}

/* Data Tables inside Content */
.table-responsive {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table-data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-data th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.table-data td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-badge.optimal { background: var(--ok-soft); color: var(--ok-ink); }
.status-badge.acceptable { background: var(--accent-soft); color: var(--accent); }
.status-badge.warning { background: var(--amber-soft); color: var(--amber-ink); }
.status-badge.critical { background: var(--bad-soft); color: var(--bad-ink); }

/* Toolkit Grid */
.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin: 16px 0;
}

.tool-item {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.tool-icon {
  font-size: 26px;
  margin-bottom: 6px;
}

.tool-item h4 {
  font-size: 14.5px;
  margin-bottom: 6px;
}

.tool-item p {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

/* Quizzes */
.quiz {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 74ch;
}

.quiz .q {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
  transition: all 0.2s ease;
}

.quiz .q b {
  display: block;
  margin-bottom: 10px;
  font-size: 14.5px;
}

.quiz label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s ease;
}

.quiz label:hover {
  background: var(--surface2);
}

.quiz .q.right {
  border-color: var(--ok);
  background: var(--ok-soft);
}

.quiz .q.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
}

.quiz-explanation {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink);
}

.navrow {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 24px;
  flex-wrap: wrap;
}

/* Login & Auth Pages */
.loginwrap {
  display: grid;
  place-items: center;
  padding: 36px 16px;
  flex: 1;
  background: linear-gradient(180deg, var(--accent-soft), var(--surface));
}

.lbox {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  gap: 4px;
}

.seg button, .seg a {
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 8px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.seg .on {
  background: var(--accent);
  color: var(--accent-ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

/* Tables */
.tw {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  background: var(--surface2);
  text-align: left;
  padding: 10px 14px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

td.n, th.n {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr.me td {
  background: var(--accent-soft);
  font-weight: 700;
}

.trophy {
  background: linear-gradient(110deg, #c76a00, #e58a12);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.trophy .ic {
  width: 38px;
  height: 38px;
}

/* Flash Messages */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.flash.success {
  background: var(--ok-soft);
  color: var(--ok-ink);
  border: 1px solid var(--ok);
}

.flash.warning {
  background: var(--amber-soft);
  color: var(--amber-ink);
  border: 1px solid var(--amber);
}

.flash.danger {
  background: var(--bad-soft);
  color: var(--bad-ink);
  border: 1px solid var(--bad);
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 99px;
  font-weight: 600;
  font-size: 13.5px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 9999;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 860px) {
  .app, .learn {
    grid-template-columns: minmax(0, 1fr);
  }
  
  .side {
    flex-direction: row;
    align-items: center;
    padding: 10px;
    overflow-x: auto;
  }
  
  .side .brand {
    display: none;
  }
  
  .side nav {
    flex-direction: row;
  }
  
  .side a span {
    white-space: nowrap;
  }
  
  .drawer {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 250px;
  }
  
  .main, .pub, .sec {
    padding-left: 18px;
    padding-right: 18px;
  }
  
  .hero {
    padding: 26px 18px;
  }
  
  .tile.xl {
    width: 100%;
  }
}

/* ==========================================================================
   WYSIWYG & Visual Image Paste Editor
   ========================================================================== */
.editor-box {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.editor-box:focus-within {
  border-color: var(--accent);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.editor-btn:hover {
  background: var(--line);
}

.editor-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.editor-btn .ic {
  width: 15px;
  height: 15px;
}

.editor-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}

.editor-paste-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  margin-left: auto;
}

.editor-canvas {
  min-height: 280px;
  max-height: 600px;
  overflow-y: auto;
  padding: 16px 20px;
  line-height: 1.7;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
}

.editor-canvas:empty:before {
  content: attr(placeholder);
  color: var(--muted);
  pointer-events: none;
  display: block;
}

.editor-canvas.dragover {
  background: var(--accent-soft);
  border: 2px dashed var(--accent);
}

.editor-canvas img, .prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 14px 0;
  display: block;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.editor-canvas figure, .prose figure {
  margin: 16px 0;
  text-align: center;
}

.editor-canvas figcaption, .prose figcaption {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

.upload-overlay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(36, 87, 214, 0.1);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  padding: 10px 16px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  margin: 8px 0;
}

