/* ── Image Tools v2 — Premium Style ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; background: #0b1120; color: #e2e8f0; min-height: 100vh; display: flex; flex-direction: column; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0b1120; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

::selection { background: rgba(8,145,178,.3); color: #fff; }

/* ── Header ── */
header { position: sticky; top: 0; z-index: 9999; background: rgba(11,17,32,.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid rgba(51,65,85,.5); }
.bar { background: transparent; }
.wrap { max-width: 80%; width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 20px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: #f1f5f9; text-decoration: none; white-space: nowrap; }
.brand svg { flex-shrink: 0; }
nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; align-items: center; }
nav::-webkit-scrollbar { display: none; }
nav a { color: #94a3b8; text-decoration: none; font-size: .85rem; padding: 5px 12px; border-radius: 8px; white-space: nowrap; transition: all .2s; font-weight: 500; }
nav a:hover, nav a.active { color: #22d3ee; background: rgba(34,211,238,.1); }

/* Nav category selects */
.nav-cat-select { background: #1e293b; color: #94a3b8; border: 1px solid #334155; border-radius: 8px; padding: 5px 10px; font-size: .82rem; cursor: pointer; font-family: inherit; transition: all .2s; white-space: nowrap; max-width: 170px; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23475569'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 26px; }
.nav-cat-select:hover { border-color: #22d3ee; color: #22d3ee; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2322d3ee'/%3E%3C/svg%3E"); }
.nav-cat-select:focus { outline: none; border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.15); }

.lang-switcher select { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 8px; padding: 5px 10px; font-size: .8rem; cursor: pointer; appearance: none; -webkit-appearance: none; padding-right: 26px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23475569'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.lang-switcher select:focus { outline: none; border-color: #22d3ee; }

/* Mobile nav toggle */
.mobile-nav-toggle { display: none; background: transparent; border: none; color: #e2e8f0; font-size: 1.5rem; cursor: pointer; padding: 4px; line-height: 1; }

/* ── Main ── */
main { flex: 1; display: flex; flex-direction: column; }
main .wrap { flex-direction: column; align-items: stretch; min-height: auto; padding-top: 40px; padding-bottom: 40px; flex: 1; }

/* ── Hero ── */
.hero { text-align: center; padding: 40px 0 32px; }
.hero h1 { font-size: 2.2rem; font-weight: 800; background: linear-gradient(135deg, #f1f5f9 0%, #22d3ee 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 12px; letter-spacing: -.5px; }
.hero p { color: #94a3b8; max-width: 640px; margin: 0 auto; line-height: 1.7; font-size: 1.05rem; }

/* ── Tool grid ── */
.tools-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 8px 0; }
.card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; background: #1e293b; border: 1px solid #334155; border-radius: 14px; padding: 20px 12px 16px; text-decoration: none; color: inherit; transition: all .25s cubic-bezier(.4,0,.2,1); position: relative; overflow: hidden; }
.card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, #22d3ee, transparent); opacity: 0; transition: opacity .3s; }
.card:hover { border-color: #22d3ee; transform: translateY(-4px); box-shadow: 0 12px 40px rgba(34,211,238,.1); }
.card:hover::before { opacity: 1; }
.card-icon { font-size: 2rem; line-height: 1; transition: transform .3s; }
.card:hover .card-icon { transform: scale(1.15); }
.card-body h3 { font-size: .82rem; color: #f1f5f9; font-weight: 600; line-height: 1.3; }
.card-body p { display: none; }

/* ── Category sections ── */
.cat-section { margin-bottom: 32px; }
.cat-title { font-size: .9rem; color: #64748b; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding-left: 4px; }
.cat-icon { font-size: 1rem; }

/* ── Quick tool ── */
.quick-tool { margin-bottom: 40px; width: 100%; }
.quick-tool h2 { font-size: 1.4rem; color: #f1f5f9; text-align: center; margin-bottom: 8px; font-weight: 700; }
.quick-tool .quick-desc { color: #94a3b8; text-align: center; font-size: .95rem; margin-bottom: 20px; }

/* ── Tool widget ── */
.tool-widget { background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 28px; }
.dropzone { border: 2px dashed #475569; border-radius: 14px; padding: 56px 24px; text-align: center; cursor: pointer; transition: all .25s; color: #94a3b8; }
.dropzone:hover, .dropzone.dragover { border-color: #22d3ee; background: rgba(34,211,238,.05); }
canvas { max-width: 100%; border-radius: 10px; margin: 16px 0; display: block; box-shadow: 0 4px 20px rgba(0,0,0,.3); }

/* ── Controls ── */
.ctrl-group { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0; align-items: center; }
.ctrl-group label { display: flex; align-items: center; gap: 8px; color: #cbd5e1; font-size: .9rem; flex-wrap: wrap; }
.ctrl-group .btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

input[type="number"], input[type="text"], select.tool-select { background: #0f172a; color: #e2e8f0; border: 1px solid #475569; border-radius: 8px; padding: 7px 12px; font-size: .85rem; width: auto; max-width: 120px; }
input[type="number"]:focus, input[type="text"]:focus, select.tool-select:focus { outline: none; border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.12); }
input[type="range"] { flex: 1; min-width: 120px; accent-color: #22d3ee; height: 6px; cursor: pointer; }
input[type="color"] { background: #0f172a; border: 1px solid #475569; border-radius: 8px; padding: 2px; width: 42px; height: 38px; cursor: pointer; }
input[type="checkbox"] { accent-color: #22d3ee; width: 16px; height: 16px; cursor: pointer; }
textarea { background: #0f172a; color: #e2e8f0; border: 1px solid #475569; border-radius: 8px; padding: 12px; font-size: .85rem; width: 100%; min-height: 80px; resize: vertical; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; }
textarea:focus { outline: none; border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.12); }

.slider-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.slider-row label { color: #cbd5e1; font-size: .85rem; min-width: 90px; font-weight: 500; }
.slider-row .val { color: #22d3ee; font-weight: 700; min-width: 36px; text-align: right; font-size: .88rem; font-variant-numeric: tabular-nums; }

.compare { display: flex; gap: 24px; margin: 16px 0; padding: 16px 20px; background: #0f172a; border-radius: 10px; }
.compare div { flex: 1; text-align: center; }
.compare p { margin: 4px 0; font-size: .9rem; }
.compare strong { color: #22d3ee; }

.crop-container { position: relative; margin: 16px 0; overflow: hidden; cursor: crosshair; border-radius: 10px; }

.tool-result { display: none; margin-top: 16px; }
.tool-result.show { display: block; }

/* ── Buttons ── */
.btn { background: linear-gradient(135deg, #0891b2, #06b6d4); color: #fff; border: none; border-radius: 10px; padding: 11px 28px; font-size: .9rem; font-weight: 600; cursor: pointer; transition: all .25s; display: inline-flex; align-items: center; gap: 7px; letter-spacing: .3px; }
.btn:hover { background: linear-gradient(135deg, #0e7490, #0891b2); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(8,145,178,.3); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 7px 16px; font-size: .82rem; }
.btn-secondary { background: #334155; color: #e2e8f0; }
.btn-secondary:hover { background: #475569; box-shadow: none; transform: none; }
.btn-success { background: linear-gradient(135deg, #059669, #10b981); }
.btn-success:hover { background: linear-gradient(135deg, #047857, #059669); box-shadow: 0 6px 20px rgba(16,185,129,.3); }

/* ── Base64 ── */
.base64-area { margin-top: 16px; }
.base64-area label { display: block; color: #cbd5e1; margin-bottom: 8px; font-size: .9rem; font-weight: 500; }
.base64-area textarea { min-height: 120px; }
.base64-output-wrap { position: relative; }
.copy-btn { position: absolute; top: 44px; right: 8px; background: #334155; color: #e2e8f0; border: none; border-radius: 6px; padding: 5px 12px; font-size: .75rem; cursor: pointer; }
.copy-btn:hover { background: #475569; }

/* ── Color picker ── */
.color-preview { display: inline-block; width: 52px; height: 52px; border-radius: 10px; border: 2px solid #334155; vertical-align: middle; transition: background .2s; }
.color-hex-output { font-size: 1.3rem; font-weight: 700; color: #22d3ee; font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; margin-left: 14px; vertical-align: middle; }
.pixel-info { text-align: center; margin: 16px 0; color: #94a3b8; }

/* ── Tool intro ── */
.tool-intro { background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 28px; margin-bottom: 24px; }
.tool-intro p { color: #cbd5e1; font-size: .95rem; line-height: 1.75; }

/* ── Sections ── */
.howto, .features, .faq-section { margin-top: 24px; background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 28px; }
.howto h2, .features h2, .faq-section h2 { font-size: 1.25rem; color: #f1f5f9; margin-bottom: 16px; font-weight: 700; letter-spacing: -.3px; }
.howto ol { padding-left: 20px; }
.howto li, .features li { color: #94a3b8; line-height: 2.2; font-size: .9rem; }
.features ul { list-style: none; padding: 0; }
.features li::before { content: "✓ "; color: #22d3ee; font-weight: 700; }

/* ── FAQ ── */
.faq-item { border-bottom: 1px solid #334155; padding: 14px 0; }
.faq-item:last-child { border-bottom: none; }
.faq-item summary { color: #22d3ee; cursor: pointer; font-size: .95rem; font-weight: 500; padding: 4px 0; transition: color .2s; }
.faq-item summary:hover { color: #67e8f9; }
.faq-item p { color: #94a3b8; font-size: .88rem; line-height: 1.7; margin-top: 10px; padding-left: 8px; }

/* ── Static pages ── */
.static-page { max-width: 800px; margin: 0 auto; }
.static-page section { background: #1e293b; border: 1px solid #334155; border-radius: 16px; padding: 28px; margin-bottom: 20px; }
.static-page h2 { font-size: 1.2rem; color: #f1f5f9; margin-bottom: 14px; font-weight: 700; }
.static-page p { color: #94a3b8; font-size: .92rem; line-height: 1.8; margin-bottom: 12px; }
.static-page p:last-child { margin-bottom: 0; }
.static-page a { color: #22d3ee; }
.static-page ul { color: #94a3b8; padding-left: 20px; line-height: 2; }

/* ── Footer ── */
footer { border-top: 1px solid rgba(51,65,85,.5); margin-top: auto; }
footer .wrap { justify-content: center; height: 56px; }
footer p { color: #475569; font-size: .82rem; text-align: center; }
footer a { color: #64748b; text-decoration: none; }
footer a:hover { color: #22d3ee; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .tools-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .wrap { max-width: 94%; padding: 0 16px; }
}
@media (max-width: 768px) {
  .wrap { max-width: 100%; padding: 0 14px; height: 54px; }
  main .wrap { padding-top: 24px; padding-bottom: 24px; }
  nav { display: none; position: absolute; top: 54px; left: 0; right: 0; background: rgba(11,17,32,.98); backdrop-filter: blur(12px); border-bottom: 1px solid #1e293b; flex-direction: column; padding: 12px 16px; z-index: 200; max-height: 80vh; overflow-y: auto; gap: 4px; }
  nav.open { display: flex; }
  nav a { padding: 10px 12px; font-size: .9rem; }
  .nav-cat-select { width: 100%; max-width: none; margin-bottom: 6px; padding: 10px; font-size: .9rem; }
  .mobile-nav-toggle { display: block; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card { padding: 14px 8px 12px; border-radius: 12px; }
  .card-icon { font-size: 1.5rem; }
  .card-body h3 { font-size: .75rem; }
  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: .9rem; }
  .compare { flex-direction: column; }
  .ctrl-group { flex-direction: column; align-items: stretch; }
  .ctrl-group .btn-group { justify-content: center; }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hero h1 { font-size: 1.35rem; }
  .brand { font-size: .9rem; }
  .brand svg { width: 28px; height: 28px; }
}
