:root {
  color-scheme: light;
  --bg: #f7f8fd;
  --panel: #ffffff;
  --ink: #1f2430;
  --sub: #626a7a;
  --muted: #7c8494;
  --line: #dde2f0;
  --accent: #6c5ce7;
  --accent2: #ff6b9d;
  --wave: #4f8cff;
  --good: #00c48c;
  --warn: #ffb020;
  --bad: #ff5252;
  --gold: #ffc531;
  --soft: #eef2ff;
  --shadow: 0 16px 42px rgba(38, 46, 76, .11);
  --radius: 20px;
  --grad-hero: linear-gradient(135deg, #6c5ce7, #ff6b9d);
  --font: "Avenir Next", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --num: "SF Mono", "Cascadia Mono", "Menlo", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
}

a {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 20px clamp(18px, 4vw, 48px) 42px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .88), rgba(247, 248, 253, .88)),
    repeating-linear-gradient(90deg, rgba(108, 92, 231, .08) 0 1px, transparent 1px 44px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.toplinks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 14px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  max-width: 1120px;
  margin: 0 auto;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(48px, 8vw, 96px);
  line-height: .95;
}

h2 {
  margin: 0;
  font-size: clamp(24px, 3.6vw, 38px);
  line-height: 1.12;
}

h3 {
  margin: 0 0 8px;
  font-size: 21px;
}

.hero-lead {
  margin: 22px 0 0;
  max-width: 680px;
  font-size: clamp(20px, 2.8vw, 30px);
  font-weight: 900;
  line-height: 1.35;
}

.hero-benefit {
  display: inline-block;
  margin: 20px 0 0;
  padding: 8px 16px;
  border: 1px solid rgba(108, 92, 231, .22);
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.hero-note {
  margin: 18px 0 0;
  max-width: 720px;
  color: var(--sub);
  font-size: 15px;
  line-height: 1.8;
}

.hero-meter {
  display: grid;
  grid-template-columns: repeat(9, minmax(12px, 1fr));
  align-items: end;
  gap: 10px;
  height: min(44vw, 360px);
  min-height: 240px;
  padding: 28px;
  border: 1px solid rgba(108, 92, 231, .18);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .62)),
    linear-gradient(135deg, rgba(79, 140, 255, .22), rgba(255, 107, 157, .18));
  box-shadow: var(--shadow);
}

.hero-meter span {
  display: block;
  height: var(--h);
  min-height: 38px;
  border-radius: 12px 12px 7px 7px;
  background: var(--grad-hero);
  box-shadow: inset 0 -12px 0 rgba(255, 255, 255, .22);
}

main {
  width: min(1120px, calc(100% - 32px));
  margin: -18px auto 0;
  padding-bottom: 42px;
}

