/* ==========================================================================
   OptiShrink — Operation Console
   Direction (via ui-ux-pro-max): Minimal Single Column · single primary CTA ·
   Dark Mode (OLED) warm-dark · "operation orange" primary · Inter + JetBrains Mono.
   Optimized for shortest time-to-result.
   ========================================================================== */

:root {
  /* Warm dark (OLED) surfaces */
  --bg: #1c1917;
  --bg-elev: #221f1c;
  --bg-2: #2a2420;
  --input: #16120f;

  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);

  /* Text — warm neutrals */
  --fg: #fafaf9;
  --fg-2: #a8a29e;
  --fg-3: #78716c;

  /* Operation orange (primary action) */
  --primary: #ea580c;
  --primary-2: #f97316;
  --primary-soft: rgba(234, 88, 12, 0.14);

  /* Status semantics */
  --green: #10b981;
  --green-2: #34d399;
  --amber: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;

  --ring: #f97316;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --fast: 0.15s ease;
  --base: 0.22s cubic-bezier(0.4, 0, 0.2, 1);

  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle warm wash — no decorative blobs */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 38% at 50% -8%, rgba(234, 88, 12, 0.10), transparent 72%),
    radial-gradient(38% 28% at 100% 0%, rgba(59, 130, 246, 0.05), transparent 70%);
}

img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--primary-2); }

/* Visible focus — required, never removed */
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 5px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden { display: none !important; }

/* --------------------------------------------------------- Layout shell */
.container { width: min(760px, 92vw); margin-inline: auto; }

.site-header {
  width: min(760px, 92vw);
  margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.25rem 0;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--fg); }
.brand__logo {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 16px -8px rgba(234, 88, 12, 0.7);
}
.brand__name { font-weight: 700; font-size: 1.06rem; letter-spacing: -0.01em; }

.privacy-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.78rem; font-weight: 500; color: var(--green-2);
  background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.28);
  padding: 0.4rem 0.7rem; border-radius: 999px;
}
.privacy-chip .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* --------------------------------------------------------- Hero */
.hero { text-align: center; padding: 1.25rem 0 1.75rem; }
.hero h1 {
  font-size: clamp(1.7rem, 4.6vw, 2.5rem); font-weight: 800;
  letter-spacing: -0.025em; line-height: 1.1;
}
.hero h1 .accent { color: var(--primary-2); }
.hero p { margin-top: 0.6rem; color: var(--fg-2); font-size: clamp(0.95rem, 1.6vw, 1.05rem); }

/* --------------------------------------------------------- Tool card */
.tool {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  display: flex; flex-direction: column; gap: 1.1rem;
  box-shadow: 0 24px 60px -34px rgba(0, 0, 0, 0.85);
}

/* --------------------------------------------------------- Target controls */
.target { display: flex; flex-direction: column; gap: 0.65rem; }
.target__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.target__label { font-size: 0.82rem; font-weight: 600; color: var(--fg-2); }
.target__custom {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--input); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 0.3rem 0.55rem; transition: border-color var(--fast);
}
.target__custom:focus-within { border-color: var(--primary); }
.target__custom input {
  width: 56px; background: none; border: 0; outline: none; color: var(--fg);
  font-family: var(--mono); font-size: 0.95rem; font-weight: 600; text-align: right;
  -moz-appearance: textfield;
}
.target__custom input::-webkit-inner-spin-button,
.target__custom input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.target__custom .u { font-size: 0.72rem; color: var(--fg-3); font-weight: 600; }

