@font-face { font-family: "Sub"; src: url("fonts/sub.ttf"); font-weight: 100 900; font-display: swap; }

/* Mongol blue, brocade gold, seal red, paper. The page is a hanging scroll on a blue wall. */
:root {
  --wall: #0c1f3d;
  --blue: #17407a;
  --gold: #d9a521;
  --red: #c4161c;
  --paper: #f8f6f0;
  --paper-2: #ece7da;
  --ink: #101418;
  --muted: #4a4f57;
  --yellow: #f3f33f;
  /* алхан хээ (meander) tile, gold on transparent */
  --meander: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M4 44V4h36v28H12V12h20' fill='none' stroke='%23d9a521' stroke-width='5'/%3E%3C/svg%3E");
  /* давалгаа (waves) tile */
  --waves: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='20'%3E%3Cg fill='none' stroke='%23d9a521' stroke-width='3'%3E%3Cpath d='M0 20a20 20 0 0 1 40 0M8 20a12 12 0 0 1 24 0M15 20a5 5 0 0 1 10 0'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html { background: var(--wall); }
body {
  margin: 0; color: var(--ink); font-family: "Sub", "Roboto Condensed", system-ui, sans-serif;
  background: var(--wall) var(--meander) 0 0 / 48px 48px; background-blend-mode: normal;
}
body::before { content: ""; position: fixed; inset: 0; background: rgba(12,31,61,.86); pointer-events: none; }

/* the scroll */
#app {
  position: relative; max-width: 500px; min-height: 100dvh; margin: 0 auto; padding: 0 14px 40px;
  background: var(--blue) var(--waves) 0 0 / 40px 20px;
}
#app::before, #app::after {
  content: ""; position: sticky; display: block; height: 22px; margin: 0 -24px; z-index: 5;
  background: #2a1408; border-radius: 11px;
}
#app::before { top: 0; }
#app::after { bottom: 0; margin-top: 18px; }
.screen, .bar { position: relative; background: var(--paper); }
.screen { display: none; padding: 28px 20px 36px; }
.screen.active { display: block; }

