:root {
  --bg: #09090b;
  --panel: #18181b;
  --border: #27272a;
  --accent: #34d399;
  --accent-dim: rgba(52, 211, 153, 0.12);
  --blue: #2563eb;
  --blue-soft: #38bdf8;
  --ink: #fafafa;
  --muted: #a1a1aa;
  --danger: #f87171;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: #09090b; }
html, body { min-height: 100%; }

body {
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  background: radial-gradient(1200px 800px at 50% 40%, #0d1530 0%, #09090b 55%, #05050a 100%);
  color: var(--ink);
  min-height: 100vh;
  padding: 4.1rem 0 0;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------- brand bar (packly-style) ---------- */
.brand {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex; align-items: center;
  min-height: 4.1rem;
  padding: 0 1.5rem;
  font-weight: 700;
  letter-spacing: -0.4px;
  font-size: 1.5rem;
  background: rgba(9, 9, 11, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  white-space: nowrap;
}
.brand a.logo { text-decoration: none; display: flex; align-items: center; gap: 0.35em; }
.logo-heic, .logo-jpg { color: var(--accent); }
.logo-arrow { color: #fafafa; font-size: 1.25em; line-height: 1; }
.brand-cluster { display: flex; align-items: center; margin-left: 1.2rem; }
.brand-line { width: 1.25rem; height: 1px; background: var(--accent); }
.brand-badge {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 9999px;
  padding: 0.12em 0.5em;
  white-space: nowrap;
}
.spacer { flex: 1; }
.brand-tools { display: flex; align-items: center; gap: 10px; }
.lang-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; background: var(--panel);
}
.lang-toggle button {
  border: 0; background: transparent; padding: 8px 14px;
  font-weight: 700; cursor: pointer; color: var(--muted);
  font-size: 0.8rem;
}
.lang-toggle button.active { background: var(--accent); color: #09090b; }
.coffee-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px 5px 5px;
  text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px;
}
.coffee-link img { height: 28px; border-radius: 999px; }
@media (max-width: 640px) {
  .brand { font-size: 1.2rem; padding: 0 1rem; }
  .brand-cluster { display: none; }
  .coffee-link span { display: none; }
  .coffee-link { padding: 5px; }
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: 36px 12px 8px; }
.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  margin: 0 0 10px; letter-spacing: -0.4px; line-height: 1.05;
}
.hero h1 .no-leave { color: var(--accent); }
.hero p.sub { color: var(--muted); font-size: clamp(15px, 2.5vw, 18px); margin: 0 auto 16px; max-width: 640px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(52, 211, 153, 0.1); color: var(--accent);
  border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 999px;
  padding: 8px 18px; font-weight: 700; font-size: 14px;
}
.proof-hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
.proof-hint code { background: #27272a; padding: 1px 6px; border-radius: 6px; }

/* ---------- proof diagram ---------- */
.proof {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 26px; padding: 20px;
}
.proof h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.2px; }
.proof p.lead { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.diagram { width: 100%; overflow: hidden; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram svg text { font-family: ui-sans-serif, system-ui, sans-serif; }
.diagram-v { display: none; }
@media (max-width: 640px) {
  .diagram-h { display: none; }
  .diagram-v { display: block; }
}

.live-status {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; margin-top: 0.55rem;
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--accent); font-weight: 700;
}
.live-status .dotp {
  width: 6px; height: 6px; border-radius: 9999px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
  animation: dotPulse 1.6s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
.net-monitor {
  margin-top: 12px; font-size: 13px;
  background: #09090b; color: #a7f3d0; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.net-monitor b { color: #fff; }

/* ---- 24s master cycle ---- */
@keyframes docBreathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes ringA { 0% { opacity: 0; } 1% { opacity: 1; } 11% { opacity: 1; } 13%, 100% { opacity: 0; } }
@keyframes ringB { 0%, 14% { opacity: 0; } 16% { opacity: 1; } 28% { opacity: 1; } 30%, 100% { opacity: 0; } }
@keyframes ringC { 0%, 32% { opacity: 0; } 34% { opacity: 1; } 46% { opacity: 1; } 48%, 100% { opacity: 0; } }
@keyframes numA { 0% { opacity: 0; } 1.5% { opacity: 0.6; } 11% { opacity: 0.6; } 13%, 100% { opacity: 0; } }
@keyframes numB { 0%, 14% { opacity: 0; } 16% { opacity: 0.6; } 28% { opacity: 0.6; } 30%, 100% { opacity: 0; } }
@keyframes numC { 0%, 32% { opacity: 0; } 34% { opacity: 0.6; } 46% { opacity: 0.6; } 48%, 100% { opacity: 0; } }
@keyframes outGapA {
  0%, 3% { opacity: 0; transform: translateX(0); }
  4% { opacity: 1; transform: translateX(0); }
  11% { opacity: 1; transform: translateX(40px); }
  13%, 100% { opacity: 0; transform: translateX(40px); }
}
@keyframes outGapB {
  0%, 20% { opacity: 0; transform: translateX(0); }
  21% { opacity: 1; transform: translateX(0); }
  28% { opacity: 1; transform: translateX(40px); }
  30%, 100% { opacity: 0; transform: translateX(40px); }
}
@keyframes outGapAV {
  0%, 3% { opacity: 0; transform: translateY(0); }
  4% { opacity: 1; transform: translateY(0); }
  11% { opacity: 1; transform: translateY(44px); }
  13%, 100% { opacity: 0; transform: translateY(44px); }
}
@keyframes outGapBV {
  0%, 20% { opacity: 0; transform: translateY(0); }
  21% { opacity: 1; transform: translateY(0); }
  28% { opacity: 1; transform: translateY(44px); }
  30%, 100% { opacity: 0; transform: translateY(44px); }
}
@keyframes deadBlip {
  0%, 49% { opacity: 0; transform: translateX(0); }
  50% { opacity: 0.9; transform: translateX(0); }
  53% { opacity: 0.9; transform: translateX(28px); }
  54%, 100% { opacity: 0; transform: translateX(28px); }
}
@keyframes deadBlipV {
  0%, 49% { opacity: 0; transform: translateY(0); }
  50% { opacity: 0.9; transform: translateY(0); }
  53% { opacity: 0.9; transform: translateY(30px); }
  54%, 100% { opacity: 0; transform: translateY(30px); }
}
@keyframes cardsDim {
  0%, 54% { opacity: 1; }
  58% { opacity: 0.22; }
  84% { opacity: 0.22; }
  88%, 100% { opacity: 1; }
}
@keyframes finaleIn {
  0%, 56% { opacity: 0; }
  60% { opacity: 1; }
  84% { opacity: 1; }
  88%, 100% { opacity: 0; }
}
@keyframes rotCW { to { transform: rotate(360deg); } }
@keyframes spinSlow { to { transform: rotate(360deg); } }

.anim-doc { animation: docBreathe 2.8s ease-in-out infinite; }
.a-ring1 { animation: ringA 24s linear infinite; }
.a-ring2 { animation: ringB 24s linear infinite; }
.a-ring3 { animation: ringC 24s linear infinite; }
.a-num1 { animation: numA 24s linear infinite; }
.a-num2 { animation: numB 24s linear infinite; }
.a-num3 { animation: numC 24s linear infinite; }
.a-out1 { animation: outGapA 24s linear infinite; }
.a-out2 { animation: outGapB 24s linear infinite; }
.a-out1v { animation: outGapAV 24s linear infinite; }
.a-out2v { animation: outGapBV 24s linear infinite; }
.a-dead { animation: deadBlip 24s linear infinite; }
.a-deadv { animation: deadBlipV 24s linear infinite; }
.a-pcard { animation: cardsDim 24s linear infinite; }
.a-finale { animation: finaleIn 24s linear infinite; }
.a-rot1 { animation: rotCW 2.2s linear infinite; transform-box: fill-box; transform-origin: center; }
.a-rot2 { animation: rotCW 3.8s linear infinite; transform-box: fill-box; transform-origin: center; }
.a-rot3 { animation: rotCW 5.4s linear infinite; transform-box: fill-box; transform-origin: center; }
.a-spin { animation: spinSlow 9s linear infinite; transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .live-status .dotp { animation: none; }
  .diagram * { animation: none !important; transition: none !important; }
  .diagram .anim-hide { display: none; }
}

/* ---------- converter ---------- */
.converter {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); margin-top: 20px; padding: 20px;
}
.converter h2 { margin: 0 0 12px; font-size: 20px; letter-spacing: -0.2px; }
.dropzone {
  border: 2px dashed var(--blue); border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.08); padding: 34px 16px; text-align: center;
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.dropzone:hover, .dropzone.over { background: rgba(37, 99, 235, 0.16); border-color: var(--blue-soft); }
.dropzone p { margin: 6px 0; color: var(--muted); }
.btn {
  display: inline-block; border: 0; border-radius: 12px; cursor: pointer;
  padding: 12px 22px; font-weight: 800; font-size: 15px;
  background: var(--blue); color: #fff;
}
.btn:hover { filter: brightness(1.15); }
.btn.emerald { background: #059669; }
.btn.emerald:hover { filter: brightness(1.15); }
.btn.ghost { background: #27272a; color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.settings { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
@media (min-width: 640px) { .settings { grid-template-columns: 1fr 1fr; } }
.setting label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.setting input[type="range"] { width: 100%; accent-color: var(--accent); }
.setting select {
  width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 14px; background: #09090b; color: var(--ink);
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.progress { margin-top: 14px; display: none; }
.progress.show { display: block; }
.bar { height: 12px; background: #27272a; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--accent)); transition: width 0.2s; }
.status-line { font-size: 13px; color: var(--muted); margin-top: 6px; }
.file-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.file-list li {
  display: flex; align-items: center; gap: 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 12px; padding: 8px 10px; background: #101014;
}
.file-list img.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #27272a; }
.file-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.badge.ok { background: rgba(52, 211, 153, 0.12); color: var(--accent); }
.badge.wait { background: #27272a; color: var(--muted); }
.badge.err { background: rgba(248, 113, 113, 0.12); color: var(--danger); }
.dl { font-size: 13px; font-weight: 700; color: var(--blue-soft); white-space: nowrap; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- why ---------- */
.why { display: grid; gap: 10px; margin-top: 20px; }
@media (min-width: 640px) { .why { grid-template-columns: 1fr 1fr 1fr; } }
.why .tile {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; font-size: 14px;
}
.why .tile b { display: block; margin-bottom: 6px; font-size: 15px; }
.why .tile p { margin: 0; color: var(--muted); }

footer { text-align: center; color: var(--muted); font-size: 13px; margin-top: 28px; }
footer a { color: var(--blue-soft); }
footer .fine { font-size: 12px; margin-top: 6px; }
footer .coffee-link { margin-bottom: 10px; }
