:root {
  --ink: #241321;
  --paper: #fffaf6;
  --paper-strong: #ffffff;
  --hot: #ff4f5e;
  --orange: #ff8b48;
  --violet: #7b4dff;
  --violet-deep: #35264e;
  --line: #eadfe7;
  --muted: #786a76;
  --soft: #f5edf3;
  --shadow: 0 24px 70px rgba(36, 19, 33, .15);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #e9e4eb; }

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 79, 94, .10), transparent 26rem),
    radial-gradient(circle at 92% 92%, rgba(123, 77, 255, .10), transparent 30rem),
    #e9e4eb;
}

button { color: inherit; font: inherit; }
button:focus-visible { outline: 3px solid rgba(123, 77, 255, .38); outline-offset: 3px; }

.app-shell {
  width: min(100%, 1240px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.screen { display: none; min-height: 100dvh; }
.screen.active { display: flex; }

.brandbar,
.quiz-header,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand,
.quiz-brand {
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: 1;
}

.brand { font-size: clamp(1.05rem, 2vw, 1.35rem); }
.quiz-brand { font-size: 1rem; }
.brand span, .quiz-brand span { color: var(--hot); }

.brand-note,
.question-count,
.result-header > span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.welcome-screen { min-height: 100dvh; }
.welcome-copy { display: flex; flex: 1 1 55%; flex-direction: column; padding: clamp(1.4rem, 4.2vw, 4.25rem); }
.brandbar { margin-bottom: clamp(2rem, 6vh, 5.5rem); }
.welcome-content { width: min(100%, 39rem); margin: auto 0; }

.eyebrow,
.question-kicker {
  margin: 0 0 .75rem;
  color: var(--hot);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.welcome-content h1 {
  margin: 0;
  font-size: clamp(3.15rem, 6.5vw, 6.6rem);
  line-height: .86;
  letter-spacing: -.078em;
}

.welcome-content h1 em { color: var(--hot); font-style: normal; }

.welcome-content h2 {
  margin: 1.15rem 0 .75rem;
  color: var(--violet);
  font-size: clamp(1.5rem, 2.3vw, 2.2rem);
  letter-spacing: -.045em;
}

.lead {
  max-width: 36rem;
  margin: 0 0 1.35rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.1rem);
  line-height: 1.55;
}

.gender-prompt { margin-bottom: .65rem; font-weight: 850; }
.gender-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }

.gender-card {
  position: relative;
  display: flex;
  min-height: 9.8rem;
  align-items: flex-end;
  justify-content: space-between;
  overflow: hidden;
  padding: 1.15rem;
  border: 0;
  border-radius: 1.4rem;
  color: white;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(36, 19, 33, .14);
  transition: transform .18s ease, box-shadow .18s ease;
}

.gender-card:hover { transform: translateY(-3px); box-shadow: 0 20px 38px rgba(36, 19, 33, .2); }
.gender-card:active { transform: scale(.985); }
.gender-card::before,
.gender-card::after {
  position: absolute;
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 50%;
  content: "";
}
.gender-card::before { width: 9rem; height: 9rem; right: -3.2rem; top: -1.7rem; }
.gender-card::after { width: 5.2rem; height: 5.2rem; right: .7rem; top: .2rem; }
.gender-female { background: linear-gradient(145deg, #ff7890 0%, var(--hot) 48%, var(--orange) 100%); }
.gender-male { background: linear-gradient(145deg, var(--violet-deep) 0%, #513b8f 48%, var(--violet) 100%); }
.gender-symbol { align-self: flex-start; font-size: 2.4rem; font-weight: 300; opacity: .95; }
.gender-copy { position: relative; z-index: 1; }
.gender-copy strong { display: block; margin-bottom: .3rem; font-size: 1.35rem; letter-spacing: -.04em; }
.gender-copy small { display: block; font-size: .78rem; line-height: 1.35; opacity: .86; }
.instant-note { margin: .75rem 0 0; color: var(--muted); font-size: .76rem; text-align: center; }

.welcome-art {
  position: relative;
  flex: 1 1 45%;
  min-width: 24rem;
  overflow: hidden;
  background: linear-gradient(150deg, var(--hot), var(--violet));
}
.welcome-art::after { position: absolute; z-index: 1; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(36, 19, 33, .3)); content: ""; }
.welcome-art picture { display: block; width: 100%; height: 100%; }
.welcome-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.art-badge { position: absolute; z-index: 2; right: 2.3rem; bottom: 2.3rem; color: white; text-align: right; }
.art-badge span { display: block; font-size: .78rem; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.art-badge strong { display: block; margin-top: .45rem; font-size: clamp(2rem, 4vw, 4rem); line-height: .88; letter-spacing: -.06em; }

.quiz-screen { flex-direction: column; padding: clamp(1.15rem, 3vw, 2.25rem); }
.quiz-header { min-height: 2.3rem; }
.back-button { min-height: 2.5rem; padding: .45rem 0; border: 0; background: none; color: var(--muted); font-size: .88rem; font-weight: 800; cursor: pointer; }
.progress-track { height: .38rem; margin: 1rem 0 clamp(1.5rem, 4vh, 3.4rem); overflow: hidden; border-radius: 999px; background: var(--soft); }
.progress-fill { width: 10%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hot), var(--orange), var(--violet)); transition: width .35s ease; }

.question-layout { display: grid; flex: 1; grid-template-columns: minmax(0, 1.22fr) minmax(20rem, .78fr); gap: clamp(1.3rem, 4vw, 4.5rem); }
.question-main { display: flex; flex-direction: column; padding: clamp(.2rem, 2vw, 1.3rem) clamp(.1rem, 2vw, 1.5rem); }
.question-main h1 { max-width: 48rem; margin: 0 0 1.5rem; font-size: clamp(2.2rem, 4.1vw, 4.5rem); line-height: .98; letter-spacing: -.062em; }

.answers { display: grid; gap: .65rem; width: 100%; max-width: 50rem; }
.answer {
  display: grid;
  min-height: 4.3rem;
  grid-template-columns: 2.35rem 1fr 1.35rem;
  gap: .85rem;
  align-items: center;
  padding: .85rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 1rem;
  background: rgba(255,255,255,.78);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.34;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.answer:hover { transform: translateY(-1px); border-color: rgba(255,79,94,.55); box-shadow: 0 8px 20px rgba(36,19,33,.06); }
.answer-letter { display: grid; width: 2.15rem; height: 2.15rem; place-items: center; border-radius: .72rem; background: var(--soft); color: var(--hot); font-size: .78rem; font-weight: 950; }
.answer-check { width: 1.2rem; height: 1.2rem; border: 1.5px solid #cfbfca; border-radius: 50%; }
.answer.selected { border-color: var(--hot); background: #fff0f1; box-shadow: 0 10px 24px rgba(255,79,94,.10); }
.answer.selected .answer-check { border: .34rem solid var(--hot); background: white; }
.answer.visual-answer { min-height: 5.4rem; grid-template-columns: 3.7rem 2.35rem 1fr 1.35rem; }
.mood-swatch { width: 3.7rem; height: 3.7rem; border-radius: .9rem; box-shadow: inset 0 0 0 1px rgba(255,255,255,.42); }
.mood-morning { background: linear-gradient(145deg, #eef8ff, #fff7d6 56%, #bfe8f5); }
.mood-city { background: linear-gradient(145deg, #ffcc58, #ff5b7e 55%, #7b4dff); }
.mood-evening { background: linear-gradient(145deg, #29152e, #7a315f 56%, #de8d72); }
.mood-wood { background: linear-gradient(145deg, #2d211f, #75513b 55%, #bd8d5a); }

.continue-button,
.restart-button,
.explain-button {
  min-height: 3.55rem;
  border-radius: .95rem;
  font-weight: 900;
  cursor: pointer;
}
.continue-button { width: min(100%, 22rem); margin-top: auto; padding: .8rem 1.4rem; border: 0; background: var(--ink); color: white; box-shadow: 0 14px 28px rgba(36,19,33,.2); }
.continue-button::after { content: "  →"; }
.continue-button:disabled { opacity: .28; cursor: default; box-shadow: none; }

.question-aside {
  position: relative;
  min-height: 32rem;
  overflow: hidden;
  border-radius: 2rem;
  background: #2c2430;
  box-shadow: 0 22px 55px rgba(82, 47, 96, .17);
}
.question-picture { position: absolute; inset: 0; display: block; }
.question-picture img { display: block; width: 100%; height: 100%; object-fit: cover; }
.question-image-shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(180deg, rgba(25,17,23,.18) 0%, transparent 42%, rgba(25,17,23,.76) 100%);
}
.scent-orbit { position: absolute; border: 1px solid rgba(255,255,255,.36); border-radius: 50%; }
.orbit-one { width: 23rem; height: 23rem; right: -7rem; top: -5rem; }
.orbit-two { width: 15rem; height: 15rem; right: 2rem; top: 2rem; }
.aside-copy { position: absolute; z-index: 2; right: 1.7rem; bottom: 1.8rem; left: 1.7rem; color: white; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.aside-copy span { display: block; margin-bottom: .55rem; font-size: .74rem; font-weight: 900; letter-spacing: .15em; text-transform: uppercase; }
.aside-copy strong { display: block; font-size: clamp(2rem, 3.5vw, 3.6rem); line-height: .92; letter-spacing: -.055em; }

.transition-screen { align-items: center; justify-content: center; flex-direction: column; padding: 2rem; background: radial-gradient(circle at center, #fff 0%, #fffaf6 48%, #f5edf4 100%); text-align: center; }
.transition-screen p { max-width: 45rem; margin: 1.3rem 0; font-size: clamp(1.7rem, 3.4vw, 3.4rem); font-weight: 850; line-height: 1.05; letter-spacing: -.05em; }
.transition-mark { width: 3.5rem; height: .18rem; border-radius: 999px; background: linear-gradient(90deg, var(--hot), var(--violet)); }

.analysis-screen { align-items: center; justify-content: center; padding: clamp(1rem, 4vw, 4rem); background: radial-gradient(circle at 80% 15%, rgba(123,77,255,.13), transparent 28rem), var(--paper); }
.analysis-card { width: min(100%, 48rem); padding: clamp(1.5rem, 5vw, 4.5rem); border: 1px solid var(--line); border-radius: 2rem; background: rgba(255,255,255,.72); box-shadow: 0 24px 70px rgba(36,19,33,.08); }
.analysis-copy h1 { margin: 0 0 1.5rem; font-size: clamp(2.4rem, 5vw, 5rem); line-height: .95; letter-spacing: -.065em; }
.score-bars { display: grid; gap: .8rem; }
.score-row { display: grid; grid-template-columns: 7rem 1fr 3rem; gap: .8rem; align-items: center; }
.score-row span { color: var(--muted); font-size: .78rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.score-track { height: .45rem; overflow: hidden; border-radius: 999px; background: var(--line); }
.score-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--hot), var(--orange), var(--violet)); transition: width 1.5s cubic-bezier(.2,.7,.2,1); }
.score-value { text-align: right; }
.analysis-code { min-height: 2.2rem; margin: 1.6rem 0 0; color: var(--hot); font-size: 1.3rem; font-weight: 900; }

.result-screen { flex-direction: column; padding: clamp(1.3rem, 4vw, 4rem); }
.result-header { padding-bottom: 1.8rem; border-bottom: 1px solid var(--line); }
.result-hero { width: min(100%, 60rem); padding: clamp(2.2rem, 6vh, 5rem) 0 2.4rem; }
.result-hero h1 { margin: 0; color: var(--hot); font-size: clamp(3rem, 7vw, 6.5rem); line-height: .88; letter-spacing: -.075em; }
.result-subtitle { margin: 1rem 0 .65rem; font-size: clamp(1.25rem, 2vw, 1.75rem); font-weight: 850; }
.result-description { max-width: 55rem; margin: 0; font-size: 1.03rem; line-height: 1.6; }
.result-menu-heading { max-width: 51rem; margin: 0 0 1.25rem; }
.result-menu-heading .eyebrow { margin-bottom: .4rem; }
.result-menu-heading h2 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.7rem); line-height: 1.05; letter-spacing: -.045em; }
.perfume-menu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.perfume-card { position: relative; display: flex; min-height: 31rem; flex-direction: column; overflow: hidden; padding: 1.35rem; border: 1px solid var(--line); border-radius: 1.35rem; background: white; box-shadow: 0 12px 32px rgba(36,19,33,.06); }
.perfume-card::before { position: absolute; width: 8rem; height: 8rem; right: -3rem; top: -3.5rem; border-radius: 50%; background: linear-gradient(145deg, rgba(255,79,94,.18), rgba(123,77,255,.17)); content: ""; }
.perfume-card .perfume-role { position: relative; display: block; margin-bottom: 2.1rem; color: var(--hot); font-size: .72rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.perfume-brand { position: relative; display: block; margin-bottom: .35rem; color: var(--violet); font-size: .72rem; font-weight: 950; letter-spacing: .13em; text-transform: uppercase; }
.perfume-card strong { position: relative; display: block; font-size: clamp(1.25rem, 2vw, 1.7rem); line-height: 1.05; letter-spacing: -.04em; }
.perfume-card p { position: relative; margin: .65rem 0 0; color: var(--muted); line-height: 1.42; }
.perfume-card .perfume-family { margin-top: .55rem; color: var(--ink); font-size: .76rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.perfume-description { font-size: .92rem; }
.perfume-card .perfume-notes,
.perfume-card .perfume-fit { padding-top: .7rem; border-top: 1px solid var(--line); font-size: .84rem; }
.perfume-card .perfume-fit { margin-bottom: 1.15rem; }
.perfume-history-link {
  position: relative;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  padding: .65rem .85rem;
  border: 1px solid #177a5d;
  border-radius: .6rem;
  background: transparent;
  color: #177a5d;
  font-size: .875rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.perfume-history-link:hover,
.perfume-history-link:focus-visible {
  border-color: #12684e;
  background: #177a5d;
  color: white;
}
.perfume-history-link:focus-visible {
  outline: 3px solid rgba(23,122,93,.22);
  outline-offset: 3px;
}
.result-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.restart-button { padding: .85rem 1.4rem; border: 0; background: var(--ink); color: white; }
.explain-button { padding: .85rem 1.4rem; border: 1.5px solid var(--line); background: transparent; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(36,19,33,.58); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: min(100%, 38rem); max-height: 88dvh; overflow: auto; padding: clamp(1.4rem, 4vw, 2.5rem); border-radius: 1.5rem; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.modal h2 { margin: 0 0 1.4rem; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.055em; }
.modal-close { position: absolute; top: .8rem; right: .9rem; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 50%; background: var(--soft); font-size: 1.6rem; cursor: pointer; }
.modal .score-row { margin-bottom: .75rem; }
.modal > p:last-child { margin: 1.3rem 0 0; color: var(--muted); line-height: 1.55; }

.library-body { min-height: 100dvh; background: var(--paper); }
.library-shell { min-height: 100dvh; }
.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.15rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255,250,246,.92);
}
.library-header > span { color: var(--muted); font-size: .74rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.library-section-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: .72rem 1rem;
  border: 1px solid #177a5d;
  border-radius: .75rem;
  background: transparent;
  color: #177a5d;
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.library-section-link:hover {
  border-color: #12684e;
  background: #177a5d;
  color: white;
  box-shadow: 0 8px 20px rgba(23,122,93,.18);
  transform: translateY(-1px);
}
.library-section-link:focus-visible {
  outline: 3px solid rgba(23,122,93,.22);
  outline-offset: 3px;
}
.library-brand { color: var(--ink); font-size: 1.25rem; font-weight: 950; letter-spacing: -.055em; line-height: 1; text-decoration: none; }
.library-brand span { color: var(--hot); }
.history-article { width: min(100% - 2.4rem, 74rem); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4.5rem) 0 2rem; }
.history-back { display: inline-block; margin-bottom: clamp(2rem, 4vw, 4rem); color: var(--muted); font-size: .88rem; font-weight: 850; text-decoration: none; }
.history-back:hover { color: var(--hot); }
.history-layout { display: grid; grid-template-columns: minmax(17rem, .75fr) minmax(0, 1.35fr); gap: clamp(2rem, 7vw, 7rem); align-items: start; }
.history-identity { position: sticky; top: 2rem; }
.history-filter-link { text-decoration: none; transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease; }
.history-brand-link { display: inline-block; }
.history-brand-link,
.history-perfumer-link { text-decoration: underline; text-decoration-color: rgba(123,77,255,.26); text-decoration-thickness: 1px; text-underline-offset: .24rem; }
.history-brand-link:hover,
.history-perfumer-link:hover { color: var(--hot); text-decoration: underline; text-underline-offset: .24rem; }
.history-filter-link:focus-visible { outline: 3px solid rgba(123,77,255,.2); outline-offset: 4px; border-radius: .3rem; }
.history-identity h1 { margin: 0; font-size: clamp(3.2rem, 7vw, 6.8rem); line-height: .84; letter-spacing: -.075em; overflow-wrap: anywhere; }
.history-family { margin: 1.4rem 0 .7rem; color: var(--violet); font-weight: 850; line-height: 1.45; }
.history-perfumer { margin: 0 0 .9rem; color: var(--muted); font-size: .86rem; font-weight: 760; line-height: 1.5; }
.history-perfumer-link { color: inherit; }
.history-year { display: inline-flex; padding: .48rem .72rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .76rem; font-weight: 850; }
.history-year:hover { border-color: var(--violet); background: rgba(123,77,255,.055); color: var(--violet); box-shadow: 0 6px 16px rgba(123,77,255,.09); }
.history-year[hidden] { display: none; }
.history-copy { display: grid; gap: 2.3rem; }
.history-copy section { padding-bottom: 2.2rem; border-bottom: 1px solid var(--line); }
.history-lead { margin: 0; font-size: clamp(1.12rem, 1.35vw, 1.34rem); font-weight: 650; line-height: 1.62; letter-spacing: -.012em; }
.note-list { display: flex; flex-wrap: wrap; gap: .55rem; }
.note-list span { padding: .58rem .8rem; border-radius: 999px; background: var(--soft); color: var(--violet-deep); font-size: .83rem; font-weight: 850; }
.history-story { display: grid; gap: 1rem; }
.history-story p { margin: 0; color: var(--muted); font-size: 1.02rem; line-height: 1.68; }
.history-principle { padding: clamp(1.3rem, 3vw, 2.1rem); border-radius: 1.4rem; background: linear-gradient(145deg, #37264e, #7b4dff); color: white; box-shadow: 0 18px 45px rgba(53,38,78,.19); }
.history-principle span { display: block; margin-bottom: .8rem; color: rgba(255,255,255,.72); font-size: .7rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.history-principle strong { display: block; font-size: clamp(1.25rem, 2.3vw, 2rem); line-height: 1.2; letter-spacing: -.035em; }
.history-principle p { margin: 1rem 0 0; color: rgba(255,255,255,.76); line-height: 1.55; }
.history-legal { margin: clamp(3rem, 7vw, 6rem) 0 0; padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; line-height: 1.5; }
.history-missing { width: min(100% - 2.4rem, 48rem); margin: 0 auto; padding: 12vh 0; }
.history-missing h1 { margin: 0 0 1rem; font-size: clamp(3rem, 8vw, 6rem); line-height: .9; letter-spacing: -.07em; }
.history-missing p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.history-missing a { display: inline-block; margin-top: .5rem; color: var(--violet); font-weight: 900; }

.library-index { width: min(100% - 2.4rem, 78rem); margin: 0 auto; padding: clamp(2.5rem, 6vw, 6rem) 0; }
.library-intro { max-width: 57rem; }
.library-intro h1 { margin: 0; font-size: clamp(3.4rem, 8vw, 7.8rem); line-height: .85; letter-spacing: -.078em; }
.library-intro > p:last-child { max-width: 48rem; margin: 1.35rem 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.65; }
.library-tools {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .8rem;
  margin: clamp(2.2rem, 5vw, 4.5rem) 0 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: white;
  box-shadow: 0 16px 45px rgba(36,19,33,.06);
  scroll-margin-top: 1rem;
}
.library-tools:target { border-color: rgba(123,77,255,.36); box-shadow: 0 16px 45px rgba(36,19,33,.06), 0 0 0 4px rgba(123,77,255,.07); }
.library-tools label { display: grid; gap: .42rem; }
.library-tools label > span { color: var(--muted); font-size: .75rem; font-weight: 850; letter-spacing: .06em; }
.library-search { grid-column: 1 / -1; }
.library-tools input,
.library-tools select {
  width: 100%;
  min-height: 3.25rem;
  padding: .72rem .8rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  outline: none;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.library-tools input:focus,
.library-tools select:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(123,77,255,.12); }
.library-reset { min-height: 3.25rem; align-self: end; padding: .72rem 1rem; border: 0; border-radius: .8rem; background: var(--ink); color: white; font: inherit; font-size: .88rem; font-weight: 900; cursor: pointer; }
.library-reset:disabled { opacity: .28; cursor: default; }
.library-summary { display: flex; align-items: center; justify-content: flex-start; gap: .7rem; width: max-content; max-width: 100%; margin: 1.35rem 0 1rem; padding: .72rem .95rem; border: 1px solid rgba(123,77,255,.24); border-radius: .8rem; background: rgba(123,77,255,.045); }
.library-summary::before { color: var(--violet); font-size: 1rem; content: "◌"; }
.library-summary strong { font-size: 1.2rem; }
.library-summary span { color: var(--ink); font-size: .9rem; font-weight: 760; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.library-card { display: flex; min-height: 24rem; flex-direction: column; padding: 1.35rem; border: 1px solid var(--line); border-radius: 1.25rem; background: white; box-shadow: 0 10px 30px rgba(36,19,33,.05); }
.library-card-meta { display: flex; align-items: center; justify-content: space-between; gap: .8rem; color: var(--hot); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.library-card h2 { margin: 1.7rem 0 .6rem; font-size: clamp(1.5rem, 2.6vw, 2.2rem); line-height: .98; letter-spacing: -.045em; }
.library-card-family { margin: 0; color: var(--violet); font-size: .82rem; font-weight: 850; line-height: 1.4; text-transform: uppercase; }
.library-card-description { display: -webkit-box; overflow: hidden; margin: 1rem 0 0; color: var(--muted); font-size: 1rem; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.library-card-author { margin: 1rem 0 0; padding-top: .85rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; line-height: 1.45; }
.library-card a { width: max-content; margin-top: auto; padding-top: 1.2rem; color: var(--violet); font-size: .9rem; font-weight: 900; text-underline-offset: .25rem; }
.library-empty { padding: 4rem 1.5rem; border: 1px dashed var(--line); border-radius: 1.4rem; text-align: center; }
.library-empty h2 { margin: 0; font-size: 2rem; }
.library-empty p { margin: .7rem 0 0; color: var(--muted); }

@media (max-width: 820px) {
  body { background: var(--paper); }
  .app-shell { width: 100%; box-shadow: none; }
  .welcome-screen { flex-direction: column; }
  .welcome-copy { min-height: 100dvh; padding: calc(1rem + env(safe-area-inset-top)) 1.15rem calc(1rem + env(safe-area-inset-bottom)); }
  .brandbar { margin-bottom: 1.8rem; }
  .welcome-content { display: flex; flex: 1; flex-direction: column; }
  .welcome-content h1 { font-size: clamp(3.05rem, 15vw, 4.5rem); }
  .welcome-content h2 { margin-top: .9rem; }
  .lead { font-size: .98rem; }
  .gender-prompt { margin-top: auto; }
  .gender-card { min-height: 12.6rem; padding: 1rem; }
  .gender-copy strong { font-size: 1.25rem; }
  .welcome-art { display: none; }

  .quiz-screen { padding: calc(.85rem + env(safe-area-inset-top)) 1rem calc(.85rem + env(safe-area-inset-bottom)); }
  .quiz-header { position: sticky; z-index: 4; top: 0; background: rgba(255,250,246,.94); backdrop-filter: blur(12px); }
  .progress-track { margin: .65rem 0 1.25rem; }
  .question-layout { display: block; }
  .question-main { min-height: calc(100dvh - 5.4rem); padding: 0; }
  .question-main h1 { margin-bottom: 1rem; font-size: clamp(2rem, 9.6vw, 3.05rem); }
  .answers { gap: .55rem; }
  .answer { min-height: 3.9rem; grid-template-columns: 2.15rem 1fr 1.25rem; gap: .65rem; padding: .72rem .78rem; border-radius: .9rem; font-size: .94rem; }
  .answer.visual-answer { grid-template-columns: 3.1rem 2rem 1fr 1.2rem; padding: .62rem; }
  .mood-swatch { width: 3.1rem; height: 3.1rem; border-radius: .75rem; }
  .answer-letter { width: 2rem; height: 2rem; }
  .continue-button { width: 100%; margin-top: 1rem; min-height: 3.7rem; position: sticky; bottom: max(.6rem, env(safe-area-inset-bottom)); z-index: 3; }
  .question-aside { display: none; }

  .analysis-card { padding: 1.35rem; border-radius: 1.35rem; }
  .analysis-copy { width: 100%; }
  .analysis-copy h1 { font-size: 2.6rem; }

  .result-header > span { display: none; }
  .result-hero { padding: 2.6rem 0 1.8rem; }
  .result-hero h1 { font-size: clamp(3.1rem, 15vw, 5.2rem); }
  .result-menu-heading { margin-top: .25rem; }
  .perfume-menu { grid-template-columns: 1fr; }
  .perfume-card { min-height: 0; }
  .result-actions { flex-direction: column; }
  .restart-button, .explain-button { width: 100%; }

  .library-header { padding: 1rem 1.15rem; }
  .library-section-link { min-height: 2.55rem; padding: .62rem .72rem; font-size: .61rem; letter-spacing: .08em; }
  .library-header > span { font-size: .62rem; }
  .history-article { width: min(100% - 2rem, 74rem); padding-top: 1.25rem; }
  .history-back { margin-bottom: 2rem; }
  .history-layout { grid-template-columns: 1fr; gap: 2.6rem; }
  .history-identity { position: static; }
  .history-identity h1 { font-size: clamp(3.2rem, 16vw, 5.4rem); }
  .history-copy { gap: 1.8rem; }
  .history-copy section { padding-bottom: 1.7rem; }
  .history-lead { font-size: 1.25rem; font-weight: 720; line-height: 1.47; letter-spacing: -.025em; }

  .library-index { width: min(100% - 2rem, 78rem); padding-top: 2.5rem; }
  .library-intro h1 { font-size: clamp(3.2rem, 16vw, 5.4rem); }
  .library-tools { grid-template-columns: 1fr; padding: .8rem; }
  .library-search { grid-column: auto; }
  .library-summary { align-items: center; flex-direction: row; gap: .65rem; width: 100%; }
  .library-grid { grid-template-columns: 1fr; }
  .library-card { min-height: 0; }
}

@media (min-width: 821px) and (max-width: 1080px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* На телефоне фотография вопроса возвращается при повороте экрана. */
@media (orientation: landscape) and (min-width: 560px) and (max-width: 950px) and (max-height: 600px) {
  .quiz-screen {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    padding: calc(.55rem + env(safe-area-inset-top)) calc(.8rem + env(safe-area-inset-right)) calc(.55rem + env(safe-area-inset-bottom)) calc(.8rem + env(safe-area-inset-left));
  }
  .quiz-header { position: static; min-height: 2rem; }
  .back-button { min-height: 2rem; padding: .2rem 0; font-size: .76rem; }
  .quiz-brand { font-size: .88rem; }
  .question-count { font-size: .66rem; }
  .progress-track { height: .28rem; margin: .35rem 0 .6rem; }
  .question-layout {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1.5fr) minmax(11.5rem, .7fr);
    gap: clamp(.7rem, 2vw, 1.15rem);
    align-items: stretch;
  }
  .question-main { min-height: 0; padding: 0; }
  .question-kicker { margin-bottom: .35rem; font-size: .64rem; }
  .question-main h1 { margin-bottom: .65rem; font-size: clamp(1.45rem, 4vw, 2.25rem); line-height: .94; }
  .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem; }
  .answer {
    min-height: 2.8rem;
    grid-template-columns: 1.75rem 1fr 1rem;
    gap: .5rem;
    padding: .45rem .58rem;
    border-radius: .72rem;
    font-size: clamp(.78rem, 1.65vw, .9rem);
    line-height: 1.2;
  }
  .answer-letter { width: 1.65rem; height: 1.65rem; border-radius: .5rem; font-size: .65rem; }
  .answer-check { width: .95rem; height: .95rem; }
  .answer.visual-answer { min-height: 3.25rem; grid-template-columns: 2.55rem 1fr 1rem; padding: .35rem .45rem; }
  .answer.visual-answer .answer-letter { display: none; }
  .mood-swatch { width: 2.55rem; height: 2.55rem; border-radius: .58rem; }
  .continue-button { width: min(100%, 18rem); min-height: 2.8rem; margin-top: .55rem; padding: .5rem 1rem; border-radius: .72rem; font-size: .86rem; }
  .question-aside { display: block; min-height: 0; border-radius: 1.15rem; box-shadow: 0 12px 30px rgba(82,47,96,.15); }
  .aside-copy { display: none; }
}

@media (max-width: 380px) {
  .brand-note { font-size: .65rem; }
  .welcome-content h1 { font-size: 2.85rem; }
  .gender-grid { gap: .55rem; }
  .gender-card { min-height: 11.2rem; }
  .gender-copy small { font-size: .7rem; }
  .question-main h1 { font-size: 1.85rem; }
  .answer { font-size: .88rem; }
}

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