*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0c0c0d;
  --surface: #161618;
  --surface2: #1e1e21;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --accent: #b8f55a;
  --accent-dim: rgba(184,245,90,0.12);
  --text: #f0f0ee;
  --muted: #888886;
  --danger: #ff6b6b;
  --font-head: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-text: 'Inter', sans-serif;
  --logo-color: #f0f0ee;
  --tool-bg: rgba(22,22,24,0.82);
  --tool-shadow: 0 24px 80px rgba(0,0,0,0.38);
  --switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='%230c0c0d'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  --grid-line: rgba(255,255,255,0.025);
  --footer-link: #ffffff;
}

html.light {
  --bg: #f2f0eb;
  --surface: #ffffff;
  --surface2: #e8e6e1;
  --border: rgba(0,0,0,0.09);
  --border-hover: rgba(0,0,0,0.22);
  --accent-dim: rgba(130,185,0,0.14);
  --text: #111110;
  --muted: #666664;
  --danger: #d93636;
  --logo-color: #3d7000;
  --tool-bg: rgba(255,255,255,0.82);
  --tool-shadow: 0 16px 60px rgba(0,0,0,0.08);
  --switch-bg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230c0c0d' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4' fill='%230c0c0d' stroke='none'/%3E%3Cline x1='12' y1='2' x2='12' y2='5'/%3E%3Cline x1='12' y1='19' x2='12' y2='22'/%3E%3Cline x1='4.22' y1='4.22' x2='6.34' y2='6.34'/%3E%3Cline x1='17.66' y1='17.66' x2='19.78' y2='19.78'/%3E%3Cline x1='2' y1='12' x2='5' y2='12'/%3E%3Cline x1='19' y1='12' x2='22' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='6.34' y2='17.66'/%3E%3Cline x1='17.66' y1='6.34' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
  --grid-line: rgba(0,0,0,0.04);
  --footer-link: #111110;
}

html {
  scroll-behavior: smooth;
}

html, body {
  transition: background-color 0.4s ease, color 0.4s ease;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-text);
  color: var(--text);
  background:
    radial-gradient(circle at 2% 2%, rgba(183,245,90,0.117), transparent 26rem),
    radial-gradient(circle at 90% 15%, rgba(184,245,90,0.08), transparent 22rem),
    radial-gradient(circle at 52% 120%, rgba(183,245,90,0.045), transparent 36rem),
    var(--bg);
}

html.light body {
  background:
    radial-gradient(circle at 2% 2%, rgba(130,185,0,0.07), transparent 26rem),
    radial-gradient(circle at 90% 15%, rgba(130,185,0,0.04), transparent 22rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.72), transparent 78%);
}

main {
  flex: 1;
}

