:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #131316;
  --panel-2: #18181c;
  --line: #2b2b31;
  --text: #f7f7f4;
  --muted: #9b9ba4;
  --neon: #d7ff2f;
  --neon-dark: #b9e315;
  --purple: #8b5cf6;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 58% -20%, rgba(139, 92, 246, .16), transparent 32rem), var(--bg); }
button, input, select { font: inherit; }
button, .upload-zone, input[type="range"] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, .upload-zone:focus-visible { outline: 3px solid rgba(215,255,47,.45); outline-offset: 3px; }

.topbar { height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 5vw; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand { color: var(--text); text-decoration: none; font-family: Manrope, sans-serif; font-weight: 800; font-size: 1.22rem; letter-spacing: -.045em; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--neon); transform: rotate(-5deg); box-shadow: 0 0 28px rgba(215,255,47,.18); }
.brand-mark span { width: 13px; height: 18px; border: 3px solid #09090b; border-radius: 3px; position: relative; }
.brand-mark span::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #09090b; top: 2px; left: 1px; }
.privacy-pill { display: flex; align-items: center; gap: 8px; color: #c9c9ce; font-size: .88rem; }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 9px var(--neon); }

.app-shell { width: min(1180px, 90vw); margin: 0 auto; padding: 56px 0 44px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 36px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 12px; font-size: .78rem; letter-spacing: .16em; font-weight: 700; color: var(--neon); }
h1 { font-family: Manrope, sans-serif; font-size: clamp(2.35rem, 5vw, 4.25rem); line-height: .99; letter-spacing: -.065em; margin: 0; max-width: 740px; }
.intro-copy { max-width: 350px; color: var(--muted); font-size: 1rem; line-height: 1.6; margin: 0 0 5px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.34fr) minmax(330px, .66fr); border: 1px solid var(--line); border-radius: 22px; background: var(--panel); overflow: hidden; box-shadow: 0 32px 100px rgba(0,0,0,.32); }
.editor-panel, .settings-panel { padding: 30px; }
.editor-panel { border-right: 1px solid var(--line); }
.settings-panel { background: #101012; }
.panel-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.panel-heading.compact { margin-bottom: 30px; }
.step-number { flex: 0 0 auto; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: #0a0a0b; background: var(--neon); font-weight: 800; box-shadow: 0 0 22px rgba(215,255,47,.12); }
.panel-heading h2 { font-family: Manrope, sans-serif; margin: 0 0 3px; font-size: 1.1rem; letter-spacing: -.025em; }
.panel-heading p { margin: 0; color: var(--muted); font-size: .86rem; }

.upload-zone { position: relative; min-height: 474px; display: grid; place-items: center; border: 1px dashed #46464e; border-radius: 15px; overflow: hidden; cursor: pointer; background: linear-gradient(135deg, rgba(255,255,255,.02), transparent), #0c0c0f; transition: border-color .2s, background .2s; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--neon); background-color: #10110d; }
.empty-upload { display: flex; align-items: center; flex-direction: column; text-align: center; padding: 32px; pointer-events: none; }
.empty-upload strong { font-family: Manrope, sans-serif; font-size: 1.05rem; margin: 17px 0 5px; }
.empty-upload span { color: var(--muted); font-size: .84rem; }
.upload-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: #1c1c20; border: 1px solid #303036; }
.upload-icon svg { width: 26px; fill: none; stroke: var(--neon); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.neon-button { margin-top: 22px; padding: 11px 19px; border: 0; border-radius: 9px; background: var(--neon); color: #0a0a0b; font-weight: 800; pointer-events: auto; cursor: pointer; box-shadow: 0 0 24px rgba(215,255,47,.13); }
#cropCanvas { display: none; width: auto; height: 474px; max-width: 100%; touch-action: none; }
.upload-zone.has-image { border-style: solid; background: #e7e7e7; cursor: grab; }
.upload-zone.has-image:active { cursor: grabbing; }
.upload-zone.has-image .empty-upload { display: none; }
.upload-zone.has-image #cropCanvas { display: block; }
.guide-overlay { display: none; position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(255,255,255,.45); }
.has-image .guide-overlay { display: block; }
.face-guide { position: absolute; width: 41%; aspect-ratio: .77; border: 1px dashed rgba(255,255,255,.9); border-radius: 50%; left: 50%; top: 44%; transform: translate(-50%,-50%); box-shadow: 0 0 0 100vmax rgba(0,0,0,.09); }
.guide-overlay span { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); white-space: nowrap; font-size: .75rem; padding: 6px 10px; border-radius: 20px; background: rgba(0,0,0,.58); backdrop-filter: blur(8px); }

.edit-controls { display: grid; grid-template-columns: 1fr auto; gap: 25px; margin-top: 20px; align-items: end; }
.edit-controls.is-disabled { opacity: .38; pointer-events: none; }
.control-row label, .label-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: .83rem; font-weight: 600; }
.control-row output { color: var(--neon); }
input[type="range"] { width: 100%; height: 5px; appearance: none; border-radius: 10px; background: linear-gradient(to right, var(--neon) 0%, var(--neon) 0%, #34343a 0%); cursor: pointer; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 17px; height: 17px; border-radius: 50%; background: var(--neon); border: 3px solid #131316; box-shadow: 0 0 0 1px var(--neon); }
.tool-row { display: flex; gap: 7px; }
.tool-button { display: flex; align-items: center; gap: 6px; border: 1px solid #34343a; color: #d7d7da; background: #1b1b1f; padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: .78rem; }
.tool-button:hover { border-color: #5a5a63; color: white; }
.tool-button svg, .download-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.setting-group { border: 0; padding: 0; margin: 0 0 24px; min-width: 0; }
.setting-group > label, .setting-group legend { display: block; margin-bottom: 10px; color: #e6e6e8; font-size: .83rem; font-weight: 600; }
.select-wrap { position: relative; }
.select-wrap select { width: 100%; appearance: none; color: var(--text); background: var(--panel-2); border: 1px solid #37373e; border-radius: 10px; padding: 13px 40px 13px 13px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); width: 19px; fill: none; stroke: #aaaab2; stroke-width: 1.6; pointer-events: none; }
.copy-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.copy-options input { position: absolute; opacity: 0; }
.copy-options span { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #36363c; background: #18181c; border-radius: 10px; cursor: pointer; transition: .18s ease; }
.copy-options strong { font-family: Manrope, sans-serif; font-size: 1.05rem; }
.copy-options small { color: var(--muted); font-size: .68rem; }
.copy-options input:checked + span { border-color: var(--neon); color: var(--neon); background: rgba(215,255,47,.07); box-shadow: inset 0 0 0 1px var(--neon), 0 0 20px rgba(215,255,47,.06); }
.copy-options input:focus-visible + span { outline: 3px solid rgba(215,255,47,.4); outline-offset: 2px; }
.label-row { align-items: center; }
.label-row span:last-child { color: var(--muted); font-weight: 400; font-size: .74rem; }
.sheet-preview { height: 180px; display: grid; place-items: center; padding: 14px; border-radius: 12px; border: 1px solid #29292f; background: repeating-linear-gradient(45deg, #141417, #141417 8px, #161619 8px, #161619 16px); overflow: hidden; }
.sheet-placeholder { display: flex; flex-direction: column; align-items: center; gap: 9px; color: #75757e; font-size: .78rem; }
.sheet-placeholder svg { width: 30px; fill: none; stroke: #55555e; stroke-width: 1.4; }
#sheetCanvas { display: none; max-width: 100%; max-height: 100%; background: white; box-shadow: 0 5px 18px rgba(0,0,0,.38); }
.sheet-preview.has-sheet .sheet-placeholder { display: none; }
.sheet-preview.has-sheet #sheetCanvas { display: block; }
.download-button, .print-button { width: 100%; min-height: 50px; border-radius: 10px; cursor: pointer; font-weight: 800; transition: transform .16s, background .16s, opacity .16s; }
.download-button { display: flex; justify-content: center; align-items: center; gap: 9px; color: #0b0b0b; background: var(--neon); border: 0; box-shadow: 0 0 30px rgba(215,255,47,.12); }
.download-button:hover:not(:disabled) { background: #e2ff68; transform: translateY(-1px); }
.print-button { margin-top: 9px; color: #e9e9ea; background: #1a1a1e; border: 1px solid #37373e; }
.print-button:hover:not(:disabled) { background: #222227; }
.download-button:disabled, .print-button:disabled { cursor: not-allowed; opacity: .35; }
.quality-note { color: #85858e; text-align: center; font-size: .73rem; margin: 12px 0 0; }
.quality-note span { color: var(--neon); margin-right: 4px; }
footer { width: min(1180px, 90vw); margin: 0 auto; padding: 0 0 32px; display: flex; justify-content: space-between; color: #65656d; font-size: .74rem; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 9px; background: var(--text); color: #101012; font-weight: 700; font-size: .84rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .app-shell { width: min(680px, 92vw); padding-top: 38px; }
  .intro { display: block; }
  .intro-copy { margin-top: 18px; }
  .workspace { grid-template-columns: 1fr; }
  .editor-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-panel { padding-bottom: 34px; }
}

@media (max-width: 560px) {
  .topbar { height: 66px; padding: 0 4vw; }
  .privacy-pill { font-size: 0; }
  .privacy-pill::after { content: "Private"; font-size: .8rem; }
  .app-shell { padding-top: 30px; }
  h1 { font-size: 2.4rem; }
  .intro-copy { font-size: .93rem; }
  .editor-panel, .settings-panel { padding: 21px 17px; }
  .upload-zone { min-height: 380px; }
  #cropCanvas { height: 380px; }
  .edit-controls { grid-template-columns: 1fr; }
  .tool-row { justify-content: space-between; }
  .tool-button { flex: 1; justify-content: center; }
  footer { display: block; line-height: 1.8; }
  footer span { display: block; }
}

@media print {
  body * { visibility: hidden; }
  #sheetCanvas { visibility: visible; display: block; position: fixed; inset: 0; width: 100%; height: auto; max-height: none; }
  @page { margin: 6mm; }
}
