:root {
  color-scheme: light;
  --ink: #17151d;
  --muted: #6f6a79;
  --line: #ded8e8;
  --panel: rgba(255, 255, 255, 0.88);
  --violet: #6c4cf1;
  --violet-dark: #4c2ed2;
  --lime: #d8ff54;
  --shadow: 0 24px 80px rgba(42, 28, 80, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f7f5fb;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(216, 255, 84, 0.28), transparent 28rem),
    radial-gradient(circle at 88% 8%, rgba(108, 76, 241, 0.18), transparent 32rem),
    #f7f5fb;
}

button,
input {
  font: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(108, 76, 241, 0.35);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid rgba(222, 216, 232, 0.78);
  background: rgba(250, 248, 253, 0.78);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 18px rgba(23, 21, 29, 0.18);
}

.brand strong {
  color: var(--violet);
}

.runtime-pill,
.privacy-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.runtime-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e6ad32;
  box-shadow: 0 0 0 4px rgba(230, 173, 50, 0.13);
}

.runtime-pill.ready .runtime-dot {
  background: #62ae39;
  box-shadow: 0 0 0 4px rgba(98, 174, 57, 0.14);
}

.runtime-pill.error .runtime-dot {
  background: #dc4f4f;
  box-shadow: 0 0 0 4px rgba(220, 79, 79, 0.14);
}

main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 44px) 48px;
}

.hero {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(58px, 9vw, 112px) 0 clamp(42px, 6vw, 72px);
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--violet);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 88px);
  letter-spacing: -0.06em;
  line-height: 0.96;
}

.hero-copy {
  max-width: 720px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-top: 28px;
}

.metrics span {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  overflow: hidden;
  min-height: 700px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(251, 250, 253, 0.9);
}

.drop-zone {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 300px;
  place-items: center;
  border: 1.5px dashed #bdb4cd;
  border-radius: 20px;
  cursor: pointer;
  background:
    linear-gradient(145deg, rgba(216, 255, 84, 0.12), rgba(108, 76, 241, 0.08)),
    white;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  transform: translateY(-2px);
  border-color: var(--violet);
  box-shadow: 0 14px 32px rgba(108, 76, 241, 0.13);
}

.drop-zone img {
  width: 100%;
  height: 300px;
  object-fit: contain;
  background:
    linear-gradient(45deg, #f2eff7 25%, transparent 25%),
    linear-gradient(-45deg, #f2eff7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f2eff7 75%),
    linear-gradient(-45deg, transparent 75%, #f2eff7 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.drop-copy {
  padding: 30px;
  text-align: center;
}

.drop-copy h2 {
  margin: 18px 0 5px;
  font-size: 20px;
}

.drop-copy p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.drop-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: var(--violet);
  font-size: 24px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(108, 76, 241, 0.24);
}

.choose-button,
.replace-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.replace-button {
  position: absolute;
  right: 12px;
  bottom: 12px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(23, 21, 29, 0.12);
}

.file-summary {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 2px 3px;
}

.file-summary strong,
.file-summary span {
  display: block;
}

.file-summary strong {
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-summary div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-chip {
  flex: none;
  padding: 6px 8px;
  color: #42772a;
  border-color: #cce5be;
  background: #f4fbea;
  font-size: 10px;
}

.actions {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.download-button {
  min-height: 48px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    box-shadow 140ms ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 18px;
  border: 0;
  color: white;
  background: var(--ink);
  box-shadow: 0 12px 24px rgba(23, 21, 29, 0.16);
}

.primary-button kbd {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 9px;
  color: var(--ink);
  background: var(--lime);
  font-family: inherit;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.download-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.progress-card {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.progress-heading {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  font-size: 12px;
}

.progress-heading span {
  color: var(--violet);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.progress-track {
  overflow: hidden;
  height: 7px;
  margin-top: 10px;
  border-radius: 999px;
  background: #eeeaf3;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), #9a6eff, var(--lime));
  transition: width 180ms ease;
}

.progress-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.examples {
  margin-top: 22px;
}

.examples > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.example-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 9px;
}

.example-list button {
  overflow: hidden;
  padding: 0 0 7px;
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  background: white;
  font-size: 10px;
  font-weight: 700;
}

.example-list img {
  display: block;
  width: 100%;
  height: 58px;
  margin-bottom: 6px;
  object-fit: cover;
  background: #eeeaf3;
}

.results-panel {
  min-width: 0;
  padding: clamp(22px, 3vw, 38px);
}

.result-header {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.result-header h2 {
  margin: 0;
  font-size: clamp(21px, 2.5vw, 30px);
  letter-spacing: -0.03em;
}

.result-header > span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
}

.result-card-ai {
  border-color: #c9baf9;
  box-shadow: 0 16px 38px rgba(108, 76, 241, 0.1);
}

.card-label {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 15px;
  border-bottom: 1px solid var(--line);
}

.card-label span {
  font-size: 13px;
  font-weight: 800;
}

.card-label small {
  color: var(--muted);
  font-size: 10px;
}

.canvas-stage {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 450px;
  place-items: center;
  background:
    linear-gradient(45deg, #f3f0f7 25%, transparent 25%),
    linear-gradient(-45deg, #f3f0f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f0f7 75%),
    linear-gradient(-45deg, transparent 75%, #f3f0f7 75%),
    white;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.canvas-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.empty-state {
  max-width: 220px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: block;
  color: #a097ae;
  font-size: 36px;
}

.empty-state p {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.tile-progress {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  overflow: hidden;
  height: 4px;
  border-radius: 999px;
  background: rgba(23, 21, 29, 0.14);
  backdrop-filter: blur(8px);
}

.tile-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--lime);
  transition: width 180ms ease;
}

.download-button {
  width: calc(100% - 24px);
  margin: 12px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.download-button-primary {
  border-color: var(--ink);
  color: white;
  background: var(--ink);
}

.result-note {
  margin: 16px 4px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

footer {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 56px) 34px;
  color: var(--muted);
  font-size: 12px;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

footer a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

footer a:hover {
  color: var(--violet);
}

.toast {
  position: fixed;
  z-index: 50;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 16px;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  box-shadow: 0 16px 40px rgba(23, 21, 29, 0.24);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .drop-zone {
    min-height: 250px;
  }

  .drop-zone img {
    height: 250px;
  }
}

@media (max-width: 680px) {
  .site-header {
    min-height: 60px;
  }

  .runtime-pill {
    max-width: 48%;
  }

  .runtime-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero {
    padding-top: 48px;
  }

  .workspace {
    border-radius: 21px;
  }

  .input-panel,
  .results-panel {
    padding: 16px;
  }

  .result-header {
    align-items: start;
    flex-direction: column;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    min-height: 330px;
  }

  footer {
    flex-direction: column;
  }
}

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