.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; }
.preset {
  min-height: 44px;
  display: flex; align-items: center; justify-content: center; gap: 0.15rem;
  background: var(--input); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--fg-2); font-family: var(--mono); font-size: 0.92rem; font-weight: 600;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
  touch-action: manipulation;
}
.preset::after { content: "KB"; font-size: 0.62em; opacity: 0.6; margin-left: 1px; }
.preset:hover { color: var(--fg); border-color: var(--border-strong); }
.preset.active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 6px 16px -9px rgba(234, 88, 12, 0.7);
}

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  border-radius: 999px; outline: none; margin-top: 0.1rem;
  background: linear-gradient(90deg, var(--primary) var(--fill, 4%), rgba(255, 255, 255, 0.1) var(--fill, 4%));
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 3px solid var(--primary); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.16); transition: transform var(--fast);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.1); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  border: 3px solid var(--primary); cursor: pointer;
}
.slider-scale {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 0.68rem; color: var(--fg-3);
}
.target__hint {
  font-size: 0.74rem; color: var(--fg-3); display: flex; gap: 0.4rem; align-items: flex-start;
}
.target__hint i { color: var(--primary-2); margin-top: 2px; }

/* --------------------------------------------------------- Dropzone (hero) */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--input);
  padding: 2.4rem 1.5rem; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  transition: border-color var(--base), background var(--base);
}
.dropzone:hover { border-color: var(--primary); background: rgba(234, 88, 12, 0.05); }
.dropzone.dragover { border-color: var(--primary); background: rgba(234, 88, 12, 0.1); }
.dropzone__icon {
  width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center;
  color: var(--primary-2); background: var(--primary-soft); font-size: 1.5rem; margin-bottom: 0.7rem;
}
.dropzone__title { font-size: 1.08rem; font-weight: 700; }
.dropzone__hint { font-size: 0.82rem; color: var(--fg-3); margin-top: 0.25rem; }
.dropzone__kbd { font-size: 0.74rem; color: var(--fg-3); margin-top: 0.7rem; }
.kbd {
  font-family: var(--mono); font-size: 0.72rem;
  background: var(--bg-2); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; color: var(--fg-2);
}

/* --------------------------------------------------------- Buttons */
.btn {
  border: 0; border-radius: var(--r-md); font-weight: 700; font-size: 0.95rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.8rem 1.2rem;
  transition: filter var(--fast), box-shadow var(--fast); touch-action: manipulation;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  width: 100%; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 28px -14px rgba(234, 88, 12, 0.8);
}
.btn--primary:hover { filter: brightness(1.06); }
.btn--inline { width: auto; margin-top: 0.85rem; }

/* --------------------------------------------------------- File bar (loaded) */
.filebar {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--input); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 0.65rem 0.85rem;
}
.filebar__icon { color: var(--primary-2); }
.filebar__name {
  flex: 1; min-width: 0; font-weight: 600; font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.filebar__size { font-family: var(--mono); font-size: 0.78rem; color: var(--fg-3); flex-shrink: 0; }
.filebar__act { display: flex; gap: 0.4rem; flex-shrink: 0; }
.linkbtn {
  background: none; border: 1px solid var(--border); color: var(--fg-2);
  font-size: 0.76rem; font-weight: 600; padding: 0 0.7rem; min-height: 36px;
  border-radius: var(--r-sm); display: inline-flex; align-items: center; gap: 0.35rem;
  transition: color var(--fast), border-color var(--fast);
}
.linkbtn:hover { color: var(--fg); border-color: var(--border-strong); }
.linkbtn.danger:hover { color: var(--red); border-color: rgba(239, 68, 68, 0.4); }

/* --------------------------------------------------------- Result */
.result { display: flex; flex-direction: column; gap: 1rem; }
.result__head { display: flex; align-items: center; gap: 0.75rem; }
.result__title {
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--fg-3);
}
.proc {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.76rem; font-weight: 600; color: var(--primary-2);
}
.proc__dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--primary-2);
  animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse { to { transform: scale(1.5); opacity: 0.4; } }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.frame {
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg);
}
.frame.is-result { border-color: rgba(16, 185, 129, 0.3); }
.frame__tag {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.7rem; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--fg-3);
  border-bottom: 1px solid var(--border);
}
.frame.is-result .frame__tag { color: var(--green-2); }
.frame__media {
  aspect-ratio: 4 / 3; display: grid; place-items: center; background: #0e0b09;
}
.frame__media img { width: 100%; height: 100%; object-fit: contain; }
.frame__stats {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.7rem; font-size: 0.78rem; border-top: 1px solid var(--border);
}
.frame__stats span { color: var(--fg-3); }
.frame__stats b { font-family: var(--mono); color: var(--fg); font-weight: 600; }
.frame.is-result .frame__stats b.size { color: var(--green-2); }

