:root{
  --bg0:#ffffff;
  --bg1:#f6f8fc;
  --card:#ffffff;
  --card2:#ffffff;
  --text:#0f172a;
  --muted:rgba(15,23,42,0.65);
  --border:rgba(15,23,42,0.12);
  --accent:#2563eb;
  --accent2:#1d4ed8;
  --danger:#ef4444;
  --ok:#16a34a;
  --shadow:0 12px 28px rgba(15,23,42,0.08);
  --radius:16px;
  --radius2:12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

*{box-sizing:border-box}
html,body{height:100%; overflow-anchor:none}
body{
  margin:0;
  font-family:var(--sans);
  color:var(--text);
  background:
    radial-gradient(1200px 800px at 15% 10%, rgba(37,99,235,0.08), transparent 60%),
    radial-gradient(900px 700px at 85% 15%, rgba(29,78,216,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:20px 24px;
  gap:16px;
  border-bottom:1px solid var(--border);
  background:rgba(255,255,255,0.75);
  backdrop-filter: blur(12px);
  position:sticky;
  top:0;
  z-index:5;
}
.brand{display:flex;gap:14px;align-items:center}
.logo{
  width:38px;height:38px;border-radius:10px;
  display:grid;place-items:center;
  background: transparent;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.logo-img{width:38px;height:38px;display:block}
.title{font-size:16px;font-weight:700;letter-spacing:0.2px}
.subtitle{font-size:12px;color:var(--muted);margin-top:2px}
.tagline{
  display:inline-flex;
  align-items:center;
  margin-top:6px;
  padding:4px 9px;
  border-radius:999px;
  border:1px solid rgba(37,99,235,0.18);
  background:linear-gradient(135deg, rgba(37,99,235,0.08), rgba(16,185,129,0.08));
  color:rgba(15,23,42,0.72);
  font-size:11px;
  line-height:16px;
  font-weight:800;
  letter-spacing:0.1px;
}
.submeta{margin-top:6px; display:flex; gap:8px; flex-wrap:wrap}
.chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(37,99,235,0.18);
  background: rgba(37,99,235,0.05);
  color: rgba(15,23,42,0.72);
  font-size: 11px;
  line-height: 16px;
  font-family: var(--sans);
  font-weight: 600;
}
.chip-wide{padding: 6px 12px}
.chip-title{
  color: rgba(37,99,235,0.95);
  font-weight: 800;
  letter-spacing: 0.2px;
}
.chip-sub{
  color: rgba(15,23,42,0.55);
  font-family: var(--mono);
  font-weight: 700;
}
.container{
  max-width:1100px;
  margin:0 auto;
  padding:22px 20px 60px;
  display:flex;
  flex-direction:column;
  gap:16px;
  min-height: calc(100vh - 120px);
}
.preview-card{display:flex; flex-direction:column; min-height:0}
.preview-card{overflow-anchor:none}

.card{
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}
.card-head{
  display:flex;align-items:flex-start;justify-content:space-between;gap:12px;
  margin-bottom:12px;
}
.card-title{font-weight:700}
.card-subtitle{font-size:12px;color:var(--muted);margin-top:4px}
.card-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}

.dropzone{
  position:relative;
  border:1px dashed rgba(15,23,42,0.28);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(15,23,42,0.02));
  border-radius: var(--radius);
  padding:18px;
  text-align:center;
  cursor:pointer;
  outline:none;
}
.dropzone:focus{border-color: rgba(37,99,235,0.65); box-shadow: 0 0 0 3px rgba(37,99,235,0.16)}
.dropzone.dragover{
  border-color: rgba(37,99,235,0.65);
  background: rgba(37,99,235,0.06);
}
.dz-icon{color:rgba(37,99,235,0.95)}
.dz-title{font-weight:700;margin-top:10px}
.dz-desc{font-size:12px;color:var(--muted);margin-top:4px}
.dz-note{font-size:11px;color: rgba(15,23,42,0.45);margin-top:8px}
.file{
  position:absolute; inset:0;
  opacity:0;
  cursor:pointer;
}

.row{
  margin-top:12px;
  display:flex;
  gap:12px;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
}
.progress{
  margin-top:12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.72);
  padding:10px 12px;
}
.progress-top{display:flex;align-items:center;justify-content:space-between;gap:10px}
.progress-label{font-size:12px;font-weight:700;color:var(--muted)}
.progress-pct{font-size:12px;font-weight:700;color:rgba(37,99,235,0.92); font-family: var(--mono)}
.progress-track{
  margin-top:8px;
  height:10px;
  border-radius:999px;
  background: rgba(2,6,23,0.06);
  overflow:hidden;
  border: 1px solid rgba(2,6,23,0.06);
}
.progress-bar{
  height:100%;
  width:0%;
  border-radius:999px;
  background: linear-gradient(90deg, rgba(37,99,235,0.95), rgba(16,185,129,0.9));
  transition: width 120ms linear;
}
.progress-bytes{
  margin-top:6px;
  font-size:12px;
  color: var(--muted);
  font-family: var(--mono);
}
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:220px;
}
.field span{font-size:12px;color:var(--muted)}
.field input{
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding: 0 12px;
  outline:none;
}
.field select{
  height:36px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding: 0 10px;
  outline:none;
}
.field input:focus{border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 3px rgba(37,99,235,0.14)}
.field select:focus{border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 3px rgba(37,99,235,0.14)}

