/* Cropper layout. Colors and typography come from the shared theme.css. */
button, input, select { font: inherit; }
button, .upload, select { cursor: pointer; }
button { transition: background .15s, border-color .15s, transform .15s; }
button:disabled { opacity: .45; cursor: default; }
button:not(:disabled):active { transform: translateY(1px); }
button:focus-visible, input:focus-visible, select:focus-visible,
a:focus-visible, .upload:focus-visible, canvas:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 4px;
}
[hidden] { display: none !important; }
.app { max-width: min(1720px, 94vw); margin: 0 auto; padding: clamp(24px, 4vh, 52px) clamp(20px, 3vw, 48px) 40px; height: auto; min-height: max(760px, 100vh); min-height: max(760px, 100dvh); display: flex; flex-direction: column; }
.tool-header { position: relative; padding-right: 150px; }
h1 { font-size: clamp(32px, 4.4vw, 46px); line-height: 1.02; }
.eyebrow { margin-bottom: 16px; }
.subtitle { margin-top: 12px; max-width: 62ch; font-size: 15px; }
h1 .dot { color: var(--accent); }
.top-links { position: absolute; top: 2px; right: 0; display: inline-flex; align-items: center; gap: 16px; }
.navlink { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; color: var(--paper-dim); background: none; border: 0; padding: 0; }
.navlink:hover { color: var(--accent); text-decoration: none; }
.gh-link { display: inline-flex; color: var(--paper-dim); transition: color .14s, transform .14s; }
.gh-link:hover { color: var(--accent); transform: translateY(-1px); }
.gh-link svg { display: block; }
.section-head { display: flex; align-items: center; gap: 16px; margin-top: clamp(24px, 4vh, 40px); margin-bottom: 16px; }
.section-rule { flex: 1; height: 1px; background: var(--rule); }
.local-status { font-family: var(--mono); font-size: 11px; color: var(--green); white-space: nowrap; }
.local-status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-right: 8px; box-shadow: 0 0 10px #5dd39e50; }
.workspace { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 18px; flex: 1 0 auto; min-height: 480px; }
.settings { --control-text: 14px; --help-text: 12px; min-width: 0; min-height: 0; padding: 20px; display: flex; flex-direction: column; }
.settings-controls { flex: 1 0 auto; padding: 4px; }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-heading h2 { font-family: var(--sans); font-size: 14px; font-weight: 500; letter-spacing: 0; margin: 0; }
.settings section + section { border-top: 1px solid var(--rule-hi); margin-top: 18px; padding-top: 18px; }
.upload { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; column-gap: 12px; border: 1px dashed var(--rule-hi); background: var(--well); border-radius: 8px; padding: 14px; text-align: left; }
.upload:hover, .upload.dragover { border-color: var(--accent); background: rgba(110,168,254,.07); }
.upload-icon { display: grid; place-items: center; width: 32px; height: 32px; grid-row: 1 / 4; margin-bottom: 0; font-size: 25px; color: var(--accent); background: rgba(110,168,254,.08); border-radius: 8px; }
.upload strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--control-text); font-weight: 500; }
.upload > span:not(.upload-icon) { font-size: var(--control-text); color: var(--paper-dim); margin-top: 5px; }
.upload .file-types { font-family: var(--mono); font-size: var(--help-text) !important; color: var(--paper-dimmer) !important; margin-top: 6px !important; }
.photo-info { font-family: var(--mono); font-size: var(--help-text); color: var(--green); margin: 9px 0 0; overflow-wrap: anywhere; }
.unit { margin-left: auto; font-family: var(--mono); font-size: var(--help-text); color: var(--paper-dimmer); }
.dimensions { display: grid; grid-template-columns: minmax(0, 1fr) 20px min(160px, 46%); align-items: end; gap: 12px; }
.control-row { display: grid; grid-template-columns: minmax(0, 1fr) min(160px, 46%); align-items: center; gap: 12px; margin-bottom: 12px; font-size: var(--control-text); color: var(--paper-dim); }
.control-row select { width: 100%; min-width: 0; }
.resolution-row { display: grid; grid-template-columns: minmax(0, 1fr) min(160px, 46%); align-items: center; gap: 12px; margin-top: 12px; font-size: var(--control-text); color: var(--paper-dim); }
.resolution-field { width: 100%; min-width: 0; height: 32px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--rule-hi); border-radius: 5px; padding: 0 8px; background: var(--well); }
.resolution-field input { flex: 1; min-width: 0; width: 0; height: 100%; border: 0; padding: 0; font-family: var(--sans); color: var(--paper); background: transparent; }
.check-control { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; font-size: var(--control-text); cursor: pointer; }
.check-control input { accent-color: var(--accent); }
input:disabled { opacity: .5; }
canvas.resize-preview { cursor: default; }
.dimensions label { flex: 1; min-width: 0; font-family: var(--sans); font-size: var(--control-text); color: var(--paper-dim); }
.dimensions input { display: block; width: 100%; padding: 9px 8px; border: 1px solid var(--rule-hi); border-radius: 6px; margin-top: 6px; font-family: var(--sans); font-size: var(--control-text); color: var(--paper); background: var(--well); appearance: textfield; }
.dimensions input::-webkit-inner-spin-button { appearance: none; }
.dimensions input[aria-invalid=true] { border-color: var(--red); }
.field-error { font-size: var(--help-text); line-height: 1.6; color: #ff9b9f; margin: 9px 0 0; }
.swap { height: 39px; border: 0; background: none; color: var(--paper-dim); font-size: 21px; padding: 0 2px; }
.swap:hover { color: var(--accent); }
.presets { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin-top: 12px; }
.presets button { flex: none; white-space: nowrap; padding: 6px; font-family: var(--sans); font-size: var(--control-text); color: var(--paper-dim); background: var(--chip); border: 1px solid var(--rule-hi); border-radius: 5px; }
.presets button.active { color: var(--accent); background: rgba(110,168,254,.10); border-color: rgba(110,168,254,.4); }
.presets button:hover { border-color: var(--accent); }
.presets select { min-width: 94px; width: 94px; max-width: 100%; flex: 1 0 94px; padding: 6px 30px 6px 8px; font-size: var(--control-text); }
.presets select:has(option:checked:not([value=""])) { color: var(--accent); border-color: rgba(110,168,254,.4); }
.hint { font-size: var(--help-text); line-height: 1.6; color: var(--paper-dimmer); margin: 8px 0 0; }
.slider-label { display: flex; justify-content: space-between; font-family: var(--sans); color: var(--paper-dim); font-size: var(--control-text); margin-bottom: 11px; }
.slider-label output { font-family: var(--sans); color: var(--paper-dim); font-size: var(--control-text); }
input[type=range] { width: 100%; height: 4px; accent-color: var(--accent); margin: 7px 0 14px; }
.adjust-buttons { display: flex; gap: 8px; }
.adjust-buttons button { flex: 1; padding: 9px 4px; background: var(--chip); border: 1px solid var(--rule-hi); border-radius: 6px; color: var(--paper-dim); font-size: var(--control-text); }
.adjust-buttons button:not(:disabled):hover { background: var(--hover); border-color: var(--accent); }
.adjust-buttons span { font-size: 14px; margin-right: 5px; }
.export-area { flex: none; margin-top: 16px; border-top: 1px solid var(--rule-hi); padding: 16px 4px 0; }
select { -webkit-appearance: none; appearance: none; border: 1px solid var(--rule-hi); background-color: var(--well); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23a8aeb8' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; border-radius: 5px; min-height: 32px; padding: 5px 30px 5px 8px; font-family: var(--sans); font-size: var(--control-text, 12px); color: var(--paper); }
.export-download-row { display: flex; align-items: stretch; gap: 8px; }
.export-download-row select { flex: none; width: 80px; }
.download { flex: 1; min-width: 0; border: 1px solid var(--accent); background: var(--accent); border-radius: 7px; padding: 11px 14px; color: var(--ink); font-size: var(--control-text); text-align: left; font-weight: 600; }
.download:not(:disabled):hover { background: #8ab9ff; }
.download > span:first-child { font-size: 19px; margin-right: 9px; }
.download .arrow { float: right; font-size: 15px; margin-top: 3px; }
.export-area > p { text-align: center; font-family: var(--mono); font-size: var(--help-text); color: var(--paper-dimmer); margin: 11px 0 0; }
.preview-panel { display: flex; flex-direction: column; background: var(--well); min-width: 0; min-height: 0; padding: 0; overflow: hidden; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; font-family: var(--mono); font-size: 9px; letter-spacing: 1.3px; color: var(--paper-dim); }
.live-dot { width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.grid-toggle { display: flex; align-items: center; gap: 7px; font-family: var(--sans); font-size: 11px; letter-spacing: 0; color: var(--paper-dim); cursor: pointer; }
.grid-toggle input { accent-color: var(--accent); width: 13px; height: 13px; }
.stage { position: relative; flex: 1 1 0; min-height: 400px; display: flex; align-items: center; justify-content: center; padding: 20px 36px 30px; background-image: radial-gradient(var(--rule-hi) .8px, transparent .8px); background-size: 12px 12px; }
.crop-frame { flex: none; position: relative; width: 330px; height: 424px; max-width: 100%; background: var(--surface); box-shadow: 0 10px 40px #0005; border: 1px solid var(--rule-hi); overflow: visible; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; background: var(--surface); }
canvas.dragging { cursor: grabbing; }
.empty-state { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; text-align: center; padding: 16px; }
.empty-icon { display: grid; place-items: center; width: 60px; height: 60px; font-size: 32px; color: var(--accent); background: rgba(110,168,254,.06); border: 1px solid rgba(110,168,254,.2); border-radius: 12px; margin-bottom: 19px; }
.empty-state h3 { font-family: var(--display); font-size: 24px; letter-spacing: -.4px; font-weight: 500; color: var(--paper); margin: 0 0 10px; }
.empty-state p { font-size: 12px; color: var(--paper-dim); line-height: 1.8; margin: 0 0 21px; }
.empty-state button { pointer-events: auto; font-size: 11px; padding: 9px 14px; border: 1px solid var(--rule-hi); border-radius: 6px; background: var(--chip); color: var(--accent); }
.empty-state button:hover { border-color: var(--accent); }
.empty-state button span { margin-left: 12px; }
.corner { position: absolute; width: 12px; height: 12px; border-color: var(--accent); border-style: solid; pointer-events: none; }
.tl { left: -1px; top: -1px; border-width: 2px 0 0 2px; }
.tr { right: -1px; top: -1px; border-width: 2px 2px 0 0; }
.bl { left: -1px; bottom: -1px; border-width: 0 0 2px 2px; }
.br { right: -1px; bottom: -1px; border-width: 0 2px 2px 0; }
.grid { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.grid i { position: absolute; background: #ffffff8a; box-shadow: 0 0 1px #0006; }
.grid i:nth-child(1), .grid i:nth-child(2) { height: 100%; width: 1px; left: 33.333%; }
.grid i:nth-child(2) { left: 66.666%; }
.grid i:nth-child(3), .grid i:nth-child(4) { width: 100%; height: 1px; top: 33.333%; }
.grid i:nth-child(4) { top: 66.666%; }
.preview-footer { padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule-hi); color: var(--paper-dim); }
#preview-size { font-family: var(--mono); font-size: 13px; letter-spacing: .3px; white-space: nowrap; }
#preview-size span { color: var(--paper-dimmer); margin: 0 5px; }
#preview-size small { font-size: 8px; margin-left: 8px; color: var(--paper-dimmer); }
#preview-tip { font-size: 10px; color: var(--paper-dimmer); }
footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 18px; margin-top: 24px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--paper-dimmer); }
#status { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--rule-hi); color: var(--paper); border-radius: 8px; padding: 12px 20px; font-size: 12px; box-shadow: var(--elev); max-width: 90%; z-index: 10; }
#status:empty { display: none; }
.about { max-width: 560px; width: calc(100% - 40px); border: 1px solid var(--rule-hi); border-radius: 14px; background: var(--surface); color: var(--paper); padding: 24px; box-shadow: var(--elev); }
.about::backdrop { background: rgba(4,5,8,.72); }
.about-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--rule-hi); }
.about h2 { font-size: 24px; margin: 0; }
.about h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; margin: 24px 0 8px; color: var(--paper-dimmer); }
.about p { font-size: 14px; line-height: 1.7; color: var(--paper-dim); }
.about strong { color: var(--paper); }
.about-heading button { border: 0; background: none; color: var(--paper-dim); font-size: 18px; padding: 5px; }
@media (max-width: 850px) {
  .workspace { grid-template-columns: 290px minmax(0, 1fr); }
  .settings { padding: 24px 19px; }
  .stage { padding: 20px; }
  #preview-tip { display: none; }
  .preview-heading { padding: 20px 16px; }
}
@media (max-width: 640px) {
  .app { padding: 24px 16px 28px; height: auto; min-height: 100vh; min-height: 100dvh; }
  .tool-header { padding-right: 0; }
  .top-links { position: static; display: flex; justify-content: flex-end; margin-bottom: 22px; }
  .eyebrow { font-size: 10px; letter-spacing: .12em; }
  .eyebrow::before { display: none; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; flex: none; gap: 16px; }
  .preview-panel { order: -1; }
  .stage { min-height: 330px; height: 360px; flex: none; padding: 10px 25px 25px; }
  .preview-heading { padding: 16px 20px; }
  .settings { --control-text: 16px; --help-text: 14px; padding: 20px; }
  .section-heading h2 { font-size: 18px; }
  .settings-controls { overflow: visible; }
  .preview-footer { padding: 14px 20px; }
  .settings section + section { margin-top: 20px; padding-top: 20px; }
  .navlink, .gh-link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  input:not([type=checkbox]):not([type=range]), select { font-size: 16px; min-height: 44px; }
  .presets select { font-size: 16px; min-width: 104px; flex-basis: 104px; }
  .presets button, .adjust-buttons button, .empty-state button { min-height: 44px; font-size: 16px; }
  .check-control, .grid-toggle { min-height: 44px; }
  .check-control input, .grid-toggle input { width: 18px; height: 18px; }
  input[type=range] { min-height: 44px; margin-bottom: 8px; }
  .resolution-field { height: 44px; }
  .resolution-field input[type=number] { min-height: 0; }
  select { font-family: var(--sans); }
  .upload { padding: 16px; }
  footer { font-size: 10px; }
}
