/* Altitude v2: expedition-gear UI. Thick ink outlines, solid lips, prayer-flag colors. */
:root {
  --ink: #13233a;
  --ink-2: #2a3b55;
  --snow: #ffffff;
  --ice: #e6f0f7;
  --yellow: #ffc21a;
  --yellow-lip: #c98d00;
  --red: #e5402f;
  --red-lip: #9e2417;
  --green: #22a86b;
  --blue: #2f7de1;
  --blue-lip: #1c55a3;
  --orange: #ff8a1f;
  --mut: #5b6b82;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --stroke: 3px;
  --lip: 5px;
  --display: 'Lilita One', 'Rubik', system-ui, sans-serif;
  --body: 'Rubik', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #bfe3fa; color: var(--ink); font-family: var(--body); -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
img.ic { display: inline-block; vertical-align: middle; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }

/* world labels */
.wlabel { position: absolute; left: 0; top: 0; padding: 4px 8px 5px; background: var(--snow); border: 2px solid var(--ink); border-radius: 8px; font-size: 12px; line-height: 1.1; white-space: nowrap; transition: opacity .25s; box-shadow: 0 3px 0 var(--ink); }
.wlabel b { display: block; font-family: var(--display); font-weight: 400; font-size: 14px; letter-spacing: .01em; }
.wlabel span { color: var(--mut); font-variant-numeric: tabular-nums; }
.wlabel.reached { background: var(--yellow); }
.wlabel.reached span { color: var(--ink-2); }
.wlabel.death { background: var(--ink); color: #fff; border-color: var(--ink); }
.wlabel.death span { color: #ff9a8f; }
.wlabel::after { content: ''; position: absolute; left: 50%; bottom: -8px; width: 2px; height: 6px; background: var(--ink); }

/* HUD */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 3; padding: calc(12px + var(--safe-t)) 14px 0; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; pointer-events: none; }
.alti { pointer-events: auto; background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink); padding: 6px 12px 7px; min-width: 132px; }
.alti-num { font-family: var(--display); font-size: 34px; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: .01em; display: flex; align-items: baseline; gap: 3px; }
.alti-num small { font-size: 16px; color: var(--mut); }
.alti-zone { font-size: 12px; color: var(--mut); margin-top: 2px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
.hud-r { display: flex; gap: 8px; pointer-events: auto; }
.ibtn { width: 44px; height: 44px; display: grid; place-items: center; background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); transition: transform .08s, box-shadow .08s; }
.ibtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.ibtn svg { width: 22px; height: 22px; }
.ibtn:focus-visible, .btn:focus-visible, .lang-opt:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* prayer-flag progress */
.flags { position: fixed; z-index: 2; top: calc(84px + var(--safe-t)); left: 50%; transform: translateX(-50%); width: min(340px, 88vw); height: 46px; pointer-events: none; }
.flags svg { width: 100%; height: 100%; overflow: visible; }
.flag { transform-box: fill-box; transform-origin: 50% 0; transition: fill .4s; }
.flag.todo { fill: rgba(255,255,255,.45); stroke-dasharray: 3 3; }
.flag.cur { animation: wave 1.4s ease-in-out infinite; fill: #fff; }
.flag.done { animation: wave 2.6s ease-in-out infinite; }
@keyframes wave { 0%,100% { transform: skewY(-6deg) } 50% { transform: skewY(6deg) } }

/* sheet */
.sheet { position: fixed; z-index: 4; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); width: min(520px, calc(100% - 24px)); background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: var(--r-lg); box-shadow: 0 6px 0 var(--ink); padding: 18px; max-height: calc(100% - 150px - var(--safe-t)); overflow-y: auto; overscroll-behavior: contain; transition: transform .38s cubic-bezier(.2,1.4,.4,1), opacity .2s; }
.sheet.out { transform: translate(-50%, 30px); opacity: 0; pointer-events: none; }
.sheet.dark { background: var(--ink); color: #fff; box-shadow: 0 6px 0 #070f1c; border-color: #070f1c; }
.sheet::-webkit-scrollbar { width: 0; }

.title { font-family: var(--display); font-weight: 400; font-size: 46px; line-height: .95; letter-spacing: .01em; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); }
.logo-row { display: flex; align-items: center; gap: 10px; }
.tagline { font-family: var(--display); font-size: 22px; margin: 12px 0 6px; }
.lead { font-size: 15px; line-height: 1.45; color: var(--ink-2); max-width: 60ch; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--ice); border: 2px solid var(--ink); border-radius: var(--r-sm); padding: 4px 10px 4px 6px; font-size: 14px; font-weight: 500; }
.chip img.flagimg { width: 22px; height: 15px; border-radius: 3px; border: 1.5px solid var(--ink); object-fit: cover; }
.chip b { font-weight: 700; font-variant-numeric: tabular-nums; }