.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{
  border:1px solid var(--border);
  border-radius: 12px;
  height:36px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255,255,255,0.95);
  cursor:pointer;
  font-weight:600;
}
.btn:disabled{opacity:0.45;cursor:not-allowed}
.btn.primary{
  border-color: rgba(37,99,235,0.45);
  background: linear-gradient(135deg, rgba(37,99,235,0.95), rgba(29,78,216,0.85));
  color:#ffffff;
}
.btn.ghost{background:transparent}
.btn.danger{border-color: rgba(239,68,68,0.35); color: rgba(239,68,68,0.95)}
.btn.link{
  display:inline-flex;align-items:center;gap:8px;
  text-decoration:none;
  color: var(--accent);
  border-color: rgba(37,99,235,0.22);
  background: rgba(37,99,235,0.04);
}
.btn.purchase{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  white-space:nowrap;
  border-color: rgba(37,99,235,0.35);
  color:#ffffff;
  background: linear-gradient(135deg, rgba(37,99,235,0.96), rgba(16,185,129,0.88));
}
.top-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.btn.lang-toggle{
  min-width:78px;
  border-color:rgba(37,99,235,0.24);
  background:rgba(255,255,255,0.9);
  color:rgba(37,99,235,0.95);
}
.btn.lang-toggle:hover{
  border-color:rgba(37,99,235,0.48);
  background:rgba(37,99,235,0.06);
}

.status{
  margin-top:12px;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.78);
  font-family: var(--mono);
  font-size:12px;
  color: var(--muted);
}
.status.ok{border-color: rgba(22,163,74,0.25); color: rgba(22,163,74,0.95)}
.status.err{border-color: rgba(239,68,68,0.25); color: rgba(239,68,68,0.95)}

.activation-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}
.activation-panel{
  width:min(680px, 100%);
  background: var(--card);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:22px;
}
.activation-brand{margin-bottom:18px}
.activation-block{display:flex;flex-direction:column;gap:14px}
.activation-field{width:100%}
.activation-copy-row{display:flex;gap:10px}
.activation-copy-row input{flex:1;min-width:0}
.activation-code{
  width:100%;
  min-height:150px;
  resize:vertical;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding:12px;
  outline:none;
  font-family: var(--mono);
  font-size:12px;
  line-height:1.5;
}
.activation-code:focus{border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 3px rgba(37,99,235,0.14)}
.activation-actions{display:flex;justify-content:flex-end}

