@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; }
[hidden] { display: none !important; }
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-top, .workspace-heading p, .inspector-head > p, .explanation-label, .guide article > span, .page-footer, .heading-pill, .readout span, .source-links { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 700; letter-spacing: .09em; }
.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(40px, 5.4vw, 82px); 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(305px, 330px); }

.controls { min-width: 0; border-right: 1px solid #cad1c9; container: controls / inline-size; }
.control-section { padding: 23px 20px; 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 16px; font-size: 16px; line-height: 1.3; }
.segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid #c9d3ca; border-radius: 11px; background: #e9eee8; }
.segmented button { min-height: 37px; padding: 7px 5px; border: 0; border-radius: 8px; background: transparent; font-size: 11px; font-weight: 800; }
.segmented button[aria-pressed='true'] { color: #fff; background: #202520; box-shadow: 0 2px 4px rgb(0 0 0 / 14%); }
.segmented button:hover:not([aria-pressed='true']) { color: #3949bc; }
.text-label { display: block; margin-top: 15px; font-size: 11px; font-weight: 800; }
.text-label input { display: block; width: 100%; min-height: 39px; margin-top: 7px; padding: 8px 10px; border: 1px solid #bfcbbf; border-radius: 8px; background: #fff; font-size: 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.mode-grid button { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 44px; padding: 6px 8px; border: 1px solid #c7d1c7; border-radius: 10px; background: #fff; text-align: left; font: 800 11px 'DM Mono', monospace; }
.mode-grid button[aria-pressed='true'] { border-color: #202520; background: #b5ff32; }
.mode-grid button:hover { border-color: #646cf4; }
.mode-grid i { position: relative; display: block; flex: none; width: 26px; height: 23px; border-radius: 6px; background: #6f75e9; overflow: hidden; isolation: isolate; }
.mode-grid i::after { position: absolute; top: 6px; left: 9px; width: 18px; height: 18px; border-radius: 50%; background: var(--blend-color, #ffb100); mix-blend-mode: var(--swatch-mode); content: ''; }
.mode-grid button[data-mode='normal'] { --swatch-mode: normal; }
.mode-grid button[data-mode='multiply'] { --swatch-mode: multiply; }
.mode-grid button[data-mode='screen'] { --swatch-mode: screen; }
.mode-grid button[data-mode='overlay'] { --swatch-mode: overlay; }
.mode-grid button[data-mode='difference'] { --swatch-mode: difference; }
.mode-grid button[data-mode='exclusion'] { --swatch-mode: exclusion; }
.control-note, .privacy-note { margin: 12px 0 0; color: #5e6b61; font-size: 10px; font-weight: 600; line-height: 1.7; }
.control-note code { color: #4e58d1; font-family: 'DM Mono', monospace; }
.privacy-note { padding: 9px 10px; border-radius: 8px; background: #eef5ef; }
.color-label, .range-label { display: block; margin-top: 17px; }
.color-label { margin-top: 0; }
.color-label > span, .range-label > span { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 800; }
.color-label output, .range-label output { color: #626af3; font-family: 'DM Mono', monospace; }
.color-label input { width: 100%; height: 38px; margin-top: 8px; padding: 3px; border: 1px solid #bcc9bf; border-radius: 8px; background: #fff; cursor: pointer; }
.range-label input { width: 100%; margin: 11px 0 0; accent-color: #626af3; }
.image-actions { display: grid; gap: 8px; }
.image-actions button, .upload-button { display: grid; place-items: center; min-height: 40px; padding: 8px 10px; border: 1px solid #cbd5ca; border-radius: 9px; color: #202520; background: #fff; font-size: 11px; 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; }

.workspace { min-width: 0; background: #edf4f0; }
.workspace-top { display: flex; align-items: center; gap: 9px; min-height: 54px; padding: 12px 20px; border-bottom: 1px solid #bfcdc2; color: #52645b; background: #d6dfd7; letter-spacing: 0; }
.window-dots { display: flex; gap: 5px; }
.window-dots i { width: 8px; height: 8px; border-radius: 50%; background: #ff6956; }
.window-dots i:nth-child(2) { background: #ffd36b; }
.window-dots i:nth-child(3) { background: #53c4a5; }
.workspace-top strong { margin-left: auto; padding: 7px 9px; border-radius: 99px; color: #fff; background: #007e6b; font: 800 10px 'DM Mono', monospace; }
.workspace-body { padding: 21px 18px 24px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.workspace-heading p { margin: 0 0 5px; color: #007d69; }
.workspace-heading h3 { margin: 0; font-size: 18px; }
.workspace-heading > span { flex: none; padding: 8px 10px; border-radius: 99px; color: #202520; background: #d4e9d9; font: 800 10px 'DM Mono', monospace; }
.blend-scene { min-height: 390px; border: 2px solid #202520; border-radius: 16px; box-shadow: 8px 9px 0 rgb(24 34 25 / 15%); }
.blend-scope { max-width: 720px; }
.blend-photo { border: 2px solid #202520; border-radius: 8px; box-shadow: 4px 5px 0 rgb(13 20 16 / 15%); }
.blend-layer { cursor: grab; touch-action: none; user-select: none; }
.blend-layer:active { cursor: grabbing; }
.blend-layer--text { margin: 0; font-family: 'DM Sans', sans-serif; }
.scene-caption { margin: 17px 3px 0; color: #4e6558; font-size: 11px; font-weight: 600; line-height: 1.6; }
.scene-caption strong { color: #202520; }
.readout { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 22px; }
.readout > div { min-width: 0; padding: 12px; border: 1px solid #cedccf; border-radius: 11px; background: #fffdfa; }
.readout span { display: block; margin-bottom: 7px; color: #6d7a71; font-size: 10px; }
.readout strong { display: block; overflow: hidden; color: #1e5e53; font: 800 14px 'DM Mono', monospace; text-overflow: ellipsis; }
.workspace-note { margin: 19px 3px 0; color: #5e6e62; font-size: 11px; line-height: 1.6; }
.mode-gallery { margin-top: 30px; padding-top: 20px; border-top: 1px solid #c9d8ca; }
.mode-gallery-head p { margin: 0 0 5px; color: #007d69; font: 700 11px 'DM Mono', monospace; letter-spacing: .09em; }
.mode-gallery-head h4 { margin: 0 0 15px; font-size: 16px; }
.mode-gallery-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.mode-gallery-grid button { min-width: 0; padding: 7px; border: 1px solid #c7d6ca; border-radius: 11px; background: #fffdfa; text-align: left; }
.mode-gallery-grid button[aria-pressed='true'] { border: 2px solid #202520; padding: 6px; background: #b5ff32; }
.mode-gallery-grid button:hover { border-color: #646cf4; }
.gallery-scene { position: relative; display: block; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 6px; background: #e9ece8; isolation: isolate; }
.gallery-scene img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-scene i { position: absolute; top: 31%; left: 42%; width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--blend-color, #ffb100); mix-blend-mode: var(--gallery-mode); opacity: var(--gallery-opacity, 1); }
.mode-gallery-grid button[data-gallery-mode='normal'] { --gallery-mode: normal; }
.mode-gallery-grid button[data-gallery-mode='multiply'] { --gallery-mode: multiply; }
.mode-gallery-grid button[data-gallery-mode='screen'] { --gallery-mode: screen; }
.mode-gallery-grid button[data-gallery-mode='overlay'] { --gallery-mode: overlay; }
.mode-gallery-grid button[data-gallery-mode='difference'] { --gallery-mode: difference; }
.mode-gallery-grid button[data-gallery-mode='exclusion'] { --gallery-mode: exclusion; }
.mode-gallery-grid b { display: block; padding: 8px 3px 1px; font: 800 11px '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-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 18px 14px 10px; }
.code-tabs { display: flex; gap: 4px; padding: 3px; border: 1px solid #596559; border-radius: 9px; }
.code-tabs button { min-height: 30px; padding: 6px 8px; border: 0; border-radius: 6px; color: #cad6c8; background: transparent; font: 800 10px 'DM Mono', monospace; }
.code-tabs button[aria-pressed='true'] { color: #202520; background: #b5ff32; }
#copyCodeButton { flex: none; padding: 9px 9px; border: 0; border-radius: 8px; color: #202520; background: #fff; font-size: 10px; font-weight: 900; }
#copyCodeButton:hover { background: #b5ff32; }
.code-block { overflow: auto; max-height: 750px; 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 article p { margin: 0; color: #5e6b61; font-size: 11px; line-height: 1.65; }
.source-links { margin: 0 20px 22px; color: #66756a; font-size: 10px; line-height: 1.6; letter-spacing: 0; }
.source-links a { color: #4e56cf; }
.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); }

@container controls (min-width: 440px) {
  .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .image-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1380px) {
  .lab-grid { grid-template-columns: minmax(250px, 275px) minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; border-top: 1px solid #202520; border-left: 0; }
  .code-block { max-height: 420px; }
}
@media (max-width: 1100px) {
  .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(2, minmax(0, 1fr)); border-right: 0; }
  .control-section { border-right: 1px solid #d9ddd6; }
  .control-section:nth-child(2n), .control-section:last-child { border-right: 0; }
  .workspace { border-top: 1px solid #cad1c9; }
  .inspector { grid-column: auto; }
}
@media (max-width: 680px) {
  .controls { display: block; }
  .control-section { border-right: 0; }
  .guide-grid { grid-template-columns: 1fr; }
  .mode-gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .page { padding: 18px 12px 20px; }
  .hero { padding: 15px 4px 25px; }
  .hero h1 { font-size: clamp(39px, 10vw, 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-top { padding-inline: 13px; }
  .workspace-body { padding: 18px 13px 21px; }
  .workspace-heading h3 { font-size: 16px; }
  .workspace-heading > span { font-size: 10px; }
  .blend-scene { min-height: 250px; }
  .readout > div { padding: 8px; }
  .readout span { font-size: 10px; }
  .readout strong { font-size: 11px; }
  .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; }
}