/* buttons */
.btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 16px; border: var(--stroke) solid var(--ink); border-radius: var(--r-md); font-family: var(--display); font-size: 21px; letter-spacing: .01em; box-shadow: 0 var(--lip) 0 var(--ink), inset 0 -4px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.45); transition: transform .08s, box-shadow .08s, filter .15s; margin-top: 14px; }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 -2px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.45); }
.btn:disabled { filter: grayscale(.8) brightness(.95); opacity: .6; cursor: default; }
.btn-y { background: var(--yellow); color: var(--ink); }
.row > .btn { font-size: clamp(15px, 4.4vw, 19px); gap: 6px; padding: 8px 10px; line-height: 1.05; }
.row > .btn .ic { width: 24px; height: 24px; flex: none; }
.btn-r { background: var(--red); color: #fff; }
.btn-b { background: var(--blue); color: #fff; }
.btn-w { background: var(--snow); color: var(--ink); }
.btn-ghost { background: transparent; box-shadow: none; border-color: currentColor; font-family: var(--body); font-weight: 600; font-size: 16px; min-height: 48px; }
.btn small { font-family: var(--body); font-size: 12px; font-weight: 500; opacity: .85; display: block; letter-spacing: 0; }
.btn .stack { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; text-align: left; }
.ad-tag { position: absolute; top: -10px; right: 10px; background: var(--ink); color: #fff; font-family: var(--body); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.row { display: flex; gap: 10px; }
.row > .btn { flex: 1; }

/* question */
.qtop { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--mut); font-weight: 500; }
.rope { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 700; }
.qtext { font-family: var(--display); font-weight: 400; font-size: clamp(21px, 5.6vw, 26px); line-height: 1.15; margin: 8px 0 12px; letter-spacing: .005em; }
.o2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.o2-bar { flex: 1; height: 16px; border: 2.5px solid var(--ink); border-radius: 8px; background: var(--ice); overflow: hidden; position: relative; }
.o2-bar i { position: absolute; inset: 0; transform-origin: left; background: var(--blue); }
.o2-bar i.low { background: var(--red); }
.o2-bar::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(19,35,58,.35) calc(10% - 2px) 10%); }
.field { display: flex; align-items: center; border: var(--stroke) solid var(--ink); border-radius: var(--r-md); background: var(--snow); box-shadow: inset 0 3px 0 rgba(19,35,58,.08); overflow: hidden; }
.field:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,125,225,.25); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-family: var(--display); font-size: 30px; padding: 10px 14px; color: var(--ink); font-variant-numeric: tabular-nums; }
.field input::placeholder { color: #a9b6c7; font-family: var(--body); font-size: 18px; }
.unit { align-self: stretch; display: grid; place-items: center; padding: 0 14px; background: var(--ice); border-left: 2px solid var(--ink); font-weight: 700; font-size: 16px; min-width: 56px; }
.hint-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; background: #fff6d9; border: 2px solid var(--ink); border-radius: var(--r-sm); padding: 8px 10px; font-weight: 600; }
.mini { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 12px 7px 8px; background: var(--ice); border: 2px solid var(--ink); border-radius: var(--r-sm); font-weight: 600; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.mini:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.mini .ad-tag { position: static; margin-left: 2px; }

/* reveal */
.verdict { display: flex; align-items: center; gap: 10px; min-width: 0; }
.verdict .ic { width: 44px; height: 44px; flex: none; }
.verdict .word { min-width: 0; font-family: var(--display); font-size: clamp(24px, 7.4vw, 36px); line-height: 1; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }
.gain { margin-left: auto; flex: none; font-family: var(--display); font-size: clamp(18px, 5.4vw, 24px); background: var(--yellow); border: var(--stroke) solid var(--ink); border-radius: var(--r-sm); padding: 4px 10px; box-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.gain.zero { background: var(--ice); }
.bonus-line { font-size: 13px; font-weight: 600; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.ruler { position: relative; margin: 34px 4px 30px; height: 18px; border: 2.5px solid var(--ink); border-radius: 9px; overflow: visible; background: linear-gradient(90deg, var(--red) 0 16.7%, var(--orange) 16.7% 29.6%, #fff 29.6% 36.4%, var(--blue) 36.4% 41.7%, var(--green) 41.7% 46.2%, var(--yellow) 46.2% 53.8%, var(--green) 53.8% 58.3%, var(--blue) 58.3% 63.6%, #fff 63.6% 70.4%, var(--orange) 70.4% 83.3%, var(--red) 83.3% 100%); }
.ruler .pin { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
.ruler .truth { top: -30px; transform: translateX(-50%); }
.ruler .truth::after { content: ''; width: 3px; height: 26px; background: var(--ink); margin-top: -2px; }
.ruler .mine { top: 12px; transform: translateX(-50%); }
.ruler .mine::before { content: ''; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 12px solid var(--ink); }
.ruler .tag { font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--snow); border: 2px solid var(--ink); border-radius: 7px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.ruler .truth .tag { background: var(--ink); color: #fff; }
.ruler .mine .tag { margin-top: 2px; }

/* storm */
.storm-head { display: flex; align-items: center; gap: 12px; }
.storm-head .title { font-size: 40px; color: #fff; text-shadow: 0 4px 0 #070f1c; -webkit-text-stroke: 3px #070f1c; }
.sheet.dark .lead { color: #c8d3e6; }
.risk { display: flex; gap: 8px; margin-top: 10px; }
.risk span { flex: 1; text-align: center; font-family: var(--display); font-size: 19px; border: 2px solid #fff; border-radius: var(--r-sm); padding: 6px; }
.risk .up { background: var(--green); } .risk .down { background: var(--red); }
.sheet.dark .btn { box-shadow: 0 var(--lip) 0 #070f1c, inset 0 -4px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.45); border-color: #070f1c; }

/* end */
.end-head { text-align: center; }
.end-head .badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; background: var(--ice); border: 2px solid var(--ink); border-radius: var(--r-sm); padding: 4px 10px; }
.end-head .badge.top { background: var(--yellow); }
.big-alt { font-family: var(--display); font-size: 64px; line-height: 1; margin: 10px 0 2px; font-variant-numeric: tabular-nums; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; color: var(--snow); text-shadow: 0 5px 0 var(--ink); }
.big-alt small { font-size: 28px; }
.squares { font-size: 22px; letter-spacing: 3px; margin-top: 6px; }
.panel { margin-top: 16px; border: 2.5px solid var(--ink); border-radius: 16px; background: var(--ice); padding: 12px 12px 8px; }
.pct { display: flex; align-items: baseline; gap: 10px; }
.pct b { font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1; color: var(--blue); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
.pct span { font-weight: 600; font-size: 15px; line-height: 1.2; }
.sub { font-size: 12px; color: var(--mut); margin-top: 4px; }
.curve { width: 100%; height: auto; display: block; margin-top: 6px; }
.c-area { fill: #fff; }
.c-mine { fill: var(--yellow); }
.c-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.c-base { stroke: var(--ink); stroke-width: 2; }
.c-tick { stroke: var(--ink); stroke-width: 1.5; }
.c-lbl { font: 600 10px var(--body); fill: var(--mut); }
.c-you-line { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 4 3; }
.c-dot { fill: var(--red); stroke: var(--ink); stroke-width: 2.5; }
.c-pill { fill: var(--ink); }
.c-pill-t { font: 700 12px var(--body); fill: #fff; }
.panel h3 { font-family: var(--display); font-weight: 400; font-size: 20px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.ctry { display: grid; grid-template-columns: 22px 26px 1fr auto; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1.5px solid rgba(19,35,58,.15); font-size: 14px; }
.ctry:first-of-type { border-top: 0; }
.ctry .rk { font-family: var(--display); font-size: 16px; text-align: center; }
.ctry img { width: 26px; height: 18px; object-fit: cover; border: 1.5px solid var(--ink); border-radius: 3px; background: #fff; }
.ctry .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctry .av { font-weight: 700; font-variant-numeric: tabular-nums; }
.ctry.me { background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; }
.next-in { text-align: center; font-size: 14px; color: var(--mut); margin-top: 14px; font-variant-numeric: tabular-nums; }
.banner { margin-top: 16px; min-height: 100px; display: grid; place-items: center; }
.ad-placeholder { width: 100%; height: 100px; display: grid; place-items: center; border: 2px dashed #9aa8ba; border-radius: 12px; color: #8a98aa; font-size: 13px; background: repeating-linear-gradient(45deg, #f5f8fb 0 10px, #eef3f8 10px 20px); }
.install { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px; border: 2px solid var(--ink); border-radius: 14px; background: #fff6d9; font-size: 14px; font-weight: 500; }
.install .btn { margin: 0; min-height: 40px; width: auto; font-size: 16px; padding: 4px 12px; }
.install .x { background: none; border: 0; font-size: 13px; color: var(--mut); text-decoration: underline; }

/* pop, toast, confetti */
.pop { position: fixed; z-index: 3; left: 0; right: 0; top: 30%; display: flex; flex-direction: column; align-items: center; pointer-events: none; opacity: 0; }
.pop.show { animation: pop 1.6s cubic-bezier(.2,1.6,.4,1) forwards; }
.pop .word { font-family: var(--display); font-size: clamp(44px, 13vw, 76px); line-height: 1; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); }
@keyframes pop { 0% { opacity: 0; transform: scale(.3) rotate(-6deg) } 14% { opacity: 1; transform: scale(1.12) rotate(2deg) } 26% { transform: scale(1) rotate(0) } 78% { opacity: 1 } 100% { opacity: 0; transform: translateY(-30px) } }
.toast { position: fixed; z-index: 5; top: calc(136px + var(--safe-t)); left: 50%; transform: translate(-50%, -14px); display: flex; align-items: center; gap: 8px; background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); padding: 6px 14px 6px 8px; font-family: var(--display); font-size: 18px; opacity: 0; transition: .3s cubic-bezier(.2,1.5,.4,1); pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.death { background: var(--ink); color: #fff; }
.confetti { position: fixed; z-index: 3; top: 34%; left: 50%; width: 10px; height: 14px; border: 1.5px solid var(--ink); pointer-events: none; animation: conf 1.3s cubic-bezier(.15,.7,.4,1) forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
.flash { position: fixed; inset: 0; z-index: 2; background: #fff; opacity: 0; pointer-events: none; }

/* language menu */
.menu { position: fixed; z-index: 6; top: calc(66px + var(--safe-t)); right: 14px; background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--ink); padding: 6px; display: none; min-width: 170px; }
.menu.open { display: block; }
.lang-opt { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; padding: 10px 12px; border-radius: 9px; font-weight: 500; font-size: 16px; }
.lang-opt[aria-checked="true"] { background: var(--yellow); font-weight: 700; }

/* ads (simulated) */
.ad-mock { position: fixed; inset: 0; z-index: 10; background: rgba(8,14,26,.92); display: grid; place-items: center; }
.ad-mock-box { width: min(320px, 86vw); aspect-ratio: 9/14; border-radius: 18px; background: linear-gradient(160deg, #2a3b55, #13233a); border: 3px solid #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #fff; position: relative; }
.ad-mock-tag { position: absolute; top: 12px; left: 12px; font-size: 12px; font-weight: 700; background: #fff; color: var(--ink); border-radius: 6px; padding: 2px 8px; }
.ad-mock-count { font-family: var(--display); font-size: 72px; }
.ad-mock-bar { width: 70%; height: 8px; border-radius: 4px; background: rgba(255,255,255,.2); overflow: hidden; }
.ad-mock-bar i { display: block; height: 100%; width: 100%; background: var(--yellow); transform-origin: left; animation: adbar 3s linear forwards; }
@keyframes adbar { from { transform: scaleX(0) } to { transform: scaleX(1) } }

@media (min-width: 900px) {
  .sheet { left: auto; right: 32px; transform: none; bottom: 32px; width: 440px; max-height: calc(100% - 64px); }
  .sheet.out { transform: translateY(30px); }
  .flags { top: 18px; }
  .toast { top: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .flag.cur, .flag.done { animation: none; }
  .pop.show { animation-duration: .01s; }
}
/* ---------- v3: persistent journey ---------- */
.jcard { margin-top: 14px; border: var(--stroke) solid var(--ink); border-radius: 18px; background: linear-gradient(160deg, #ffffff 0%, var(--ice) 100%); padding: 12px 14px; box-shadow: 0 4px 0 var(--ink); }
.jc-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.jc-top strong { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; line-height: 1.05; }
.jc-lbl { font-size: 12px; color: var(--mut); font-weight: 600; }
.jc-dist { text-align: right; }
.jc-dist b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; font-variant-numeric: tabular-nums; }
.jc-dist span { font-size: 12px; color: var(--mut); }
.jc-bar { margin-top: 10px; height: 12px; border: 2.5px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; }
.jc-bar i { display: block; height: 100%; background: repeating-linear-gradient(135deg, var(--yellow) 0 10px, #ffd65a 10px 20px); border-right: 2px solid var(--ink); transition: width .6s; }
.jc-next { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.jc-next b { font-family: var(--display); font-weight: 400; font-size: 16px; letter-spacing: .08em; }
.jc-eta { margin-left: auto; font-weight: 700; color: var(--ink); }
.btn-ghost .ic { width: 24px; height: 24px; }
.map { list-style: none; display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; position: relative; }
.map::before { content: ''; position: absolute; left: 31px; top: 10px; bottom: 10px; width: 4px; background: repeating-linear-gradient(var(--ink) 0 8px, transparent 8px 14px); opacity: .35; }
.mw { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; }
.mw > .ic { flex: none; background: #fff; border-radius: 10px; }
.mw div { flex: 1; min-width: 0; }
.mw strong { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; }
.mw span { font-size: 13px; color: var(--mut); }
.mw.done { background: var(--ice); }
.mw.here { background: var(--yellow); box-shadow: 0 4px 0 var(--ink); }
.mw.here span { color: var(--ink); font-weight: 700; }
.mw.locked { background: repeating-linear-gradient(45deg, #f3f6f9 0 10px, #e8eef4 10px 20px); border-style: dashed; }
.mw.locked strong { letter-spacing: .2em; color: var(--mut); }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { flex: 1; border: 2px solid var(--ink); border-radius: 10px; background: #fff; padding: 7px 4px; font-weight: 700; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.pts-tag { font-family: var(--display); font-size: 16px; color: var(--ink); background: var(--ice); border: 2px solid var(--ink); border-radius: 8px; padding: 1px 8px; }
.bonus-tag { font-style: normal; font-weight: 700; color: #fff; background: var(--blue); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.wcard { position: fixed; z-index: 6; left: 50%; top: 26%; transform: translate(-50%, -50%) scale(.6); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 28px 20px; background: var(--snow); border: var(--stroke) solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink); opacity: 0; pointer-events: none; }
.wcard.show { animation: wcard 3s cubic-bezier(.2,1.5,.4,1) forwards; }
.wcard strong { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 8vw, 40px); white-space: nowrap; }
.wc-tag { font-weight: 700; font-size: 13px; background: var(--yellow); border: 2px solid var(--ink); border-radius: 8px; padding: 2px 10px; }
@keyframes wcard { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(-4deg) } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(1deg) } 22% { transform: translate(-50%, -50%) scale(1) } 82% { opacity: 1; transform: translate(-50%, -50%) scale(1) } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.96) } }

/* ---------- rarity climb: the tier pops at each threshold while the climber goes up the gauge ---------- */
[hidden] { display: none !important; }
.callout { position: fixed; z-index: 4; left: 50%; bottom: calc(34px + var(--safe-b)); width: min(92vw, 520px); transform: translate(-50%, 14px); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s, transform .25s; }
.callout.show { opacity: 1; transform: translate(-50%, 0); }
.c-ans { background: var(--snow); border: 2.5px solid var(--ink); border-radius: 10px; box-shadow: 0 3px 0 var(--ink); padding: 3px 10px; font-size: 14px; font-weight: 500; }
.c-ans b { font-family: var(--display); font-weight: 400; font-size: 17px; font-variant-numeric: tabular-nums; }
.c-tier { font-family: var(--display); font-size: clamp(40px, 12vw, 68px); line-height: 1.05; color: var(--tc, #fff); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink); white-space: nowrap; }
.c-tier.bump { animation: cpop .45s cubic-bezier(.2, 1.8, .4, 1); }
.c-tier.land { animation: cland .75s cubic-bezier(.2, 1.6, .4, 1); }
.c-tier.legend { animation: hue 1.4s linear infinite; }
.c-tier.legend.bump { animation: cpop .45s cubic-bezier(.2, 1.8, .4, 1), hue 1.4s linear infinite; }
.c-tier.legend.land { animation: cland .9s cubic-bezier(.2, 1.6, .4, 1), hue 1.4s linear infinite; }
.c-gain { font-family: var(--display); font-size: 24px; background: var(--yellow); border: var(--stroke) solid var(--ink); border-radius: var(--r-sm); padding: 2px 12px; box-shadow: 0 3px 0 var(--ink); font-variant-numeric: tabular-nums; }
.c-bonus { display: inline-flex; font-weight: 700; font-size: 14px; color: #fff; background: var(--orange); border: 2.5px solid var(--ink); border-radius: 9px; padding: 2px 10px; box-shadow: 0 3px 0 var(--ink); }
.c-bonus.bump { animation: cpop .45s cubic-bezier(.2, 1.8, .4, 1); }
.c-skip { margin-top: 2px; font-size: 12px; font-weight: 600; color: #fff; opacity: .85; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
@keyframes cpop { 0% { transform: scale(.55) rotate(-4deg); } 60% { transform: scale(1.14) rotate(1deg); } 100% { transform: scale(1); } }
@keyframes cland { 0% { transform: scale(1); } 30% { transform: scale(1.32) rotate(-2deg); } 100% { transform: scale(1); } }
@keyframes hue { to { filter: hue-rotate(360deg); } }

.gauge { position: fixed; z-index: 3; left: calc(16px + env(safe-area-inset-left, 0px)); top: calc(150px + var(--safe-t)); bottom: calc(250px + var(--safe-b)); width: 160px; pointer-events: none; opacity: 0; transform: translateX(-18px); transition: opacity .3s, transform .3s; }
.gauge.show { opacity: 1; transform: none; }
.g-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 20px; border: 3px solid var(--ink); border-radius: 11px; background: rgba(255, 255, 255, .92); box-shadow: 0 3px 0 var(--ink); }
.g-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 0 0 8px 8px; background: var(--tc, #fff); transition: background .25s; }
.g-notch { position: absolute; left: -3px; width: 26px; height: 0; border-top: 3px solid var(--ink); }
.g-notch b { position: absolute; left: 36px; top: 0; transform: translateY(-50%); white-space: nowrap; font-family: var(--display); font-weight: 400; font-size: 13px; padding: 1px 7px; border: 2px solid var(--ink); border-radius: 7px; background: rgba(255, 255, 255, .9); color: var(--mut); transition: background .2s, color .2s; }
.g-notch.on b { background: var(--tc); color: var(--ink); box-shadow: 0 2px 0 var(--ink); }
.g-notch.secret b { letter-spacing: .12em; }
.g-notch.secret.on b { letter-spacing: 0; animation: hue 1.4s linear infinite; }
.g-notch.hit b { animation: nhit .5s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes nhit { 0% { transform: translateY(-50%) scale(.7); } 60% { transform: translateY(-50%) scale(1.25); } 100% { transform: translateY(-50%) scale(1); } }
.g-knob { position: absolute; left: 50%; bottom: 0; width: 28px; height: 28px; transform: translate(-50%, 50%); border-radius: 50%; background: var(--tc, #fff); border: 3px solid var(--ink); box-shadow: 0 2px 0 var(--ink), 0 0 0 4px rgba(255, 255, 255, .45); transition: background .25s; }

body.shake #gl, body.shake #labels { animation: shake .45s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translate(-2px, 1px); } 20%, 80% { transform: translate(4px, -2px); } 30%, 50%, 70% { transform: translate(-6px, 2px); } 40%, 60% { transform: translate(6px, -1px); } }

.word.legend { animation: hue 1.4s linear infinite; }
@media (min-width: 900px) {
  .callout { bottom: 48px; }
  .gauge { left: 32px; top: 150px; bottom: 60px; }
}
@media (max-height: 700px) and (min-aspect-ratio: 1/1) {
  .gauge { top: calc(100px + var(--safe-t)); bottom: calc(24px + var(--safe-b)); }
  .callout { bottom: calc(14px + var(--safe-b)); }
  .c-tier { font-size: clamp(34px, 9vh, 56px); }
}
@media (prefers-reduced-motion: reduce) {
  .c-tier.bump, .c-tier.land, .c-bonus.bump, .g-notch.hit b, body.shake #gl, body.shake #labels { animation: none; }
}

/* links to the legal pages */
.legal { margin-top: 12px; text-align: center; font-size: 12px; color: var(--mut); }
.legal a, .legal .lnk { color: var(--mut); font-weight: 600; text-decoration: underline; background: none; border: 0; padding: 0; font-size: 12px; }
.sheet.dark .legal, .sheet.dark .legal a { color: #a9b6c7; }

/* ---------- friends: nickname, leagues, challenges ---------- */
.s-title { font-size: clamp(30px, 8.5vw, 40px); margin-bottom: 6px; overflow-wrap: anywhere; }
.s-wait { margin: 18px 0; }
.s-err { min-height: 18px; margin: 6px 2px 4px; color: var(--red); font-size: 14px; font-weight: 600; }
.s-me { margin: 2px 0 10px; }
.lnk { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; text-decoration: underline; font-size: inherit; }
.s-row { display: flex; gap: 8px; align-items: stretch; margin-top: 12px; }
.s-row .field { flex: 1; min-width: 0; }
.s-row .field input { font-size: 18px; padding: 10px 12px; font-family: var(--body); font-weight: 600; }
.s-row .btn { width: auto; flex: none; min-height: 0; font-size: 17px; padding: 8px 14px; }
.lg-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 4px; }
.lg-card { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--snow); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); padding: 8px 12px; }
.lg-card:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.lg-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lg-name { font-family: var(--display); font-size: 20px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-meta { font-size: 13px; color: var(--mut); }
.lg-go { font-family: var(--display); font-size: 28px; color: var(--mut); }
.s-code { margin: 16px auto 6px; width: fit-content; font-family: var(--display); font-size: clamp(40px, 13vw, 58px); letter-spacing: .12em; padding: 6px 18px 4px 26px; background: var(--yellow); border: var(--stroke) solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); user-select: all; }
.s-lname { text-align: center; font-weight: 700; margin-bottom: 14px; overflow-wrap: anywhere; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lb-head .s-title { margin: 0; min-width: 0; }
.lb-code { flex: none; font-family: var(--display); letter-spacing: .1em; background: var(--ice); border: 2px solid var(--ink); border-radius: 9px; padding: 2px 8px; }
.lb { margin: 4px 0 12px; border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--snow); }
.lb-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1.5px solid rgba(19,35,58,.12); }
.lb-row:first-child { border-top: 0; }
.lb-row .rk { font-family: var(--display); font-size: 18px; text-align: center; }
.lb-row .nm { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lb-row .nm small { color: var(--mut); font-weight: 500; }
.lb-row .sc { font-family: var(--display); font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-row .sc small { font-family: var(--body); font-size: 12px; color: var(--mut); }
.lb-row.me { background: #fff3c4; }
.s-leave { display: block; margin: 10px auto 0; color: var(--mut); font-size: 13px; }
.s-banner { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; margin-top: 12px; padding: 8px 12px; background: #fff3c4; border: 2.5px solid var(--ink); border-radius: 14px; font-size: 14px; line-height: 1.3; }
.s-banner span { flex: 1; min-width: 0; }
.s-banner small { display: block; font-family: var(--display); letter-spacing: .1em; font-size: 16px; }
.s-banner .s-go { flex: none; font-family: var(--display); font-size: 16px; background: var(--blue); color: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 4px 10px; }
.s-banner.duel { background: #ffe1d6; }
.duel-card { background: #ffe1d6; }
.duel-top { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.duel-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 8px 0 4px; text-align: center; }
.duel-vs span { display: flex; flex-direction: column; font-size: 13px; color: var(--mut); background: var(--snow); border: 2px solid var(--ink); border-radius: 12px; padding: 6px 4px; overflow: hidden; }
.duel-vs span b { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--ink); }
.duel-vs span.win { background: var(--yellow); color: var(--ink); }
.duel-vs i { font-style: normal; font-weight: 700; color: var(--mut); }
.sheet.dark .lnk { color: #8fc0ff; }
