:root {
  color-scheme: light;
  --page-bg: #727171;
  --ink: #111827;
  --muted: #5f6877;
  --line: #d7dce4;
  --soft: #f5f7fa;
  --accent: #1f56d8;
  --accent-dark: #153ea3;
  --safe: #12633f;
  --safe-bg: #ecf8f1;
  --warning: #8a4b08;
  --warning-bg: #fff8e8;
  --danger: #a51d2d;
  --danger-bg: #fff0f2;
}

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

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  background: var(--page-bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #000;
}

nav {
  position: relative;
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

.header-image {
  flex-shrink: 0;
}

.header-image img {
  display: block;
  width: auto;
  height: 22px;
  object-fit: contain;
}

.nav-links {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(17, 24, 39, 0.98);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.nav-links.active {
  display: flex;
}

.nav-item {
  position: relative;
  width: 100%;
}

.nav-item > a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: #e5e7eb;
  font-weight: 500;
  text-decoration: none;
}

.nav-item > a:hover {
  color: #fff;
}

.dropdown {
  position: static;
  display: none;
  min-width: 11rem;
  margin-top: 0.35rem;
  margin-left: 1rem;
  padding: 0.6rem;
  border-radius: 0.5rem;
  background: rgba(17, 24, 39, 0.98);
}

.nav-item.active .dropdown {
  display: block;
}

.dropdown a {
  display: flex;
  min-height: 42px;
  padding: 0.55rem 0.75rem;
  align-items: center;
  border-radius: 0.35rem;
  color: #e5e7eb;
  font-size: 0.875rem;
  text-decoration: none;
}

.dropdown a:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.menu-btn {
  display: inline-grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #e5e7eb;
  cursor: pointer;
}

.menu-icon {
  display: grid;
  width: 24px;
  gap: 5px;
}

.menu-icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}

main {
  max-width: 1248px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4.5rem;
}

.checker-hero {
  max-width: 900px;
  margin: 0 auto 2rem;
  color: #fff;
  text-align: center;
}

.eyebrow {
  margin-bottom: 0.65rem;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.checker-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.16;
  letter-spacing: 0.04em;
}

.hero-copy {
  max-width: 740px;
  margin: 1rem auto 0;
  color: #fff;
  line-height: 1.75;
}

.en {
  display: block;
  margin-top: 0.25rem;
  color: inherit;
  font-size: 0.83em;
  line-height: 1.55;
  opacity: 1;
}

.privacy-notice {
  display: grid;
  max-width: 820px;
  margin: 1.5rem auto 0;
  padding: 1rem 1.15rem;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  border: 1px solid #b9e3cd;
  border-radius: 0.8rem;
  background: var(--safe-bg);
  color: #174b35;
  text-align: left;
}

.privacy-notice strong {
  display: block;
  margin-bottom: 0.25rem;
}

.privacy-notice p {
  font-size: 0.85rem;
  line-height: 1.55;
}

.privacy-notice .access-log-note {
  margin-top: 0.45rem;
  font-size: 0.72rem;
  opacity: 0.82;
}

.privacy-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--safe);
  color: #fff;
  font-weight: 800;
}

.checker-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.82fr) minmax(0, 1.18fr);
  gap: 1.5rem;
  align-items: start;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 58px rgba(15, 23, 42, 0.2);
}

.input-panel,
.result-panel {
  padding: 2rem;
}

.result-panel {
  min-height: 660px;
}

.section-heading {
  display: flex;
  margin-bottom: 1.75rem;
  align-items: center;
  gap: 0.85rem;
}

.section-heading h2 {
  font-size: 1.3rem;
  letter-spacing: 0.03em;
}

