:root {
  color-scheme: light;
  --ink: #1e2430;
  --muted: #717988;
  --line: #e3e6ec;
  --surface: #ffffff;
  --canvas: #f6f7fb;
  --accent: #5b62d8;
  --accent-deep: #4249b6;
  --accent-soft: #eef0ff;
  --success: #2e966c;
  --success-soft: #e9f7f0;
  --warning: #ad6d1e;
  --shadow: 0 22px 70px rgba(39, 45, 75, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(116, 125, 239, 0.12), transparent 30rem),
    linear-gradient(180deg, #fbfbfd 0%, #f5f6fa 100%);
  min-width: 320px;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.shell { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.site-header { padding: 21px 0; border-bottom: 1px solid rgba(225, 228, 236, 0.78); background: rgba(251, 251, 253, 0.88); backdrop-filter: blur(18px); }
.header-inner, .footer-inner, .header-actions, .brand, .privacy-chip, .file-summary { display: flex; align-items: center; }
.header-inner, .footer-inner { justify-content: space-between; gap: 20px; }
.brand { gap: 10px; text-decoration: none; font-size: 14px; font-weight: 750; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: white; background: linear-gradient(145deg, #747bed, #4c53c6); box-shadow: 0 6px 15px rgba(80, 87, 200, 0.22); font-size: 17px; }
.header-actions { gap: 18px; }
.privacy-chip { gap: 7px; padding: 7px 11px; border: 1px solid #d9eee3; border-radius: 999px; background: #f4fbf7; color: #36815f; font-size: 12px; font-weight: 700; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #43ac78; box-shadow: 0 0 0 4px rgba(67, 172, 120, 0.14); }
.header-link, .text-button { color: var(--muted); font-size: 13px; text-decoration: none; }
.header-link:hover, .text-button:hover { color: var(--accent-deep); }

.hero { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding: 74px 0 40px; }
.hero-copy { max-width: 720px; }
.eyebrow, .panel-kicker { margin: 0; color: #7179d8; font-size: 10px; font-weight: 800; letter-spacing: 0.15em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 15px; font-size: clamp(35px, 5vw, 58px); line-height: 0.98; letter-spacing: -0.065em; }
.hero-lede { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: clamp(16px, 2vw, 19px); line-height: 1.65; }
.hero-note { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid #e4e5fa; border-radius: 14px; background: rgba(255, 255, 255, 0.68); color: #626a7c; font-size: 12px; white-space: nowrap; }
.hero-note-icon { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 16px; }

.tool-shell { padding-bottom: 75px; }
.upload-card, .editor-card { border: 1px solid rgba(222, 225, 234, 0.95); border-radius: 24px; background: rgba(255, 255, 255, 0.92); box-shadow: var(--shadow); }
.upload-card { padding: 10px; }
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 365px; padding: 40px 20px; border: 1px dashed #bbc0d8; border-radius: 18px; background: linear-gradient(145deg, #fcfcff, #f5f6ff); cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.drop-zone:hover, .drop-zone.is-dragging, .drop-zone:focus-visible { border-color: var(--accent); background: #f0f1ff; outline: none; transform: translateY(-1px); }
.upload-icon { display: grid; place-items: center; width: 67px; height: 67px; margin-bottom: 21px; border-radius: 21px; background: var(--accent); color: white; box-shadow: 0 15px 30px rgba(91, 98, 216, .24); }
.upload-icon svg { width: 33px; height: 33px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.drop-zone strong { margin-bottom: 8px; font-size: 20px; letter-spacing: -0.03em; }
.drop-zone span { color: #626a7c; font-size: 14px; }
.drop-zone small { margin-top: 25px; color: #9096a5; font-size: 12px; }
.upload-footer { display: flex; justify-content: space-between; gap: 15px; padding: 15px 12px 5px; color: #858c9a; font-size: 12px; }
.mini-icon { color: var(--success); font-size: 13px; }

.editor-card { overflow: hidden; }
.editor-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 23px; border-bottom: 1px solid var(--line); }
.file-summary { gap: 11px; min-width: 0; }
.file-icon { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 11px; color: #5f67d1; background: var(--accent-soft); font-size: 9px; font-weight: 850; letter-spacing: .04em; }
.file-summary strong, .file-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-summary strong { max-width: 460px; font-size: 14px; }
.file-summary span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.text-button, .reset-button { border: 0; background: transparent; cursor: pointer; }
.text-button { padding: 8px 2px; font-weight: 700; }
.status-message { margin: 16px 23px 0; padding: 11px 14px; border: 1px solid #e4e6ef; border-radius: 12px; color: #656d7e; background: #fafaff; font-size: 12px; line-height: 1.5; }
.status-message.is-success { border-color: #cceadb; color: #2f815f; background: #f0faf5; }
.status-message.is-warning { border-color: #f0dbbd; color: #98601b; background: #fff9f0; }
.status-message.is-error { border-color: #f0c8c8; color: #a64c4c; background: #fff6f6; }

.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 22px 23px; }
.preview-panel { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: #fcfcfd; }
.result-preview-panel { border-color: #cfe9dd; background: #fbfefc; }
.panel-heading, .section-title-row, .range-control > span { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.panel-heading { margin-bottom: 12px; }
.panel-heading h3, .section-title-row h3 { margin: 4px 0 0; font-size: 15px; letter-spacing: -0.03em; }
.panel-badge, .detection-badge { padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.panel-badge.neutral { color: #7a8190; background: #f0f1f4; }
.panel-badge.success, .detection-badge.is-found { color: #318362; background: var(--success-soft); }
.detection-badge { color: #7b8190; background: #f1f2f5; }
.canvas-wrap { position: relative; display: grid; place-items: center; min-height: 265px; overflow: hidden; border-radius: 11px; background-color: #f3f4f7; }
.checkerboard { background-image: linear-gradient(45deg, rgba(215, 218, 225, .42) 25%, transparent 25%), linear-gradient(-45deg, rgba(215, 218, 225, .42) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(215, 218, 225, .42) 75%), linear-gradient(-45deg, transparent 75%, rgba(215, 218, 225, .42) 75%); background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0; }
canvas { display: block; max-width: 100%; max-height: 480px; height: auto; object-fit: contain; }
.guide-box { position: absolute; border: 1.5px solid #6d74e6; border-radius: 5px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(94, 101, 213, .035); }

.editor-bottom { display: grid; grid-template-columns: minmax(0, 1fr) 245px; gap: 20px; padding: 22px 23px 24px; border-top: 1px solid var(--line); background: #fafbfc; }
.tuning-panel { min-width: 0; }
.preset-row { display: flex; gap: 8px; margin: 18px 0 20px; }
.preset-button { padding: 8px 12px; border: 1px solid #dfe2e9; border-radius: 9px; color: #6f7685; background: white; cursor: pointer; font-size: 11px; font-weight: 700; }
.preset-button:hover, .preset-button.is-active { border-color: #aab0ee; color: var(--accent-deep); background: var(--accent-soft); }
.range-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 22px; }
.range-control { display: grid; gap: 9px; color: #656d7e; font-size: 11px; }
.range-control output { color: #303746; font-size: 11px; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; height: 4px; accent-color: var(--accent); cursor: pointer; }
.tuning-hint { margin: 18px 0 0; color: #9298a5; font-size: 11px; }
.tuning-hint span { color: var(--accent); font-size: 15px; vertical-align: -1px; }
.export-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 17px; border: 1px solid #dfe3f2; border-radius: 14px; background: #f4f5ff; }
.export-summary { display: grid; gap: 7px; }
.export-summary strong { font-size: 14px; letter-spacing: -0.03em; }
.export-summary span:last-child { color: #767d8d; font-size: 11px; }
.download-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 13px 14px; border: 0; border-radius: 10px; color: white; background: var(--accent); box-shadow: 0 9px 18px rgba(91, 98, 216, .22); cursor: pointer; font-size: 12px; font-weight: 800; transition: transform .2s ease, background .2s ease; }
.download-button:hover { background: var(--accent-deep); transform: translateY(-1px); }
.button-arrow { font-size: 18px; line-height: .8; }
.reset-button { color: #777e8e; font-size: 11px; }
.reset-button:hover { color: var(--accent-deep); }

.explain-section { padding: 14px 0 70px; }
.section-heading { margin-bottom: 22px; }
.section-heading h2 { margin: 7px 0 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.055em; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step-card { min-height: 160px; padding: 21px; border: 1px solid #e2e5ec; border-radius: 16px; background: rgba(255,255,255,.6); }
.step-card > span { color: #7b83df; font-size: 11px; font-weight: 850; letter-spacing: .1em; }
.step-card h3 { margin: 22px 0 8px; font-size: 15px; }
.step-card p { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.notice-section { padding-bottom: 75px; }
.notice-card { display: flex; align-items: flex-start; gap: 13px; padding: 17px 19px; border: 1px solid #e6e1d7; border-radius: 15px; background: #fffdf8; }
.notice-icon { display: grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border: 1px solid #e7c997; border-radius: 50%; color: var(--warning); font-size: 12px; font-weight: 800; }
.notice-card strong { display: block; margin: 1px 0 6px; color: #68563c; font-size: 12px; }
.notice-card p { margin-bottom: 0; color: #87795f; font-size: 11px; line-height: 1.6; }
.site-footer { border-top: 1px solid #e3e5ea; background: rgba(255,255,255,.44); }
.footer-inner { min-height: 73px; color: #8b919d; font-size: 11px; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--accent-deep); }
.noscript-message { padding: 15px; color: #8d4f39; background: #fff0e8; text-align: center; }

@media (max-width: 860px) {
  .hero { align-items: start; flex-direction: column; padding-top: 55px; }
  .hero-note { white-space: normal; }
  .editor-bottom { grid-template-columns: 1fr; }
  .export-panel { gap: 17px; }
}
@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1160px); }
  .site-header { padding: 15px 0; }
  .header-actions { gap: 10px; }
  .header-link { display: none; }
  .privacy-chip { padding: 6px 9px; }
  h1 { font-size: 41px; }
  .hero { padding: 48px 0 28px; }
  .upload-card, .editor-card { border-radius: 18px; }
  .drop-zone { min-height: 310px; }
  .upload-footer { flex-direction: column; gap: 7px; }
  .editor-topbar, .preview-grid, .editor-bottom { padding-left: 15px; padding-right: 15px; }
  .preview-grid { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: 210px; }
  .range-grid, .steps-grid { grid-template-columns: 1fr; }
  .steps-grid { gap: 10px; }
  .step-card { min-height: 0; }
  .step-card h3 { margin-top: 14px; }
  .notice-card { padding: 14px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 6px; }
}
