/* FONT VARIANT B: Inter for all text (real Inter Italic vendored) */
@font-face { font-family: "Inter"; src: url("fonts/Inter.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --bg: #0E0E10;
  --surface: #1D1D21;
  --gold: #D4AF37;
  --gold-hi: #E8C766;
  --sand: #F1E3BC;
  --mist: #7A7160;        /* lines, borders */
  --mist-text: #A89F8E;   /* secondary text: warm grey, >= 6:1 on surfaces */
  --sh-dark: #000000;
  --sh-light: #2D2D33;
  --raise: 6px 6px 14px var(--sh-dark), -5px -5px 12px var(--sh-light), inset 0 1px 0 rgba(241,227,188,.06);
  --raise-sm: 4px 4px 9px var(--sh-dark), -3px -3px 8px var(--sh-light), inset 0 1px 0 rgba(241,227,188,.05);
  --inset: inset 4px 4px 9px var(--sh-dark), inset -3px -3px 8px var(--sh-light);
  --radius: 22px;
  --serif: var(--sans); /* Variant B: single family (Inter) */
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { position: relative;
  background: var(--bg);
  color: var(--sand);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
  font-feature-settings: "lnum" 1;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }

.sky { position: absolute; inset: 0; min-height: 100vh; z-index: 0; pointer-events: none; background: radial-gradient(120% 80% at 50% 0%, #1C1A15 0%, var(--bg) 55%, #09090B 100%); }
.sky svg { width: 100%; height: 100%; }

.topbar {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  max-width: 560px; margin: 0 auto; padding: 16px 20px 0;
}
.brand { font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: .04em; color: var(--gold); text-decoration: none; }
.brand.is-hidden { visibility: hidden; }
.lang {
  display: inline-flex; padding: 4px; border-radius: 999px; background: var(--bg); box-shadow: var(--inset);
}
.lang button {
  border: 0; background: transparent; padding: 6px 13px; border-radius: 999px; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--mist-text);
  transition: all .2s ease;
}
.lang button[aria-pressed="true"] { background: var(--surface); color: var(--gold); box-shadow: var(--raise-sm); }

main { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 8px 20px 0; }
.screen { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 16px; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--mist-text); font-weight: 500; }
.title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 52px; line-height: 1.02; color: var(--sand); letter-spacing: .01em; }
.title-md { font-size: 40px; }
.subtitle { margin: 10px 0 22px; font-family: var(--serif); font-style: italic; font-size: 22px; line-height: 1.3; color: var(--gold); max-width: 22em; }
.subtitle.sm { font-size: 19px; }
.h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 28px; color: var(--sand); }
.muted { margin: 0 0 18px; color: var(--mist-text); font-size: 14px; }
.note { margin: 6px 0 0; font-size: 12.5px; color: var(--mist-text); display: flex; gap: 6px; align-items: flex-start; text-align: left; line-height: 1.45; }
.note.center { justify-content: center; text-align: center; }

.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.note .ico { width: 14px; height: 14px; margin-top: 1px; color: var(--gold); }
.ico.flip { transform: scaleX(-1); }

.raised-circle { border-radius: 50%; background: var(--surface); box-shadow: var(--raise); }
.hero-glyph { width: 96px; height: 96px; display: grid; place-items: center; margin: 6px 0 18px; }
.hero-glyph .glyph { width: 62px; height: 62px; }

.glyph line { stroke: var(--mist); stroke-width: 1.1; }
.glyph circle { fill: var(--sand); }
.glyph circle.big { fill: var(--gold); }

