:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --soft: #f8fafc;
  --line: #e5e7eb;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --blue: #1e3a8a;
  --blue-hover: #1e40af;
  --green: #166534;
  --green-bg: #f0fdf4;
  --red: #991b1b;
  --red-bg: #fef2f2;
  --container: 1120px;
  --radius: 0;
  --space-1: 0.5rem;
  --space-2: 0.75rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --space-6: 3rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  box-shadow: none !important;
}

html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
svg,
canvas {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-underline-offset: 4px;
}

button,
input {
  font: inherit;
}

button,
label,
a.button {
  touch-action: manipulation;
}

button:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

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

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.narrow {
  max-width: 880px;
}

.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;
}

.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.header-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--soft);
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-copy {
  min-width: 0;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.brand-subtitle {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}

.header-nav {
  display: none;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-weight: 750;
}

.header-nav a {
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav a:focus-visible {
  color: var(--blue);
}

.hero {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.hero-grid {
  display: grid;
  gap: var(--space-4);
  padding: clamp(2.5rem, 7vw, 5rem) 0;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--text);
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.25rem, 10vw, 5rem);
}

h2 {
  font-size: clamp(1.55rem, 5vw, 2.6rem);
}

h3 {
  font-size: clamp(1.12rem, 3vw, 1.45rem);
}

p,
li,
dd,
code {
  overflow-wrap: anywhere;
}

.hero-text {
  max-width: 68ch;
  margin: var(--space-3) 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
}

.hero-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.hero-facts span {
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-weight: 750;
}

.intro-card,
.panel,
.faq details,
.info-grid article {
  border: 1px solid var(--line);
  background: var(--panel);
}

.intro-card,
.panel {
  padding: clamp(1rem, 4vw, 1.5rem);
}

.intro-card p,
.section-heading p,
.helper-text,
.info-grid p,
.faq p {
  color: var(--muted);
}

.section {
  padding: clamp(2.5rem, 7vw, 5rem) 0;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  max-width: 760px;
  margin-bottom: var(--space-4);
}

.section-heading p {
  margin: var(--space-2) 0 0;
}

.converter-shell {
  display: grid;
  gap: var(--space-3);
  align-items: start;
}

.step-label {
  display: inline-flex;
  margin-bottom: var(--space-2);
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
  padding: 0.35rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

.helper-text {
  margin: var(--space-2) 0 0;
}

.drop-zone {
  min-height: 220px;
  margin-top: var(--space-3);
  display: grid;
  place-items: center;
  gap: 0.4rem;
  padding: var(--space-4);
  border: 2px dashed var(--line-strong);
  background: var(--soft);
  text-align: center;
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--blue);
  background: #eff6ff;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--blue);
  font-size: 2rem;
  line-height: 1;
}

.drop-title {
  color: var(--text);
  font-weight: 850;
}

.drop-note,
.message,
.result-meta,
.copy-status {
  color: var(--muted);
  font-size: 0.95rem;
}

.message {
  min-height: 1.5rem;
  margin-top: var(--space-3);
}

.message.error {
  color: var(--red);
}

.message.success {
  color: var(--green);
}

.preview-card {
  margin-top: var(--space-3);
  border: 1px solid var(--line);
  background: #ffffff;
}

.preview-media {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.preview-media img {
  display: block;
  max-height: 320px;
  object-fit: contain;
}

.file-info {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: var(--space-3);
}

.file-info div {
  display: grid;
  gap: 0.2rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.file-info div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.file-info dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.file-info dd {
  margin: 0;
  color: var(--text);
  font-weight: 750;
}

.sizes-fieldset {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0 0;
  padding: 0;
  border: 0;
}

.sizes-fieldset label {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 0.75rem;
  color: var(--text);
  font-weight: 750;
}

.sizes-fieldset input {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.convert-label {
  margin-top: var(--space-5);
}

.actions {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.button {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  padding: 0.85rem 1rem;
  font-weight: 850;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:disabled,
.button.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.primary,
.button.download {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button.primary:hover:not(:disabled),
.button.download:not(.is-disabled):hover {
  background: var(--blue-hover);
}

.button.secondary:hover:not(:disabled) {
  background: var(--soft);
}

.progress {
  margin-top: var(--space-3);
  border: 1px solid var(--line);
  padding: var(--space-3);
  background: var(--soft);
}

.progress-bar {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #ffffff;
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
}

.progress p {
  margin: 0.6rem 0 0;
  color: var(--muted);
}

.result-box {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border: 1px solid #bbf7d0;
  background: var(--green-bg);
}

.result-box p {
  margin: 0.5rem 0 0;
  color: var(--green);
}

.output-panel {
  margin-top: var(--space-3);
}

.panel-heading-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-3);
}

.favicon-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: var(--space-3);
  color: var(--muted);
}

.favicon-preview-item {
  display: grid;
  place-items: center;
  gap: var(--space-2);
  margin: 0;
  min-height: 128px;
  border: 1px solid var(--line);
  background: var(--soft);
  padding: var(--space-3);
}

.favicon-preview-item img {
  display: block;
  image-rendering: auto;
}

.favicon-preview-item figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.code-copy {
  margin-top: var(--space-4);
  border-top: 1px solid var(--line);
  padding-top: var(--space-4);
}

.code-row {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.code-row code {
  display: block;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  padding: var(--space-3);
  white-space: nowrap;
}

.copy-status {
  min-height: 1.4rem;
  margin: var(--space-2) 0 0;
}

.steps-list {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-4) 0;
  padding-left: 1.25rem;
}

.steps-list li {
  color: var(--muted);
}

.info-grid {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.info-grid article {
  padding: var(--space-3);
}

.info-grid p {
  margin: var(--space-2) 0 0;
}

.faq details {
  padding: var(--space-3);
}

.faq details + details {
  margin-top: var(--space-2);
}

.faq summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 850;
}

.faq p {
  margin: var(--space-2) 0 0;
}

.site-footer {
  background: #0f172a;
  color: #e5e7eb;
}

.footer-inner {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
}

.footer-inner p {
  margin: 0;
}

.footer-inner a {
  color: #ffffff;
}

@media (min-width: 560px) {
  .actions,
  .code-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .code-row code {
    grid-column: span 2;
  }

  .favicon-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (min-width: 720px) {
  .header-nav {
    display: flex;
  }

  .hero-grid,
  .converter-shell {
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    align-items: start;
  }

  .sizes-fieldset {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1180px) {
  .favicon-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .container {
    width: min(100% - 1rem, var(--container));
  }

  .header-inner {
    min-height: 76px;
  }

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

  .brand-subtitle {
    display: none;
  }

  .sizes-fieldset,
  .favicon-grid {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 190px;
    padding: var(--space-3);
  }
}
