:root {
  --ink: #18202a;
  --muted: #626c78;
  --line: #d9dee5;
  --soft: #f4f6f8;
  --blue: #6848d8;
  --blue-dark: #4e32b7;
  --blue-soft: #eee9ff;
  --danger: #b82f2a;
  --panel: #ffffff;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: #f7f5ef;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(34, 104, 232, .28); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.shell { width: min(1480px, calc(100% - 36px)); margin-right: auto; margin-left: auto; }

.page-intro {
  display: block;
  padding-top: 34px;
  padding-bottom: 20px;
}

.breadcrumbs { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: .78rem; }
.breadcrumbs a { color: inherit; text-underline-offset: 3px; }

.eyebrow, .panel-eyebrow {
  margin: 0 0 8px;
  color: var(--blue-dark);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.page-intro h1 { margin: 0; font-size: clamp(2.4rem, 5vw, 4.15rem); line-height: .98; letter-spacing: -.055em; }
.intro-copy { max-width: 720px; margin: 14px 0 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); line-height: 1.55; }
.privacy-note { display: flex; align-items: center; gap: 12px; max-width: 920px; margin-top: 22px; padding: 13px 16px; border: 1px solid #cabff5; border-radius: 14px; background: #f2efff; }
.privacy-note strong, .privacy-note span { display: block; }
.privacy-note strong { font-size: .9rem; }
.privacy-note div > span { margin-top: 2px; color: #625b78; font-size: .78rem; }
.privacy-note b { color: var(--blue-dark); }
.privacy-dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--blue); }

.editor-shell {
  width: min(1480px, calc(100% - 36px));
  min-height: 700px;
  margin: 0 auto 80px;
  overflow: hidden;
  border: 1px solid #cfd5dd;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 58px rgba(31, 34, 48, .13);
}

.editor-topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}
.toolbar-group { display: flex; align-items: center; gap: 5px; padding-right: 8px; margin-right: 2px; border-right: 1px solid var(--line); }
.toolbar-group:last-child { border-right: 0; padding-right: 0; }
.toolbar-spacer { flex: 1; }
.toolbar-button, .icon-button, .open-button, .panel-button, .mobile-properties-button {
  min-height: 40px;
  border: 1px solid #cbd2db;
  border-radius: 9px;
  background: #fff;
  font-weight: 750;
  cursor: pointer;
}
.toolbar-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 13px; font-size: .86rem; }
.toolbar-button.compact { padding: 0 10px; }
.toolbar-button:hover:not(:disabled), .icon-button:hover:not(:disabled), .panel-button:hover:not(:disabled) { border-color: #c9c4df; background: var(--blue-soft); }
.toolbar-button.primary { color: #fff; border-color: var(--blue); background: var(--blue); }
.toolbar-button.primary:hover:not(:disabled) { border-color: var(--blue-dark); background: var(--blue-dark); }
.copy-button { border-color: #c2b7ee; color: var(--blue-dark); background: #faf9ff; }
.toolbar-button:disabled, .icon-button:disabled { color: #9da5ae; cursor: not-allowed; opacity: .64; }
.toolbar-button svg, .icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon-button { width: 40px; padding: 0; font-size: 1.25rem; }
.zoom-controls output { min-width: 50px; text-align: center; color: #4f5b67; font-size: .78rem; font-variant-numeric: tabular-nums; }

.editor-layout { display: grid; grid-template-columns: 108px minmax(460px, 1fr) 304px; min-height: 620px; background: #f0f1f4; }
.tool-rail { display: flex; flex-direction: column; gap: 5px; padding: 10px 9px; border-right: 1px solid var(--line); background: #f8f8fa; }
.tool-button { position: relative; display: grid; min-height: 58px; place-items: center; align-content: center; gap: 5px; padding: 7px 6px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: center; cursor: pointer; }
.tool-button:hover { border-color: #d3d0dc; background: #fff; }
.tool-button.is-active { color: #492ea9; border-color: #b9aaf0; background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.tool-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-button span { font-size: .7rem; font-weight: 800; line-height: 1.08; }
.tool-button kbd { position: absolute; top: 5px; right: 5px; color: #96919f; font: 700 .56rem/1 ui-monospace, monospace; }

.canvas-column { min-width: 0; display: flex; flex-direction: column; padding: 14px 14px 0; background: #e3e4e8; }
.canvas-viewport { position: relative; min-height: 560px; flex: 1; overflow: hidden; border: 1px solid #aeb0b8; border-radius: 10px; touch-action: none; background-color: #c9cbd1; background-image: linear-gradient(45deg,#c2c4c9 25%,transparent 25%),linear-gradient(-45deg,#c2c4c9 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#c2c4c9 75%),linear-gradient(-45deg,transparent 75%,#c2c4c9 75%); background-size: 16px 16px; background-position: 0 0,0 8px,8px -8px,-8px 0; }
.canvas-viewport.is-dragging { box-shadow: inset 0 0 0 4px var(--blue); }
#annotationCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#annotationCanvas[data-tool="select"] { cursor: default; }
#annotationCanvas[data-tool="hand"] { cursor: grab; }
#annotationCanvas[data-tool="arrow"], #annotationCanvas[data-tool="rectangle"], #annotationCanvas[data-tool="ellipse"], #annotationCanvas[data-tool="highlight"], #annotationCanvas[data-tool="pen"], #annotationCanvas[data-tool="redact"], #annotationCanvas[data-tool="crop"] { cursor: crosshair; }
#annotationCanvas[data-tool="text"], #annotationCanvas[data-tool="number"] { cursor: text; }
#annotationCanvas.can-pan { cursor: grab; }
#annotationCanvas.is-panning { cursor: grabbing; }
.empty-state { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; background: linear-gradient(150deg,rgba(250,249,255,.96),rgba(244,241,255,.96) 55%,rgba(251,250,247,.96)); }
.empty-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 18px; border: 0; border-radius: 18px; background: var(--blue); color: #fff; box-shadow: 0 10px 24px rgba(104,72,216,.25); }
.empty-icon svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin: 0; font-size: 1.42rem; }
.empty-state > p { max-width: 430px; margin: 10px auto 0; color: var(--muted); line-height: 1.5; }
.open-button { margin-top: 18px; padding: 0 22px; color: #fff; border-color: var(--blue-dark); background: var(--blue); box-shadow: 0 5px 14px rgba(104,72,216,.2); }
.empty-state .empty-privacy { margin-top: 22px; color: #554879; font-size: .82rem; }
.empty-privacy span { margin-right: 6px; color: var(--blue); }
.empty-state .paste-hint { margin-top: 8px; font-size: .74rem; }
kbd { display: inline-block; padding: 2px 5px; border: 1px solid #cfd4da; border-bottom-width: 2px; border-radius: 4px; background: #fff; font: 700 .72em/1.2 ui-monospace, monospace; }
.canvas-text-editor { position: absolute; z-index: 5; width: min(320px, 60vw); min-height: 46px; padding: 7px 10px; resize: none; overflow: hidden; border: 2px solid var(--blue); border-radius: 5px; background: rgba(255,255,255,.96); box-shadow: 0 8px 24px rgba(20,36,58,.18); transform: translateY(-2px); }
.editor-statusbar { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 2px; background: transparent; }
.editor-statusbar p { margin: 0; color: #596572; font-size: .75rem; }
#status[data-tone="error"] { color: #a32a26; }
#status[data-tone="success"] { color: #26734d; }
.status-help { white-space: nowrap; }

.properties-panel { padding: 18px 17px; overflow-y: auto; border-left: 1px solid var(--line); background: #fff; }
.properties-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.properties-heading h2 { margin: 0; font-size: 1.3rem; letter-spacing: -.025em; }
.close-properties { display: none; border: 0; background: transparent; color: var(--blue-dark); font-weight: 750; }
.properties-empty { margin: 18px 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.property-field { display: block; margin-top: 18px; }
.property-field > span:first-child { display: flex; justify-content: space-between; margin-bottom: 8px; color: #4f5b66; font-size: .78rem; font-weight: 750; }
.property-field output { color: #77818c; font-weight: 650; }
.property-field input[type="range"] { width: 100%; accent-color: var(--blue); }
.property-field select { width: 100%; min-height: 42px; padding: 0 9px; border: 1px solid #c6ced7; border-radius: 6px; background: #fff; }
.color-control { display: flex; align-items: center; gap: 9px; height: 42px; padding: 5px 9px; border: 1px solid #c6ced7; border-radius: 6px; color: #4f5a66; font-size: .78rem; }
.color-control input { width: 29px; height: 29px; padding: 0; border: 0; background: transparent; }
.safety-copy { padding: 11px; border: 1px solid #edcf9c; border-radius: 7px; background: #fff8e8; color: #6d5632; font-size: .75rem; line-height: 1.45; }
.safety-copy strong { display: block; color: #4a391d; }
.selection-actions, .crop-actions { display: grid; gap: 8px; margin-top: 18px; padding: 12px; border: 1px solid #c8bff0; border-radius: 10px; background: #f7f5ff; }
.crop-actions p { margin: 0 0 3px; color: var(--muted); font-size: .8rem; }
.panel-button { width: 100%; padding: 0 12px; font-size: .82rem; }
.panel-button.primary { color: #fff; border-color: var(--blue); background: var(--blue); }
.panel-button.danger, .text-button.danger { color: var(--danger); }
.panel-footer-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.text-button { min-height: 30px; padding: 0; border: 0; background: transparent; color: #4d5965; font-size: .76rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.shortcut-card { margin-top: 24px; padding: 12px; border-radius: 9px; background: #f2f1f5; }
.shortcut-card h3 { margin: 0 0 8px; font-size: .76rem; }
.shortcut-card dl { margin: 0; }
.shortcut-card dl div { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; color: #66717d; font-size: .68rem; }
.shortcut-card dt, .shortcut-card dd { margin: 0; }
.shortcut-card dd { color: #394550; font-weight: 700; }
.mobile-properties-button { display: none; }

.content-section { padding-top: 80px; padding-bottom: 30px; }
.content-heading { max-width: 760px; }
.content-heading h2, .two-column-content h2, .faq-section h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.55rem); line-height: 1.12; letter-spacing: -.035em; }
.content-heading > p:last-child, .two-column-content article > p { color: var(--muted); line-height: 1.7; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.steps-grid article { padding: 22px; border: 1px solid #dcdedc; border-radius: 10px; background: #fff; }
.steps-grid article > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #184c9c; background: #e8f0ff; font-weight: 850; }
.steps-grid h3 { margin: 17px 0 8px; font-size: 1.03rem; }
.steps-grid p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.two-column-content { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.two-column-content article { padding-top: 28px; border-top: 1px solid #d5d7d5; }
.faq-section { padding-top: 78px; padding-bottom: 90px; }
.faq-list { max-width: 920px; margin-top: 28px; border-top: 1px solid #d5d7d5; }
.faq-list details { border-bottom: 1px solid #d5d7d5; }
.faq-list summary { padding: 20px 4px; font-weight: 800; cursor: pointer; }
.faq-list details p { max-width: 780px; margin: -4px 4px 22px; color: var(--muted); line-height: 1.65; }

@media (max-width: 1050px) {
  .editor-layout { grid-template-columns: 78px minmax(0, 1fr); }
  .properties-panel { position: fixed; z-index: 80; top: 0; right: 0; bottom: 0; width: min(340px, 88vw); transform: translateX(105%); box-shadow: -16px 0 40px rgba(21,29,38,.18); transition: transform .2s ease-out; }
  .properties-panel.is-open { transform: translateX(0); }
  .close-properties { display: block; }
  .mobile-properties-button { position: absolute; right: 24px; bottom: 58px; z-index: 5; display: block; padding: 0 14px; box-shadow: 0 5px 16px rgba(32,47,66,.16); }
  .editor-shell { position: relative; }
  .toolbar-button span { display: none; }
  .toolbar-button { padding: 0 10px; }
}

@media (max-width: 700px) {
  .nav-links a:not(.nav-pill) { display: none; }
  .page-intro { display: block; padding-top: 30px; }
  .page-intro.shell { width: calc(100% - 24px); }
  .breadcrumbs { margin-bottom: 17px; }
  .privacy-note { min-width: 0; margin-top: 20px; }
  .editor-shell { width: 100%; min-height: 670px; margin-bottom: 48px; border-right: 0; border-left: 0; border-radius: 0; }
  .editor-topbar { min-height: 54px; overflow-x: auto; scrollbar-width: none; }
  .editor-topbar::-webkit-scrollbar { display: none; }
  .editor-topbar .history-controls { display: none; }
  .toolbar-spacer { min-width: 4px; }
  .zoom-controls .compact { display: none; }
  .export-controls { margin-left: auto; }
  .copy-button span { display: inline; }
  .toolbar-button.primary span { display: none; }
  .toolbar-button.primary { min-width: 44px; padding-inline: 9px; }
  .editor-layout { display: flex; min-height: 610px; flex-direction: column-reverse; }
  .tool-rail { position: relative; z-index: 4; width: 100%; flex-direction: row; flex: none; gap: 3px; padding: 7px; overflow-x: auto; border-top: 1px solid var(--line); border-right: 0; background: rgba(255,255,255,.98); scrollbar-width: none; }
  .tool-rail::-webkit-scrollbar { display: none; }
  .tool-button { min-width: 66px; min-height: 56px; display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 5px 6px; text-align: center; }
  .tool-button.is-active { box-shadow: inset 0 -3px 0 var(--blue); }
  .tool-button svg { width: 21px; height: 21px; }
  .tool-button span { font-size: .66rem; }
  .tool-button kbd { display: none; }
  .canvas-column { padding: 7px 7px 0; }
  .canvas-viewport { min-height: 500px; border-radius: 8px; }
  .editor-statusbar { min-height: 44px; }
  .status-help { display: none; }
  .mobile-properties-button { right: 12px; bottom: 108px; min-height: 44px; }
  .steps-grid, .two-column-content { grid-template-columns: 1fr; }
  .two-column-content { gap: 26px; }
  .content-section { padding-top: 58px; }
}

@media (max-width: 430px) {
  .page-intro { padding-right: 18px; padding-left: 18px; }
  .page-intro h1 { font-size: 2.35rem; }
  .intro-copy { font-size: .98rem; }
  .editor-topbar { padding: 6px; }
  .toolbar-group { padding-right: 5px; }
  .toolbar-button, .icon-button { min-height: 42px; }
  .copy-button span { display: none; }
  .toolbar-button.primary { padding: 0 9px; white-space: nowrap; font-size: .74rem; }
  .canvas-viewport { min-height: 470px; }
  .empty-state { padding: 22px; }
  .empty-state h2 { font-size: 1.25rem; }
  .paste-hint { display: none; }
  .content-section.shell, .faq-section.shell { width: 100%; padding-right: 18px; padding-left: 18px; }
}

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