.panel {
  width: 100%; background: var(--surface); border-radius: var(--radius); box-shadow: var(--raise);
  padding: 22px 20px; text-align: left;
}
.landing-form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mist-text); font-weight: 600; }
.req { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--gold); }
.input {
  width: 100%; border: 0; outline: 0; border-radius: 14px; background: var(--bg); box-shadow: var(--inset);
  padding: 13px 16px; font-size: 15px; color: var(--sand); resize: vertical;
}
.input::placeholder { color: #8A8275; }
.input:focus { box-shadow: var(--inset), 0 0 0 1.5px rgba(212,175,55,.55); }

.photo-row { display: flex; gap: 16px; align-items: center; }
.photo-drop {
  width: 84px; height: 84px; flex: none; border-radius: 50%; background: var(--bg); box-shadow: var(--inset);
  display: grid; place-items: center; cursor: pointer; overflow: hidden; position: relative;
}
.photo-drop::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--gold); opacity: .8; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty { width: 40px; height: 40px; fill: none; stroke: var(--mist); stroke-width: 1.6; stroke-linecap: round; }
.photo-side { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; justify-content: space-between; }
.chip {
  flex: 1 1 auto; text-align: center; font-size: 12px; color: var(--sand); padding: 9px 8px; border-radius: 999px;
  background: var(--bg); box-shadow: var(--inset); white-space: nowrap;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none; border-radius: 16px; padding: 14px 20px;
  font-size: 15px; font-weight: 600; letter-spacing: .02em; transition: box-shadow .18s ease, transform .18s ease, background .18s;
}
.btn-gold { background: linear-gradient(145deg, var(--gold-hi), var(--gold) 60%, #B8912E); color: #0E0E10; box-shadow: var(--raise); }
.btn-gold:active { box-shadow: inset 3px 3px 7px rgba(0,0,0,.28), inset -2px -2px 6px rgba(255,238,190,.35); transform: translateY(1px); }
.btn-gold:disabled { opacity: .45; cursor: default; box-shadow: var(--raise-sm); }
.btn-soft { background: var(--surface); color: var(--sand); box-shadow: var(--raise); }
.btn-soft:active { box-shadow: var(--inset); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 12px; box-shadow: var(--raise-sm); }
.btn-block { width: 100%; font-size: 16px; padding: 16px; }

.disclaimer { margin: 18px 0 0; font-size: 12.5px; color: var(--mist-text); }

/* quiz */
.progress-wrap { width: 100%; margin-bottom: 18px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--mist-text); margin-bottom: 8px; font-weight: 600; }
.progress { height: 12px; border-radius: 999px; background: var(--bg); box-shadow: var(--inset); padding: 3px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #B8912E, var(--gold-hi)); width: 5%; transition: width .4s ease; box-shadow: 0 0 10px rgba(212,175,55,.35); }
.quiz-card { padding: 24px 20px 22px; }
.q-num { margin: 0 0 8px; font-family: var(--serif); font-size: 18px; color: var(--gold); font-style: italic; }
.q-text { margin: 0 0 6px; font-family: var(--serif); font-weight: 600; font-size: 29px; line-height: 1.18; color: var(--sand); }
.q-hint { margin: 0 0 20px; font-size: 13px; color: var(--mist-text); }
.options { display: flex; flex-direction: column; gap: 14px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-radius: 18px; padding: 16px 16px; background: var(--surface); box-shadow: var(--raise);
  font-size: 15px; line-height: 1.4; color: var(--sand); transition: box-shadow .2s ease, color .2s;
}
.option .key {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--gold); background: var(--bg); box-shadow: var(--inset);
}
.option[aria-checked="true"] { box-shadow: var(--inset); background: #17171A; color: var(--gold-hi); }
.option[aria-checked="true"] .key { background: var(--gold); color: var(--bg); box-shadow: 0 0 12px rgba(212,175,55,.45); }
.quiz-nav { width: 100%; display: grid; grid-template-columns: 1fr 1.6fr; gap: 14px; margin-top: 22px; }

/* result */
.result-lead { margin: 4px 0 2px; color: var(--mist-text); font-size: 15px; }
.result-animal { font-size: 56px; color: var(--gold); }
.card-frame { margin: 20px 0 0; width: 100%; padding: 12px; border-radius: 26px; background: var(--surface); box-shadow: var(--raise); }
.card-frame canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; border-radius: 16px; }
.card-frame .note { margin-top: 10px; }
.actions { width: 100%; display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.actions .btn { flex: 1 1 auto; font-size: 14px; padding: 14px 16px; white-space: nowrap; }
.link-gold { display: inline-flex; gap: 8px; align-items: center; margin: 24px 0 6px; color: var(--gold); text-decoration: none; font-weight: 600; font-size: 15px; border-bottom: 1px solid rgba(212,175,55,.4); padding-bottom: 2px; }
.feedback { margin-top: 26px; display: flex; flex-direction: column; gap: 16px; }
.feedback .muted { margin-bottom: 2px; }
.fb-status { color: var(--gold); }
.trakteer {
  margin: 34px 0 0; font-size: 12px; color: var(--mist-text); text-decoration: none;
  padding: 7px 14px; border-radius: 999px; background: var(--bg); box-shadow: var(--raise-sm); letter-spacing: .02em;
}
.trakteer:hover { color: var(--gold); }

/* gallery */
.gallery { list-style: none; margin: 4px 0 0; padding: 0; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { position: relative; background: var(--surface); border-radius: 20px; box-shadow: var(--raise); padding: 16px 12px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.tile .g { width: 74px; height: 74px; border-radius: 50%; background: var(--bg); box-shadow: var(--inset); display: grid; place-items: center; margin-bottom: 10px; }
.tile .g svg { width: 56px; height: 56px; }
.tile h3 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.1; color: var(--sand); }
.tile p { margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--mist-text); }
.tile.is-you { box-shadow: var(--raise), 0 0 0 1.5px rgba(212,175,55,.7); }
.tile .tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--bg); background: var(--gold); padding: 3px 8px; border-radius: 999px; }

