@font-face {
  font-family: "Advercase";
  src: url("/fonts/advercase-demo.otf") format("opentype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #071127;
  --paper: #f6f0e7;
  --coral: #ff634c;
  --sunflower: #d69a00;
  --signal: #70e990;
  --muted: rgba(245, 241, 232, 0.68);
  --faint: rgba(234, 238, 248, 0.46);
  --line: rgba(229, 235, 247, 0.25);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; min-height: 100vh; margin: 0; overflow-x: hidden; background: var(--paper); color: var(--night); }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

#field { display: none; }
.grain { display: none; }
body::after { display: none; }
body::before { display: none; }

.site-header { position: fixed; z-index: 20; top: 0; left: 50%; display: flex; width: min(1100px, 100%); min-height: 76px; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid rgba(7, 17, 39, 0.3); background: rgba(246, 240, 231, 0.96); backdrop-filter: blur(16px); transform: translateX(-50%); }
.wordmark { display: inline-flex; gap: 11px; align-items: center; width: max-content; color: rgba(7, 17, 39, 0.7); font: 31px/0.8 "Advercase", Georgia, serif; }
.wordmark img { width: 42px; height: 42px; object-fit: contain; mix-blend-mode: multiply; }
.wordmark span { padding: 3px 0 5px; border-bottom: 3px solid var(--sunflower); }
.site-header nav { display: flex; gap: 38px; align-self: stretch; }
.site-header nav a { display: grid; place-items: center; color: rgba(7, 17, 39, 0.9); font: 27px/1 "Advercase", Georgia, serif; letter-spacing: -0.01em; }
.site-header nav a:hover { color: var(--night); }
.workspace { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 36px; width: min(1100px, 100%); min-height: 100svh; margin: 0 auto; padding: 84px 24px 12px; }
.intro { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: center; padding: 0 0 18px; }
.intro h1 { width: 520px; margin: 0; color: #333333; font-family: "Advercase", Georgia, serif; font-weight: 400; letter-spacing: -0.022em; }
.intro h1 > span { display: block; }
.intro h1 > span:first-child { color: #575757; font-size: 24px; line-height: 1.12; }
.intro h1 > span:last-child { margin-top: 16px; font-size: 43px; line-height: 0.98; }
.intro h1 strong { font-weight: 700; }
.intro h1 .highlight { display: inline; padding: 0 0.04em; background: linear-gradient(transparent 67%, rgba(214, 154, 0, 0.24) 67%); color: #bd8200; }
.calibrate-button { display: inline-flex; width: auto; min-height: 54px; gap: 14px; align-items: center; margin-top: 32px; padding: 0 28px; border: 1px solid rgba(246, 240, 231, 0.9); background: var(--sunflower); color: var(--paper); cursor: pointer; box-shadow: 0 12px 28px rgba(176, 126, 0, 0.28); transition: transform 160ms ease, box-shadow 160ms ease; }
.calibrate-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(176, 126, 0, 0.36); }
.calibrate-button > span:first-child { font-size: 15px; font-weight: 700; }
.calibrate-button > span:last-child { font-size: 20px; font-weight: 300; line-height: 1; transition: transform 180ms ease; }
.calibrate-button:hover > span:last-child { transform: translateX(4px); }
.transformation { position: relative; display: flex; min-width: 0; min-height: calc(100svh - 96px); align-items: center; justify-content: flex-end; padding: 18px 0 0; }
.wallpaper-stage { position: relative; width: auto; height: min(88vh, 930px); max-height: calc(100svh - 96px); margin: 0 -4px 0 0; }
.wallpaper-stage img { display: block; width: auto; height: 100%; object-fit: contain; }

dialog { padding: 0; overflow: hidden; border: 1px solid rgba(7, 17, 39, 0.24); border-radius: 5px; color: var(--night); box-shadow: 0 40px 110px rgba(30, 25, 18, 0.36); }
dialog::backdrop { background: rgba(24, 24, 26, 0.72); backdrop-filter: blur(12px); }
.dialog-close { position: absolute; z-index: 4; top: 18px; right: 18px; width: 34px; height: 34px; border: 1px solid rgba(7, 17, 39, 0.34); border-radius: 50%; background: transparent; color: var(--night); font-size: 20px; cursor: pointer; }

.generator-dialog { width: min(980px, calc(100% - 30px)); background: var(--paper); }
.generator-dialog[open] { display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.setup-heading { position: relative; display: flex; min-height: 620px; flex-direction: column; justify-content: center; padding: 52px 36px; overflow: hidden; background: #e0a11a; color: var(--paper); }
.setup-heading::after { content: ""; position: absolute; right: -86px; bottom: -90px; width: 260px; height: 260px; border: 1px solid rgba(44, 37, 26, 0.18); border-radius: 50%; }
.setup-heading h2 { position: relative; z-index: 1; margin: 0; font: 48px/0.92 "Advercase", Georgia, serif; letter-spacing: -0.035em; white-space: nowrap; }
.setup-blurb { position: relative; z-index: 1; max-width: 25ch; margin: 20px 0 0; color: rgba(255, 251, 242, 0.86); font-size: 13px; line-height: 1.5; }
#generator-form { display: flex; min-width: 0; min-height: 620px; flex-direction: column; padding: 58px 46px 34px; }
.sentence-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: end; font: 18px/1.2 "Advercase", Georgia, serif; }
.sentence-fields label { min-width: 0; }
.sentence-fields label span, .date-fields label span { display: block; margin-bottom: 7px; color: rgba(7, 17, 39, 0.55); font: 9px/1.2 "Helvetica Neue", Arial, sans-serif; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.sentence-fields input, .date-fields input { width: 100%; height: 38px; padding: 0 1px 6px; border: 0; border-bottom: 1px solid rgba(7, 17, 39, 0.36); outline: 0; background: transparent; color: var(--night); }
.sentence-fields input { font: 27px/1 "Advercase", Georgia, serif; }
.sentence-fields input:focus, .date-fields input:focus { border-color: var(--sunflower); }
.joiner { padding-bottom: 10px; color: rgba(7, 17, 39, 0.55); font-size: 14px; }
.date-fields { display: flex; gap: 16px; align-items: end; margin-top: 28px; }
.date-fields > span { padding-bottom: 10px; color: rgba(7, 17, 39, 0.48); }
.date-fields label { flex: 1; }
.date-fields input { font-size: 13px; color-scheme: light; }
.date-fields input::-webkit-calendar-picker-indicator { opacity: 0.55; }
.progress-summary { display: flex; gap: 14px; align-items: center; margin: 12px 0 0; color: rgba(7, 17, 39, 0.52); font-size: 11px; }
.progress-summary strong { color: var(--night); font-size: 13px; }
.progress-summary span::before { content: "·"; margin-right: 14px; color: var(--sunflower); }
.background-picker { min-width: 0; margin: 34px 0 0; padding: 0; border: 0; }
.background-picker legend { margin-bottom: 11px; color: rgba(7, 17, 39, 0.55); font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.background-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.background-option { position: relative; display: grid; min-width: 0; gap: 6px; cursor: pointer; }
.background-option > input[type="radio"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.background-option > img { display: block; width: 100%; aspect-ratio: 4 / 5; border: 1px solid rgba(7, 17, 39, 0.16); object-fit: cover; object-position: center bottom; }
.background-option > span { color: rgba(7, 17, 39, 0.62); font-size: 10px; }
.background-option:has(input:checked) > img { border: 3px solid var(--sunflower); }
.background-option:has(input:checked) > span { color: var(--night); font-weight: 700; }
.upload-option { display: flex; aspect-ratio: 4 / 5; align-items: center; justify-content: center; flex-direction: column; border: 1px dashed rgba(7, 17, 39, 0.34); text-align: center; }
.upload-option .upload-glyph { font-size: 24px; font-weight: 300; }
.upload-option strong, .upload-option small { display: block; }
.upload-option strong { margin-top: 8px; font-size: 10px; }
.upload-option small { margin-top: 3px; color: rgba(7, 17, 39, 0.48); font-size: 8px; }
.upload-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-option[data-selected="true"] { border: 3px solid var(--sunflower); }
.form-footer { display: flex; gap: 20px; align-items: end; justify-content: space-between; margin-top: auto; padding-top: 28px; }
.generate-button { display: flex; width: 202px; min-height: 50px; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 0 15px; border: 0; background: var(--night); color: var(--paper); font-size: 11px; font-weight: 800; cursor: pointer; }
.generate-button:disabled { cursor: wait; opacity: 0.65; }
.form-status { min-height: 15px; margin: 0; color: rgba(7, 17, 39, 0.52); font-size: 10px; line-height: 1.4; }
.form-status[data-state="error"] { color: #b33b2e; }
.form-status[data-state="success"] { color: #526b2f; }

.result-dialog { width: min(760px, calc(100% - 28px)); background: #0a1730; color: var(--paper); }
.result-dialog .dialog-close { border-color: rgba(229, 235, 247, 0.3); background: rgba(8, 16, 34, 0.6); color: white; }
.result-dialog[open] { display: grid; grid-template-columns: minmax(220px, 0.7fr) 1fr; }
.result-image-wrap { height: 100%; min-height: 520px; background: #050a15; }
.result-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.result-copy { display: flex; max-height: min(88vh, 860px); flex-direction: column; justify-content: center; padding: 54px 42px; }
.section-index { color: var(--faint); font-size: 9px; text-transform: uppercase; }
.result-copy h2 { margin: 12px 0 0; font: 48px/0.9 "Advercase", Georgia, serif; }
.result-copy p { margin: 22px 0 30px; color: var(--muted); font-size: 14px; line-height: 1.55; }
#download-button, .dialog-secondary { display: flex; width: 100%; min-height: 46px; gap: 10px; align-items: center; justify-content: center; padding: 0 14px; border: 0; font-size: 12px; font-weight: 750; }
#download-button { background: var(--coral); color: #180b0b; }
.dialog-secondary { margin-top: 8px; border: 1px solid var(--line); background: transparent; color: var(--paper); cursor: pointer; }

.device-field { display: block; margin-top: 26px; }
.device-field span { display: block; margin-bottom: 7px; color: rgba(7, 17, 39, 0.55); font: 9px/1.2 "Helvetica Neue", Arial, sans-serif; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.device-field select { width: 100%; height: 38px; padding: 0 1px 6px; border: 0; border-bottom: 1px solid rgba(7, 17, 39, 0.36); outline: 0; background: transparent; color: var(--night); font-size: 14px; }
.device-field select:focus { border-color: var(--sunflower); }

.result-copy { overflow-y: auto; }
.result-copy h2 { margin: 12px 0 0; }

.tier-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 26px 0 0; padding: 0; list-style: none; }
.tier { display: flex; height: 100%; gap: 10px; align-items: center; flex-direction: column; width: 100%; padding: 18px 12px 16px; border: 1px solid var(--line); background: rgba(246, 240, 231, 0.04); color: var(--paper); text-align: center; cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
.tier:hover, .tier:focus-visible { border-color: var(--sunflower); background: rgba(214, 154, 0, 0.12); outline: 0; }
.tier svg { display: block; width: 46px; height: auto; }
.tier-copy { display: block; }
.tier-name { display: block; min-height: 2.1em; font: 17px/1.05 "Advercase", Georgia, serif; }
.tier-western { display: block; min-height: 2.6em; margin-top: 6px; color: var(--faint); font-size: 9px; line-height: 1.3; letter-spacing: 0.05em; text-transform: uppercase; }
.tier-note { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.tier-price { margin-top: auto; padding-top: 12px; font: 22px/1 "Advercase", Georgia, serif; color: var(--sunflower); font-variant-numeric: tabular-nums; }
.tier[disabled] { cursor: not-allowed; opacity: 0.45; }
.tier-footnote { margin: 16px 0 0; color: var(--faint); font-size: 10px; line-height: 1.5; }

.restore { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.restore > p:first-child { margin: 0 0 10px; color: var(--faint); font-size: 11px; }
.restore input { font-family: inherit; font-size: 12px; }
.restore-status { min-height: 14px; margin: 8px 0 0; color: var(--faint); font-size: 11px; }
.restore-status[data-state="error"] { color: #ff9d8c; }
.restore-status[data-state="success"] { color: var(--signal); }

.setup-steps { display: grid; gap: 22px; margin: 26px 0 28px; padding: 0 0 0 20px; counter-reset: step; }
.setup-steps li { color: var(--muted); font-size: 12px; line-height: 1.55; }
.setup-steps li::marker { color: var(--sunflower); font-weight: 700; }
.setup-steps h3 { margin: 0 0 8px; color: var(--paper); font: 15px/1.2 "Helvetica Neue", Arial, sans-serif; font-weight: 700; }
.setup-steps p { margin: 0; }
.setup-steps strong { color: var(--paper); font-weight: 700; }
.setup-warning { margin-top: 10px; padding: 10px 12px; border-left: 2px solid var(--sunflower); background: rgba(214, 154, 0, 0.1); color: var(--muted); font-size: 11px; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; flex: 1; height: 40px; padding: 0 10px; border: 1px solid var(--line); background: rgba(4, 9, 20, 0.6); color: var(--paper); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 11px; text-overflow: ellipsis; }
.copy-row button { height: 40px; flex: 0 0 auto; padding: 0 16px; border: 0; background: var(--sunflower); color: #201500; font-size: 11px; font-weight: 800; cursor: pointer; }
.copy-row button[data-copied="true"] { background: var(--signal); }

.site-footer { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; justify-content: space-between; width: min(1100px, 100%); margin: 0 auto; padding: 26px 24px 34px; border-top: 1px solid rgba(7, 17, 39, 0.16); }
.footer-mark { display: flex; margin: 0; }
.footer-mark img { width: 32px; height: 32px; object-fit: contain; filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; opacity: 0.8; }
.site-footer nav { display: flex; gap: 22px; align-items: center; }
.site-footer button, .site-footer a { display: inline-flex; gap: 8px; align-items: center; padding: 0; border: 0; background: transparent; color: rgba(7, 17, 39, 0.62); font-size: 13px; cursor: pointer; }
.site-footer button:hover, .site-footer a:hover { color: var(--night); }
.site-footer svg { width: 18px; height: 18px; }

.privacy-dialog { width: min(640px, calc(100% - 28px)); max-height: min(84vh, 760px); padding: 46px 44px 40px; overflow-y: auto; background: var(--paper); }
.privacy-dialog h2 { margin: 0 0 18px; font: 42px/0.95 "Advercase", Georgia, serif; }
.privacy-dialog h3 { margin: 26px 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: rgba(7, 17, 39, 0.55); }
.privacy-dialog p { margin: 0; color: rgba(7, 17, 39, 0.78); font-size: 14px; line-height: 1.6; }
.privacy-dialog a { text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 980px) {
  .site-header { left: 0; width: 100%; transform: none; }
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .intro h1 { width: 440px; }
  .intro h1 > span:first-child { font-size: 21px; }
  .intro h1 > span:last-child { font-size: 37px; }
  .wallpaper-stage { height: min(82vh, 820px); margin-right: -8px; }
}

@media (max-width: 720px) {
  .site-header { right: 10px; left: 10px; width: auto; padding-inline: 14px 6px; }
  .site-header nav { gap: 15px; }
  .workspace { display: block; min-height: 0; padding: 0; }
  .intro { min-height: 0; padding: 124px 26px 0; }
  .intro h1 { width: 100%; }
  .intro h1 > span:first-child { font-size: clamp(17px, 4.6vw, 22px); }
  .intro h1 > span:last-child { margin-top: 10px; font-size: clamp(31px, 8.6vw, 44px); }
  .calibrate-button { min-height: 50px; margin-top: 26px; padding: 0 24px; }
  .transformation { min-height: 0; margin: 0; padding: 0; justify-content: flex-end; }
  .wallpaper-stage { width: min(66vw, 292px); height: auto; max-height: none; margin: -22px -16px 0 auto; }
  .wallpaper-stage img { width: 100%; height: auto; }
  .generator-dialog[open], .result-dialog[open] { display: block; max-height: calc(100vh - 28px); overflow-y: auto; }
  .setup-heading { min-height: 250px; padding: 54px 24px 34px; }
  .setup-heading h2 { margin: 0; font-size: 56px; }
  #generator-form { min-height: 680px; padding: 36px 24px 24px; }
  .sentence-fields { grid-template-columns: 1fr; }
  .joiner { padding: 0; }
  .background-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-footer { align-items: stretch; flex-direction: column; }
  .generate-button { width: 100%; }
  .result-image-wrap { height: 390px; }
  .result-copy { padding: 34px 24px; }
  .tier { padding: 14px 8px 12px; }
  .tier svg { width: 38px; }
  .tier-name { font-size: 15px; }
  .tier-price { padding-top: 10px; font-size: 19px; }
  .site-footer { padding: 22px 26px 30px; }
  .privacy-dialog { padding: 40px 24px 30px; }
  .privacy-dialog h2 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
