:root {
  --paper: #f5f2ea;
  --ink: #171a16;
  --muted: #6f746c;
  --line: #cecbbf;
  --lime: #c6f04d;
  --coral: #ff795f;
  --white: #fffefa;
  --mono: 'DM Mono', monospace;
  --sans: 'Manrope', sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--ink); background: var(--paper); }
button, textarea, input { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.home-page { display: grid; place-items: center; }
.home-shell { width: min(1180px, calc(100% - 48px)); padding: 64px 0 28px; }
.site-return { display: inline-flex; margin-bottom: 42px; border-bottom: 1px solid currentColor; padding-bottom: 4px; font: 500 12px var(--mono); letter-spacing: .05em; }
.home-header { position: relative; max-width: 780px; margin-bottom: 52px; }
.brand-mark { position: absolute; left: -64px; top: 5px; width: 36px; height: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.brand-mark span { background: var(--ink); }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { border-radius: 50%; }
.eyebrow { margin: 0 0 17px; font: 500 12px/1 var(--mono); letter-spacing: .16em; }
.home-header h1 { margin: 0; font-size: clamp(50px, 7vw, 91px); line-height: .93; letter-spacing: -.065em; font-weight: 600; }
.home-header h1 em { color: var(--coral); font-style: normal; }
.lede { max-width: 570px; margin: 28px 0 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.app-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.app-card { min-height: 420px; padding: 27px 30px 30px; border: 1px solid var(--ink); display: flex; flex-direction: column; justify-content: space-between; transition: transform .2s ease, box-shadow .2s ease; }
.app-card:hover { transform: translateY(-5px); box-shadow: 0 9px 0 var(--ink); }
.generator-card { background: var(--lime); }
.scanner-card { background: var(--ink); color: var(--paper); }
.card-topline { display: flex; justify-content: space-between; align-items: center; font: 500 12px var(--mono); }
.arrow { font-size: 22px; transition: transform .2s ease; }
.app-card:hover .arrow { transform: translate(3px, -3px); }
.card-art { height: 145px; position: relative; margin: 16px 0 20px; }
.note-art { display: flex; align-items: center; justify-content: center; }
.paper-lines { width: 210px; height: 126px; padding: 27px 25px; background: var(--white); transform: rotate(-3deg); box-shadow: 8px 8px 0 rgba(23,26,22,.16); }
.paper-lines i { display: block; width: 100%; height: 4px; margin-bottom: 13px; background: var(--ink); opacity: .68; }
.paper-lines i:nth-child(2) { width: 76%; }.paper-lines i:nth-child(3) { width: 88%; }.paper-lines i:nth-child(4) { width: 50%; }
.mini-qr, .empty-qr { background: repeating-conic-gradient(var(--ink) 0 25%, transparent 0 50%) 50% / 14px 14px; }
.mini-qr { position: absolute; width: 79px; height: 79px; right: calc(50% - 130px); bottom: 0; border: 7px solid var(--white); box-shadow: 4px 4px 0 rgba(23,26,22,.2); }
.scan-art { display: grid; place-items: center; }
.scan-corners { width: 150px; height: 130px; background: linear-gradient(var(--lime),var(--lime)) left top/35px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) left top/3px 35px no-repeat, linear-gradient(var(--lime),var(--lime)) right top/35px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) right top/3px 35px no-repeat, linear-gradient(var(--lime),var(--lime)) left bottom/35px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) left bottom/3px 35px no-repeat, linear-gradient(var(--lime),var(--lime)) right bottom/35px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) right bottom/3px 35px no-repeat; }
.scan-beam { position: absolute; width: 125px; height: 1px; background: var(--coral); box-shadow: 0 0 12px var(--coral); animation: beam 2.4s ease-in-out infinite; }
.scan-dot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }
@keyframes beam { 0%,100%{transform:translateY(-45px)} 50%{transform:translateY(45px)} }
.card-label { margin: 0 0 8px; font: 500 11px var(--mono); letter-spacing: .14em; }
.app-card h2 { margin: 0 0 10px; font-size: 31px; letter-spacing: -.04em; }
.app-card div > p:last-child { margin: 0; max-width: 430px; opacity: .72; line-height: 1.55; font-size: 14px; }
.home-footer { display: flex; justify-content: space-between; padding-top: 22px; color: var(--muted); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; }