.upload-panel,
.progress-card,
.result-preview,
.results,
.repair-guide,
.export-panel,
.cta-panel {
  border: 1px solid rgba(108, 92, 231, .12);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-panel,
.progress-card,
.result-preview,
.results {
  padding: clamp(18px, 3vw, 28px);
}

.upload-benefit {
  margin: 14px 0 0;
  color: var(--accent);
  font-weight: 900;
  text-align: center;
}

.result-preview {
  margin-top: 22px;
}

.preview-note {
  margin: 10px 0 0;
  color: var(--sub);
}

.preview-check-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.preview-check-item {
  display: grid;
  gap: 8px;
  min-height: 188px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.preview-check-item[data-state="pass"] { border-color: rgba(0, 196, 140, .42); background: linear-gradient(180deg, rgba(0, 196, 140, .08), #fff 56%); }
.preview-check-item[data-state="near"] { border-color: rgba(255, 176, 32, .48); background: linear-gradient(180deg, rgba(255, 176, 32, .1), #fff 56%); }
.preview-check-item[data-state="warn"] { border-color: rgba(255, 82, 82, .5); background: linear-gradient(180deg, rgba(255, 82, 82, .09), #fff 56%); }

.preview-stamp {
  position: relative;
  justify-self: start;
  display: inline-grid;
  place-items: center;
  min-width: 102px;
  min-height: 58px;
  padding: 8px 14px;
  border: 4px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 8%, white);
  font-size: clamp(18px, 1.8vw, 20px);
  font-weight: 1000;
  letter-spacing: .15em;
  line-height: 1;
  text-indent: .15em;
  transform: rotate(-4deg);
  isolation: isolate;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 5px currentColor;
}

.preview-stamp::after,
.stamp::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: repeating-radial-gradient(circle at 22% 34%, transparent 0 2px, currentColor 2px 2.7px, transparent 2.7px 5px);
  opacity: .12;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.preview-check-item[data-state="pass"] .preview-stamp { color: var(--good); }
.preview-check-item[data-state="near"] .preview-stamp { color: var(--warn); }
.preview-check-item[data-state="warn"] .preview-stamp { color: var(--bad); }
.preview-check-item strong { font-size: clamp(17px, 1.7vw, 18px); line-height: 1.45; }
.preview-check-item small { color: var(--sub); font-size: 14px; line-height: 1.6; }

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

.section-head.compact {
  align-items: start;
  margin-bottom: 14px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 240px;
  padding: 28px;
  border: 3px dashed rgba(108, 92, 231, .36);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(108, 92, 231, .09), rgba(255, 107, 157, .08)),
    #fff;
  text-align: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--grad-hero);
  color: #fff;
}

.drop-icon svg { width: 30px; height: 30px; }

.drop-zone strong {
  font-size: clamp(21px, 4vw, 31px);
}

.drop-zone span,
.drop-zone small,
.file-summary,
.result-note,
.repair-guide p,
.export-panel p,
.cta-panel p,
.export-status {
  color: var(--sub);
  font-size: 15px;
  line-height: 1.7;
}

.drop-zone small {
  max-width: 760px;
}

.file-summary {
  margin: 14px 0 0;
}

.progress-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #ecf0fb;
}

.progress-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--grad-hero);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.progress-meta,
.progress-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  color: var(--sub);
  font-size: 14px;
}

.progress-meta > span:first-child {
  display: grid;
  gap: 4px;
}

.flavor-text {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stage-chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 12px;
  padding: 0;
  list-style: none;
}

.stage-chips li {
  padding: 8px 6px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #f8f9fe;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.stage-chips li.is-current {
  border-color: rgba(108, 92, 231, .42);
  background: var(--soft);
  color: var(--accent);
}

.stage-chips li.is-complete {
  border-color: var(--good);
  background: rgba(0, 196, 140, .1);
  color: #008c66;
}

.stage-chips li.just-completed {
  animation: checkpointPop .42s cubic-bezier(.2, .9, .3, 1.35);
}

.viz-shell {
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(108, 92, 231, .2);
  border-radius: 18px;
  background: #fbfcff;
  box-shadow: inset 0 0 0 5px rgba(238, 242, 255, .72);
}

#viz-canvas {
  display: block;
  width: 100%;
  height: 220px;
}

.viz-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 9px;
  border: 1px solid rgba(108, 92, 231, .24);
  border-radius: 999px;
  background: rgba(255, 255, 255, .88);
  color: var(--accent);
  font: 800 13px/1 var(--num);
}

.live-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: stretch;
  margin-top: 10px;
}

.live-meter {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.live-meter span,
.meter-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.live-meter strong {
  overflow: hidden;
  color: var(--ink);
  font: 800 clamp(16px, 2vw, 20px)/1.2 var(--num);
  font-variant-numeric: tabular-nums;
}

.live-meter strong.is-updated {
  animation: digitRoll .24s ease-out;
}

.meter-note {
  align-self: end;
  max-width: 9em;
  padding: 8px 2px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #f1f3fb;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
}

.result-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 20px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 5px;
  border-radius: 999px;
  background: #edf0fb;
}

.segmented button {
  min-width: 112px;
  padding: 10px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--sub);
  font-size: 14px;
  font-weight: 900;
}

.segmented button.active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(108, 92, 231, .14);
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.score-strip div {
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  background: #f4f6ff;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.score-strip strong {
  display: block;
  margin-top: 8px;
  font-family: var(--num);
  font-size: clamp(20px, 3vw, 29px);
  line-height: 1.1;
  overflow-wrap: anywhere;
}

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

.check-item {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 330px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: #fff;
}