.page,
.footer-wrap {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page2 {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page-inner {
  width: min(100% - 40px, 1140px);
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  padding-top: 2.8rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  justify-self: start;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.brand-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--logo-color);
  transition: color 0.4s ease;
  font-family: var(--font-head);
}

.site-nav {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
  background: var(--accent-dim);
}

html.light .nav-link:hover,
html.light .nav-link.active {
  color: #3d7000;
}

.theme-switch {
  position: relative;
  justify-self: end;
  width: 56px;
  height: 30px;
  cursor: pointer;
  flex-shrink: 0;
  background: transparent;
  border: 0;
}

.theme-knob {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  background: white var(--switch-bg) no-repeat center;
  background-size: 14px 14px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 2;
  transform: translateY(-50%);
  animation: tswitch-out 0.3s forwards;
}

.theme-switch:hover .theme-knob {
  outline: 6px solid var(--accent-dim);
}

html.light .theme-knob {
  animation: tswitch-in 0.3s forwards;
}

.theme-track {
  display: block;
  width: 56px;
  height: 22px;
  background: var(--surface2);
  border: 1px solid var(--border-hover);
  border-radius: 9999px;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

@keyframes tswitch-in {
  from { left: 0; }
  to { left: calc(100% - 30px); }
}

@keyframes tswitch-out {
  from { left: calc(100% - 30px); }
  to { left: 0; }
}

@media (max-width: 768px) {
  .site-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand theme"
      "nav nav";
    align-items: center;
    gap: 1.25rem;
    padding-top: 1.5rem;
  }

  .brand {
    grid-area: brand;
    justify-self: start;
  }

  .theme-switch {
    grid-area: theme;
    justify-self: end;
  }

  .site-nav {
    grid-area: nav;
    justify-self: center;
    margin: 0 auto;
  }
}

.hero {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.hero-content {
  max-width: 1100px;
  margin: 8rem auto 6rem;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(3rem, 7vw, 6.1rem);
  line-height: 1;
  letter-spacing: -0.08em;
}

.hero h1 span {
  color: var(--accent);
}

html.light .hero h1 span {
  color: #3d7000;
}

.hero-text {
  max-width: 650px;
  margin: 1.5rem auto 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.7;
}

.tool-section {
  border: 1px solid var(--border);
  padding-inline: 1.4rem;
  border-radius: 22px;
  background: var(--tool-bg);
  box-shadow: var(--tool-shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
  transition: background 0.4s ease, border-color 0.4s ease;
}

.tool-header {
  padding-block: 1.8rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tool-header h2 {
  font-family: var(--font-head);
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  letter-spacing: -0.05em;
}

.tool-header p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.5rem;
}

.controls {
  display: grid;
  gap: 1rem;
  margin-block: 1.5rem;
}

.controls-compressor {
  grid-template-columns: 1fr 1fr;
}

.controls-resizer {
  grid-template-columns: repeat(2, 1fr);
}

.control-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.5rem;
}

.control-group label,
.control-group > label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.6rem;
}

.control-group .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}

html.light .control-group .value {
  color: #3d7000;
}

input,
select,
button {
  font: inherit;
}

input[type="number"],
select {
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  font-family: var(--font-mono);
  outline: none;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

select {
  cursor: pointer;
  appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f0f0ee' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 16px;
}

html.light select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23111110' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  outline: none;
  background: var(--surface2);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

html.light input[type="range"]::-webkit-slider-thumb,
html.light input[type="range"]::-moz-range-thumb {
  background: #3d7000;
}

.format-toggle {
  display: flex;
  gap: 0.5rem;
}

.fmt-btn {
  flex: 1;
  padding: 0.55rem 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.fmt-btn input {
  display: none;
}

.fmt-btn.active,
.fmt-btn:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

html.light .fmt-btn.active,
html.light .fmt-btn:has(input:checked) {
  color: #3d7000;
  border-color: #3d7000;
}

.drop-zone {
  min-height: 320px;
  padding: 5rem 2rem;
  border: 1.5px dashed var(--border-hover);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: border-color .25s ease, background .25s ease;
  margin-bottom: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--muted);
}

.drop-zone:hover,
.drop-zone.drag-over,
.drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(183,245,90,0.014);
}

html.light .drop-zone:hover,
html.light .drop-zone.drag-over,
html.light .drop-zone.dragover {
  border-color: #3d7000;
  background: rgba(130,185,0,0.08);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
  display: block;
}

.drop-zone p {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.drop-zone strong {
  color: var(--text);
  font-weight: 600;
}

.action-bar {
  display: flex;
  gap: 1rem;
  margin-top: 2.4rem;
  margin-bottom: 0.5rem;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-family: var(--font-head);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #0c0c0d;
  box-shadow: 0 0 0 rgba(184,245,90,0);
}

.btn-primary:hover {
  background: #d6fd88;
  transform: scale(1.01);
}

.btn-primary:disabled {
  background: var(--surface2);
  color: var(--muted);
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--muted);
}

.btn-outline:hover {
  border-color: var(--text);
  color: var(--text);
}

.btn-outline:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stats-bar[hidden] {
  display: none;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

html.light .stat-value {
  color: #3d7000;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  padding-bottom: 2rem;
}

.image-card,
.preview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}

.image-card:hover,
.preview-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.image-card.done,
.preview-card.done {
  border-color: rgba(184,245,90,0.3);
}

html.light .image-card.done,
html.light .preview-card.done {
  border-color: rgba(61,112,0,0.35);
}

.card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--surface2);
}

.card-thumb,
.card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.image-card:hover .card-thumb,
.preview-card:hover .card-thumb-wrap img {
  transform: scale(1.04);
}