.tool-nav { height: 76px; padding: 0 max(28px, calc((100% - 1180px)/2)); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); font: 500 13px var(--mono); }
.back-link, .switch-link { display: flex; gap: 10px; align-items: center; }
.switch-link { border-bottom: 1px solid currentColor; padding-bottom: 4px; }
.dark-nav { border-color: #393d37; }
.tool-shell { width: min(1180px, calc(100% - 48px)); margin: auto; padding: 62px 0 30px; }
.tool-heading { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; margin-bottom: 44px; align-items: end; }
.tool-heading .eyebrow { grid-column: 1 / -1; }
.tool-heading h1 { margin: 0; font-size: clamp(44px, 6vw, 72px); letter-spacing: -.06em; line-height: 1; }
.tool-heading > p:last-child { max-width: 480px; justify-self: end; color: var(--muted); line-height: 1.6; margin: 0; }
.workspace { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { min-height: 490px; border: 1px solid var(--ink); padding: 24px; background: var(--white); display: flex; flex-direction: column; }
.panel-heading { display: flex; justify-content: space-between; font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; }
.panel-heading span:last-child { color: var(--muted); }
textarea { flex: 1; width: 100%; margin: 25px 0; resize: none; background: transparent; border: 0; outline: none; color: var(--ink); font-size: 20px; line-height: 1.65; }
textarea::placeholder { color: #aaa99f; }
.input-actions, .output-actions { display: flex; gap: 10px; justify-content: flex-end; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .38; }
.text-button { background: transparent; margin-right: auto; text-decoration: underline; text-underline-offset: 4px; }
.primary-button, .secondary-button { min-height: 49px; padding: 0 20px; border: 1px solid var(--ink); font: 500 13px var(--mono); }
.primary-button { background: var(--ink); color: white; }
.primary-button span { margin-left: 20px; }
.secondary-button { background: transparent; }
.output-panel { background: var(--lime); }
.qr-stage { flex: 1; margin: 20px 0; display: grid; place-items: center; min-height: 330px; }
.qr-stage #qrcode { background: white; padding: 16px; box-shadow: 7px 7px 0 rgba(23,26,22,.14); }
.qr-stage.empty #qrcode { display: none; }
.empty-state { text-align: center; color: #565b48; font: 12px var(--mono); }
.empty-qr { width: 92px; height: 92px; opacity: .16; margin: 0 auto 20px; }
.privacy-note { text-align: center; color: var(--muted); font: 11px var(--mono); margin: 26px 0 0; }
.privacy-note span { color: #6f9b14; margin-right: 7px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 15px); padding: 12px 18px; background: var(--ink); color: white; font: 12px var(--mono); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.scanner-page { background: var(--ink); color: var(--paper); }
.scanner-heading > p:last-child { color: #a5aaa1; }
.scanner-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .65fr); gap: 18px; }
.camera-card { position: relative; min-height: 535px; background: #0b0d0b; border: 1px solid #484d45; overflow: hidden; display: grid; place-items: center; }
#reader { width: 100%; border: 0 !important; }
#reader video { object-fit: cover; min-height: 535px; }
#reader__scan_region { background: #0b0d0b; }
#reader__dashboard { display: none !important; }
.camera-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at center, #242920 0, #0b0d0b 62%); }
.viewfinder { position: relative; width: 218px; height: 218px; margin-bottom: 35px; background: linear-gradient(var(--lime),var(--lime)) left top/48px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) left top/3px 48px no-repeat, linear-gradient(var(--lime),var(--lime)) right top/48px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) right top/3px 48px no-repeat, linear-gradient(var(--lime),var(--lime)) left bottom/48px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) left bottom/3px 48px no-repeat, linear-gradient(var(--lime),var(--lime)) right bottom/48px 3px no-repeat, linear-gradient(var(--lime),var(--lime)) right bottom/3px 48px no-repeat; }
.viewfinder span { position: absolute; left: 15px; right: 15px; height: 1px; top: 50%; background: var(--coral); box-shadow: 0 0 14px var(--coral); animation: beam 2.4s ease-in-out infinite; }
.camera-placeholder p { color: #a5aaa1; font-size: 14px; }
.lime-button { margin-top: 10px; min-height: 52px; padding: 0 27px; background: var(--lime); color: var(--ink); font: 500 13px var(--mono); }
.stop-button { position: absolute; z-index: 5; bottom: 20px; left: 50%; transform: translateX(-50%); background: rgba(10,12,10,.88); color: white; border: 1px solid #60665b; padding: 12px 18px; font: 12px var(--mono); }
.scan-side { display: flex; flex-direction: column; gap: 18px; }
.upload-block, .result-block { border: 1px solid #484d45; padding: 24px; }
.upload-block { background: #242720; }
.side-label { margin: 0 0 20px; color: #a5aaa1; font: 11px var(--mono); letter-spacing: .12em; }
.upload-button { display: flex; justify-content: space-between; align-items: center; min-height: 60px; padding: 0 18px; background: var(--paper); color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 600; }
.upload-button b { font-size: 23px; font-weight: 400; }
.upload-block > p:last-child { margin: 13px 0 0; color: #848a80; font-size: 11px; }
.result-block { flex: 1; min-height: 260px; display: flex; flex-direction: column; }
.result-header { display: flex; justify-content: space-between; text-transform: uppercase; color: #a5aaa1; font: 11px var(--mono); letter-spacing: .1em; }
.result-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #73796e; }
.result-dot.active { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 8px var(--lime); }
.result-empty { margin: auto 0; color: #777c73; font-size: 14px; line-height: 1.6; }
.result-content { display: flex; flex: 1; flex-direction: column; }
.result-content p { overflow-wrap: anywhere; font: 14px/1.55 var(--mono); color: var(--paper); }
.result-actions { display: flex; gap: 9px; margin-top: auto; }
.result-actions button, .result-actions a { padding: 11px 14px; border: 1px solid #5a6056; color: var(--paper); background: transparent; font: 11px var(--mono); }
.result-actions .copy-result-button { flex: 1; background: var(--paper); border-color: var(--paper); color: var(--ink); font-weight: 500; }
.result-actions a { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.scanner-privacy { color: #858b81; }.dark-toast { background: var(--lime); color: var(--ink); }
.hidden { display: none !important; }

@media (max-width: 820px) {
  .home-shell, .tool-shell { width: min(100% - 30px, 620px); }
  .home-shell { padding-top: 35px; }
  .brand-mark { position: static; margin-bottom: 28px; width: 28px; height: 28px; }
  .home-header { margin-bottom: 35px; }
  .lede { font-size: 16px; }
  .app-grid, .workspace, .scanner-layout { grid-template-columns: 1fr; }
  .app-card { min-height: 370px; }
  .tool-heading { grid-template-columns: 1fr; }
  .tool-heading > p:last-child { justify-self: start; margin-top: 18px; }
  .tool-shell { padding-top: 42px; }
  .panel { min-height: 440px; }
  .camera-card { min-height: 470px; }
  #reader video { min-height: 470px; }
}

@media (max-width: 480px) {
  .home-shell { width: calc(100% - 22px); }
  .home-header h1 { font-size: 48px; }
  .app-card { padding: 22px; min-height: 350px; }
  .tool-nav { height: 64px; padding: 0 16px; }
  .back-link span { display: none; }
  .tool-shell { width: calc(100% - 22px); padding-top: 35px; }
  .tool-heading h1 { font-size: 46px; }
  .panel { padding: 18px; }
  .output-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .primary-button, .secondary-button { padding: 0 10px; }
  .qr-stage #qrcode { padding: 10px; }
  .qr-stage #qrcode canvas, .qr-stage #qrcode img { width: 230px !important; height: 230px !important; }
  .camera-card { min-height: 430px; }
  .viewfinder { width: 185px; height: 185px; }
  .home-footer { font-size: 9px; }
}

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