.asmr-quest {
    --aq-bg: #0b192c;
    --aq-panel: #14263e;
    --aq-text: #edf3fc;
    --aq-muted: #a0b1c9;
    --aq-line: #26384e;
    --aq-indigo: #4f46e5;
    --aq-mint: #7ddbb6;
    --aq-viewport: calc(
        100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)
    );
    box-sizing: border-box;
    min-height: 100dvh;
    background: var(--aq-bg);
    color: var(--aq-text);
    font:
        400 15px/1.45 Inter,
        'Noto Sans',
        sans-serif;
    isolation: isolate;
    padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
/* The app shell already reserves Telegram's top safe area. Standalone entry
   pages still use the device insets above. */
#main-content > .asmr-quest {
    --aq-viewport: calc(var(--app-height, 100dvh) - var(--tg-safe-area-top, 0px) - env(safe-area-inset-bottom));
    min-height: var(--aq-viewport);
    padding-top: 0;
}
#main-content > .asmr-quest[data-page='home'] .aq-screen {
    padding-top: var(--page-top-gap, 12px);
}
.asmr-quest * {
    box-sizing: border-box;
}
.asmr-quest h1,
.asmr-quest h2,
.asmr-quest p {
    margin: 0;
}
.asmr-quest button {
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    -webkit-tap-highlight-color: transparent;
}
.asmr-quest button:disabled {
    opacity: 0.4;
    cursor: default;
}
.asmr-quest button:focus-visible,
.asmr-quest canvas:focus-visible,
.asmr-quest summary:focus-visible {
    outline: 2px solid #a7a3ff;
    outline-offset: 4px;
}
.asmr-quest svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.asmr-quest button,
.asmr-quest summary {
    touch-action: manipulation;
}
.asmr-quest [hidden] {
    display: none !important;
}
.aq-screen {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 22px 22px 30px;
}
.aq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    margin-bottom: 18px;
}
.asmr-quest .aq-back {
    display: flex;
    align-items: center;
    gap: 7px;
    text-align: left;
    padding: 8px 0;
    min-height: 40px;
    color: #c8d5ea;
    font-size: 13px;
}
.aq-back > span {
    font-size: 23px;
    line-height: 1;
}
.asmr-quest h1 {
    font:
        900 clamp(27px, 7vw, 33px) / 1.13 'Exo 2',
        'Noto Sans',
        sans-serif;
    letter-spacing: -0.035em;
}
.asmr-quest p.aq-intro {
    margin: 9px 0 23px;
    color: var(--aq-muted);
    font-size: 13px;
}
.asmr-quest .aq-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 51px;
    padding: 12px 18px;
    border-radius: 15px;
    background: var(--aq-indigo);
    font-weight: 700;
    color: white;
    line-height: 1.25;
    font-size: 14px;
    transition:
        background 0.15s,
        transform 0.15s;
}
.aq-primary:hover {
    background: #5c54ee;
}
.aq-primary:active {
    transform: scale(0.985);
}
.aq-primary svg {
    width: 20px;
    height: 20px;
}
.asmr-quest .aq-wide {
    width: 100%;
}
.asmr-quest .aq-link {
    color: #c1cde4;
    padding: 12px 6px;
    min-height: 44px;
    font-size: 13px;
}
.aq-footer-link {
    display: block;
    margin: 10px auto 0;
    text-align: center;
}
.aq-game-row {
    width: 100%;
    display: flex;
    align-items: center;
    text-align: left;
    gap: 17px;
    padding: 10px 0 !important;
    border-bottom: 1px solid var(--aq-line) !important;
    min-height: 108px;
}
.aq-game-row > img {
    width: 76px;
    height: 76px;
    object-fit: contain;
    flex-shrink: 0;
}
.aq-game-row > span {
    flex: 1;
    min-width: 0;
}
.aq-game-row strong {
    display: block;
    font:
        700 16px/1.3 Inter,
        'Noto Sans',
        sans-serif;
}
.aq-game-row small {
    display: block;
    font-size: 12px;
    color: var(--aq-muted);
    margin-top: 5px;
}
.aq-game-row > svg {
    width: 19px;
    height: 19px;
    color: #bccbe2;
}
.aq-game-row:hover {
    background: #14263e55;
}
.aq-center {
    text-align: center;
}
.aq-achievement {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 0;
    border-top: 1px solid var(--aq-line);
}
.aq-check {
    width: 40px;
    height: 40px;
    border: 1px solid #45607b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #93a6bf;
    flex-shrink: 0;
    font-size: 24px;
}
.aq-check.earned {
    color: #0b2930;
    background: var(--aq-mint);
    border: 0;
}
.aq-achievement strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
}
.aq-achievement small {
    display: block;
    color: var(--aq-muted);
    font-size: 12px;
    margin-top: 5px;
}
.aq-achievement em {
    display: block;
    font-size: 11px;
    margin-top: 8px;
    font-style: normal;
    color: var(--aq-mint);
}
.asmr-quest[data-page='home'] .aq-screen {
    display: flex;
    flex-direction: column;
    min-height: var(--aq-viewport);
}
.asmr-quest[data-page='home'] .aq-header {
    margin-bottom: 0;
}
.aq-home-tagline {
    color: var(--aq-muted);
    font-size: 15px;
}
.aq-game-list {
    margin-top: 12px;
}
.aq-home-footer {
    margin-top: auto;
    padding-top: 12px;
}
.asmr-quest .aq-achievements-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-inline: 3px;
    margin-bottom: 12px;
}
.aq-achievements-link svg {
    width: 19px;
    height: 19px;
}
.aq-achievements-link svg:last-child {
    width: 15px;
    height: 15px;
}
.aq-playing .aq-screen {
    display: flex;
    flex-direction: column;
    height: max(540px, var(--aq-viewport));
    padding: 24px 18px 32px;
}
.aq-playing .aq-header {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    justify-content: start;
    gap: 10px;
    flex-shrink: 0;
    margin-bottom: 12px;
}
.aq-native-back.aq-playing .aq-header {
    grid-template-columns: minmax(0, 1fr);
}
.aq-native-back .aq-header-tools {
    margin-left: auto;
}
.aq-header-tools:empty {
    display: none;
}
.aq-back {
    width: 40px;
    justify-content: flex-start;
}
.aq-back svg {
    width: 24px;
    height: 24px;
}
.aq-game-heading {
    padding-top: 7px;
}
.aq-game-heading h1 {
    font-size: 21px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.4px;
}
.aq-game-heading p {
    color: var(--aq-muted);
    font-size: 13px;
    margin-top: 8px;
}
.aq-stage {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 280px;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.aq-stage canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.aq-clean-progress {
    flex-shrink: 0;
    width: min(100% - 40px, 300px);
    margin: 10px auto 6px;
    text-align: center;
}
#clean-status {
    display: block;
    color: var(--aq-text);
    font-size: 13px;
    margin-bottom: 12px;
}
.aq-clean-meter {
    height: 6px;
    border-radius: 6px;
    background: #25364e;
    overflow: hidden;
}
.aq-clean-meter > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--aq-indigo);
}
.aq-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.asmr-quest .aq-tool {
    border: 1px solid #30435e;
    border-radius: 11px;
    min-height: 43px;
    padding: 9px 11px;
    background: #12243b;
    font-size: 12px;
    flex: 1;
    white-space: nowrap;
}
.aq-tool:hover {
    background: #1b3050;
}
.aq-result {
    text-align: center;
    padding: 45px 0 30px;
}
.aq-result-check {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--aq-mint);
    border-radius: 50%;
    width: 69px;
    height: 69px;
    color: var(--aq-mint);
    font-size: 43px;
    margin: 0 auto 34px;
}
.aq-result p {
    color: var(--aq-muted);
    font-size: 13px;
    margin-top: 13px;
}
.aq-rewards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 32px;
}
.aq-rewards > span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: #14263e77;
    border: 1px solid var(--aq-line);
    border-radius: 13px;
    min-height: 57px;
    flex: 1;
}
.aq-rewards strong {
    font-size: 17px;
    font-weight: 600;
}
.aq-xp {
    color: var(--aq-mint);
}
.aq-gold {
    color: #f4cc78;
}
.aq-result-actions {
    margin-top: 65px;
}
.aq-loading,
.aq-empty {
    padding: 80px 0;
    text-align: center;
    color: var(--aq-muted);
}
.aq-empty p {
    margin: 20px 0 !important;
}
.aq-toast {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(90vw, 420px);
    padding: 13px 18px;
    background: #243951;
    color: #edf3fc;
    border: 1px solid #45607b;
    border-radius: 14px;
    box-shadow: 0 8px 32px #0005;
    z-index: 10;
    font-size: 13px;
}
.aq-objects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 24px 0;
}
.aq-object {
    background: #14263e !important;
    border: 1px solid #293c54 !important;
    border-radius: 15px;
    padding: 10px !important;
    min-width: 0;
    text-align: center;
}
.aq-object canvas {
    width: 100%;
    height: auto;
    display: block;
}
.aq-object strong {
    display: block;
    font-weight: 500;
    font-size: 12px;
}
.aq-object small {
    display: block;
    color: var(--aq-muted);
    font-size: 10px;
    margin-top: 5px;
}
.aq-pages {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--aq-muted);
}
@media (min-width: 720px) {
    .aq-screen {
        padding-top: 28px;
    }
    .aq-result-actions {
        margin-top: 80px;
    }
}
@media (max-width: 359px) {
    .aq-screen {
        padding-inline: 16px;
    }
    .aq-game-row {
        gap: 12px;
    }
    .aq-tools {
        gap: 5px;
    }
    .asmr-quest .aq-tool {
        font-size: 11px;
        padding-inline: 8px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .asmr-quest * {
        transition: none !important;
    }
}

/* One shared sound setting; play screens show only compact puzzle actions. */
.aq-header-tools {
    display: flex;
    align-items: center;
    gap: 12px;
}
.asmr-quest .aq-sound {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border: 1px solid #ffffff1a;
    border-radius: 50%;
    background: #1e293b;
    color: #94a3b8;
    padding: 9px;
}
.aq-sound svg {
    width: 18px;
    height: 18px;
}
.aq-sound[aria-pressed='true'] {
    color: #edf3fc;
}
.aq-tools {
    justify-content: center;
    gap: 12px;
}
.asmr-quest .aq-tools .aq-tool {
    flex: 0 0 44px;
    padding: 10px;
    min-height: 44px;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.aq-tools .aq-tool svg {
    width: 20px;
    height: 20px;
}
.aq-sr-controls {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.aq-sr-controls:focus-within {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    white-space: normal;
    margin: 12px 0;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.aq-sr-controls button {
    min-height: 40px;
    padding: 8px;
    border: 1px solid #30435e;
    border-radius: 8px;
}

/* Per-game progress and one open-ended random Play action. */
.asmr-quest .aq-play {
    margin: 0;
    min-height: 56px;
    font-size: 16px;
}
.aq-play svg {
    width: 21px;
    height: 21px;
}
.aq-game-row small {
    font-size: 13px;
    color: #b5c4da;
}
.aq-game-achievement > img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    flex-shrink: 0;
}
.aq-achievement-copy {
    flex: 1;
    min-width: 0;
}
.aq-achievement-meter {
    height: 6px;
    background: #25344c;
    border-radius: 6px;
    overflow: hidden;
    margin: 12px 0 7px;
}
.aq-achievement-meter > i {
    display: block;
    height: 100%;
    background: #7ddbb6;
    border-radius: 6px;
}
.aq-achievement-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 11px;
    color: #a0b1c9;
}
.aq-achievement-status em {
    margin-top: 0;
    font-size: 10px;
    text-align: right;
}
.aq-rewards > span {
    flex-direction: column;
    padding: 16px 20px;
    min-height: 100px;
    border-radius: 24px;
    background: #1e293b80;
    border-color: #ffffff1a;
    box-shadow: 0 8px 18px #0002;
    gap: 7px;
}
.aq-rewards svg {
    width: 24px;
    height: 24px;
}
.aq-rewards strong {
    color: #fff;
    font:
        900 23px/1.2 'Exo 2',
        'Noto Sans',
        sans-serif;
}
.aq-gold {
    color: #fbbf24;
}
.aq-xp {
    color: #fde047;
}
.aq-result-actions {
    margin-top: 30px;
}
