@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500;700&family=DM+Sans:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

:root { font-family: 'DM Sans', 'Noto Sans JP', sans-serif; color: #202520; background: #f7f4ed; font-synthesis: none; }
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, .upload-button:focus-within { outline: 3px solid #646cf4; outline-offset: 3px; }
.page { max-width: 1880px; margin: auto; padding: 36px clamp(18px, 3vw, 48px) 28px; }
.hero { padding: 16px 10px 34px; }
.eyebrow, .section-heading p, .section-kicker, .workspace-head p, .results-head p, .inspector-head > p, .explanation-label, .code-title > span, .guide article > span, .page-footer, .crop-card-head, .heading-pill { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 13px; color: #007f69; }
.brand-mark { display: inline-block; width: 20px; height: 20px; margin-right: 4px; border: 2px solid #007d68; border-radius: 5px; box-shadow: 5px 5px 0 #b5ff32; }
.hero h1 { margin: 0; font-size: clamp(38px, 5.15vw, 78px); font-weight: 800; line-height: 1.04; letter-spacing: 0; }
.hero-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 23px; }
.lead { margin: 0; font-size: clamp(16px, 1.45vw, 21px); font-weight: 700; line-height: 1.65; white-space: nowrap; }
.lead strong { color: #646cf4; }
.hero-actions { display: flex; gap: 10px; flex: none; }
.hero-actions button { min-height: 45px; padding: 12px 17px; border: 1px solid #d4d8cf; border-radius: 13px; background: #fff; font-size: 12px; font-weight: 800; transition: transform .18s, box-shadow .18s; }
.hero-actions button:last-child { color: #fff; background: #202520; border-color: #202520; }
.hero-actions button:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #dbe2d9; }

.lab, .guide { overflow: hidden; border: 1px solid #cad1c9; border-radius: 27px; background: #fffdf8; box-shadow: 0 13px 40px rgb(31 42 34 / 4%); }
.section-heading { display: flex; align-items: center; gap: 18px; min-height: 98px; padding: 19px 26px; border-bottom: 1px solid #cad1c9; }
.section-number { display: grid; place-items: center; flex: none; width: 51px; height: 51px; border-radius: 14px; color: #fff; background: #ff6956; font: 800 13px 'DM Mono', monospace; }
.section-number.blue { background: #646cf4; }
.section-heading p { margin: 0 0 5px; color: #00806b; }
.section-heading h2 { margin: 0; font-size: clamp(20px, 2vw, 28px); line-height: 1.25; }
.heading-pill { margin-left: auto; padding: 8px 11px; border-radius: 99px; color: #007b67; background: #e9f5ee; white-space: nowrap; }
.lab-grid { display: grid; grid-template-columns: minmax(255px, 280px) minmax(0, 1fr) minmax(300px, 330px); align-items: stretch; }

.controls { border-right: 1px solid #cad1c9; }
.control-section { padding: 24px 21px; border-bottom: 1px solid #d9ddd6; }
.control-section:last-child { border-bottom: 0; }
.section-kicker { margin: 0 0 8px; color: #007d69; }
.control-section h3 { margin: 0 0 17px; font-size: 16px; line-height: 1.3; }
.image-actions { display: grid; gap: 8px; }
.image-actions button, .upload-button { display: grid; place-items: center; min-height: 42px; padding: 8px 12px; border: 1px solid #cbd5ca; border-radius: 10px; color: #202520; background: #fff; font-size: 12px; font-weight: 800; text-align: center; transition: transform .16s, box-shadow .16s; }
.image-actions button:hover, .upload-button:hover { transform: translateY(-2px); box-shadow: 0 4px 0 #e1e7df; }
.upload-button { position: relative; border-color: #202520; background: #b5ff32; cursor: pointer; }
.upload-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.control-note, .privacy-note { margin: 12px 0 0; color: #5e6b61; font-size: 10px; font-weight: 600; line-height: 1.7; }
.privacy-note { padding: 9px 10px; border-radius: 8px; background: #eef5ef; }
.fit-options, .focus-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.fit-options button { display: grid; gap: 4px; min-height: 59px; padding: 9px; border: 1px solid #cbd5ca; border-radius: 10px; background: #fff; text-align: left; }
.fit-options b { font: 800 13px 'DM Mono', monospace; }
.fit-options small { color: #66746a; font-size: 10px; font-weight: 700; }
.fit-options button[aria-pressed='true'] { border-color: #202520; color: #fff; background: #202520; }
.fit-options button[aria-pressed='true'] small { color: #d6e8db; }
.focus-presets button { min-height: 36px; padding: 7px 5px; border: 1px solid #cbd5ca; border-radius: 9px; background: #fff; font-size: 11px; font-weight: 800; }
.focus-presets button[aria-pressed='true'] { border-color: #202520; color: #202520; background: #b5ff32; }
.fit-options button:hover, .focus-presets button:hover { border-color: #646cf4; }
.range-label { display: block; margin-top: 20px; }
.range-label > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 800; }
.range-label output { color: #626af3; font-family: 'DM Mono', monospace; }
.range-label input { width: 100%; margin: 12px 0 0; accent-color: #626af3; }

.workspace { min-width: 0; padding-bottom: 24px; background: #edf4f0; }
.workspace-head, .results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.workspace-head { padding: 24px 22px 17px; }
.workspace-head p, .results-head p { margin: 0 0 5px; color: #007d69; }
.workspace-head h3, .results-head h3 { margin: 0; font-size: 18px; }
.workspace-head > span, .results-head > span { flex: none; padding: 8px 10px; border-radius: 99px; color: #fff; background: #007e6b; font: 700 10px 'DM Mono', monospace; white-space: nowrap; }
.source-figure { margin: 0 19px; }
.source-stage { position: relative; overflow: hidden; border: 2px solid #202520; border-radius: 16px; background: #d8e7df; cursor: crosshair; touch-action: none; box-shadow: 8px 9px 0 rgb(24 34 25 / 13%); }
.source-stage img { display: block; width: 100%; height: auto; pointer-events: none; user-select: none; }
.source-marker { position: absolute; top: 56%; left: 65%; display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid #202520; border-radius: 50%; background: #b5ff32; box-shadow: 0 0 0 4px #fff, 5px 6px 0 rgb(23 32 28 / 22%); transform: translate(-50%, -50%); pointer-events: none; }
.source-marker::before, .source-marker::after { position: absolute; background: #202520; content: ''; }
.source-marker::before { width: 16px; height: 2px; }
.source-marker::after { width: 2px; height: 16px; }
.source-marker i { width: 6px; height: 6px; border-radius: 50%; background: #202520; }
.source-figure figcaption { margin-top: 15px; color: #5d6b61; font-size: 10px; font-weight: 700; line-height: 1.5; }
.results-head { margin: 25px 20px 15px; }
.results-head h3 { font-size: 16px; }
.results-head > span { color: #202520; background: #dff4e5; }
.preview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 10px; margin: 0 18px; }
.crop-card { min-width: 0; padding: 10px; border: 1px solid #c8d6ca; border-radius: 13px; background: #fffefa; box-shadow: 4px 5px 0 rgb(24 34 25 / 8%); }
.crop-card-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 9px; color: #637468; font-size: 10px; letter-spacing: 0; }
.crop-card-head b { color: #202520; }
.crop-frame { position: relative; overflow: hidden; border: 2px solid #202520; border-radius: 8px; background: #dfe9e3; }
.crop-frame--wide { aspect-ratio: 16 / 9; }
.crop-frame--square { aspect-ratio: 1 / 1; }
.crop-frame--portrait { aspect-ratio: 4 / 5; }
.crop-frame--story { aspect-ratio: 9 / 16; }
.crop-frame img { position: absolute; inset: 0; width: 100%; height: 100%; }
.crop-card p { margin: 10px 0 2px; font-size: 11px; font-weight: 800; }
.crop-card code { color: #626af3; font: 700 10px 'DM Mono', monospace; }
.workspace-foot { margin: 18px 20px 0; color: #52675a; font-size: 11px; font-weight: 700; line-height: 1.6; }
.workspace-foot code { color: #626af3; font-family: 'DM Mono', monospace; }

.inspector { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid #202520; color: #f7faf5; background: #252923; }
.inspector-head { padding: 25px 20px 19px; border-bottom: 1px solid #454d43; }
.inspector-head > p { margin: 0 0 7px; color: #a9bbb0; }
.inspector-head h3 { display: inline-block; margin: 0; font-size: 21px; }
.inspector-head > span { float: right; padding: 7px 9px; border-radius: 99px; color: #202520; background: #b5ff32; font: 800 10px 'DM Mono', monospace; }
.inspector-explanation { padding: 18px 20px; border-bottom: 1px solid #454d43; }
.explanation-label { margin: 0 0 5px; color: #acbbad; }
.inspector-explanation p:not(.explanation-label) { margin: 0 0 15px; font-size: 12px; font-weight: 700; line-height: 1.65; }
.inspector-explanation p:last-child { margin-bottom: 0; }
.code-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 20px 20px 10px; }
.code-title > span { color: #adbeae; }
.code-title button { flex: none; padding: 9px 10px; border: 0; border-radius: 8px; background: #fff; font-size: 10px; font-weight: 900; }
.code-title button:hover { background: #b5ff32; }
.code-block { overflow: auto; max-height: 620px; margin: 0 13px; padding: 16px 14px; border: 1px solid #465047; border-radius: 12px; color: #dcf2ce; background: #171d17; font: 500 10px/1.65 'DM Mono', monospace; tab-size: 2; white-space: pre; }
.code-footnote { margin: 0; padding: 17px 20px 22px; color: #adbdac; font-size: 10px; line-height: 1.7; }

.guide { margin-top: 22px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 20px; }
.guide article { min-width: 0; padding: 19px; border: 1px solid #d4dcd3; border-radius: 16px; background: #fff; }
.guide article > span { color: #626af3; }
.guide h3 { margin: 14px 0 8px; font-size: 16px; }
.guide p { margin: 0; color: #5e6b61; font-size: 11px; line-height: 1.65; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 4px 0; color: #647168; }
.toast { position: fixed; z-index: 100; bottom: 22px; left: 50%; padding: 12px 18px; border-radius: 99px; color: #fff; background: #202520; box-shadow: 0 10px 28px #0003; font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .18s, transform .18s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1350px) {
  .lab-grid { grid-template-columns: minmax(240px, 270px) minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; border-top: 1px solid #202520; border-left: 0; }
  .code-block { max-height: 360px; }
}
@media (max-width: 1160px) {
  .hero-bottom { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 900px) {
  .lab-grid { grid-template-columns: 1fr; }
  .controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-right: 0; }
  .control-section { border-right: 1px solid #d9ddd6; }
  .control-section:last-child { border-right: 0; }
  .workspace { border-top: 1px solid #cad1c9; }
  .inspector { grid-column: auto; }
}
@media (max-width: 720px) {
  .controls { display: block; }
  .control-section, .control-section:last-child { border-right: 0; }
  .preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guide-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .page { padding: 18px 12px 20px; }
  .hero { padding: 15px 4px 25px; }
  .hero h1 { font-size: clamp(36px, 9.5vw, 55px); }
  .lead { font-size: 15px; white-space: normal; }
  .hero-actions { width: 100%; }
  .hero-actions button { flex: 1; padding: 11px 8px; }
  .lab, .guide { border-radius: 20px; }
  .section-heading { min-height: 84px; padding: 16px; }
  .section-heading h2 { font-size: 18px; }
  .section-number { width: 44px; height: 44px; border-radius: 12px; }
  .heading-pill { display: none; }
  .control-section { padding: 20px 18px; }
  .workspace-head { padding: 19px 16px; }
  .workspace-head h3 { font-size: 16px; }
  .source-figure { margin-inline: 12px; }
  .results-head { align-items: flex-start; margin-inline: 14px; }
  .results-head > span { display: none; }
  .preview-grid { margin-inline: 12px; }
  .crop-card { padding: 8px; }
  .crop-card-head { font-size: 10px; }
  .guide-grid { padding: 14px; }
  .page-footer { flex-direction: column; gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-actions button, .image-actions button, .upload-button, .toast { transition: none; }
}