.card-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  backdrop-filter: blur(4px);
}

.image-card:hover .card-remove,
.preview-card:hover .card-remove {
  opacity: 1;
  transform: scale(1);
}

.card-remove:hover {
  background: var(--danger);
  border-color: transparent;
}

.card-saving-overlay {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(184,245,90,0.92);
  color: #0c0c0d;
  padding: 3px 8px;
  border-radius: 5px;
  display: none;
}

.image-card.done .card-saving-overlay,
.preview-card.done .card-saving-overlay {
  display: block;
}

.card-body,
.preview-info {
  padding: 0.75rem 0.875rem 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card-name,
.preview-info strong {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-info small {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.card-sizes {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.size-original {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: line-through;
}

.size-arrow {
  color: var(--muted);
  font-size: 0.65rem;
}

.size-new {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent) !important;
  font-weight: 500;
}

html.light .size-new {
  color: #3d7000 !important;
}

.progress-bar {
  width: 100%;
  height: 2px;
  background: var(--surface2);
  border-radius: 1px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 1px;
  width: 0%;
  transition: width 0.3s;
}

html.light .progress-fill {
  background: #3d7000;
}

.card-download,
.download-btn {
  width: 100%;
  padding: 0.45rem;
  margin-top: auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  text-decoration: none;
}

.card-download:hover,
.download-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

html.light .card-download:hover,
html.light .download-btn:hover {
  color: #3d7000;
  border-color: #3d7000;
  background: rgba(130,185,0,0.06);
}

.card-download:disabled,
.download-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.footer-wrap {
  padding: 1.5rem 0 1.8rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  color: var(--muted);
  font-family: var(--font-text);
  font-size: 0.875rem;
}

.creator {
  display: inline-flex;
  align-items: center;
  gap: 0;
  line-height: 1;
}

.site-footer a {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  font-family: 'Bebas Neue', sans-serif;
  text-decoration: none;
  color: var(--footer-link);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}

.site-footer a span {
  color: #00d4ff;
  font-size: 1.8rem;
  line-height: 0;
  transform: translateY(0.02em);
}

#cookie-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  max-width: 440px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  z-index: 100;
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  display: none;
  animation: cookie-rise 0.4s ease forwards;
}

#cookie-banner.show {
  display: block;
}

#cookie-banner p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

#cookie-banner p strong {
  color: var(--text);
  font-weight: 600;
}

.cookie-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.cookie-btn {
  padding: 0.5rem 1rem;
  border-radius: 7px;
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  text-decoration: none;
}

.cookie-btn.primary {
  background: var(--accent);
  color: #0c0c0d;
}

.cookie-btn.primary:hover {
  filter: brightness(1.1);
}

html.light .cookie-btn.primary {
  background: #3d7000;
  color: #ffffff;
}

.cookie-btn.ghost {
  background: transparent;
  border: 1px solid var(--border-hover);
  color: var(--muted);
}

.cookie-btn.ghost:hover {
  color: var(--text);
  border-color: var(--text);
}

.hidden {
  display: none !important;
}

@keyframes cookie-rise {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .site-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
  }

  .controls-compressor,
  .controls-resizer,
  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding-top: 1.5rem;
  }

  .brand-name {
    font-size: 1.4rem;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .hero-content {
    margin-block: 2rem 3rem;
    padding-inline: 1.25rem;
  }

  .hero h1 {
    font-size: clamp(2.6rem, 11vw, 4rem);
    letter-spacing: -0.05em;
  }

  .hero-text {
    font-size: 0.9rem;
  }

  .controls-compressor,
  .controls-resizer {
    grid-template-columns: 1fr;
  }

  .tool-header h2 {
    font-size: 1.4rem;
  }

  .tool-header p {
    font-size: 0.85rem;
  }

  .action-bar {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .drop-zone {
    min-height: 220px;
    padding: 3rem 1.5rem;
  }

  .drop-icon {
    font-size: 2.5rem;
  }

  .drop-zone p {
    font-size: 0.9rem;
  }

  .site-footer {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
  }

  .tool-section {
    border-radius: 16px;
  }
}

@media (max-width: 540px) {
  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .hero h1 {
    font-size: 2.4rem;
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }
}
