@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
  --cipher-cell-width: 32px;
  --cipher-cell-height: 52px;
  --red: #8c3dc1;
  --red-dark: #54297e;
  --bg: #0a0a0a;
  --text-color: #fff;
  --text-muted: #aaa3b3;
  --glass: rgba(31, 27, 38, .78);
  --glass-hover: rgba(58, 48, 70, .9);
  --glass-border: rgba(183, 123, 255, .25);
  --page-bg: radial-gradient(circle at 50% 110%, #24142f 0%, #0a0a0a 62%);
  --danger: #ff6f82;
  --success: #65d29a;
  --warning: #f4c65d;
  --focus: #e0bbff;
  --category-color: #e0bbff;
  --category-accent: #68308d;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--telegram-content-safe-top, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--telegram-content-safe-right, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--telegram-content-safe-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--telegram-content-safe-left, 0px));
  --app-height: var(--telegram-stable-height, 100dvh);
}

:root.light-theme {
  --bg: #f3eff7;
  --text-color: #221a2b;
  --text-muted: #6e6478;
  --glass: rgba(255, 255, 255, .84);
  --glass-hover: rgba(255, 255, 255, .96);
  --glass-border: rgba(84, 41, 126, .16);
  --page-bg: radial-gradient(circle at 50% 110%, #e7d5f0 0%, #f7f4f9 62%);
  --focus: #68308d;
}

body.telegram-mini-app {
  --bg: var(--tg-theme-bg-color, #0a0a0a);
  --text-color: var(--tg-theme-text-color, #fff);
  --text-muted: var(--tg-theme-hint-color, #aaa3b3);
  --glass: var(--tg-theme-secondary-bg-color, rgba(31, 27, 38, .9));
  --glass-hover: var(--tg-theme-section-bg-color, rgba(58, 48, 70, .95));
  --glass-border: var(--tg-theme-section-separator-color, rgba(183, 123, 255, .25));
  --page-bg: var(--tg-theme-bg-color, #0a0a0a);
  --red: var(--tg-theme-button-color, #8c3dc1);
  --focus: var(--tg-theme-link-color, #e0bbff);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: var(--app-height); min-height: var(--app-height); overflow: hidden; }
html { color-scheme: dark; background: var(--bg); overscroll-behavior: none; }
:root.light-theme { color-scheme: light; }
body { margin: 0; color: var(--text-color); background: var(--page-bg); font-family: Inter, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button, a { color: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.gradient-background { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.gradient-sphere { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .22; }
.sphere-1 { width: 42vw; height: 42vw; top: -15vw; right: -8vw; background: #8c3dc1; }
.sphere-2 { width: 34vw; height: 34vw; bottom: -12vw; left: -8vw; background: #4d2390; }
.sphere-3 { width: 24vw; height: 24vw; top: 40%; left: 38%; background: #d34db2; opacity: .1; }
.grid-overlay { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 46px 46px; mask-image: linear-gradient(to bottom, #000, transparent 82%); }

.shyfr-page { width: min(100%, 760px); height: var(--app-height); margin: 0 auto; padding: calc(.55rem + var(--safe-top)) calc(.65rem + var(--safe-right)) calc(.45rem + var(--safe-bottom)) calc(.65rem + var(--safe-left)); display: flex; flex-direction: column; gap: .45rem; }
body:not(.telegram-mini-app) .shyfr-page { padding-top: calc(4.7rem + var(--safe-top)); }
#siteHeaderMount { flex: 0 0 auto; }
.shyfr-shell { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 26px; background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.025)); box-shadow: 0 20px 70px rgba(0,0,0,.42); backdrop-filter: blur(24px); }
.game-brand { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem .65rem; border-bottom: 1px solid var(--glass-border); }
.game-brand h1 { margin: .12rem 0 0; font-size: clamp(1.35rem, 5vw, 2rem); line-height: 1; }
.game-brand.is-level h1 { margin-top: 0; color: var(--category-color); }
.eyebrow { margin: 0; color: var(--text-muted); font-size: .65rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, #a75ce0, #613194); box-shadow: inset 0 1px rgba(255,255,255,.22), 0 8px 24px rgba(88,35,130,.32); }
.brand-inventory { min-width: 112px; }
.app-stage { flex: 1 1 auto; min-height: 0; overflow: hidden; }

.loading-card { height: 100%; display: grid; place-content: center; gap: .75rem; text-align: center; color: var(--text-muted); }
.loading-glyph { color: var(--focus); font-weight: 800; letter-spacing: .18em; }
.screen { height: 100%; min-height: 0; padding: .8rem; display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.screen--game { overflow: hidden; padding-bottom: max(.45rem, var(--safe-bottom)); gap: .45rem; }
.screen h2, .screen h3, .screen p { margin-top: 0; }
.topline, .section-row, .profile-summary, .shop-item, .leader-row { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.topline { min-height: 40px; flex: 0 0 auto; }
.topline--end { justify-content: flex-end; }
.section-row h3 { margin: 0; font-size: .94rem; }
.section-row span { color: var(--text-muted); font-size: .76rem; }
.screen-heading h2 { margin: 0; font-size: 1.25rem; }
.screen-heading p { margin: .2rem 0 0; color: var(--text-muted); font-size: .82rem; }

.button, .icon-button, .back-button { min-height: 42px; border: 1px solid var(--glass-border); border-radius: 13px; color: var(--text-color); background: var(--glass); cursor: pointer; font-weight: 750; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .48rem; padding: .68rem .85rem; }
.button:hover, .icon-button:hover, .back-button:hover { background: var(--glass-hover); border-color: color-mix(in srgb, var(--focus) 48%, transparent); }
.button:active, .icon-button:active, .back-button:active { transform: translateY(1px) scale(.99); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button--primary { color: #fff; background: linear-gradient(145deg, #994ad2, #7437b4); border-color: rgba(224,187,255,.25); }
.button--danger { color: #ffdbe0; border-color: color-mix(in srgb, var(--danger) 42%, transparent); }
.button--wide { width: 100%; }
.icon-button, .back-button { width: 42px; padding: 0; display: grid; place-items: center; flex: 0 0 42px; }
.inventory-row { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; margin-left: auto; }
.inventory-chip { min-width: 47px; min-height: 34px; padding: .35rem .55rem; display: inline-flex; align-items: center; justify-content: center; gap: .32rem; border: 1px solid var(--glass-border); border-radius: 999px; color: var(--text-color); background: var(--glass); cursor: pointer; font-size: .78rem; font-weight: 800; }
.inventory-chip .fa-heart { color: #d35bbc; }
.inventory-chip .fa-lightbulb { color: var(--warning); }

.hero-card, .panel-card, .failure-card, .result-card, .profile-card, .leaderboard-card { border: 1px solid var(--glass-border); border-radius: 20px; background: var(--glass); padding: 1rem; }
.hero-card h2 { max-width: 500px; margin: .45rem 0; font-size: clamp(1.4rem, 6vw, 2.2rem); line-height: 1.05; }
.hero-card > p:last-child { margin: 0; color: var(--text-muted); font-size: .84rem; line-height: 1.5; }
.tutorial-card { width: 100%; padding: .85rem; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; align-items: center; gap: .72rem; border: 1px solid color-mix(in srgb, var(--category-color) 42%, var(--glass-border)); border-radius: 20px; color: inherit; text-align: left; background: linear-gradient(110deg, color-mix(in srgb, var(--category-color) 18%, var(--glass)), var(--glass)); cursor: pointer; }
.tutorial-card.is-complete { cursor: default; }
.tutorial-card__icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: var(--category-color); background: color-mix(in srgb, var(--category-accent) 42%, transparent); font-size: 1.05rem; }
.tutorial-card > span:nth-child(2) { min-width: 0; display: grid; gap: .22rem; }
.tutorial-card strong { font-size: .92rem; }
.tutorial-card small { color: var(--text-muted); font-size: .65rem; line-height: 1.35; }
.tutorial-card__progress { display: grid; justify-items: end; gap: .38rem; color: var(--category-color); font-size: .7rem; font-weight: 850; }
.category-list, .shop-list, .leaderboard-list { display: grid; gap: .52rem; }
.category-card { width: 100%; min-height: 74px; padding: .68rem; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; align-items: center; gap: .68rem; border: 1px solid var(--glass-border); border-radius: 18px; color: inherit; text-align: left; background: linear-gradient(100deg, color-mix(in srgb, var(--category-color) 16%, var(--glass)), var(--glass)); cursor: pointer; }
.category-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--category-color) 28%, transparent); color: var(--category-color); }
.category-copy { min-width: 0; display: grid; gap: .18rem; }
.category-copy strong { font-size: .87rem; }
.category-copy small { overflow: hidden; color: var(--text-muted); font-size: .68rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.category-meta { min-width: 76px; display: grid; justify-items: end; gap: .34rem; }
.badge { padding: .24rem .42rem; border-radius: 999px; font-size: .58rem; font-weight: 850; white-space: nowrap; }
.badge--free { color: #beffda; background: rgba(44,151,94,.24); }
.badge--paid { color: #ffe29a; background: rgba(159,116,18,.24); }
.badge--soon { color: #d0c8d8; background: rgba(150,140,160,.18); }
.progress-mini { overflow: hidden; background: rgba(255,255,255,.1); }
.progress-mini { width: 68px; height: 4px; border-radius: 999px; }
.progress-mini span { display: block; width: var(--progress); height: 100%; background: linear-gradient(90deg, var(--category-accent), var(--category-color)); }
.bottom-nav { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .45rem; }
.bottom-nav .button { min-width: 0; padding-inline: .35rem; font-size: .7rem; }

.notice { margin: 0; padding: .75rem; border: 1px solid var(--glass-border); border-radius: 14px; color: var(--text-muted); background: rgba(255,255,255,.035); font-size: .76rem; line-height: 1.4; }
.mistake-row { display: flex; justify-content: center; gap: .35rem; }
.mistake-stack { display: grid; justify-items: center; gap: .18rem; }
.mistake-stack > span { color: var(--text-muted); font-size: .52rem; font-weight: 850; letter-spacing: .14em; }
.mistake-dot { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid color-mix(in srgb, var(--text-muted) 55%, transparent); border-radius: 50%; color: #fff; font-size: .72rem; font-weight: 900; }
.mistake-dot.is-used { border-color: var(--danger); background: var(--danger); }
.game-guidance, .solve-message { flex: 0 0 auto; padding: .55rem .7rem; display: grid; gap: .14rem; border: 1px solid var(--glass-border); border-radius: 13px; background: rgba(255,255,255,.035); font-size: .68rem; line-height: 1.35; }
.game-guidance span { color: var(--text-muted); }
.game-guidance--hint { border-style: dashed; border-color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent); }
.solve-message { grid-template-columns: auto 1fr; align-items: center; color: #d4ffe6; border-color: color-mix(in srgb, var(--success) 48%, transparent); background: color-mix(in srgb, var(--success) 12%, transparent); font-size: .82rem; }
.cipher-scroll-wrap { position: relative; flex: 1 1 auto; min-height: 70px; overflow: hidden; border: 1px solid var(--glass-border); border-radius: 18px; background: rgba(255,255,255,.025); }
.cipher-scroll { width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain; scrollbar-width: none; }
.cipher-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.cipher-scroll-indicator { position: absolute; top: .6rem; right: .35rem; bottom: .6rem; z-index: 2; width: 4px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--category-accent) 28%, transparent); opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.cipher-scroll-wrap.is-scrollable .cipher-scroll-indicator { opacity: 1; }
.cipher-scroll-indicator__thumb { position: absolute; top: 0; left: 0; width: 100%; min-height: 20px; border-radius: inherit; background: linear-gradient(to bottom, var(--category-color), color-mix(in srgb, var(--category-accent) 58%, var(--category-color))); box-shadow: 0 0 8px color-mix(in srgb, var(--category-color) 38%, transparent); }
.cipher-board { min-height: 100%; padding: clamp(.55rem, 2.2vh, 1rem); display: grid; align-content: center; gap: .55rem; }
.cipher-board, .keyboard { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cipher-line { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem var(--cipher-cell-width); }
.cipher-word { display: inline-flex; align-items: flex-end; gap: .08rem; white-space: nowrap; }
.cipher-cell { width: var(--cipher-cell-width); min-width: var(--cipher-cell-width); height: var(--cipher-cell-height); padding: 0 1px; display: grid; grid-template-rows: 32px 2px 18px; border: 1px solid transparent; border-radius: 8px; color: var(--text-color); background: transparent; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.cipher-cell:disabled { cursor: not-allowed; }
.cipher-cell__letter { min-height: 0; display: grid; place-items: center; font-size: 1.2rem; font-weight: 900; }
.cipher-cell__line { width: 100%; height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--text-muted) 65%, transparent); }
.cipher-cell__code { display: grid; place-items: center; color: var(--text-muted); font-size: .58rem; font-weight: 700; line-height: 1; }
.cipher-cell.is-selected { border-color: var(--category-color); background: color-mix(in srgb, var(--category-accent) 24%, transparent); }
.cipher-cell.is-selected .cipher-cell__line { background: var(--category-color); }
.cipher-cell.is-revealed .cipher-cell__letter { color: var(--category-color); }
.cipher-cell.is-code-complete:not(.is-code-completing) .cipher-cell__code { color: transparent; }
.cipher-cell.is-code-completing .cipher-cell__code { animation: code-vanish .42s cubic-bezier(.2,.9,.2,1) both; }
.cipher-cell.is-hinted { border-style: dashed; border-color: var(--warning); }
.cipher-cell.is-hint-target { border-style: dashed; border-color: var(--warning); background: color-mix(in srgb, var(--warning) 8%, transparent); animation: hint-pulse 1.2s ease-in-out infinite; }
.cipher-cell.is-error { border-color: var(--danger); animation: shake .28s ease; }
.cipher-cell.is-locked { opacity: .55; border-color: rgba(255,255,255,.07); background: rgba(255,255,255,.025); }
.cipher-cell.is-locked .cipher-cell__letter { color: var(--text-muted); font-size: .72rem; }
.screen--game[data-tutorial-coach="cell"] .cipher-cell:not(.is-revealed):not(:disabled),
.screen--game[data-tutorial-coach="lock"] .cipher-cell.is-locked,
.screen--game[data-tutorial-coach="hint-cell"] .cipher-cell.is-hint-target { animation: tutorial-pulse 1.35s ease-in-out infinite; }
.screen--game[data-tutorial-coach="keyboard"] .key:not(:disabled),
.screen--game[data-tutorial-coach="hint"] [data-action="hint"] { animation: tutorial-pulse 1.35s ease-in-out infinite; }
.lock-stack { display: inline-flex; gap: 2px; font-size: .56rem; }
.cipher-cell.is-word-complete { animation: word-pop .56s cubic-bezier(.2,.9,.2,1) both; animation-delay: calc(var(--celebration-index) * 36ms); }
.cipher-board.is-solved .cipher-cell { animation: solve-wave .78s cubic-bezier(.2,.9,.2,1) both; animation-delay: calc(var(--cell-index) * 13ms); }
.cipher-literal { align-self: center; padding-bottom: 18px; font-weight: 800; }

.keyboard { flex: 0 0 auto; width: 100%; display: grid; gap: 3px; padding: 3px; border: 1px solid var(--glass-border); border-radius: 14px; background: rgba(255,255,255,.035); }
.keyboard-row { width: 100%; display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; }
.keyboard-row:nth-child(2) .key:first-child { grid-column: 2 / span 2; }
.keyboard-row:last-child .key:first-child { grid-column: 3 / span 2; }
.key { grid-column: span 2; min-width: 0; height: clamp(34px, 5.7vh, 45px); padding: 0; display: grid; place-items: center; border: 1px solid var(--glass-border); border-radius: 8px; color: var(--text-color); background: var(--glass); cursor: pointer; font-size: clamp(.75rem, 3.3vw, .98rem); font-weight: 850; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* Shyfr keeps the shared cursor visually static while it moves. */
body.shyfr-page-body .custom-cursor,
body.shyfr-page-body .custom-cursor.cursor-hover,
body.shyfr-page-body .custom-cursor.cursor-click {
  width: 20px !important;
  height: 20px !important;
  background: rgba(255, 255, 255, .56) !important;
  box-shadow: 0 0 12px rgba(255, 255, 255, .5) !important;
  transition: opacity .16s ease !important;
}
.key.is-partial { color: var(--category-color); border-color: color-mix(in srgb, var(--category-color) 54%, transparent); background: color-mix(in srgb, var(--category-accent) 24%, var(--glass)); }
.key.is-complete { color: color-mix(in srgb, var(--text-muted) 78%, transparent); border-color: color-mix(in srgb, var(--text-muted) 24%, transparent); background: color-mix(in srgb, var(--text-muted) 12%, var(--glass)); }
.key:disabled { cursor: not-allowed; opacity: .58; }
.key.is-complete:disabled { opacity: 1; }
.game-actions .button.is-active { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 12%, var(--glass)); }
.game-actions { flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.game-actions .button { min-height: 38px; padding: .5rem; font-size: .74rem; }

.failure-card { margin: auto 0; text-align: center; }
.failure-symbol { width: 56px; height: 56px; margin: 0 auto .7rem; display: grid; place-items: center; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #b74c75, #7b2d54); font-size: 1.4rem; }
.failure-card h2 { margin-bottom: .45rem; }
.failure-card p { color: var(--text-muted); line-height: 1.5; }
.action-stack { display: grid; gap: .55rem; }
.action-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.result-card blockquote { margin: .8rem 0; font-size: clamp(1.12rem, 4.8vw, 1.55rem); font-weight: 850; line-height: 1.42; }
.source-line { display: grid; gap: .18rem; color: var(--text-muted); font-size: .78rem; line-height: 1.45; }
.source-line strong { color: var(--text-color); }
.spotify-widget { margin: .9rem 0 .55rem; overflow: hidden; border: 1px solid color-mix(in srgb, #1ed760 42%, var(--glass-border)); border-radius: 16px; background: color-mix(in srgb, #1ed760 8%, var(--glass)); }
.spotify-widget__label { min-height: 34px; padding: .45rem .7rem; display: flex; align-items: center; gap: .4rem; color: #1ed760; font-size: .7rem; font-weight: 850; }
.spotify-widget__player { width: 100%; height: 152px; display: block; border: 0; }
.result-stats, .profile-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: .45rem; margin: .9rem 0; }
.stat, .profile-metric { padding: .55rem .25rem; text-align: center; border: 1px solid var(--glass-border); border-radius: 13px; }
.stat strong, .profile-metric strong { display: block; font-size: 1rem; }
.stat span, .profile-metric span { color: var(--text-muted); font-size: .58rem; }
.shop-item { padding: .7rem; border: 1px solid var(--glass-border); border-radius: 16px; background: var(--glass); }
.shop-item > div { display: grid; gap: .18rem; }
.shop-item small { color: var(--text-muted); font-size: .67rem; }
.reset-card { padding: .85rem; display: grid; justify-items: center; gap: .2rem; border: 1px dashed var(--glass-border); border-radius: 18px; background: rgba(255,255,255,.025); }
.reset-card span, .reset-card small { color: var(--text-muted); font-size: .66rem; }
.reset-card strong { color: var(--focus); font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.resource-list { display: grid; gap: .6rem; }
.resource-card { padding: .85rem; border: 1px solid var(--glass-border); border-radius: 18px; background: var(--glass); }
.resource-card__heading { display: flex; align-items: center; gap: .65rem; }
.resource-card__heading > div { display: grid; gap: .12rem; }
.resource-card__heading strong { font-size: 1.05rem; }
.resource-card__heading span { color: var(--text-muted); font-size: .67rem; }
.resource-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; }
.resource-icon--lives { color: #ff92c4; background: rgba(211,91,188,.16); }
.resource-icon--hints { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); }
.resource-card p { margin: .65rem 0; color: var(--text-muted); font-size: .72rem; line-height: 1.45; }
.profile-summary { justify-content: flex-start; }
.avatar { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 16px; color: #fff; background: linear-gradient(145deg, #a75ce0, #613194); font-weight: 900; }
.avatar img, .leader-avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.profile-summary h2, .profile-summary p { margin: 0; }
.profile-summary p { color: var(--text-muted); font-size: .72rem; }
.profile-grid { grid-template-columns: repeat(2,1fr); }
.leaderboard-card { padding: .65rem; }
.leader-row { min-height: 48px; padding: .5rem .6rem; border-bottom: 1px solid var(--glass-border); }
.leader-row:last-child { border-bottom: 0; }
.leader-rank { width: 30px; color: var(--warning); font-weight: 900; }
.leader-avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; overflow: hidden; border-radius: 11px; color: #fff; background: linear-gradient(145deg, #a75ce0, #613194); font-size: .8rem; font-weight: 900; }
.leader-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 760; }
.leader-score { text-align: right; font-weight: 900; }
.leader-score small { display: block; color: var(--text-muted); font-size: .56rem; font-weight: 500; }

.shyfr-footer { flex: 0 0 auto; display: flex; justify-content: space-between; padding: .1rem .25rem 0; color: var(--text-muted); font-size: .63rem; }
.toast { position: fixed; left: 50%; bottom: calc(.75rem + var(--safe-bottom)); z-index: 20; width: min(calc(100% - 1.4rem), 430px); padding: .72rem .9rem; transform: translateX(-50%); border: 1px solid var(--glass-border); border-radius: 14px; color: var(--text-color); background: color-mix(in srgb, var(--bg) 88%, transparent); box-shadow: 0 15px 50px rgba(0,0,0,.4); backdrop-filter: blur(18px); text-align: center; font-size: .76rem; }
.onboarding-screen { justify-content: center; }
.onboarding-card, .nickname-card { width: min(100%, 430px); margin: auto; padding: 1.2rem; display: grid; gap: .72rem; border: 1px solid color-mix(in srgb, var(--focus) 34%, var(--glass-border)); border-radius: 22px; background: linear-gradient(145deg, color-mix(in srgb, var(--focus) 12%, var(--glass)), var(--glass)); text-align: center; }
.onboarding-card h2, .nickname-card h2 { margin: 0; font-size: clamp(1.35rem, 5.8vw, 1.8rem); }
.onboarding-card > p:not(.eyebrow), .nickname-card > p:not(.eyebrow) { margin: 0; color: var(--text-muted); font-size: .82rem; line-height: 1.5; }
.onboarding-icon { width: 56px; height: 56px; margin: 0 auto .15rem; display: grid; place-items: center; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #a75ce0, #613194); font-size: 1.35rem; }
.nickname-card label { text-align: left; color: var(--text-muted); font-size: .72rem; font-weight: 800; }
.nickname-card input { min-height: 44px; padding: .65rem .78rem; border: 1px solid var(--glass-border); border-radius: 13px; outline: none; color: var(--text-color); background: rgba(0,0,0,.15); font: inherit; }
.nickname-card input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }

body.telegram-mini-app .shyfr-page { width: 100%; padding-top: max(.25rem, var(--safe-top)); }
body.telegram-mini-app #siteHeaderMount, body.telegram-mini-app .shyfr-footer { display: none; }
body.telegram-mini-app .shyfr-shell { border: 0; border-radius: 0; box-shadow: none; backdrop-filter: none; }
body.telegram-mini-app .game-brand { padding-top: .55rem; }

@keyframes shake { 0%,100% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } }
@keyframes hint-pulse { 0%,100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 18%, transparent); } }
@keyframes tutorial-pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--category-color) 0%, transparent); } 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--category-color) 35%, transparent); border-color: var(--category-color); } }
@keyframes word-pop { 0% { transform: translateY(0) scale(1); } 42% { transform: translateY(-7px) scale(1.12); color: var(--focus); } 100% { transform: translateY(0) scale(1); } }
@keyframes code-vanish { from { transform: scale(1); opacity: 1; } to { transform: scale(0); opacity: 0; } }
@keyframes solve-wave { 0% { transform: translateY(0) rotate(0); } 42% { transform: translateY(-9px) rotate(-3deg) scale(1.13); filter: drop-shadow(0 0 8px color-mix(in srgb, var(--success) 70%, transparent)); } 100% { transform: translateY(0) rotate(0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-height: 700px) {
  .shyfr-page { padding-top: calc(.25rem + var(--safe-top)); gap: .25rem; }
  .game-brand { padding-block: .5rem; }
  .game-brand .eyebrow { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .screen { padding: .55rem; gap: .4rem; }
  .screen--game { gap: .28rem; }
  .cipher-board { padding: .4rem; gap-block: .3rem; }
  .cipher-cell { height: 43px; grid-template-rows: 1fr 2px 14px; }
  .cipher-literal { padding-bottom: 14px; }
  .key { height: clamp(30px, 5.2vh, 37px); }
}

@media (min-width: 700px) {
  .shyfr-page { padding-inline: 1rem; }
  .screen { padding: 1rem; }
  .category-list { grid-template-columns: 1fr 1fr; }
}
