:root {
  --primary: #6C5CE7;
  --primary-dark: #5A4BD1;
  --bg: #0F0F1A;
  --card: #1A1A2E;
  --card-hover: #252540;
  --text: #E8E8F0;
  --text-muted: #8888A0;
  --border: #2A2A45;
  --success: #00E676;
  --danger: #FF5252;
  --radius: 12px;
}
[data-theme="light"] {
  --bg: #F5F5FA;
  --card: #FFFFFF;
  --card-hover: #EEEEF5;
  --text: #1A1A2E;
  --text-muted: #8888A0;
  --border: #D0D0E0;
  --success: #00C853;
  --danger: #FF1744;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
nav {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 20px;
  background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-left { display:flex; align-items:center; gap:10px; flex:1; min-width:0; }
nav .logo { display:flex; align-items:center; }
.logo-img { height: 28px; width: auto; display: block; }
.logo-black { display: none; }
[data-theme="light"] .logo-white { display: none; }
[data-theme="light"] .logo-black { display: block; }
.nav-links { display:flex; align-items:center; gap:4px; }
.nav-links a {
  color:var(--text-muted); text-decoration:none; font-size:0.85rem; padding:6px 12px;
  border-radius:6px; transition:.2s; cursor:pointer;
}
.nav-links a:hover { color:var(--text); background:var(--card-hover); }

/* ── Hamburger ── */
.hamburger {
  background:none; border:none; cursor:pointer; display:flex; flex-direction:column;
  gap:5px; padding:6px; border-radius:6px; transition:.2s;
}
.hamburger:hover { background:var(--card-hover); }
.hamburger span { display:block; width:24px; height:2px; background:var(--text); border-radius:2px; }

/* ── Sidebar ── */
.sidebar {
  position:fixed; top:0; left:-280px; width:260px; height:100vh;
  background:var(--card); border-right:1px solid var(--border);
  z-index:300; transition:left .3s ease; overflow-y:auto;
  display:flex; flex-direction:column; padding-top:14px;
}
.sidebar.open { left:0; }
.sidebar-header {
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 18px 14px; border-bottom:1px solid var(--border); margin-bottom:6px;
}
.sidebar-title { font-weight:600; font-size:0.95rem; color:var(--text); }
.sidebar-close { background:none; border:none; color:var(--text-muted); font-size:1.5rem; cursor:pointer; padding:0 4px; }
.sidebar-close:hover { color:var(--text); }
.sidebar a {
  display:block; padding:10px 20px; color:var(--text-muted); text-decoration:none;
  font-size:0.9rem; transition:.2s; cursor:pointer;
}
.sidebar a:hover { background:var(--card-hover); color:var(--text); }
.sidebar a.active { color:var(--primary); background:rgba(108,92,231,.1); border-right:3px solid var(--primary); }

.sidebar-overlay {
  display:none; position:fixed; inset:0; background:rgba(0,0,0,.5);
  z-index:250;
}
.sidebar-overlay.open { display:block; }

.container { max-width: 720px; margin: 0 auto; padding: 32px 20px; }
.page { display: none; }
.page.active { display: block; }
.hero { text-align: center; padding: 60px 0; }
.hero h1 { font-size: 2.5rem; margin-bottom: 12px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-muted); font-size: 1rem; max-width: 520px; margin: 0 auto 28px; line-height: 1.6; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  text-decoration: none; color: var(--text); transition: .2s; cursor: pointer; display: block;
}
.card:hover { background: var(--card-hover); transform: translateY(-2px); }
.card .icon { font-size: 1.8rem; margin-bottom: 8px; }
.card h3 { font-size: 1rem; margin-bottom: 6px; }
.card p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.card-form {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
}
.card-form h2 { margin-bottom: 20px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.form-group input, .form-group select {
  width: 100%; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem; outline: none; transition: .2s;
}
.form-group input:focus, .form-group select:focus { border-color: var(--primary); }
.btn {
  display: inline-block; padding: 10px 28px; background: var(--primary); color: #fff;
  border: none; border-radius: 8px; font-size: 0.9rem; cursor: pointer; transition: .2s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tab-btn { flex: 1; background: var(--card-hover); color: var(--text-muted); }
.tab-btn.active { background: var(--primary); color: #fff; }
.result {
  margin-top: 10px; padding: 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); white-space: pre-wrap; word-break: break-word;
  max-height: 400px; overflow: auto; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.78rem;
}
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; margin-left: auto; }
.badge-success { background: rgba(0,230,118,.15); color: var(--success); }
.badge-muted { background: rgba(136,136,160,.15); color: var(--text-muted); }
.badge-warning { background: rgba(255,193,7,.15); color: #ffc107; }
.spinner { display: none; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; margin: 12px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.c2pa-type-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.c2pa-type-card {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  padding: 8px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; transition: .2s;
}
.c2pa-type-card:hover { border-color: var(--primary); background: var(--card-hover); }
.c2pa-type-card:has(input:checked) { border-color: var(--primary); background: rgba(108,92,231,.12); }
.c2pa-type-card input { accent-color: var(--primary); margin: 0; }
.c2pa-type-name { font-size: 0.85rem; }
/* footer moved below */
#md-output { font-family: inherit; white-space: normal; }
.meta-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.meta-table td { padding: 5px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.meta-table td:first-child { color: var(--text-muted); white-space: nowrap; width: 120px; }
.meta-table code { font-size: 0.7rem; word-break: break-all; }
/* ── Nav Search ── */
.nav-search {
  position:relative; display:flex; align-items:center;
  width:30px; flex-shrink:0; margin:0 4px; transition:width .3s ease;
}
.nav-search.focused { width:180px; }
.nav-search input {
  width:100%; padding:6px 14px; border:1px solid transparent; background:var(--card-hover);
  border-radius:20px; color:var(--text); font-size:0.8rem; outline:none; height:30px;
  cursor:pointer; transition:border-color .3s ease;
}
.nav-search.focused input, .nav-search input:focus {
  border-color:var(--border); cursor:text; padding-right:32px;
}
.nav-search .search-btn {
  position:absolute; right:4px; width:24px; height:24px; border:none; background:none;
  cursor:pointer; opacity:0.4; transition:.2s; font-size:0; pointer-events:none;
}
.nav-search.focused .search-btn { opacity:0.8; pointer-events:auto; }
.nav-search .search-btn::before {
  content:''; display:block; width:12px; height:12px;
  border:2px solid var(--text-muted); border-radius:50%;
  position:absolute; top:4px; left:4px;
}
.nav-search .search-btn::after {
  content:''; display:block; width:6px; height:2px;
  background:var(--text-muted); border-radius:1px;
  position:absolute; bottom:6px; right:3px;
  transform:rotate(45deg);
}
.nav-search.focused .search-btn::before { border-color:var(--primary); }
.nav-search.focused .search-btn::after { background:var(--primary); }
.nav-search .search-results {
  display:none; position:absolute; top:calc(100% + 6px); left:0;
  width:360px; max-width:calc(100vw - 40px);
  max-height:360px; overflow-y:auto;
  background:var(--card); border:1px solid var(--border); border-radius:10px;
  box-shadow:0 8px 24px rgba(0,0,0,.4); z-index:1000;
}
.nav-search.focused .search-results { display:block; }
.search-result-item {
  display:block; padding:12px 16px; text-decoration:none; color:var(--text);
  border-bottom:1px solid var(--border); transition:.2s; cursor:pointer;
}
.search-result-item:last-child { border-bottom:none; }
.search-result-item:hover { background:var(--card-hover); }
.search-result-title { font-weight:600; font-size:0.85rem; margin-bottom:2px; }
.search-result-snippet { font-size:0.72rem; color:var(--text-muted); line-height:1.4; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ── 404 Page ── */
.error-page {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  min-height:70vh; text-align:center; padding:40px 20px;
}
.error-code {
  font-size:8rem; font-weight:800; line-height:1;
  background:linear-gradient(135deg,var(--primary),#a78bfa,#ec4899);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent;
  background-clip:text; animation:glow404 3s ease-in-out infinite;
}
@keyframes glow404 {
  0%,100% { filter:drop-shadow(0 0 20px rgba(108,92,231,.3)); }
  50% { filter:drop-shadow(0 0 40px rgba(108,92,231,.6)); }
}
.error-title { font-size:1.4rem; color:var(--text); margin:8px 0 6px; }
.error-desc { font-size:0.9rem; color:var(--text-muted); max-width:400px; line-height:1.6; margin-bottom:24px; }
.error-search { width:100%; max-width:400px; margin-bottom:28px; }
.error-search input {
  width:100%; padding:12px 16px; background:var(--card); border:1px solid var(--border);
  border-radius:var(--radius); color:var(--text); font-size:0.9rem; outline:none; transition:.2s;
}
.error-search input:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(108,92,231,.15); }
.error-links { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; max-width:400px; }
.error-links a {
  padding:8px 18px; background:var(--card); border:1px solid var(--border);
  border-radius:8px; color:var(--text); text-decoration:none; font-size:0.82rem;
  transition:.2s;
}
.error-links a:hover { background:var(--primary); border-color:var(--primary); transform:translateY(-2px); }
.error-shapes { position:fixed; inset:0; pointer-events:none; overflow:hidden; z-index:-1; }
.error-shape {
  position:absolute; border-radius:50%; opacity:.05;
  animation:floatShape 20s ease-in-out infinite;
}
.error-shape:nth-child(1) { width:300px; height:300px; background:var(--primary); top:-50px; left:-50px; animation-delay:0s; }
.error-shape:nth-child(2) { width:200px; height:200px; background:#a78bfa; bottom:-30px; right:-30px; animation-delay:-5s; }
.error-shape:nth-child(3) { width:150px; height:150px; background:#ec4899; top:50%; left:60%; animation-delay:-10s; }
@keyframes floatShape {
  0%,100% { transform:translate(0,0) scale(1); }
  25% { transform:translate(30px,-30px) scale(1.1); }
  50% { transform:translate(-20px,20px) scale(0.9); }
  75% { transform:translate(20px,30px) scale(1.05); }
}

/* ── Search results page ── */
#page-search .search-result-item {
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px 20px; margin-bottom:10px;
}
#page-search .search-result-item:hover { background:var(--card-hover); transform:translateY(-1px); }
#page-search .search-result-title { font-size:0.95rem; }
#page-search .search-result-snippet { font-size:0.8rem; white-space:normal; margin-top:4px; }

@media (max-width: 640px) {
  nav { padding: 8px 14px; }
  .hero h1 { font-size: 1.8rem; }
  .sidebar { width:220px; left:-240px; }
  .nav-search.focused { width:140px; }
  .nav-search .search-results { width:calc(100vw - 40px); left:0; }
  .error-code { font-size:5rem; }
}
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.6); z-index:200; align-items:center; justify-content:center; }
.modal-overlay.open { display:flex; }
.modal-box { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:28px; max-width:420px; width:90%; position:relative; }
.modal-close { position:absolute; top:12px; right:16px; font-size:1.4rem; cursor:pointer; color:var(--text-muted); }
.modal-close:hover { color:var(--text); }
.dl-grid { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
.dl-option { background:var(--bg); border:1px solid var(--border); border-radius:8px; padding:16px 8px; cursor:pointer; color:var(--text); font-size:0.8rem; transition:.2s; text-align:center; }
.dl-option:hover { background:var(--primary); border-color:var(--primary); }
.dl-icon { display:block; font-size:1.3rem; margin-bottom:4px; }

/* ── Static pages (About, Privacy, Contact, Social) ── */
.static-page { max-width:650px; margin:0 auto; }
.static-page h2 { font-size:1.6rem; color:var(--primary); margin-bottom:16px; }
.static-page h3 { font-size:1rem; color:var(--text); margin:20px 0 8px; }
.static-page p { font-size:0.9rem; line-height:1.7; color:var(--text); margin-bottom:12px; }
.static-page ul { margin:12px 0 16px 20px; }
.static-page ul li { font-size:0.9rem; line-height:1.7; color:var(--text-muted); margin-bottom:4px; }
.static-page ul li strong { color:var(--text); }
.static-page a { color:var(--primary); }

.contact-links { display:flex; flex-direction:column; gap:12px; margin-top:20px; }
.contact-card {
  display:flex; align-items:center; gap:14px; padding:18px; background:var(--card);
  border:1px solid var(--border); border-radius:var(--radius); text-decoration:none;
  transition:.2s; cursor:pointer;
}
.contact-card:hover { background:var(--card-hover); transform:translateY(-2px); }
.contact-icon { font-size:1.8rem; }
.contact-title { display:block; font-weight:600; font-size:0.95rem; color:var(--text); }
.contact-desc { display:block; font-size:0.8rem; color:var(--text-muted); margin-top:2px; }

.social-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:14px; margin-top:20px; }
.social-card {
  display:flex; flex-direction:column; align-items:center; gap:6px; padding:28px 20px;
  background:var(--card); border:1px solid var(--border); border-radius:var(--radius);
  text-decoration:none; transition:.2s; cursor:pointer;
}
.social-card:hover { background:var(--card-hover); transform:translateY(-2px); }
.social-icon { font-size:2.2rem; }
.social-name { font-weight:600; font-size:1rem; color:var(--text); }
.social-handle { font-size:0.8rem; color:var(--text-muted); }

/* ── Theme Toggle ── */
.theme-btn {
  background:none; border:1px solid var(--border); border-radius:50%; width:32px; height:32px;
  display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
  font-size:1rem; transition:.2s; color:var(--text-muted);
}
.theme-btn:hover { background:var(--card-hover); color:var(--text); border-color:var(--primary); }

/* ── File Drop Zone ── */
.file-drop-zone {
  border:2px dashed var(--border); border-radius:var(--radius); padding:24px 20px;
  text-align:center; cursor:pointer; transition:.2s; position:relative;
}
.file-drop-zone:hover { border-color:var(--primary); background:rgba(108,92,231,.04); }
.file-drop-zone.drag-over { border-color:var(--primary); background:rgba(108,92,231,.08); transform:scale(1.01); }
.file-drop-zone input[type="file"] { display:none; }
.file-drop-zone .dz-icon { font-size:2rem; display:block; margin-bottom:6px; }
.file-drop-zone .dz-text { font-size:0.85rem; color:var(--text-muted); }
.file-drop-zone .dz-text strong { color:var(--primary); }
.file-drop-zone .dz-file {
  display:none; align-items:center; gap:8px; justify-content:center;
  font-size:0.85rem; color:var(--text); margin-top:8px;
  background:rgba(108,92,231,.1); padding:6px 14px; border-radius:20px;
  word-break:break-all;
}
.file-drop-zone.has-file .dz-icon,
.file-drop-zone.has-file .dz-text { display:none; }
.file-drop-zone.has-file .dz-file { display:inline-flex; }
.file-drop-zone.has-file { border-style:solid; border-color:var(--success); }

/* ── Language Dropdown ── */
.lang-dropdown { position:relative; display:inline-block; flex-shrink:0; }
.lang-btn {
  background:var(--card-hover); border:1px solid var(--border); border-radius:6px;
  color:var(--text); cursor:pointer; font-size:0.85rem; padding:6px 12px;
  transition:.2s; min-width:80px; text-align:center;
}
.lang-btn:hover { background:var(--primary); border-color:var(--primary); }
.lang-menu {
  position:absolute; top:100%; right:0; margin-top:4px;
  background:var(--card); border:1px solid var(--border); border-radius:8px;
  min-width:140px; box-shadow:0 4px 12px rgba(0,0,0,.3);
  opacity:0; visibility:hidden; transform:translateY(-8px);
  transition:.2s; z-index:1000;
}
.lang-menu.show {
  opacity:1; visibility:visible; transform:translateY(0);
}
.lang-option {
  display:block; padding:8px 12px; color:var(--text); text-decoration:none;
  font-size:0.85rem; transition:.2s; border-bottom:1px solid var(--border);
}
.lang-option:last-child { border-bottom:none; }
.lang-option:hover { background:var(--card-hover); color:var(--primary); }
.lang-option[data-lang="ar"] { font-family:'Segoe UI', Tahoma, sans-serif; }
.lang-option[data-lang="zh"] { font-family:'PingFang SC', 'Microsoft YaHei', sans-serif; }

/* ── C2PA ── */
.c2pa-section { margin-bottom: 16px; padding: 12px; background: var(--bg); border-radius: 8px; }
.c2pa-section h3 { font-size: 0.85rem; color: var(--primary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.c2pa-details-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.c2pa-details-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.c2pa-details-table td:first-child { color: var(--text-muted); white-space: nowrap; width: 140px; font-size: 0.75rem; }
.c2pa-details-table code { font-size: 0.7rem; word-break: break-all; }
.c2pa-action-item { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.c2pa-action-item:last-child { border-bottom: none; }
.c2pa-action-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.72rem; font-weight: 600; background: rgba(108,92,231,.15); color: var(--primary); }
.c2pa-assertion-item { padding: 8px; margin-bottom: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; }
.c2pa-assertion-item strong { font-size: 0.78rem; }
.c2pa-assertion-item pre { font-size: 0.7rem; margin-top: 4px; max-height: 120px; overflow: auto; color: var(--text-muted); white-space: pre-wrap; word-break: break-all; }
.c2pa-ingredient-item { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.c2pa-ingredient-item:last-child { border-bottom: none; }
.c2pa-sig-info p { font-size: 0.8rem; margin: 2px 0; }
.c2pa-empty { font-size: 0.78rem; color: var(--text-muted); font-style: italic; }
.c2pa-no-data { text-align: center; padding: 24px; color: var(--text-muted); }
.c2pa-no-data strong { display: block; font-size: 1rem; margin-bottom: 6px; color: var(--text); }
.c2pa-error { color: var(--danger); padding: 12px; background: rgba(255,82,82,.08); border-radius: 8px; }
.c2pa-success { text-align: center; padding: 16px; color: var(--success); }
.c2pa-success strong { display: block; font-size: 1.1rem; margin-bottom: 8px; }
.c2pa-verify-result { text-align: center; padding: 20px; border-radius: var(--radius); }
.c2pa-verified { background: rgba(0,230,118,.08); border: 1px solid var(--success); }
.c2pa-unverified { background: rgba(255,193,7,.08); border: 1px solid #ffc107; }
.c2pa-verify-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: bold; margin: 0 auto 8px; background: var(--success); color: #000; }
.c2pa-verify-icon-warn { background: #ffc107; }
.c2pa-verify-result strong { display: block; font-size: 1.2rem; margin-bottom: 8px; }
.c2pa-verify-result p { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0; }

footer { text-align:center; padding:24px; border-top:1px solid var(--border); margin-top:40px; }
.footer-links { display:flex; justify-content:center; gap:16px; margin-bottom:10px; flex-wrap:wrap; }
.footer-links a { color:var(--text-muted); text-decoration:none; font-size:0.82rem; cursor:pointer; }
.footer-links a:hover { color:var(--primary); }
.footer-copy { color:var(--text-muted); font-size:0.78rem; }