.section-heading p {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.step-number {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  font-weight: 800;
}

.field-group {
  margin-bottom: 1.4rem;
}

.field-group > label,
.dimension-grid > label,
.unit-field {
  color: #303846;
  font-size: 0.88rem;
  font-weight: 700;
}

.file-input {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 0.55rem;
  padding: 0.6rem;
  border: 1px solid #b9c0ca;
  border-radius: 0.65rem;
  background: #fff;
  color: var(--ink);
}

.file-input::file-selector-button {
  min-height: 38px;
  margin-right: 0.8rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid #8993a1;
  border-radius: 0.45rem;
  background: #eef1f5;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.field-help {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.file-summary {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-left: 4px solid var(--accent);
  background: #eef4ff;
}

.summary-label {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#file-name {
  display: block;
  overflow-wrap: anywhere;
}

.file-summary dl {
  display: grid;
  margin-top: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.file-summary dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.file-summary dd {
  margin-top: 0.15rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.preview-limit-note {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 1px solid #c9d7ed;
  color: #594613;
  font-size: 0.78rem;
  line-height: 1.55;
}

.size-heading {
  display: flex;
  margin-top: 1.5rem;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}

.size-heading h3 {
  font-size: 1rem;
}

.size-heading p {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.unit-field {
  display: grid;
  flex: 0 0 auto;
  gap: 0.35rem;
}

.unit-field select {
  min-width: 78px;
  min-height: 44px;
  padding: 0.55rem 2rem 0.55rem 0.65rem;
  border: 1px solid #b9c0ca;
  border-radius: 0.55rem;
  background: #fff;
}

.dimension-grid {
  display: grid;
  margin-top: 1rem;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: end;
}

.number-with-unit {
  position: relative;
  display: block;
  margin-top: 0.45rem;
}

.number-with-unit input {
  width: 100%;
  min-height: 48px;
  padding: 0.72rem 2.7rem 0.72rem 0.85rem;
  border: 1px solid #b9c0ca;
  border-radius: 0.6rem;
  background: #fff;
}

.unit-output {
  position: absolute;
  top: 50%;
  right: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  transform: translateY(-50%);
}

.times-mark {
  padding-bottom: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}

.ratio-actions {
  display: grid;
  margin-top: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.secondary-button,
.primary-button,
.text-button {
  min-height: 44px;
  border-radius: 0.6rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  padding: 0.55rem 0.65rem;
  border: 1px solid #aab3c0;
  background: #f4f6f8;
  color: #334155;
  font-size: 0.76rem;
}

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

.placement-options {
  display: grid;
  margin-top: 1.5rem;
  gap: 0.7rem;
  border: 0;
}

.placement-options legend {
  margin-bottom: 0.7rem;
  color: #303846;
  font-size: 0.88rem;
  font-weight: 700;
}

.placement-options > label {
  display: grid;
  min-height: 60px;
  padding: 0.8rem;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
  cursor: pointer;
}

.placement-options > label:has(input:checked) {
  border-color: var(--accent);
  background: #eef4ff;
}

.placement-options input {
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  accent-color: var(--accent);
}

.placement-options strong,
.placement-options small {
  display: block;
}

.placement-options strong {
  font-size: 0.88rem;
}

.placement-options small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.status-message,
.error-message {
  min-height: 1.25rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.status-message {
  color: var(--muted);
}

.error-message {
  padding: 0.7rem 0.8rem;
  border: 1px solid #f0b7be;
  border-radius: 0.55rem;
  background: var(--danger-bg);
  color: var(--danger);
}

.action-row {
  display: grid;
  margin-top: 0.7rem;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
}

.primary-button {
  padding: 0.8rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.text-button {
  padding: 0.8rem;
  border: 1px solid #b9c0ca;
  background: #fff;
  color: #374151;
}

.empty-result {
  display: grid;
  min-height: 500px;
  place-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.empty-result p {
  max-width: 380px;
  line-height: 1.65;
}

.empty-graphic {
  position: relative;
  width: 122px;
  height: 96px;
  margin: 0 auto 1.4rem;
  border: 2px solid #9aa3af;
  border-radius: 0.75rem;
}

.empty-graphic span {
  position: absolute;
  display: block;
  border: 2px solid #9aa3af;
}

.empty-graphic span:first-child {
  top: 19px;
  left: 22px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.empty-graphic span:nth-child(2) {
  right: 14px;
  bottom: 16px;
  left: 14px;
  height: 38px;
  border-width: 2px 0 0 2px;
  transform: skewY(-25deg);
}

.empty-graphic span:last-child {
  right: -8px;
  bottom: -8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f8fafc;
}

.ppi-summary {
  padding: 1.35rem;
  border: 1px solid #c6d4f0;
  border-radius: 0.8rem;
  background: #eef4ff;
  text-align: center;
}

.result-kicker {
  color: #35445d;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ppi-value {
  display: flex;
  margin-top: 0.3rem;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
}

.ppi-value strong {
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  line-height: 1;
}

.ppi-value span {
  color: #46536a;
  font-size: 1.05rem;
  font-weight: 800;
}

.comparison-band {
  margin-top: 0.65rem;
  color: #263752;
  font-size: 0.82rem;
  font-weight: 700;
}

.header-only-note {
  margin-top: 0.65rem;
  padding: 0.55rem;
  border: 1px solid #e3c57a;
  border-radius: 0.45rem;
  background: var(--warning-bg);
  color: #6b4310;
  font-size: 0.75rem;
  line-height: 1.45;
}

.metric-grid {
  display: grid;
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-grid > div {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
}

.metric-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.metric-grid dd {
  margin-top: 0.25rem;
  font-size: 0.87rem;
  font-weight: 750;
  line-height: 1.45;
}

.placement-note {
  margin-top: 1rem;
  padding: 0.85rem;
  border-left: 4px solid #c78322;
  background: var(--warning-bg);
  color: #6b4310;
  font-size: 0.82rem;
  line-height: 1.6;
}

.reference-block,
.overview-block,
.detail-heading {
  margin-top: 1.6rem;
}

.reference-block h3,
.overview-block h3,
.detail-heading h3,
.preview-unavailable h3,
.result-disclaimer h3 {
  font-size: 1rem;
}

.reference-block > p,
.overview-block > p,
.detail-heading > p,
.preview-unavailable p,
.result-disclaimer p {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.table-scroll {
  margin-top: 0.75rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.8rem;
}

th,
td {
  padding: 0.72rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f1f3f6;
  color: #394252;
  font-size: 0.72rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.preview-unavailable {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid #e3c57a;
  border-radius: 0.65rem;
  background: var(--warning-bg);
}

.canvas-frame {
  display: grid;
  overflow: hidden;
  place-items: center;
  border: 1px solid #c4cad3;
  border-radius: 0.65rem;
  background: #e7eaf0;
}

.overview-frame {
  min-height: 120px;
  margin-top: 0.75rem;
  padding: 0.65rem;
}

.overview-frame canvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 520px;
  background: #fff;
  cursor: crosshair;
}

.focus-controls {
  display: grid;
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.focus-controls label {
  color: #303846;
  font-size: 0.78rem;
  font-weight: 700;
}

.focus-controls output {
  float: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.focus-controls input {
  width: 100%;
  min-height: 44px;
  margin-top: 0.3rem;
  accent-color: var(--accent);
}

.detail-grid {
  display: grid;
  margin-top: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.detail-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.pixelated canvas {
  image-rendering: pixelated;
}

.detail-grid figcaption {
  display: grid;
  margin-top: 0.55rem;
  gap: 0.15rem;
  font-size: 0.78rem;
}

.detail-grid figcaption span {
  color: var(--muted);
  font-size: 0.7rem;
}

.result-disclaimer {
  margin-top: 1.6rem;
  padding: 1rem;
  border: 1px solid #d5d8dd;
  border-radius: 0.65rem;
  background: #f5f5f4;
}

.information-grid {
  display: grid;
  margin-top: 1.5rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.information-grid article {
  padding: 1.35rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.94);
}

.info-number {
  color: #697386;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.information-grid h2 {
  margin-top: 0.45rem;
  font-size: 1rem;
}

.information-grid p {
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.contact-cta {
  display: flex;
  margin-top: 1rem;
  padding: 1.2rem 1.35rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-radius: 0.85rem;
  background: #111827;
  color: #fff;
}

.contact-cta p {
  font-size: 0.85rem;
  line-height: 1.55;
}

.contact-cta a {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0.65rem 1rem;
  align-items: center;
  border: 1px solid #fff;
  border-radius: 0.55rem;
  font-size: 0.8rem;
  font-weight: 750;
  text-decoration: none;
}

.noscript-message {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #f0b7be;
  border-radius: 0.65rem;
  background: var(--danger-bg);
  color: var(--danger);
}

footer {
  padding: 2.5rem 1.5rem;
  color: #fff;
  font-size: 0.82rem;
  text-align: center;
}

.footer-links {
  display: flex;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem 1.2rem;
}

.footer-links a {
  color: #fff;
}

button:hover,
a:hover {
  text-decoration-thickness: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #111827;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
}

@media (min-width: 768px) {
  .nav-links {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 1.75rem;
    align-items: center;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-item {
    width: auto;
  }

  .dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    display: none;
    margin: 0;
    padding: 0.75rem;
    background: rgba(17, 24, 39, 0.97);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
  }

  .nav-item:hover .dropdown,
  .nav-item:focus-within .dropdown {
    display: block;
  }

  .menu-btn {
    display: none;
  }
}

@media (max-width: 900px) {
  .checker-layout {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 0;
  }

  .empty-result {
    min-height: 320px;
  }
}

@media (max-width: 680px) {
  main {
    padding: 2.5rem 1rem 3.5rem;
  }

  .input-panel,
  .result-panel {
    padding: 1.25rem;
  }

  .checker-hero h1 {
    font-size: 2rem;
  }

  .privacy-notice {
    grid-template-columns: 1fr;
  }

  .size-heading {
    align-items: start;
  }

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

  .times-mark {
    display: none;
  }

  .ratio-actions,
  .metric-grid,
  .focus-controls,
  .detail-grid,
  .information-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  .contact-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .contact-cta a {
    justify-content: center;
  }
}

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