.footer { position: relative; z-index: 1; text-align: center; padding: 26px 20px 30px; font-size: 12.5px; color: var(--mist-text); }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 5; max-width: min(92vw, 420px);
  background: var(--surface); color: var(--sand); font-size: 13.5px; padding: 12px 16px; border-radius: 14px;
  box-shadow: var(--raise), 0 0 0 1px rgba(212,175,55,.35);
}

@media (min-width: 900px) {
  main, .topbar { max-width: 600px; }
  .title { font-size: 64px; }
  .screen[data-screen="gallery"] { }
  main:has(#screen-gallery:not([hidden])) { max-width: 920px; }
  .gallery { grid-template-columns: repeat(4, 1fr); }
}

/* Long description prose: justified with language-aware hyphenation (<html lang> is set to en/id by app.js). */
.prose-justify { text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }

/* ===== Full app additions ===== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.input:focus-visible { outline: none; }
.photo-side:focus-within .btn-sm { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.photo-btns { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.btn-text { border: 0; background: none; padding: 4px 2px; cursor: pointer; font-size: 13px; color: var(--mist-text); text-decoration: underline; text-underline-offset: 3px; }
.btn-text:hover { color: var(--gold); }
.field-err { font-size: 13px; color: #F2A38C; }
.input[aria-invalid="true"] { box-shadow: var(--inset), 0 0 0 1.5px rgba(242,163,140,.7); }
.btn-soft:hover, .option:hover { color: var(--gold-hi); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.05); }
.center-text { text-align: center; }
.h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; color: var(--sand); }
.q-text:focus { outline: none; }

/* invite banner (friend's compare link) */
.invite { display: flex; gap: 16px; align-items: center; margin: 0 0 20px; box-shadow: var(--raise), 0 0 0 1.5px rgba(212,175,55,.45); }
.invite-g { width: 62px; height: 62px; flex: none; border-radius: 50%; background: var(--bg); box-shadow: var(--inset); display: grid; place-items: center; }
.invite-g svg { width: 46px; height: 46px; }
.invite-title { margin: 0 0 2px; font-weight: 600; color: var(--gold-hi); font-size: 16px; line-height: 1.35; overflow-wrap: anywhere; }
.invite-text { margin: 0; font-size: 13.5px; color: var(--mist-text); }

/* compat */
.compat { margin-top: 20px; box-shadow: var(--raise), 0 0 0 1.5px rgba(212,175,55,.45); }
.compat .h2 { font-size: 22px; overflow-wrap: anywhere; }
.compat-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin: 16px 0 14px; }
.compat-side { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.compat-side .g { width: 64px; height: 64px; border-radius: 50%; background: var(--bg); box-shadow: var(--inset); display: grid; place-items: center; margin-bottom: 6px; }
.compat-side .g svg { width: 48px; height: 48px; }
.compat-side span { font-size: 12.5px; color: var(--mist-text); overflow-wrap: anywhere; max-width: 100%; }
.compat-side strong { font-size: 16px; color: var(--sand); }
.compat-score { display: flex; flex-direction: column; align-items: center; }
.compat-score span { font-size: 40px; font-weight: 700; color: var(--gold); line-height: 1; }
.compat-score em { font-size: 13px; color: var(--gold-hi); margin-top: 4px; text-align: center; }
.compat-text { margin: 0; font-size: 14.5px; }

/* compare link box */
.linkbox { margin-top: 18px; }
.linkbox .muted { margin-bottom: 12px; }
.link-row { display: flex; gap: 10px; align-items: center; }
.link-row .input { font-size: 13px; padding: 11px 14px; min-width: 0; }

/* profile */
.profile { margin-top: 26px; display: flex; flex-direction: column; gap: 20px; }
.pf-title { margin-bottom: -4px; }
.pf-label { display: block; margin: 0 0 8px; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.pf-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf-chip { background: var(--bg); box-shadow: var(--inset); border-radius: 16px; padding: 14px 14px; }
.pf-value { margin: 0; font-size: 15px; color: var(--sand); }
.pf-mantra { margin: 0; font-style: italic; color: var(--gold-hi); font-size: 15px; line-height: 1.45; }
.pf-block p { margin: 0; }
.res-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-bottom: 8px; }
.res-a { color: var(--sand); font-weight: 600; }
.res-b { color: var(--mist-text); }
.res-bar { height: 12px; border-radius: 999px; background: var(--bg); box-shadow: var(--inset); padding: 3px; }
.res-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #B8912E, var(--gold-hi)); }
.res-why { margin: 10px 0 0 !important; font-size: 13.5px; }
.pf-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pf-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pf-list li { position: relative; padding-left: 18px; font-size: 14.5px; line-height: 1.4; }
.pf-list li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.shadow .pf-list li::before { background: transparent; border: 1.5px solid var(--mist-text); }
.shadow .pf-label { color: var(--mist-text); }
.pf-reading { font-size: 15px; line-height: 1.65; }
.match { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; background: var(--surface); box-shadow: var(--raise-sm); border-radius: 18px; padding: 14px; transition: box-shadow .2s; }
.match:hover { box-shadow: var(--raise-sm), 0 0 0 1.5px rgba(212,175,55,.5); }
.match .g { width: 50px; height: 50px; flex: none; border-radius: 50%; background: var(--bg); box-shadow: var(--inset); display: grid; place-items: center; }
.match .g svg { width: 38px; height: 38px; }
.match-body { display: flex; flex-direction: column; min-width: 0; }
.match-body .pf-label { margin-bottom: 2px; font-size: 10.5px; }
.opposing .pf-label { color: var(--mist-text); }
.match-name { font-size: 17px; color: var(--sand); margin-bottom: 4px; }
.match-why { font-size: 13px; line-height: 1.45; color: var(--mist-text); }

/* gallery tiles are links */
.gallery li { display: flex; }
.tile { width: 100%; text-decoration: none; transition: box-shadow .2s; }
.tile:hover { box-shadow: var(--raise), 0 0 0 1.5px rgba(212,175,55,.45); }
.tile.is-friend { box-shadow: var(--raise), 0 0 0 1.5px rgba(168,159,142,.7); }
.tile .tag-soft { background: var(--mist-text); }
body[data-screen="gallery"] main { max-width: 560px; }

/* feedback status */
.fb-status.ok { color: #A8D5A2; }
.fb-status.err { color: #F2A38C; }
.feedback .btn-block:disabled { opacity: .6; cursor: progress; }

@media (min-width: 900px) {
  body[data-screen="gallery"] main { max-width: 920px; }
  .pf-reading { font-size: 15.5px; }
}
@media (max-width: 520px) {
  .pf-cols, .pf-meta { grid-template-columns: 1fr; }
}
@media (max-width: 400px) {
  main, .topbar { padding-left: 14px; padding-right: 14px; }
  .title { font-size: 44px; }
  .result-animal { font-size: 46px; }
  .title-md { font-size: 34px; }
  .subtitle { font-size: 19px; }
  .q-text { font-size: 24px; }
  .panel { padding: 20px 16px; }
  .chips { gap: 6px; }
  .chip { font-size: 11.5px; padding: 8px 6px; }
  .actions .btn { flex: 1 1 40%; padding: 13px 10px; font-size: 13.5px; }
  .compat-score span { font-size: 32px; }
  .gallery { gap: 12px; }
  .tile h3 { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.link-row .btn { white-space: nowrap; flex: none; }

/* card is shown as an <img> (blob URL) rendered from an off-screen canvas: an <img> can't be
   wiped by a mobile GPU canvas reset when the tab goes to the background */
.card-stage { position: relative; width: 100%; aspect-ratio: 4 / 5; border-radius: 16px; overflow: hidden; background: var(--bg); box-shadow: var(--inset); }
.card-frame .card-stage img { display: block; width: 100%; height: 100%; }
.card-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.card-status[hidden] { display: none !important; }
.card-status-text { margin: 0; font-size: 14px; color: var(--mist-text); max-width: 22em; }
.card-stage.is-error .card-status-text { color: #F2A38C; }
.card-frame .card-stage canvas.card-live { display: block; width: 100%; height: 100%; }
.debug-panel { position: relative; z-index: 5; margin: 16px 0 0; width: 100%; text-align: left; padding: 12px; max-height: 50vh; overflow: auto; border-radius: 12px; background: #08080A; color: #B8AE9A; font: 11px/1.45 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
/* manual compare with a friend's result */
.mfriend { margin-top: 18px; }
.mfriend .muted { margin-bottom: 14px; }
.mf-form { display: flex; flex-direction: column; gap: 12px; }
.mf-form .field-err { margin: 0; }
.mf-or { margin: 16px 0 12px; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--mist-text); }
.mf-or::before, .mf-or::after { content: ""; flex: 1; height: 1px; background: rgba(168,159,142,.18); }
.mf-select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, #D4AF37 50%), linear-gradient(135deg, #D4AF37 50%, transparent 50%);
  background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
.mf-select option { background: #0E0E10; color: #F1E3BC; }
.mf-form > .btn { align-self: stretch; }
.mf-result .h2 { font-size: 22px; overflow-wrap: anywhere; margin-top: 4px; }
.mf-result .h2:focus, .mf-result .h2:focus-visible { outline: none; }
.mf-reset { width: 100%; margin-top: 16px; }
.footer-credit { display: inline-flex; align-items: center; gap: 8px; }
.footer-mark { display: block; width: auto; height: 26px; flex: none; }