/* Size meter — result vs target gauge */
.meter { display: flex; flex-direction: column; gap: 0.5rem; }
.meter__head { display: flex; align-items: baseline; gap: 0.5rem; }
.meter__result { font-family: var(--mono); font-size: 1.5rem; font-weight: 700; color: #fff; letter-spacing: -0.5px; }
.meter__target { font-size: 0.82rem; color: var(--fg-2); }
.meter__target b { font-family: var(--mono); color: var(--amber); font-weight: 600; }
.meter__saved {
  margin-left: auto; font-family: var(--mono); font-size: 0.82rem; font-weight: 700;
  color: var(--green-2); background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.28); padding: 2px 8px; border-radius: 6px;
}
.meter__track {
  position: relative; height: 10px; border-radius: 999px;
  background: var(--input); border: 1px solid var(--border); overflow: hidden;
}
.meter__fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--green-2));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}
.meter__track.is-close .meter__fill { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.meter__track.is-over .meter__fill { background: linear-gradient(90deg, var(--red), #f87171); }

/* --------------------------------------------------------- Whole-window drop overlay */
.drop-overlay {
  position: fixed; inset: 0; z-index: 1000; display: none;
  align-items: center; justify-content: center;
  background: rgba(28, 25, 23, 0.86); backdrop-filter: blur(6px);
}
.drop-overlay.show { display: flex; }
.drop-overlay__inner {
  border: 2px dashed var(--primary); border-radius: var(--r-lg);
  padding: 2.6rem 3.5rem; text-align: center; background: rgba(234, 88, 12, 0.08);
}
.drop-overlay__inner i { font-size: 2.4rem; color: var(--primary-2); }
.drop-overlay__inner p { margin-top: 0.8rem; font-size: 1.1rem; font-weight: 700; }

/* --------------------------------------------------------- FAQ */
.faq { margin: 3rem 0 1rem; }
.faq__title { text-align: center; font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; }
.faq__sub { text-align: center; color: var(--fg-2); margin-top: 0.4rem; font-size: 0.9rem; }
.faq__list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.6rem; }
.faq__item { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--bg-elev); }
.faq__q {
  width: 100%; background: none; border: 0; color: var(--fg);
  font-family: inherit; font-size: 0.95rem; font-weight: 600; text-align: left;
  padding: 1rem 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq__q:hover { background: rgba(255, 255, 255, 0.02); }
.faq__q .ic { color: var(--primary-2); transition: transform var(--base); flex-shrink: 0; }
.faq__item.active .faq__q .ic { transform: rotate(45deg); }
.faq__a { max-height: 0; overflow: hidden; transition: max-height var(--base); }
.faq__a p { padding: 0 1.1rem 1.1rem; color: var(--fg-2); font-size: 0.9rem; line-height: 1.65; }

/* --------------------------------------------------------- Footer + toast */
.site-footer {
  width: min(760px, 92vw); margin: 2rem auto; text-align: center;
  color: var(--fg-3); font-size: 0.8rem; border-top: 1px solid var(--border); padding-top: 1.5rem;
}
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 160%);
  background: var(--green); color: #06281d; font-weight: 700; font-size: 0.88rem;
  padding: 0.7rem 1.2rem; border-radius: var(--r-md);
  display: flex; align-items: center; gap: 0.5rem;
  box-shadow: 0 14px 30px -10px rgba(16, 185, 129, 0.5);
  z-index: 1100; transition: transform var(--base);
}
.toast.show { transform: translate(-50%, 0); }

/* --------------------------------------------------------- Responsive */
@media (max-width: 560px) {
  .compare { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; gap: 0.6rem; }
  .privacy-chip { font-size: 0.72rem; }
  .tool { padding: 1rem; }
  .filebar { flex-wrap: wrap; }
  .filebar__act { width: 100%; }
  .linkbtn { flex: 1; justify-content: center; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
