/* Yomi's solid selection and restrained motions, shared by the Mini App and games. */
:root {
  --selection-bg: #5ae0b1;
  --selection-ink: #063424;
  --control-line: #ffffff38;
  --negative-bg: #ffb0b8;
  --negative-ink: #480918;
  --ui-ease: cubic-bezier(.2,.75,.25,1);
}
html[data-theme="light"] {
  --selection-bg: #146844;
  --selection-ink: #ffffff;
  --control-line: #30233440;
  --negative-bg: #a2223e;
  --negative-ink: #ffffff;
}
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--pink, var(--accent, #e8c8df));
  outline-offset: 3px;
}
/* Scope the shared selection to buttons; correct/wrong quiz answers keep their meaning. */
html body button:is(.selected, [aria-pressed="true"]):not(.answer-button),
html[data-theme][data-wallpaper] body :is(.chip.selected,.theme-option.selected,.media-tabs button.selected,.nav-item.active),
html body .bottom-nav .nav-item.active {
  background: var(--selection-bg);
  color: var(--selection-ink);
  border-color: var(--selection-bg);
  box-shadow: inset 0 0 0 1px var(--selection-bg);
  font-weight: 800;
  opacity: 1;
}
html body button:is(.selected,[aria-pressed="true"]) :where(small,b,strong,.scene-copy,.scene-copy small,.scene-selected,.mode-icon,.mode-check,.map-mark,.role-mark,.selection-dot),
html body .nav-item.active :is(small,.nav-glyph,.chosen-emoji) { color: var(--selection-ink); }
.choice-check { display:grid;place-items:center;flex:none;width:19px;height:19px;border-radius:50%;font-size:12px;font-weight:900;visibility:hidden; }
.selected .choice-check { visibility:visible; background:var(--selection-ink); color:var(--selection-bg); }
html body :is(.route-option,.hero-option,.map-choice,.role-choice,.mode-card,.scene-choice) { position:relative; }
html body :is(.route-option,.hero-option,.map-choice,.role-choice,.mode-card,.duel-options button) { background:#233047;color:#f3f1f5;border-color:var(--control-line); }
html body button.selected :is(.role-mark,.map-mark,.mode-icon,.mode-check) { color:var(--selection-ink); }
html body :is(.route-option,.hero-option,.map-choice,.role-choice).selected::after {
  content:"✓";position:absolute;right:5px;top:5px;display:grid;place-items:center;width:18px;height:18px;
  background:var(--selection-ink);color:var(--selection-bg);border-radius:50%;font:900 12px/1 sans-serif;pointer-events:none;
}
html body :is(.role-choice,.map-choice).selected { padding-right:28px; }
html body .role-choice.selected .selection-dot { display:none; }
html body .mode-card.selected .mode-check { color:var(--selection-ink); }
html body #menu .screen-choice { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px; }
html body #menu .screen-choice button { min-width:0;white-space:normal;font-size:13px;line-height:1.4; }
html body .shop-tabs button.selected kbd { color:var(--selection-ink);border-color:var(--selection-ink); }
html body .touch-actions button.active { background:var(--selection-bg);color:var(--selection-ink);border-color:var(--selection-bg); }
html[data-theme][data-wallpaper] body .answer-button:is(.selected,.correct) { background:var(--selection-bg);color:var(--selection-ink);border-color:var(--selection-bg);opacity:1; }
html[data-theme][data-wallpaper] body .answer-button.wrong { background:var(--negative-bg);color:var(--negative-ink);border-color:var(--negative-bg);opacity:1; }
html body .answer-button:is(.selected,.correct,.wrong) .answer-letter { color:inherit;border-color:currentColor; }
html body .scene-choice.selected { outline:2px solid var(--selection-bg);outline-offset:2px; }
html body button:is(.selected,[aria-pressed="true"]):disabled { opacity:.65; }
html body :is(.primary,.secondary,.quiet,.theme-option,.scene-choice,.feature-card,.game-card,.profile-shortcuts button,.anime-filter-choice,.anime-interest,.chip,.nav-item,.hero-option,.route-option,.map-choice,.role-choice,.element-choice,.mode-card,.shop-tabs button,.duel-options button) {
  transition: transform .16s var(--ui-ease), border-color .2s ease, box-shadow .2s ease;
}
html body :is(.primary,.secondary,.quiet,.theme-option,.scene-choice,.feature-card,.game-card,.profile-shortcuts button,.anime-filter-choice,.anime-interest,.chip,.nav-item,.hero-option,.route-option,.map-choice,.role-choice,.element-choice,.mode-card):not(:disabled):active {
  transform:scale(.97);
}
@media(hover:hover) and (pointer:fine) {
  html body :is(.scene-choice,.feature-card,.game-card,.profile-shortcuts button,.hero-option,.route-option,.map-choice,.role-choice):not(:disabled):hover { border-color:var(--pink,var(--accent,#e8c8df)); }
}

/* Opaque, readable controls over both built-in and uploaded wallpapers. */
/* Native checkbox semantics are preserved; on/off settings are visible switches. */
html body input[type="checkbox"]:not([role="switch"]) {
  appearance:none;-webkit-appearance:none;position:relative;display:inline-grid;place-content:center;
  flex:0 0 22px;min-width:22px;width:22px;height:22px;min-height:22px;margin:0;
  border:2px solid var(--muted,#b6c6d2);border-radius:6px;background:var(--panel-2,#233047);cursor:pointer;
}
html body input[type="checkbox"]:not([role="switch"])::before {
  content:"✓";font:900 14px/1 sans-serif;color:var(--selection-ink);opacity:0;
}
html body input[type="checkbox"]:not([role="switch"]):is(:checked,:indeterminate) { background:var(--selection-bg);border-color:var(--selection-bg); }
html body input[type="checkbox"]:not([role="switch"]):checked::before { opacity:1; }
html body input[type="checkbox"]:not([role="switch"]):indeterminate::before { content:"–";opacity:1; }
html body input[type="checkbox"]:disabled { opacity:.5;cursor:not-allowed; }
html body input[type="checkbox"][role="switch"] {
  appearance:none;-webkit-appearance:none;position:relative;display:block;flex:0 0 48px;
  width:48px;min-width:48px;height:28px;min-height:28px;padding:3px;margin:0;
  border:1px solid var(--muted,#b6c6d2);border-radius:999px;background:var(--panel-2,#233047);cursor:pointer;
}
html body input[type="checkbox"][role="switch"]::before {
  content:"";display:block;width:20px;height:20px;border-radius:50%;background:var(--muted,#b6c6d2);transition:transform .16s var(--ui-ease);
}
html body input[type="checkbox"][role="switch"]::after { content:"–";position:absolute;right:7px;top:5px;color:var(--muted,#b6c6d2);font:900 13px/1 sans-serif; }
html body input[type="checkbox"][role="switch"]:checked { background:var(--selection-bg);border-color:var(--selection-bg); }
html body input[type="checkbox"][role="switch"]:checked::before { background:var(--selection-ink);transform:translateX(18px); }
html body input[type="checkbox"][role="switch"]:checked::after { content:"✓";left:6px;right:auto;color:var(--selection-ink); }
html body :is(.toggle-row,.protection-toggle) { display:grid;grid-template-columns:minmax(0,1fr) 48px;column-gap:14px;row-gap:4px;min-height:58px;padding:11px 0;cursor:pointer; }
html body :is(.toggle-row,.protection-toggle)>span { grid-column:1;grid-row:1/3;align-self:center;min-width:0;line-height:1.45;font-size:13px; }
html body :is(.toggle-row,.protection-toggle)>input { grid-column:2;grid-row:1; }
html body :is(.toggle-row,.protection-toggle)::after { content:"Выкл";grid-column:2;grid-row:2;color:var(--muted);font-size:10px;font-weight:750;text-align:center; }
html body :is(.toggle-row,.protection-toggle):has(input:checked)::after { content:"Вкл";color:var(--selection-bg); }
html body :is(.check-row,.qs-check,.media-card footer label) { min-height:44px;align-items:center; }
html body :is(.check-row,.qs-check):has(input:checked) { border-color:var(--selection-bg); }
html body .media-card { position:relative; }
html[data-theme][data-wallpaper] body .media-card:has([data-media-select]:checked) { border-color:var(--selection-bg);box-shadow:inset 0 0 0 1px var(--selection-bg); }
html body .media-card:has([data-media-select]:checked)::after { content:"✓";position:absolute;right:8px;top:8px;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--selection-bg);color:var(--selection-ink);box-shadow:0 0 0 2px var(--panel,#233047);font:900 16px/1 sans-serif;pointer-events:none; }
html body .help-tabs button { min-width:130px;flex:1 1 130px;gap:6px;white-space:normal; }
html body .help-actions button[data-help-action="ticket-state"].selected:disabled { opacity:1; }
html body :is(.qs-tabs,.qs-format,.qs-actions,.help-tabs) .choice-label { min-width:0;white-space:normal; }
html body .qs-tabs button { min-height:48px;white-space:normal; }
@media(max-width:520px) { html body .qs-tabs { grid-template-columns:repeat(2,minmax(0,1fr)); } }
html[data-theme][data-wallpaper] body :is(.quiet,.secondary,.chip,.theme-option,.anime-filter-choice) {
  border:1px solid var(--control-line);background:var(--panel-2);color:var(--text);
}
html body :is(.primary,.secondary,.quiet) { gap:6px; }
html[data-theme][data-wallpaper] body button:is(.selected,[aria-pressed="true"]):not(.answer-button),
html[data-theme][data-wallpaper] body .media-tabs button.selected {
  background:var(--selection-bg);color:var(--selection-ink);border-color:var(--selection-bg);
}
html[data-theme][data-wallpaper] body .anime-interest { background:var(--selection-bg);color:var(--selection-ink);border-color:var(--selection-bg); }
html body .anime-filter-choice span:last-child { display:grid;place-items:center;width:21px;height:21px;border-radius:50%;background:var(--panel,var(--bg));color:var(--muted);font-weight:900; }
html body .anime-filter-choice.selected span:last-child { background:var(--selection-ink);color:var(--selection-bg); }
html body .media-tabs button { display:flex;align-items:center;justify-content:center;gap:7px;min-height:44px;font-size:13px; }
.media-tabs button::before { content:"✓";visibility:hidden;font-weight:900; }
.media-tabs button.selected::before { visibility:visible; }
html body .theme-switch { background:var(--panel-2);border-color:var(--control-line);gap:8px;padding:6px;border-radius:19px; }
html body .theme-option { display:flex;align-items:center;justify-content:center;gap:8px;min-height:54px;padding:10px 8px;font-size:13px;border-radius:14px; }
html body .theme-option .ui-icon { flex:none;width:23px;height:23px; }
.theme-option .choice-check { margin-left:2px; }
.theme-option:not(.selected) .choice-check { display:none; }
.appearance-card .panel-title { align-items:center; }
.appearance-card .field-note { margin:11px 0;font-size:11px;line-height:1.6; }
.appearance-mark .ui-icon { width:27px;height:27px; }
html body .scene-choice { min-height:82px;border:1px solid var(--control-line);border-radius:16px;padding:10px;gap:9px; }
html body .scene-preview { position:relative;isolation:isolate;flex:0 0 58px;width:58px;height:54px;border-radius:10px; }
html body .scene-copy b { font-size:12px; }
html body .scene-copy small { font-size:10px;line-height:1.4; }
html body .scene-selected { flex:0 0 18px;width:18px;height:18px;display:grid;place-items:center;border-radius:50%;visibility:hidden; }
html body .scene-choice.selected .scene-selected { background:var(--selection-ink);color:var(--selection-bg);visibility:visible;font-weight:900; }
.scene-cycle { position:absolute;inset:0;overflow:hidden; }
html body .scene-cycle img { position:absolute;inset:0;object-fit:cover;opacity:0;animation:ui-scene-cycle 12s linear infinite; }
html body .scene-cycle img:nth-child(2) { animation-delay:-8s; }
html body .scene-cycle img:nth-child(3) { animation-delay:-4s; }
.scene-auto .scene-preview::after { content:"↻";position:absolute;bottom:3px;right:3px;width:19px;height:19px;display:grid;place-items:center;border-radius:6px;background:#102332dc;color:#fff;font-size:14px;line-height:1; }
@keyframes ui-scene-cycle { 0%,30% { opacity:1;transform:scale(1); } 34%,96% { opacity:0;transform:scale(1.06); } 100% { opacity:1;transform:scale(1); } }

/* More uses Yomi-style settings rows with room for each animated icon. */
html body .more-tools { display:grid;grid-template-columns:1fr;gap:0;padding:0 14px;border:1px solid var(--line);border-radius:22px;background:var(--panel);overflow:hidden; }
html body .more-tools .feature-card { display:grid;grid-template-columns:44px minmax(0,1fr) 16px;grid-template-rows:auto auto;column-gap:12px;row-gap:4px;align-content:center;min-height:82px;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:13px 0;background:transparent; }
html body .more-tools .feature-card:last-child { border-bottom:0; }
html body .more-tools .feature-card .feature-icon { grid-row:1/3;width:44px;height:44px;border-radius:15px;align-self:center;background:var(--pink-soft); }
html body .more-tools .feature-card b { grid-column:2;grid-row:1;margin:0;align-self:end;font-size:14px;line-height:1.3; }
html body .more-tools .feature-card small { grid-column:2;grid-row:2;margin:0;align-self:start;font-size:11px;line-height:1.4; }
html body .more-tools .feature-card::after { content:"›";grid-column:3;grid-row:1/3;align-self:center;font-size:23px;color:var(--muted); }
html body .more-tools .feature-icon .ui-icon { width:25px;height:25px; }
html body .profile-shortcuts button { min-height:94px;gap:7px;border-color:var(--control-line);border-radius:17px;padding:14px 4px; }
html body .profile-shortcuts .ui-icon { width:27px;height:27px;stroke:currentColor;color:var(--pink); }
html body .profile-shortcuts small { font-size:11px; }
html body .more-tools .feature-card:focus-visible { outline-offset:-3px; }
.nh-view-enter { animation:ui-view-in .3s var(--ui-ease); }
.nh-view-enter :is(.profile-shortcuts button,.more-tools .feature-card) { animation:ui-row-in .4s var(--ui-ease) backwards;animation-delay:calc(var(--ui-order,0) * 35ms); }
.profile-shortcuts button:nth-child(2),.more-tools .feature-card:nth-child(2) { --ui-order:1; }
.profile-shortcuts button:nth-child(3),.more-tools .feature-card:nth-child(3) { --ui-order:2; }
.more-tools .feature-card:nth-child(4) { --ui-order:3; }.more-tools .feature-card:nth-child(5) { --ui-order:4; }
.more-tools .feature-card:nth-child(6) { --ui-order:5; }.more-tools .feature-card:nth-child(7) { --ui-order:6; }
.more-tools .feature-card:nth-child(8) { --ui-order:7; }.more-tools .feature-card:nth-child(9) { --ui-order:8; }
@keyframes ui-view-in { from { opacity:.6; } to { opacity:1; } }
@keyframes ui-row-in { from { opacity:0;transform:translateY(8px); } to { opacity:1;transform:none; } }

/* Navigation stays legible, with a short reaction when its selection changes. */
html body .bottom-nav { gap:5px;grid-template-columns:repeat(5,minmax(0,1fr));border-top-color:var(--control-line);padding-top:8px;box-shadow:0 -8px 24px #00000014; }
html body .bottom-nav .nav-item { min-width:0;min-height:54px;border:1px solid transparent;border-radius:15px;gap:5px;padding:6px 2px;color:var(--muted); }
html body .bottom-nav .nav-item small { font-size:10px;font-weight:650; }
html body .bottom-nav .nav-item.active small { font-weight:850; }
html body .nav-item .nav-glyph { width:25px;height:25px;transform:none; }
html body .nav-item .ui-icon { width:24px;height:24px;animation:none;stroke:currentColor; }
html body .nav-item:not(.active) .ui-icon * { animation:none; }
html body .nav-item.active .ui-icon,html body .nav-item.active .ui-emoji { animation:ui-nav-arrive .42s var(--ui-ease) both; }
@keyframes ui-nav-arrive { 0% { transform:translateY(3px) scale(.8); } 60% { transform:translateY(-2px) scale(1.08); } 100% { transform:none; } }

/* Code-native icons: each section keeps its own small, slow gesture. */
.ui-icon { display:block;width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round; }
.ui-icon,.ui-icon *,.ui-emoji { transform-box:fill-box;transform-origin:center; }
.ui-icon-home { animation:ui-home 6s ease-in-out infinite; }
.ui-icon-games { animation:ui-rock 4.8s ease-in-out infinite; }
.ui-icon-anime path:last-child,.ui-icon-sakura,.ui-icon-rating { animation:ui-spark 4.6s ease-in-out infinite; }
.ui-icon-media circle,.ui-icon-friends circle { animation:ui-float 4.8s ease-in-out infinite; }
.ui-icon-more circle { animation:ui-dots 3s ease-in-out infinite; }
.ui-icon-more circle:nth-child(2) { animation-delay:-2.8s; }.ui-icon-more circle:nth-child(3) { animation-delay:-2.6s; }
.ui-icon-chat,.ui-icon-profile,.ui-icon-help { animation:ui-float 5.2s ease-in-out infinite; }
.ui-icon-trophy { animation:ui-rock 5.8s ease-in-out infinite; }
.ui-icon-settings { animation:ui-gear 7s ease-in-out infinite; }
.ui-icon-shield .ui-shield-check { animation:ui-shield 5s ease-in-out infinite; }
.ui-icon-support { animation:ui-rock 5.4s ease-in-out infinite; }
.ui-icon-moon,.ui-icon-lantern,.ui-icon-dango { animation:ui-float 5.2s ease-in-out infinite; }
.ui-icon-fox,.ui-icon-butterfly { animation:ui-rock 5.6s ease-in-out infinite; }
.ui-emoji { display:inline-block;animation:ui-float 5.2s ease-in-out infinite; }
.theme-option .ui-icon { animation:none; }
.theme-option.selected .ui-icon-moon { animation:ui-moon-arrive .65s var(--ui-ease) both; }
.theme-option.selected .ui-icon-sun { animation:ui-sun-arrive .8s var(--ui-ease) both; }
.theme-option.selected .ui-sun-rays { animation:ui-sun-rays 8s linear infinite; }
@keyframes ui-home { 0%,25%,100% { transform:none; } 35% { transform:translateY(-1.5px); } 45% { transform:none; } }
@keyframes ui-rock { 0%,100% { transform:rotate(-3deg); } 50% { transform:rotate(4deg); } }
@keyframes ui-float { 0%,100% { transform:none; } 50% { transform:translateY(-2px); } }
@keyframes ui-spark { 0%,100% { transform:scale(1); } 50% { transform:scale(1.08); } }
@keyframes ui-dots { 0%,30%,70%,100% { transform:none; } 50% { transform:translateY(-2px); } }
@keyframes ui-gear { 0%,100% { transform:rotate(-9deg); } 50% { transform:rotate(14deg); } }
@keyframes ui-shield { 0%,75%,100% { transform:none; } 85% { transform:scale(.75); } 92% { transform:scale(1.12); } }
@keyframes ui-moon-arrive { from { transform:rotate(-35deg) scale(.7);opacity:.3; } to { transform:none;opacity:1; } }
@keyframes ui-sun-arrive { 0% { transform:rotate(-45deg) scale(.6);opacity:.3; } 65% { transform:rotate(8deg) scale(1.15);opacity:1; } 100% { transform:none;opacity:1; } }
@keyframes ui-sun-rays { to { transform:rotate(360deg); } }
/* Paused and offscreen icons consume no ongoing animation work. */
html.nh-ui-paused :is(.ui-icon,.ui-icon *,.ui-emoji,.scene-cycle img,.nh-illustration *),
.nh-ui-offscreen,.nh-ui-offscreen * { animation-play-state:paused!important; }
body.moon-running .route-option .nh-illustration * { animation-play-state:paused!important; }
@media(max-width:420px) and (min-width:361px) {
  html body .scene-choice:not(.scene-auto) { flex-wrap:wrap; }
  html body .scene-choice:not(.scene-auto) .scene-copy { flex-basis:calc(100% - 30px); }
  html body .scene-choice:not(.scene-auto) .scene-preview { flex-basis:100%;width:100%;height:72px; }
  html body .scene-choice:not(.scene-auto) .scene-selected { margin-left:auto; }
}
@media(max-width:360px) {
  html body .anime-filter-choices { grid-template-columns:1fr; }
}
@media(max-width:380px) { html body #menu .screen-choice { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:reduce) {
  html body *,html body *::before,html body *::after { animation:none!important;transition:none!important;scroll-behavior:auto!important; }
  html body .scene-cycle img:first-child { opacity:1;transform:none; }
}

/* v150: correctness must remain unmistakable in every theme and wallpaper. */
html[data-theme][data-wallpaper] body .answer-button.pending{background:#eee5d4;color:#433d3a;border-color:#be9e65;opacity:1;box-shadow:inset 0 0 0 2px #d7b67b}
html[data-theme][data-wallpaper] body .answer-button.correct{background:#bce9ce;color:#174c34;border-color:#3b9265;opacity:1;box-shadow:inset 0 0 0 2px #3b9265}
html[data-theme][data-wallpaper] body .answer-button.wrong{background:#f6c3cb;color:#78223a;border-color:#c54561;opacity:1;box-shadow:inset 0 0 0 2px #c54561}
.answer-feedback{padding:10px 13px;border-radius:12px;font-size:14px;font-weight:800}.answer-feedback.is-correct{background:#bce9ce;color:#174c34}.answer-feedback.is-wrong{background:#f6c3cb;color:#78223a}
