:root {
  color-scheme: dark;
  --bg: #080b10;
  --surface: #0f141c;
  --surface-2: #151b25;
  --surface-3: #1b2330;
  --line: #293241;
  --line-soft: #1d2632;
  --text: #f5f7fb;
  --muted: #98a4b5;
  --muted-2: #6d7889;
  --cyan: #69e6ff;
  --yellow: #ffd166;
  --radius: 20px;
  --shadow: 0 28px 70px rgba(0,0,0,.28);
  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; min-width: 320px; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
button, input, select { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button:focus-visible, label:focus-visible, [tabindex]:focus-visible, select:focus-visible { outline: 3px solid rgba(105,230,255,.45); outline-offset: 3px; }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background:
    radial-gradient(circle at 16% 4%, rgba(105,230,255,.09), transparent 27rem),
    radial-gradient(circle at 86% 27%, rgba(255,209,102,.06), transparent 25rem),
    linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
}

.site-header { width: min(1440px, calc(100% - 48px)); margin: 0 auto; min-height: 78px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.wordmark { display: inline-flex; gap: 12px; align-items: center; color: var(--text); text-decoration: none; font-weight: 750; letter-spacing: -.02em; }
.mark { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--cyan); border-radius: 50%; position: relative; box-shadow: inset 0 0 0 5px var(--bg); background: var(--yellow); }
.mark::before, .mark::after { content: ""; position: absolute; background: var(--text); border-radius: 2px; }
.mark::before { width: 2px; height: 42px; }
.mark::after { height: 2px; width: 42px; }
.mark span { position: relative; z-index: 1; width: 9px; height: 9px; border-radius: 50%; background: var(--yellow); }
.privacy-chip { display: inline-flex; align-items: center; gap: 9px; color: #c8d1de; font-size: .875rem; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; background: rgba(15,20,28,.75); }
.privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: #6ee7a2; box-shadow: 0 0 0 4px rgba(110,231,162,.1); }

main { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }
.intro { display: grid; grid-template-columns: 1.25fr .75fr; gap: 64px; align-items: end; padding: 74px 0 42px; }
.eyebrow { margin: 0 0 14px; color: var(--cyan); font-size: .78rem; text-transform: uppercase; letter-spacing: .18em; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; max-width: 920px; font-size: clamp(2.65rem, 6.1vw, 6.8rem); line-height: .91; letter-spacing: -.065em; font-weight: 820; }
h1 span { color: var(--muted-2); }
.intro-copy { max-width: 520px; margin: 0 0 8px auto; color: #b7c0cd; font-size: clamp(1rem, 1.4vw, 1.22rem); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, .65fr); min-height: 650px; border: 1px solid var(--line); border-radius: 26px; background: rgba(15,20,28,.9); box-shadow: var(--shadow); overflow: hidden; }
.image-panel { display: flex; min-width: 0; flex-direction: column; border-right: 1px solid var(--line); }
.result-panel { min-width: 0; padding: 26px; background: rgba(10,13,18,.58); }
.panel-head, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; }
.panel-head > div:first-child, .section-heading > div:first-child { display: flex; align-items: center; gap: 13px; }
.panel-head h2, .section-heading h2 { margin: 0; font-size: 1rem; letter-spacing: -.01em; }
.panel-head.compact { padding: 0 0 23px; }
.step { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 26px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.source-actions, .palette-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.button { min-height: 42px; border-radius: 10px; border: 1px solid var(--line); padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; color: var(--text); font-weight: 720; font-size: .88rem; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); border-color: #46546a; }
.button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { background: var(--text); color: #090d12; border-color: var(--text); }
.button-primary:hover { background: var(--cyan); border-color: var(--cyan); }
.button-quiet { background: var(--surface-2); }
.button:disabled, .text-button:disabled { opacity: .38; cursor: not-allowed; }
.text-button { border: 0; padding: 7px 3px; background: transparent; color: var(--muted); font-size: .84rem; cursor: pointer; }
.text-button:hover:not(:disabled) { color: var(--cyan); }

.drop-zone { flex: 1; min-height: 480px; margin: 0 26px 20px; border: 1px dashed #3a4659; border-radius: 18px; overflow: hidden; position: relative; display: grid; place-items: center; background: #090d13; transition: border-color .2s, background .2s; }
.drop-zone.dragging { border-color: var(--cyan); background: rgba(105,230,255,.05); }
.empty-state { text-align: center; display: grid; justify-items: center; gap: 8px; color: var(--muted); padding: 32px; }
.empty-state strong { color: var(--text); font-size: 1.18rem; }
.empty-state span { font-size: .9rem; }
.empty-state small { margin-top: 14px; color: var(--muted-2); }
.drop-icon { width: 78px; height: 78px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.drop-icon svg { width: 44px; fill: none; stroke: var(--cyan); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
kbd { min-width: 25px; display: inline-flex; justify-content: center; border: 1px solid #3d495c; background: var(--surface-3); border-radius: 5px; padding: 1px 5px; color: #dbe2eb; font-size: .72rem; box-shadow: 0 2px 0 #05080c; }
.canvas-wrap { position: relative; width: 100%; height: 100%; min-height: 480px; overflow: hidden; display: grid; place-items: center; background: repeating-conic-gradient(#121822 0 25%, #0d1219 0 50%) 50% / 22px 22px; }
#image-canvas { display: block; max-width: 100%; max-height: 610px; cursor: crosshair; touch-action: none; box-shadow: 0 12px 42px rgba(0,0,0,.25); }
.crosshair { position: absolute; width: 18px; height: 18px; border: 2px solid white; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); box-shadow: 0 0 0 1px #000, 0 2px 8px rgba(0,0,0,.6); display: none; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: white; box-shadow: 0 0 0 1px #000; }
.crosshair::before { width: 26px; height: 1px; top: 7px; left: -6px; }
.crosshair::after { height: 26px; width: 1px; left: 7px; top: -6px; }
.loupe { --loupe-color: #69e6ff; position: absolute; width: 146px; height: 170px; display: none; transform: translate(-50%, calc(-100% - 22px)); pointer-events: none; border: 4px solid white; background: #080b10; border-radius: 20px; box-shadow: 0 18px 45px rgba(0,0,0,.55); overflow: hidden; }
.loupe canvas { width: 138px; height: 132px; image-rendering: pixelated; display: block; }
.loupe span { height: 34px; display: block; background: var(--loupe-color); border-top: 3px solid white; }
.image-toolbar { min-height: 68px; border-top: 1px solid var(--line-soft); display: flex; align-items: center; gap: 24px; padding: 12px 26px; }
.file-meta { min-width: 0; display: flex; flex-direction: column; margin-right: auto; }
.file-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; font-weight: 700; font-size: .86rem; }
.file-meta small { color: var(--muted-2); }
.radius-control { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .82rem; }
select { color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 28px 7px 9px; }

.color-hero { display: grid; grid-template-columns: 88px minmax(0,1fr) 40px; gap: 17px; align-items: center; border: 1px solid var(--line); background: var(--surface-2); padding: 14px; border-radius: 16px; }
.color-swatch { width: 88px; aspect-ratio: 1; border-radius: 12px; background: var(--picked); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.color-hero span { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-hero strong { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: clamp(1.3rem, 2.4vw, 2.1rem); letter-spacing: -.04em; }
.copy-hero { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-3); color: var(--text); cursor: pointer; }
.copy-hero:hover { color: var(--cyan); }
.copy-hero svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.value-grid { margin-top: 18px; border: 1px solid var(--line-soft); border-radius: 14px; overflow: hidden; }
.value-row { width: 100%; display: grid; grid-template-columns: 58px minmax(0,1fr) auto; gap: 10px; align-items: center; min-height: 49px; padding: 0 13px; color: var(--text); background: transparent; border: 0; border-bottom: 1px solid var(--line-soft); text-align: left; cursor: pointer; }
.value-row:last-child { border-bottom: 0; }
.value-row:hover { background: var(--surface-2); }
.value-row span { color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.value-row strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.value-row em { color: var(--cyan); font-size: .72rem; font-style: normal; opacity: 0; }
.value-row:hover em, .value-row:focus-visible em { opacity: 1; }
.contrast-card { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 15px 0; }
.contrast-card span { color: var(--muted); font-size: .75rem; }
.contrast-card strong { display: block; font-size: .88rem; }
.contrast-preview { display: grid; place-items: center; width: 64px; height: 45px; border-radius: 9px; background: var(--picked); color: var(--ink); font-weight: 850; font-size: 1.1rem; }
.pick-help { margin: 16px 2px 0; color: var(--muted); font-size: .82rem; }

.palette-section { margin: 26px 0; border: 1px solid var(--line); border-radius: 22px; background: rgba(15,20,28,.9); overflow: hidden; }
.palette-section .section-heading { border-bottom: 1px solid var(--line-soft); }
.palette-empty { min-height: 150px; display: grid; place-items: center; padding: 30px; color: var(--muted-2); text-align: center; }
.palette-grid { display: grid; grid-template-columns: repeat(6, 1fr); min-height: 190px; }
.palette-color { position: relative; min-height: 190px; border: 0; padding: 0; background: var(--color); color: var(--ink); cursor: pointer; overflow: hidden; }
.palette-color:hover .palette-label, .palette-color:focus-visible .palette-label { transform: translateY(0); }
.palette-label { position: absolute; inset: auto 10px 10px; display: flex; justify-content: space-between; gap: 8px; padding: 8px 9px; border-radius: 8px; background: color-mix(in srgb, var(--color), transparent 12%); color: var(--ink); font: 750 .77rem ui-monospace, SFMono-Regular, Menlo, monospace; backdrop-filter: blur(8px); transition: transform .18s ease; }
.palette-label span:last-child { opacity: .68; }

.trust-row { display: grid; grid-template-columns: repeat(3,1fr); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 82px 0; }
.trust-row article { padding: 30px; border-right: 1px solid var(--line); }
.trust-row article:last-child { border-right: 0; }
.trust-row article > span { color: var(--cyan); font: 700 .73rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.trust-row strong { display: block; margin: 12px 0 8px; font-size: 1.05rem; }
.trust-row p { margin-bottom: 0; color: var(--muted); font-size: .91rem; }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: 90px; margin: 0 0 110px; align-items: start; }
.guide h2 { max-width: 560px; font-size: clamp(2.1rem, 4vw, 4.7rem); line-height: .98; letter-spacing: -.055em; }
.guide ol { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.guide li { display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.guide li > span { color: var(--cyan); font: 700 .76rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.guide li strong { display: block; margin-bottom: 5px; }
.guide li p { margin: 0; color: var(--muted); }

footer { width: min(1440px, calc(100% - 48px)); margin: 0 auto; min-height: 90px; display: flex; justify-content: space-between; gap: 20px; align-items: center; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .84rem; }
footer > span { color: var(--text); font-weight: 750; }
footer p { margin: 0; }
footer nav { display: flex; gap: 18px; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover, footer a:focus-visible { color: var(--accent); }

.legal-content { width: min(780px, calc(100% - 40px)); margin: 72px auto 110px; }
.legal-content h1 { max-width: 760px; font-size: clamp(2.4rem, 7vw, 5rem); }
.legal-content h2 { margin: 42px 0 10px; font-size: 1.35rem; }
.legal-content p { color: var(--muted); font-size: 1.02rem; line-height: 1.75; }
.legal-content strong { color: var(--text); }
.legal-page .site-header .text-button { text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 10px 15px; border-radius: 10px; color: #081019; background: var(--cyan); font-weight: 800; font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; box-shadow: 0 10px 35px rgba(0,0,0,.32); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 54px; }
  .intro-copy { margin-left: 0; }
  .workspace { grid-template-columns: 1fr; }
  .image-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .result-panel { display: grid; grid-template-columns: minmax(260px,.85fr) minmax(310px,1fr); gap: 18px 28px; align-content: start; }
  .result-panel .panel-head { grid-column: 1/-1; }
  .value-grid { margin-top: 0; }
  .contrast-card, .pick-help { grid-column: 1/-1; }
  .guide { gap: 48px; }
}

@media (max-width: 720px) {
  .site-header, main, footer { width: min(100% - 28px, 1440px); }
  .site-header { min-height: 68px; }
  .privacy-chip { font-size: 0; width: 38px; height: 38px; justify-content: center; padding: 0; }
  .intro { padding: 42px 0 30px; }
  h1 { font-size: clamp(2.65rem, 14vw, 4.6rem); }
  .workspace { border-radius: 18px; }
  .panel-head, .section-heading { align-items: flex-start; padding: 18px; }
  .source-actions { flex-direction: column; align-items: stretch; }
  .button { min-height: 44px; }
  .drop-zone { margin: 0 14px 14px; min-height: 380px; }
  .canvas-wrap { min-height: 380px; }
  #image-canvas { max-height: 520px; }
  .image-toolbar { align-items: flex-start; flex-wrap: wrap; padding: 13px 18px; gap: 10px 18px; }
  .file-meta { width: calc(100% - 80px); }
  .radius-control { order: 3; width: 100%; justify-content: space-between; }
  .result-panel { display: block; padding: 18px; }
  .value-grid { margin-top: 16px; }
  .color-hero { grid-template-columns: 70px minmax(0,1fr) 40px; }
  .color-swatch { width: 70px; }
  .palette-section { border-radius: 16px; }
  .palette-section .section-heading { flex-direction: column; }
  .palette-actions { justify-content: flex-start; }
  .palette-grid { grid-template-columns: repeat(2,1fr); }
  .palette-color { min-height: 135px; }
  .trust-row { grid-template-columns: 1fr; margin: 60px 0; }
  .trust-row article { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 4px; }
  .trust-row article:last-child { border-bottom: 0; }
  .guide { grid-template-columns: 1fr; gap: 22px; margin-bottom: 70px; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; padding: 24px 0; }
  footer nav { flex-wrap: wrap; }
}

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