.stamp {
  position: relative;
  justify-self: start;
  display: inline-grid;
  place-items: center;
  min-width: 104px;
  min-height: 104px;
  padding: 13px;
  border: 6px solid currentColor;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 8%, white);
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
  font-weight: 1000;
  letter-spacing: .12em;
  line-height: 1.05;
  text-align: center;
  text-indent: .12em;
  transform: rotate(-5deg);
  isolation: isolate;
  box-shadow: inset 0 0 0 4px #fff, inset 0 0 0 6px currentColor;
}

.results.is-ready .stamp {
  animation: stampPop .42s cubic-bezier(.18, 1.5, .4, 1) both;
}

.check-item[data-state="pass"] {
  border-color: rgba(0, 196, 140, .42);
  background: linear-gradient(180deg, rgba(0, 196, 140, .08), #fff 48%);
}

.check-item[data-state="near"] {
  border-color: rgba(255, 176, 32, .48);
  background: linear-gradient(180deg, rgba(255, 176, 32, .1), #fff 48%);
}

.check-item[data-state="warn"] {
  border-color: rgba(255, 82, 82, .5);
  background: linear-gradient(180deg, rgba(255, 82, 82, .09), #fff 48%);
}

.check-item[data-state="pass"] .stamp {
  color: var(--good);
}

.check-item[data-state="near"] .stamp {
  color: var(--warn);
}

.check-item[data-state="warn"] .stamp {
  color: var(--bad);
}

.check-value {
  margin: 0 0 8px;
  font-family: var(--num);
  font-size: 23px;
  font-weight: 1000;
}

.check-detail {
  margin: 0;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.55;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

summary {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

details p {
  margin: 10px 0 0;
  color: var(--sub);
  font-size: 14px;
  line-height: 1.7;
}

.repair-guide,
.export-panel,
.cta-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: center;
  gap: 22px;
  margin-top: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.repair-guide {
  align-items: start;
}

.repair-guide ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.repair-guide li {
  padding: 13px 14px;
  border-radius: 16px;
  background: #f4f6ff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.export-panel {
  border-color: rgba(79, 140, 255, .24);
  background:
    linear-gradient(135deg, rgba(79, 140, 255, .08), rgba(255, 107, 157, .08)),
    #fff;
}

.export-panel.needs-repair {
  border-color: rgba(255, 107, 157, .52);
  box-shadow: 0 18px 52px rgba(255, 107, 157, .18);
}

.rights-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.5;
}

.rights-check input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--accent);
}

.primary-action,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 16px;
  background: var(--grad-hero);
  color: #fff;
  font-size: 15px;
  font-weight: 1000;
  box-shadow: 0 12px 26px rgba(108, 92, 231, .25);
}

.primary-link:hover {
  text-decoration: none;
}

.export-status {
  grid-column: 1 / -1;
  margin: 0;
}

.cta-panel {
  background:
    linear-gradient(135deg, rgba(108, 92, 231, .1), rgba(255, 107, 157, .1)),
    #fff;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 34px 18px 44px;
  color: var(--sub);
  font-size: 14px;
}

.license-hero .hero-copy {
  margin: 0 auto;
  width: min(1120px, 100%);
}

.license-table-wrap {
  overflow-x: auto;
}

.license-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 14px;
}

.license-table th,
.license-table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.license-table th {
  color: var(--accent);
  font-size: 13px;
}

.license-section {
  margin-top: 18px;
}

.license-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding-left: 22px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
}

.hidden {
  display: none !important;
}

@keyframes stampPop {
  0% {
    opacity: 0;
    transform: scale(2.6) rotate(-8deg);
  }
  62% {
    opacity: 1;
    transform: scale(.92) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-8deg);
  }
}

@keyframes checkpointPop {
  0% { transform: scale(.8); }
  58% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes digitRoll {
  from { opacity: .45; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 980px) {
  .hero-grid,
  .result-toolbar,
  .repair-guide,
  .export-panel,
  .cta-panel {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 720px) {
  .hero {
    padding-inline: 16px;
  }

  main {
    width: min(100% - 20px, 1120px);
  }

  .hero-meter {
    min-height: 180px;
    padding: 18px;
    gap: 7px;
  }

  .score-strip,
  .check-grid,
  .preview-check-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .progress-meta,
  .progress-actions {
    align-items: start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }

  .segmented button {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .stage-chips {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #viz-canvas {
    height: 150px;
  }

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

  .meter-note {
    max-width: none;
  }
}