.viewer{
  border-radius: var(--radius2);
  border:1px solid var(--border);
  background: rgba(255,255,255,0.85);
  display:block;
  padding: 14px;
  overflow:auto;
  height: clamp(360px, 62vh, 780px);
  min-height: 240px;
  position: relative;
  overflow-anchor:none;
  scrollbar-gutter: stable both-edges;
}
.viewer:focus{outline:none; box-shadow: 0 0 0 3px rgba(37,99,235,0.14), var(--shadow)}
.viewer-toolbar{
  margin-top: 2px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.78);
}
.viewer-tools{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.zoom{display:flex; align-items:center; gap:8px; padding: 6px 10px; border-radius: 999px; border:1px solid var(--border); background: rgba(255,255,255,0.85)}
.zoom-label{font-size:12px; color: var(--muted); font-weight:700}
.zoom-range{width:140px}
.zoom-pct{font-size:12px; font-family: var(--mono); color: var(--muted); font-weight:700; min-width: 48px; text-align:right}
.viewer-stage{
  position: relative;
  min-width: 100%;
  min-height: 100%;
  margin: 0 auto;
}
.img-skeleton{
  position:absolute;
  inset:14px;
  border-radius: 12px;
  border: 1px dashed rgba(15,23,42,0.18);
  background:
    linear-gradient(90deg, rgba(2,6,23,0.04), rgba(37,99,235,0.10), rgba(2,6,23,0.04));
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer{
  0%{background-position: 0% 0%}
  100%{background-position: 100% 0%}
}
.viewer-empty{
  position:absolute;
  inset:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  padding: 18px;
  pointer-events:none;
  text-align:center;
}
.viewer-stage[hidden]{display:none !important}
.viewer-img{
  /* keep preview sized relative to the viewer/container */
  position:absolute;
  top:50%;
  left:50%;
  height: auto;
  display:block;
  background: white;
  border-radius: 10px;
  max-width: none;
  border: 1px solid rgba(15,23,42,0.18);
  box-shadow: 0 10px 26px rgba(15,23,42,0.12);
  transform: translate(-50%, -50%) rotate(var(--img-rot, 0deg));
  transform-origin: center center;
  will-change: transform;
}
.viewer-img[hidden]{display:none !important}

.thumbs{
  margin-top: 10px;
  display:flex;
  gap:10px;
  overflow:auto;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.78);
}
.thumb{
  width: 86px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,0.14);
  background: rgba(255,255,255,0.95);
  box-shadow: 0 8px 18px rgba(15,23,42,0.08);
  padding: 6px;
  cursor:pointer;
}
.thumb[aria-current="true"]{border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 3px rgba(37,99,235,0.14), 0 8px 18px rgba(15,23,42,0.08)}
.thumb img{width:100%; height:auto; display:block; border-radius: 8px; border: 1px solid rgba(15,23,42,0.12); background: #fff}
.thumb .thumb-label{margin-top:6px; font-size:11px; color: var(--muted); font-family: var(--mono); text-align:center; font-weight:700}

.nav-overlay{
  position: sticky;
  top: 50%;
  transform: translateY(-50%);
  width:44px;
  height:44px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,0.18);
  background: rgba(255,255,255,0.92);
  color: rgba(15,23,42,0.78);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-weight:800;
  box-shadow: 0 10px 22px rgba(15,23,42,0.10);
  user-select:none;
  z-index: 2;
}
.nav-overlay.left{position:absolute; left:12px}
.nav-overlay.right{position:absolute; right:12px}
.nav-overlay:hover{background: rgba(255,255,255,0.98); color: rgba(15,23,42,0.92)}
.nav-overlay:disabled{opacity:0.35; cursor:not-allowed; box-shadow:none}
.nav-overlay:focus{outline:none; box-shadow: 0 0 0 3px rgba(37,99,235,0.18), 0 10px 22px rgba(15,23,42,0.10)}
.pager{
  margin-top:10px;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
}
.page-label{
  font-family: var(--mono);
  font-size:12px;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.85);
  display:flex;
  align-items:center;
  gap:6px;
}
.page-input{
  width:84px;
  height:30px;
  border-radius: 10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: var(--text);
  padding: 0 10px;
  outline:none;
  font-family: var(--mono);
}
.page-input:focus{border-color: rgba(37,99,235,0.55); box-shadow: 0 0 0 3px rgba(37,99,235,0.14)}

.footer{
  grid-column: 1 / -1;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align:center;
}
.footer-note{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  max-width:820px;
  padding:9px 12px;
  border:1px solid rgba(15,23,42,0.08);
  border-radius:999px;
  background:rgba(255,255,255,0.62);
}
.footer-note strong{
  color:rgba(15,23,42,0.72);
}

@media (max-width: 900px){
  .container{padding:18px 14px 50px}
  .topbar{align-items:flex-start; flex-wrap:wrap}
  .brand{align-items:flex-start}
  .top-actions{width:100%; justify-content:flex-start}
  .viewer-img{width: min(92%, 720px)}
  .footer-note{border-radius:16px}
}