.bar { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.brand { font-weight: 800; font-size: 17px; color: var(--blue); }
.seal-mini {
  font-family: "Noto Sans Mongolian", serif; writing-mode: vertical-lr; font-size: 13px; line-height: 1;
  background: var(--red); color: #fff; padding: 6px 5px; transform: rotate(4deg);
}

h1 { font-size: clamp(44px, 13vw, 64px); line-height: .95; letter-spacing: -.02em; margin: 18px 0 14px; font-weight: 800; color: var(--ink); }
h2 { font-size: 30px; line-height: 1.1; letter-spacing: -.01em; margin: 6px 0 22px; font-weight: 800; }
.lead { font-size: 19px; line-height: 1.45; margin: 0 0 22px; }
.note, .small { font-size: 16px; color: var(--muted); text-align: center; }
.note { margin: 12px 0 0; }

/* three real cards fanned like a hand */
.fan { position: relative; height: 250px; margin: 10px 0 22px; }
.fan img {
  position: absolute; top: 0; left: 50%; width: 44%; aspect-ratio: 3/4; object-fit: cover;
  border: 6px solid var(--paper); outline: 4px solid var(--gold); background: var(--paper-2);
}
.fan img:nth-child(1) { transform: translateX(-118%) translateY(26px) rotate(-9deg); }
.fan img:nth-child(2) { transform: translateX(-50%); z-index: 2; }
.fan img:nth-child(3) { transform: translateX(18%) translateY(26px) rotate(9deg); }

.btn {
  display: block; width: 100%; padding: 19px 16px; margin: 0 0 12px; border: 0; border-radius: 0;
  background: var(--red); color: #fff; font: 800 21px/1 "Sub", sans-serif; letter-spacing: .01em;
  cursor: pointer; transition: transform .12s, background .2s;
}
.btn:hover { background: #a91217; }
.btn:active { transform: translateY(2px); }
.btn:focus-visible, .answers button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn.ghost { background: var(--paper-2); color: var(--ink); }
.btn.ghost:hover { background: #e0d9c8; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* quiz */
.progress { height: 10px; background: var(--paper-2); margin-bottom: 18px; }
#bar { height: 100%; width: 0; background: var(--gold) var(--meander) 0 0 / 10px 10px; transition: width .3s; }
.qnum { font-size: 16px; font-weight: 700; color: var(--blue); margin: 0; }
.answers button {
  display: block; width: 100%; text-align: left; padding: 17px 18px; margin: 0 0 10px; border: 0;
  border-left: 8px solid var(--gold); background: var(--paper-2); color: var(--ink);
  font: 600 19px/1.25 "Sub", sans-serif; cursor: pointer; transition: transform .12s, background .15s;
}
.answers button:hover { background: #e3dccb; transform: translateX(4px); }
.answers button:active { background: var(--gold); }

/* result */
canvas { display: block; width: 100%; height: auto; margin-bottom: 16px; }
.themes { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 0 0 18px; }
.themes button { width: 40px; height: 40px; border-radius: 50%; border: 4px solid; cursor: pointer; padding: 0; }
.themes button.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.themes button.locked { opacity: .45; position: relative; }
.themes button.locked::after { content: "🔒"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; }

/* premium: a blue brocade panel with a gold meander band */
.premium {
  margin: 30px -20px -36px; padding: 0 20px 30px; color: var(--paper);
  background: var(--wall); transition: box-shadow .3s;
}
.premium::before { content: ""; display: block; height: 26px; margin: 0 -20px 24px; background: var(--gold) var(--meander) 0 0 / 26px 26px; background-color: var(--red); }
.premium.pulse { box-shadow: 0 0 0 6px var(--yellow); }
.premium h3 { font-size: 30px; line-height: 1.05; margin: 20px 0 14px; letter-spacing: -.01em; }
.locked-card { position: relative; width: 70%; margin: 0 auto; aspect-ratio: 3/4; overflow: hidden; border: 6px solid var(--paper); outline: 4px solid var(--gold); background: var(--blue); }
.locked-card img { width: 100%; height: 100%; object-fit: cover; filter: blur(16px) saturate(.6); transform: scale(1.15); }
.lock { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: 54px; }
.lock span { font-size: 16px; font-weight: 800; background: var(--red); color: #fff; padding: 6px 12px; margin-top: 8px; }
.lock-name, .lock-role { position: absolute; left: 0; right: 0; margin: 0; text-align: center; font-weight: 800; }
.lock-name { top: 0; font-size: 22px; color: var(--ink); background: var(--paper); padding: 8px 4px; }
.lock-role { bottom: 0; font-size: 17px; color: var(--wall); background: var(--gold); padding: 6px 4px; }
.premium label.small { color: #c9d3e3; text-align: left; display: block; }
#nameInput, select, #pName {
  display: block; width: 100%; padding: 15px; margin: 6px 0 18px; border: 0; border-radius: 0;
  background: var(--paper); color: var(--ink); font: 700 20px "Sub", sans-serif;
}
.perks { list-style: none; padding: 0; margin: 0 0 20px; font-size: 18px; line-height: 1.5; }
.perks li { padding: 8px 0 8px 26px; position: relative; }
.perks li::before { content: ""; position: absolute; left: 4px; top: 17px; width: 10px; height: 10px; background: var(--gold); transform: rotate(45deg); }
.price { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.price b {
  font-size: 34px; color: #fff; background: var(--red); padding: 10px 14px; transform: rotate(-3deg); display: inline-block;
}
.price span { font-size: 17px; color: #c9d3e3; }
.premium .btn { background: var(--gold); color: var(--wall); }
.premium .btn:hover { background: #f0bd34; }
.premium .small, .tiny { color: #c9d3e3; }
.tiny { font-size: 13px; text-align: center; margin: 10px 0 0; }

/* paid */
#paid h2 { color: var(--blue); }
#pSelfie { display: block; margin: 6px 0 16px; font-size: 16px; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.4; margin: 0 0 18px; }
.consent input { width: 22px; height: 22px; flex: none; accent-color: var(--red); }
#paid label.small { text-align: left; display: block; color: var(--muted); }
#paid select, #paid #pName { background: var(--paper-2); }
.out-img { display: block; width: 100%; margin: 20px 0 10px; border: 6px solid var(--paper-2); }
#pMeme { margin-top: 20px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* premium, richer */
.p-title { margin: 0; font-size: 46px; font-weight: 800; letter-spacing: -.02em; color: var(--gold); line-height: 1; }
.premium h3 { margin-top: 6px; }
.before-after { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 6px 0 6px; }
.before-after figure { margin: 0; }
.before-after img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; border: 5px solid var(--paper); }
.before-after figure:last-child img { outline: 4px solid var(--gold); }
.before-after figcaption { font-size: 15px; font-weight: 700; color: var(--gold); text-align: center; margin-top: 6px; }
.arrow { font-size: 34px; color: var(--gold); font-weight: 800; }
.ex-note { font-size: 14px; color: #c9d3e3; text-align: center; margin: 2px 0 22px; }
.locked-card { width: 60%; }

/* sticky upsell on the result screen */
.upsell { position: sticky; bottom: 26px; z-index: 6; margin: 18px -6px 0; transition: opacity .25s, transform .25s; }
.upsell.hide { opacity: 0; transform: translateY(20px); pointer-events: none; }
.upsell button {
  width: 100%; padding: 17px 16px; border: 0; cursor: pointer; font: 800 20px/1 "Sub", sans-serif;
  background: var(--wall); color: var(--gold); outline: 4px solid var(--gold); outline-offset: -4px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.upsell button b { background: var(--red); color: #fff; padding: 4px 8px; margin-left: 4px; }

/* owner 2026-11-29: soft corners 12-24px everywhere */
.btn, .upsell button { border-radius: 16px; }
.upsell button { outline: none; border: 4px solid var(--gold); }
.answers button { border-radius: 14px; }
#nameInput, select, #pName { border-radius: 12px; }
.progress, #bar { border-radius: 99px; }
.fan img { border-radius: 18px; outline: none; border: 6px solid var(--paper); box-shadow: 0 0 0 4px var(--gold); }
.before-after img { border-radius: 16px; }
.before-after figure:last-child img { outline: none; box-shadow: 0 0 0 4px var(--gold); }
.locked-card { border-radius: 22px; outline: none; border: 6px solid var(--paper); box-shadow: 0 0 0 4px var(--gold); }
.lock span { border-radius: 99px; }
.price b { border-radius: 12px; }
.premium { border-radius: 24px 24px 0 0; overflow: hidden; }
.premium::before { margin-top: 0; }
.screen, .bar { border-radius: 0; }
.out-img, #pMeme, canvas { border-radius: 16px; }
.themes button.on { outline-offset: 3px; }
.seal-mini { border-radius: 6px; }
/* header seal: both words, two vertical columns, left to right */
.seal-mini { display: flex; gap: 3px; writing-mode: horizontal-tb; padding: 7px 6px; border: 2px solid #fff; outline: 3px solid var(--red); }
.seal-mini span { writing-mode: vertical-lr; font-family: "Noto Sans Mongolian", serif; font-size: 13px; line-height: 1.05; }

/* header seal is a canvas now */
.seal-mini { display: block; width: 56px; height: 56px; padding: 0; border: 0; outline: 0; background: none; transform: none; border-radius: 0; }
.name-label { margin-top: 22px; }
.upsell button { font-size: 18px; }
.upsell button { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 17px; white-space: nowrap; padding: 14px 14px 14px 18px; }
.upsell button b { margin-left: 0; padding: 7px 10px; border-radius: 10px; }

.hint { font-size: 14px; color: var(--muted); text-align: center; margin: -4px 0 14px; }
.save-sheet { position: fixed; inset: 0; z-index: 20; background: rgba(12,31,61,.94); display: grid; place-content: center; gap: 14px; padding: 20px; text-align: center; color: var(--paper); }
.save-sheet[hidden] { display: none; }
.save-sheet img { max-width: min(86vw, 420px); max-height: 70dvh; margin: 0 auto; border-radius: 16px; -webkit-touch-callout: default; }
.save-sheet p { font-size: 18px; font-weight: 700; margin: 0; }

.bgs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 18px; }
.bgs button { padding: 13px 10px; border: 0; border-radius: 12px; background: var(--paper-2); color: var(--ink); font: 700 16px/1.2 "Sub", sans-serif; cursor: pointer; transition: background .15s; }
.bgs button.on { background: var(--blue); color: #fff; box-shadow: 0 0 0 3px var(--gold); }

.resume { display: block; margin: 0 0 16px; padding: 14px 16px; border-radius: 14px; background: var(--blue); color: #fff; font-weight: 800; font-size: 17px; text-decoration: none; }
.resume[hidden] { display: none; }
.keep { font-size: 15px; line-height: 1.45; background: var(--paper-2); border-radius: 12px; padding: 12px 14px; margin: 14px 0 0; word-break: break-all; }
.keep a { color: var(--blue); font-weight: 700; }

.preview { width: 62%; margin: 4px auto 18px; border-radius: 14px; box-shadow: 0 0 0 4px var(--gold); }
.bgs button { display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 10px; align-items: stretch; }
.bgs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; }
.selfie-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.selfie-row .btn { margin: 0; font-size: 17px; text-align: center; }
.selfie-prev { display: block; width: 40%; margin: 14px auto 4px; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; box-shadow: 0 0 0 4px var(--gold); }
.selfie-prev[hidden] { display: none; }
#paid .consent { margin-top: 18px; }
#pGo:disabled { background: #b9b4a8; color: #f1eee6; opacity: 1; }
.err { margin: 12px 0 0; padding: 14px 16px; border-radius: 12px; background: #fde8e8; color: #9b0f14; font-size: 17px; font-weight: 800; border-left: 6px solid var(--red); text-align: left; }
.err[hidden] { display: none; }

.working { display: flex; gap: 14px; align-items: center; background: var(--wall); color: var(--paper); border-radius: 16px; padding: 18px; margin: 0 0 18px; }
.working[hidden] { display: none; }
.working p { margin: 0; font-size: 16px; line-height: 1.45; }
.working b { color: var(--gold); font-size: 19px; }
.spin { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 5px solid rgba(217,165,33,.3); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#againBtn { margin-top: 18px; }

.pick-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 18px; }
.pick-row button { padding: 6px 6px 8px; border: 0; border-radius: 14px; background: var(--paper-2); cursor: pointer; font: 700 15px "Sub", sans-serif; color: var(--ink); display: flex; flex-direction: column; gap: 6px; }
.pick-row img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; }
.pick-row button.on { background: var(--blue); color: #fff; box-shadow: 0 0 0 3px var(--gold); }

/* premium v3: showcase, theme strip, backgrounds, what you get */
.premium h3 { font-size: 28px; }
.premium h4 { font-size: 22px; margin: 26px 0 12px; color: var(--gold); }
.showcase { display: grid; grid-template-columns: 30% auto 1fr; align-items: center; gap: 8px; }
.showcase figure { margin: 0; }
.showcase img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; border: 3px solid var(--paper); }
.showcase figcaption { font-size: 13px; font-weight: 700; color: var(--gold); text-align: center; margin-top: 4px; }
.sc-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sc-out img { border-color: var(--gold); }
.theme-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; margin: 0 -20px; padding-left: 20px; }
.theme-strip canvas { flex: none; width: 128px; height: auto; border-radius: 10px; scroll-snap-align: start; box-shadow: none; margin: 0; }
.bg-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.bg-strip img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 10px; }
.incl { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.incl li { background: rgba(248,246,240,.08); border-radius: 12px; padding: 12px 14px 12px 40px; position: relative; font-size: 16px; line-height: 1.35; color: #c9d3e3; }
.incl li::before { content: "✓"; position: absolute; left: 14px; top: 11px; color: var(--gold); font-weight: 800; font-size: 18px; }
.incl b { display: block; color: #fff; font-size: 17px; }
.buybox { margin-top: 24px; background: var(--blue); border-radius: 18px; padding: 18px 16px 16px; box-shadow: 0 0 0 3px var(--gold); }
.buybox .price { margin-bottom: 14px; }
.buybox .price span { color: #dfe6f2; line-height: 1.3; }

.upsell { position: fixed; left: 50%; bottom: 22px; width: min(460px, calc(100vw - 40px)); transform: translateX(-50%); margin: 0; z-index: 10; }
.upsell.hide { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.sc-out { grid-template-columns: repeat(2, 1fr); }
.pick-row { grid-template-columns: repeat(2, 1fr); }
.showcase { grid-template-columns: 1fr auto 1fr; }
.sc-out { grid-template-columns: 1fr; }

.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 430px; overflow-y: auto; padding: 4px; margin: 6px 0 18px; background: var(--paper-2); border-radius: 14px; }
.role-grid button { display: flex; flex-direction: column; gap: 4px; padding: 4px 4px 6px; border: 0; border-radius: 10px; background: #fff; cursor: pointer; font: 700 13px/1.15 "Sub", sans-serif; color: var(--ink); }
.role-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; border-radius: 8px; }
.role-grid button.on { background: var(--blue); color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.save-sheet video { max-width: min(86vw, 420px); max-height: 60dvh; margin: 0 auto; border-radius: 16px; }
.save-sheet video[hidden], .save-sheet img[hidden], .save-sheet a[hidden] { display: none; }

.from-friend { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--gold); color: var(--wall); font-weight: 800; font-size: 17px; line-height: 1.3; }
.from-friend[hidden] { display: none; }

.back { display: block; margin: 6px auto 0; padding: 10px 14px; border: 0; background: none; color: var(--blue); font: 700 17px "Sub", sans-serif; cursor: pointer; }
.back[hidden] { display: none; }

/* rarity tier under the card (themes.js TIERS): silver, purple-gold, gold foil; shimmer only when motion is welcome */
.rarity-badge { display: block; width: fit-content; margin: 4px auto 14px; padding: 10px 20px; border-radius: 99px; font: 800 18px/1.2 "Sub", sans-serif; letter-spacing: .02em; }
.rarity-badge[hidden] { display: none; }
.r-common { background: #ece7da; color: #4a4f57; border: 2px solid #d9cfba; }
.r-special { background: linear-gradient(135deg, #13806d, #0a463c); color: #f4fffb; border: 2px solid #9fe3d2; box-shadow: 0 0 10px rgba(70,190,160,.35); }
.r-rare { background: linear-gradient(135deg, #1d4f94, #0c1f3d); color: #e8eef7; border: 2px solid #c9d6e6; box-shadow: 0 0 14px rgba(120,170,230,.5); }
.r-epic { background: linear-gradient(135deg, #4a1763, #24093a); border: 2px solid #f7d77a; box-shadow: 0 0 20px rgba(190,120,255,.6); }
.r-legend { background: linear-gradient(135deg, #3a1d06, #140800); border: 2px solid #f1c040; box-shadow: 0 0 26px rgba(255,196,60,.8); }
.r-epic { color: #ffe7a3; }
.r-legend { color: #ffd75a; }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  /* first layer = the moving metal, clipped to the letters; second = the pill */
  .r-epic, .r-legend { color: transparent; background-size: 250% 100%, 100% 100%; -webkit-background-clip: text, padding-box; background-clip: text, padding-box; }
  .r-epic { background-image: linear-gradient(100deg, #ffe7a3 20%, #e2b8ff 45%, #fff 50%, #ffd36b 60%, #ffe7a3 80%), linear-gradient(135deg, #4a1763, #24093a); }
  .r-legend { background-image: linear-gradient(100deg, #ffd75a 20%, #f6bb2e 42%, #fffbe0 50%, #f6bb2e 58%, #ffd75a 80%), linear-gradient(135deg, #3a1d06, #140800); }
}
@media (prefers-reduced-motion: no-preference) {
  .r-rare { animation: rGlow 2.4s ease-in-out infinite; }
  .r-epic, .r-legend { animation: rShine 2.6s linear infinite, rGlow 2.2s ease-in-out infinite; }
  .r-legend { animation-duration: 1.8s, 1.6s; }
}
@keyframes rShine { from { background-position: 120% 0, 0 0; } to { background-position: -120% 0, 0 0; } }
@keyframes rGlow { 50% { box-shadow: 0 0 34px rgba(255,214,110,.9); transform: scale(1.03); } }

/* ---------- Ховрын шат (start screen) and the 5-step row under the result (owner 2026-11-30) ---------- */
.ladder { margin: 34px -6px 4px; padding: 22px 14px 18px; background: var(--wall) var(--meander) 0 0 / 36px 36px; border: 4px solid var(--gold); border-radius: 18px; color: #f8f6f0; position: relative; overflow: hidden; }
.ladder::before { content: ""; position: absolute; inset: 0; background: rgba(12,31,61,.9); }
.ladder > * { position: relative; }
.ladder[hidden] { display: none; }
.ladder h2 { margin: 0; text-align: center; font: 800 28px/1.1 "Sub", sans-serif; color: var(--gold); letter-spacing: .02em; }
.ladder-sub { margin: 8px 0 18px; text-align: center; font-size: 17px; line-height: 1.35; color: #dfe6f2; }
.ladder-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
/* a stair: the top step (Домогт) is the narrowest */
.step { display: grid; justify-items: center; gap: 6px; margin: 0 auto; padding: 12px 10px; border-radius: 14px; background: rgba(248,246,240,.07); border: 2px solid rgba(217,165,33,.35); }
.s-legend { width: 88%; } .s-epic { width: 91%; } .s-rare { width: 94%; } .s-special { width: 97%; } .s-common { width: 100%; }
.step .rarity-badge { margin: 0; font-size: 19px; }
.step-meta { font-size: 15px; color: #c9d3e3; }
.s-legend { border-color: var(--gold); box-shadow: inset 0 0 22px rgba(255,196,60,.25), 0 0 18px rgba(255,196,60,.35); }
.legend-faces { display: flex; gap: 7px; justify-content: center; margin-top: 4px; }
.face { position: relative; width: 46px; height: 60px; border-radius: 10px; overflow: hidden; border: 2px solid var(--gold); background: radial-gradient(circle at 50% 35%, #ffe7a3, #d9a521 60%, #8a5a00); }
.face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; filter: brightness(.45) sepia(1) blur(3px); opacity: .9; } /* the pictures are not cut out: a blurred hint, not a face */
.face b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 26px/1 "Sub", sans-serif; color: #ffd75a; text-shadow: 0 0 8px rgba(255,196,60,.9); }
/* twinkling stars on the Домогт step */
.s-legend { position: relative; }
.s-legend::before, .s-legend::after { content: "✦"; position: absolute; color: #ffd75a; text-shadow: 0 0 8px rgba(255,196,60,.9); font-size: 18px; }
.s-legend::before { left: 8px; top: 6px; } .s-legend::after { right: 10px; bottom: 8px; font-size: 14px; }

/* result: the player's tier as one big badge and a line praising it (no ladder, no comparison) */
.tier-row { margin: 6px 0 16px; padding: 16px 12px 14px; border-radius: 16px; background: var(--paper-2); text-align: center; }
.tier-row[hidden] { display: none; }
.tier-badge .rarity-badge.big { margin: 0 auto; font-size: 20px; padding: 12px 20px; white-space: nowrap; }
.tier-quip { margin: 12px 0 0; font-size: 17px; line-height: 1.4; color: var(--ink); }
.t-legend { background: linear-gradient(135deg, #2a1408, #0c1f3d); }
.t-legend .tier-quip { color: #ffe7a3; }
.t-epic { background: linear-gradient(135deg, #ece7da, #e7dcf3); }
.t-legend .tier-badge { position: relative; }
.t-legend .tier-badge::before, .t-legend .tier-badge::after { content: "✦"; position: absolute; top: -6px; color: #ffd75a; text-shadow: 0 0 8px rgba(255,196,60,.9); }
.t-legend .tier-badge::before { left: 14%; } .t-legend .tier-badge::after { right: 14%; top: auto; bottom: -8px; }

@media (prefers-reduced-motion: no-preference) {
  .ladder .step { opacity: 0; transform: translateY(18px); }
  .ladder.in .step { animation: stepUp .5s cubic-bezier(.2, .8, .2, 1.1) forwards; animation-delay: calc(var(--i) * 120ms); }
  .s-legend::before { animation: twinkle 1.6s ease-in-out infinite; } .s-legend::after { animation: twinkle 1.6s .8s ease-in-out infinite; }
  .t-legend .tier-badge::before { animation: twinkle 1.6s ease-in-out infinite; } .t-legend .tier-badge::after { animation: twinkle 1.6s .8s ease-in-out infinite; }
}
@keyframes stepUp { to { opacity: 1; transform: none; } }
@keyframes twinkle { 50% { opacity: .2; transform: scale(.6) rotate(20deg); } }
/* common on the result: still proud, gold-rimmed on white */
.t-common { background: #fff; border: 2px solid var(--paper-2); }
.tier-badge .r-common { border-color: var(--gold); color: var(--ink); }

/* Домогт step: any role can reach it, so a gold seal and an example title instead of faces */
.legend-ex { display: flex; align-items: center; gap: 10px; margin-top: 4px; font-size: 15px; line-height: 1.3; color: #ffe7a3; text-align: left; }
.legend-ex canvas { width: 46px; height: 46px; flex: none; filter: drop-shadow(0 0 8px rgba(255,196,60,.6)); }

/* "Миний дүр" is always Ховор or above: said in the panel and on the sticky bar */
.p-rank { margin: -4px 0 16px; text-align: center; font-weight: 800; font-size: 17px; color: #ffd75a; text-shadow: 0 0 10px rgba(255,196,60,.45); }
.upsell button span { display: inline-flex; flex-direction: column; text-align: left; line-height: 1.15; }
.upsell button small { font-size: 13px; font-weight: 700; color: #ffd75a; margin-top: 3px; }
.upsell button { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }

/* ---------- "Юу авах вэ" (owner 2026-12-01): picture cards, not a text list ---------- */
.perks { display: grid; gap: 12px; }
.perk-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.perk-tile { margin: 0; padding: 10px 10px 12px; border-radius: 16px; background: rgba(248,246,240,.07); border: 2px solid rgba(217,165,33,.45); display: grid; gap: 10px; }
.perk-tile figcaption, .perk-list .pt { font-size: 14px; line-height: 1.3; color: #c9d3e3; }
.perk-tile b, .perk-list b { display: block; color: #fff; font-size: 16px; margin-bottom: 2px; }
/* a little hanging scroll: brocade, paper, the example portrait */
.mini-scroll { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--blue) var(--waves) 0 0 / 20px 10px; display: flex; flex-direction: column; align-items: stretch; padding: 0 10px; }
.mini-scroll .roll { display: block; height: 9px; margin: 6px -6px; border-radius: 6px; background: linear-gradient(#5a3622, #2a1408); flex: none; }
.mini-scroll .paper { flex: 1; background: var(--paper); border: 1.5px solid var(--ink); display: flex; flex-direction: column; align-items: center; padding: 6px 6px 8px; gap: 2px; overflow: hidden; }
.mini-scroll .mt { font-size: 7px; font-weight: 700; color: var(--ink); letter-spacing: .03em; }
.mini-scroll .mn { font-size: 13px; font-weight: 800; color: var(--red); line-height: 1; }
.mini-scroll img { width: 82%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; border: 2px solid var(--ink); margin-top: 4px; }
.mini-scroll .play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: rgba(196,22,28,.92); color: #fff; font-size: 17px; box-shadow: 0 0 0 3px var(--gold), 0 6px 16px rgba(0,0,0,.4); padding-left: 3px; }
.perk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.perk-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: rgba(248,246,240,.07); border: 1px solid rgba(217,165,33,.25); }
.pv { flex: none; width: 74px; display: grid; place-items: center; }
.pv-rank { gap: 3px; }
.pv-rank .rarity-badge { margin: 0; padding: 2px 7px; font-size: 10px; font-style: normal; border-width: 1px; box-shadow: none; animation: none; white-space: nowrap; }
.pv-round img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; border: 3px solid var(--gold); box-shadow: 0 0 12px rgba(217,165,33,.45); }
.pv-roles { display: flex; justify-content: center; }
.pv-roles img { width: 30px; height: 40px; object-fit: cover; object-position: 50% 15%; border-radius: 6px; border: 2px solid var(--gold); margin-left: -10px; background: var(--paper-2); }
.pv-roles img:first-child { margin-left: 0; transform: rotate(-6deg); } .pv-roles img:nth-child(3) { transform: rotate(6deg); }
.pv-roles em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--gold); margin-left: 3px; }
.pv-again { width: 52px; height: 52px; margin: 0 11px; border-radius: 50%; background: var(--red); font-size: 24px; box-shadow: 0 0 0 3px var(--gold); }
@media (prefers-reduced-motion: no-preference) {
  /* the Story tile unrolls on a loop, like the real video */
  .mini-scroll.story .paper { animation: unroll 3.2s cubic-bezier(.3, .7, .3, 1) infinite; }
  .mini-scroll.story .play { animation: playPulse 3.2s ease-in-out infinite; }
}
@keyframes unroll { 0%, 8% { clip-path: inset(0 0 100% 0); } 60%, 100% { clip-path: inset(0 0 0 0); } }
@keyframes playPulse { 0%, 55% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.12); } 85%, 100% { opacity: 1; transform: scale(1); } }
.perk-list li::before { content: none; display: none; }
