:root {
  --primary: #198754;
  --accent: #0d6efd;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e5e7eb;
  --bg: #f8fafc;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0; }

/* ===== Navbar ===== */
.public-nav {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand-link {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 17px;
}
.brand-link i { color: var(--primary); font-size: 22px; }
.nav-links { display: flex; align-items: center; gap: 24px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px; }
.nav-links a:hover { color: var(--primary); }
.btn-login {
  background: var(--primary); color: #fff !important;
  padding: 8px 18px; border-radius: 30px; transition: .2s;
}
.btn-login:hover { background: #0d6e44; transform: translateY(-1px); }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #0f1f3a 0%, #198754 100%);
  color: #fff;
  padding: 80px 24px 60px;
  text-align: center;
}
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero-eyebrow {
  display: inline-block;
  background: rgba(255,255,255,.15);
  padding: 6px 16px; border-radius: 30px;
  font-size: 13px; font-weight: 600; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; margin: 0 0 16px; }
.hero p { font-size: 17px; opacity: .9; max-width: 600px; margin: 0 auto 32px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.btn-cta {
  padding: 14px 28px; border-radius: 30px; font-weight: 600; font-size: 15px;
  text-decoration: none; transition: .2s; display: inline-flex; align-items: center; gap: 8px;
}
.btn-cta.primary { background: #fff; color: var(--primary); }
.btn-cta.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.btn-cta.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.4); }
.btn-cta.ghost:hover { background: rgba(255,255,255,.1); }

/* ===== Tool ===== */
.tool-wrap { padding: 40px 16px; }
.crop-modal-content {
  max-width: 1100px; margin: -60px auto 0;
  background: #fff; border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0,0,0,.15);
  padding: 32px; position: relative;
}
.app { position: relative; }
.tool-icon-left { text-align: center; }
.tool-icon-left img { width: 70px; height: 70px; object-fit: contain; }
.app h2 { text-align: center; font-size: 28px; font-weight: 800; margin: 6px 0 4px; }
.app .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }

.status-bar { text-align: center; padding: 10px 16px; border-radius: 10px; font-weight: 500; margin-bottom: 16px; }
.status-bar.success { background: #ecfdf5; color: #059669; }
.status-bar.warning { background: #fff7ed; color: #c2410c; }
.status-bar.error { background: #fef2f2; color: #dc2626; }

.instruction-box { background: #eff6ff; border-left: 4px solid var(--accent); padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.instruction-box p { margin: 0; font-size: 14px; color: #1e3a8a; }

/* Share */
.share-wrapper { position: absolute; top: 0; right: 0; z-index: 5; }
.share-btn-main {
  background: linear-gradient(90deg, var(--accent), #6366f1);
  color: #fff; border: 0; padding: 9px 16px;
  border-radius: 30px; font-weight: 600; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 4px 12px rgba(13,110,253,.3);
}
.share-dropdown {
  position: absolute; top: 110%; right: 0;
  background: #fff; border-radius: 10px; padding: 6px;
  box-shadow: 0 12px 30px rgba(0,0,0,.15);
  min-width: 180px; display: none;
}
.share-dropdown.show { display: block; animation: fadeDown .2s; }
@keyframes fadeDown { from { opacity:0; transform: translateY(-8px); } to { opacity:1; transform: translateY(0); } }
.share-item {
  padding: 10px 14px; cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; gap: 10px; font-size: 14px;
}
.share-item:hover { background: #f1f5f9; }

/* Grid - Front/Back */
.grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }

.app .card {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 14px; padding: 18px;
}
.app .card h3 { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--text); }

.drop-zone {
  border: 2.5px dashed #cbd5e1; border-radius: 12px;
  padding: 28px 18px; text-align: center;
  cursor: pointer; transition: .2s; position: relative;
  background: #fff;
}
.drop-zone:hover { border-color: var(--primary); background: #f0fdf4; }
.drop-zone.dragover { border-color: var(--primary); background: #ecfdf5; transform: scale(1.02); }
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.drop-zone-icon { font-size: 36px; color: var(--accent); display: block; margin-bottom: 6px; }
.drop-zone-text { font-size: 13px; color: var(--muted); }
.drop-zone-text strong { color: var(--text); display: block; font-size: 15px; margin-top: 2px; }

.canvas-container { position: relative; margin: 14px 0; min-height: 200px; background: #fff; border-radius: 10px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); }
.canvas-container canvas:not(.magnifier) { max-width: 100%; max-height: 320px; display: block; border-radius: 8px; }
.status-msg { color: var(--muted); font-size: 13px; padding: 14px; text-align: center; }
.canvas-container canvas[data-loaded] ~ .status-msg { display: none; }
.magnifier { position: absolute; bottom: 8px; right: 8px; border: 2px solid #fff; border-radius: 50%; display: none !important; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.magnifier.show { display: block !important; }

.control-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.icon-btn { background: #fff; border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: .2s; }
.icon-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.delete-btn:hover { background: #dc2626; border-color: #dc2626; }

.btn-group-tool .main-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-group-tool button {
  background: var(--primary); color: #fff; border: 0;
  padding: 11px; border-radius: 10px; font-weight: 600;
  cursor: pointer; transition: .2s; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-group-tool button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(25,135,84,.3); }
.btn-group-tool button:disabled { opacity: .45; cursor: not-allowed; }
.btn-group-tool button.secondary { background: #8b5cf6; }
.btn-group-tool button.secondary:hover:not(:disabled) { box-shadow: 0 6px 14px rgba(139,92,246,.3); }
.filter-controls { display: none; align-items: center; gap: 10px; justify-content: center; margin-top: 10px; }
.filter-controls.show { display: flex; }
.adjust-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; cursor: pointer; font-size: 14px; }
.filter-label { font-weight: 600; font-size: 14px; min-width: 70px; text-align: center; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 768px) { .actions { grid-template-columns: 1fr 1fr; } }
.actions button {
  color: #fff; border: 0; padding: 14px; border-radius: 12px;
  font-weight: 600; cursor: pointer; transition: .2s; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.actions button:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.15); }

/* How section */
.how-section, .features { padding: 80px 24px; }
.features { background: #fff; }
.section-title { text-align: center; font-size: 32px; font-weight: 800; margin-bottom: 40px; }
.container { max-width: 1100px; margin: 0 auto; }
.step-card, .feature-card {
  background: #fff; border: 1px solid var(--border); padding: 28px;
  border-radius: 16px; text-align: center; height: 100%;
  transition: .25s;
}
.step-card:hover, .feature-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.08); }
.features .feature-card { background: var(--bg); }
.step-num {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #20c997);
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 20px; margin: 0 auto 14px;
}
.feature-card i { font-size: 32px; color: var(--primary); margin-bottom: 12px; }
.step-card h5, .feature-card h5 { font-weight: 700; margin-bottom: 8px; }
.step-card p, .feature-card p { color: var(--muted); font-size: 14px; margin: 0; }

/* Footer */
.public-footer {
  background: #0f172a; color: #cbd5e1;
  padding: 60px 24px 30px;
}
.public-footer h6 { color: #fff; font-weight: 700; margin-bottom: 14px; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--primary); }
.public-footer hr { border-color: #1e293b; }

@media (max-width: 768px) {
  .nav-links a:not(.btn-login) { display: none; }
  .crop-modal-content { padding: 20px 16px; margin-top: -30px; }
  .share-wrapper { position: static; margin-bottom: 12px; text-align: right; }
}
