/* Revamed Mansion — public release visual authority */

:root {
    --release-gold: #d5a64a;
    --release-gold-soft: #f0cf86;
    --release-ink: #07090d;
    --release-panel: rgba(10, 11, 16, .86);
    --release-blue: #17233b;
}

.title-screen {
    position: relative;
    isolation: isolate;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 100svh;
    padding: clamp(20px, 4vw, 48px);
    overflow: hidden;
    background: #040508 url("../assets/title-mansion.svg") center / cover no-repeat;
}

.title-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(213, 166, 74, 0.12) 0%, transparent 65%),
        linear-gradient(90deg, rgba(3, 5, 8, .98) 0%, rgba(4, 6, 10, .92) 38%, rgba(4, 7, 12, .45) 70%, rgba(1, 3, 7, .25) 100%),
        linear-gradient(0deg, rgba(3, 4, 7, 0.95) 0%, transparent 50%);
    pointer-events: none;
}

.title-screen::after {
    content: "";
    position: absolute;
    inset: -50%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, rgba(240, 193, 92, 0.04), transparent 60%);
    animation: title-mist-pan 18s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes title-mist-pan {
    0% { transform: translate(-20px, -10px) scale(1); }
    100% { transform: translate(20px, 10px) scale(1.04); }
}

.title-card {
    position: relative;
    z-index: 2;
    align-self: center;
    width: min(580px, 94vw);
    margin-left: clamp(0px, 5.5vw, 84px);
    padding: clamp(28px, 4.5vw, 54px);
    border: 1px solid rgba(213, 166, 74, .55);
    border-radius: 20px;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(213, 166, 74, 0.12), transparent 75%),
        linear-gradient(155deg, rgba(12, 14, 20, 0.92), rgba(5, 5, 8, 0.88));
    box-shadow:
        0 0 60px rgba(0, 0, 0, 0.90),
        0 25px 80px rgba(0, 0, 0, 0.75),
        inset 0 1px rgba(255, 235, 182, 0.18),
        inset 0 0 30px rgba(213, 166, 74, 0.05);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    transition: border-color .3s ease, box-shadow .3s ease;
}

.title-card:hover {
    border-color: rgba(240, 193, 92, 0.75);
    box-shadow:
        0 0 70px rgba(213, 166, 74, 0.15),
        0 30px 90px rgba(0, 0, 0, 0.95),
        inset 0 1px rgba(255, 235, 182, 0.25);
}

.title-logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.title-logo {
    width: 72px;
    height: 72px;
    margin: 0;
    border-radius: 18px;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.60)) drop-shadow(0 0 16px rgba(213, 166, 74, 0.35));
    transition: transform .26s cubic-bezier(0.34, 1.56, 0.64, 1), filter .26s ease;
    animation: title-logo-pulse 4s ease-in-out infinite;
}

.title-logo:hover,
.title-logo:focus-visible {
    transform: scale(1.10) rotate(-3deg);
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.80)) drop-shadow(0 0 25px rgba(240, 193, 92, 0.70));
}

.title-logo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 20px;
    background: rgba(213, 166, 74, 0.12);
    border: 1px solid rgba(213, 166, 74, 0.40);
    color: #f0cf86;
    font-size: .82rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
    transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.title-logo-badge:hover {
    transform: translateY(-1px);
    background: rgba(240, 193, 92, 0.22);
    border-color: rgba(240, 193, 92, 0.75);
    box-shadow: 0 0 18px rgba(240, 193, 92, 0.35);
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: dot-pulse 2s infinite ease-in-out;
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.title-card .eyebrow {
    color: var(--release-gold-soft);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    margin-bottom: 8px;
    opacity: 0.92;
}

.title-card h1 {
    font-size: clamp(2.8rem, 5.5vw, 4.4rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: 0.02em;
    margin: 0;
    background: linear-gradient(180deg, #fff4d4 0%, #f0c15c 55%, #bd8c2e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 18px rgba(0, 0, 0, 0.85));
}

.title-card h1 span {
    display: block;
    font-size: 0.82em;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, #f0f4f8 0%, #b0c0d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 4px;
}

.title-card .tagline {
    position: relative;
    max-width: 38ch;
    margin-top: 18px;
    margin-bottom: 24px;
    color: #ded6c5;
    font-size: 1.05rem;
    line-height: 1.55;
    font-style: italic;
}

.title-menu {
    display: grid;
    gap: 10px;
    margin-top: 22px;
}

.title-card .primary-button,
.title-card .secondary-button,
.title-card .help-toggle-btn,
.title-card .install-app-button,
.title-card #title-settings-toggle {
    width: 100%;
    min-height: 52px;
    margin: 0 !important;
    border-radius: 8px;
    border: 1px solid rgba(213, 166, 74, .48);
    background: linear-gradient(180deg, rgba(37, 32, 24, .96), rgba(13, 13, 17, .96));
    color: #f1dfb4;
    font-weight: 750;
    letter-spacing: .04em;
    text-align: left;
    padding: 0 18px;
    box-shadow: inset 0 1px rgba(255,255,255,.05);
    transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.title-card .primary-button {
    color: #fff0c6;
    border-color: rgba(240, 193, 92, .90);
    background: linear-gradient(180deg, rgba(80, 59, 29, .98), rgba(30, 24, 18, .98));
    box-shadow: 0 0 28px rgba(213, 166, 74, .12), inset 0 1px rgba(255,255,255,.08);
}

.title-card button:hover,
.title-card button:focus-visible {
    transform: translateY(-1px);
    border-color: var(--release-gold-soft);
    box-shadow: 0 0 0 3px rgba(213, 166, 74, .14), 0 8px 22px rgba(0,0,0,.28);
}

.install-app-button[hidden] {
    display: none !important;
}

.install-copy {
    margin: 10px 0 0;
    color: #a9b0b7;
    font-size: .82rem;
    line-height: 1.4;
}

.pwa-installed .install-app-button,
.pwa-installed .install-copy {
    display: none !important;
}

.game-screen {
    background:
        radial-gradient(circle at 50% -10%, rgba(56, 69, 99, .20), transparent 38%),
        linear-gradient(180deg, #080a0f 0%, #05060a 100%);
}

.game-header {
    position: sticky;
    top: 0;
    z-index: 500;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    background: linear-gradient(180deg, rgba(8, 9, 13, .97), rgba(8, 9, 13, .84));
    border-bottom: 1px solid rgba(213, 166, 74, .26);
}

.game-header .small-button,
.game-header .help-toggle-btn {
    min-height: 44px;
    border-radius: 7px;
    border-color: rgba(213, 166, 74, .34);
    background: rgba(18, 18, 24, .88);
    color: #e8ddc5;
}

.hover-label,
.clear-instruction-strip,
.backbone-feedback {
    border-color: rgba(213, 166, 74, .42) !important;
    background: rgba(7, 8, 12, .92) !important;
    color: #f0eadf !important;
    box-shadow: 0 12px 30px rgba(0,0,0,.28);
}

.scene {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    box-shadow:
        inset 0 0 100px rgba(0, 0, 0, .72),
        0 18px 54px rgba(0, 0, 0, .30);
}

.scene::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 90;
    background:
        radial-gradient(circle at 50% 40%, transparent 42%, rgba(2, 3, 6, .36) 100%),
        linear-gradient(180deg, rgba(85, 102, 148, .035), transparent 40%, rgba(0,0,0,.10));
}

.hotspot {
    border-radius: 10px;
    transition: outline-color .14s ease, background .14s ease, filter .14s ease, transform .14s ease;
}

.hotspot:hover,
.hotspot:focus-visible {
    outline: 2px solid rgba(240, 193, 92, .84);
    outline-offset: -2px;
    background: rgba(213, 166, 74, .09);
    filter: drop-shadow(0 0 12px rgba(213, 166, 74, .20));
}

.hotspot-word {
    border: 1px solid rgba(235, 192, 102, .48) !important;
    background: rgba(5, 6, 9, .90) !important;
    color: #f3e9d2 !important;
    border-radius: 999px !important;
    padding: 4px 8px !important;
    box-shadow: 0 4px 14px rgba(0,0,0,.35);
}

.verb {
    min-height: 48px !important;
    border-radius: 8px !important;
    font-weight: 760;
}

.verb.active {
    border-color: rgba(240, 193, 92, .94) !important;
    background: linear-gradient(180deg, rgba(82, 60, 29, .95), rgba(32, 26, 18, .95)) !important;
    color: #fff0c7 !important;
    box-shadow: 0 0 18px rgba(213, 166, 74, .14);
}

.inventory-item {
    min-height: 44px;
    border-radius: 7px !important;
}

/* Give the tiny baseline character a more deliberate illustrated silhouette. */
.player {
    transform-origin: 50% 100%;
    filter: drop-shadow(0 10px 8px rgba(0,0,0,.55));
    transition: left .42s cubic-bezier(.2,.75,.25,1), transform .16s ease;
}

.player::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 32px;
    height: 9px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: rgba(0, 0, 0, .48);
    filter: blur(3px);
    z-index: -1;
}

.player-head {
    position: relative;
    background: radial-gradient(circle at 40% 28%, #e4bb9e 0 20%, #bc846b 58%, #6f4d43 100%) !important;
    border: 1px solid rgba(47, 24, 22, .72);
    box-shadow: inset -4px -3px 6px rgba(63,31,28,.20);
}

.player-head::before {
    content: "";
    position: absolute;
    inset: -3px -2px 48% -2px;
    border-radius: 60% 60% 25% 25%;
    background: linear-gradient(145deg, #2b211f, #0e1015);
}

.player-body {
    position: relative;
    background: linear-gradient(90deg, #17363a 0%, #285b59 46%, #142e34 100%) !important;
    border: 1px solid rgba(7, 17, 19, .75);
    box-shadow: inset -5px 0 8px rgba(0,0,0,.22);
}

.player-body::before {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    top: 54%;
    height: 10%;
    background: #6b4a29;
    border-top: 1px solid #b78947;
}

.player-body::after {
    content: "";
    position: absolute;
    left: 18%;
    right: 18%;
    bottom: -34%;
    height: 38%;
    background: linear-gradient(90deg, #202329 0 42%, transparent 42% 58%, #202329 58% 100%);
    border-radius: 0 0 3px 3px;
}

.completion-badge {
    border-radius: 8px !important;
    border-color: rgba(213,166,74,.55) !important;
    background: rgba(11, 12, 17, .94) !important;
    color: #f4d98e !important;
}

/* ==============================================================
   PWA INSTALL TO DEVICE MODAL & HARDENED UI/UX CONTROLS
============================================================== */

.title-logo {
    transition: transform .22s cubic-bezier(0.34, 1.56, 0.64, 1), filter .22s ease;
}

.title-logo:hover,
.title-logo:focus-visible {
    transform: scale(1.12) rotate(-2deg);
    filter: drop-shadow(0 0 16px rgba(240, 193, 92, 0.55));
}

.pwa-install-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    box-sizing: border-box;
}

.pwa-install-modal[hidden] {
    display: none !important;
}

.pwa-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 4, 7, 0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.pwa-modal-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    background: rgba(5, 5, 7, 0.90);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(213, 166, 74, 0.55);
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow:
        0 0 45px rgba(213, 166, 74, 0.18),
        0 24px 60px rgba(0, 0, 0, 0.85);
    color: #f1dfb4;
    animation: pwa-modal-pop .28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwa-modal-pop {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.pwa-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: transparent;
    border: none;
    color: #c9b080;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: color .15s ease, background .15s ease;
}

.pwa-modal-close:hover,
.pwa-modal-close:focus-visible {
    color: #fff0c6;
    background: rgba(213, 166, 74, 0.15);
}

.pwa-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.pwa-modal-icon {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 14px rgba(213, 166, 74, 0.35));
    animation: title-logo-pulse 3s infinite ease-in-out;
}

@keyframes title-logo-pulse {
    0%, 100% { filter: drop-shadow(0 4px 14px rgba(213, 166, 74, 0.35)); }
    50% { filter: drop-shadow(0 6px 22px rgba(240, 193, 92, 0.70)); }
}

.pwa-modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
    color: #fff0c6;
    letter-spacing: .02em;
}

.pwa-modal-subtitle {
    margin: 4px 0 0;
    font-size: .88rem;
    color: #a9b0b7;
    line-height: 1.35;
}

.pwa-modal-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.pwa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(213, 166, 74, 0.12);
    border: 1px solid rgba(213, 166, 74, 0.32);
    color: #f0c15c;
    font-size: .80rem;
    font-weight: 600;
}

.pwa-modal-instructions {
    background: rgba(12, 14, 20, 0.75);
    border: 1px solid rgba(213, 166, 74, 0.22);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 22px;
}

.pwa-instruction-text {
    margin: 0;
    font-size: .92rem;
    color: #e2d3b2;
    line-height: 1.5;
}

.pwa-steps {
    display: grid;
    gap: 10px;
}

.pwa-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .90rem;
    color: #e2d3b2;
}

.pwa-step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(240, 193, 92, 0.22);
    border: 1px solid rgba(240, 193, 92, 0.60);
    color: #fff0c6;
    font-weight: 700;
    font-size: .78rem;
    flex-shrink: 0;
}

.pwa-modal-actions {
    display: flex;
    gap: 12px;
}

.pwa-modal-actions button {
    flex: 1;
    min-height: 48px;
    text-align: center !important;
    justify-content: center;
}

/* UI Hardened Micro-Animations & Glow Pulses */
.primary-button,
.secondary-button,
.verb,
.inventory-item {
    position: relative;
    overflow: hidden;
}

.primary-button:hover,
.secondary-button:hover,
.verb:hover {
    box-shadow: 0 0 16px rgba(240, 193, 92, 0.28), inset 0 0 12px rgba(240, 193, 92, 0.12) !important;
}

.primary-button:active,
.secondary-button:active,
.verb:active {
    transform: scale(0.97) !important;
}

@media (max-width: 760px) {
    .title-screen {
        padding: 14px;
        align-items: end;
        background-position: 66% center;
    }

    .title-screen::before {
        background: linear-gradient(0deg, rgba(3,5,8,.98) 0%, rgba(3,5,8,.86) 56%, rgba(3,5,8,.25) 100%);
    }

    .title-card {
        width: 100%;
        margin: 0;
        padding: 22px;
        max-height: calc(100svh - 28px);
        overflow-y: auto;
    }

    .title-logo {
        width: 58px;
        height: 58px;
        margin-bottom: 12px;
    }

    .title-card h1 {
        font-size: clamp(2.65rem, 15vw, 4.4rem);
    }

    .title-card h1 span {
        margin-top: 14px;
    }

    .title-card .tagline {
        margin-top: 18px;
        margin-bottom: 14px;
    }

    .title-card .primary-button,
    .title-card .secondary-button,
    .title-card .help-toggle-btn,
    .title-card .install-app-button,
    .title-card #title-settings-toggle {
        min-height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .player,
    .hotspot,
    .title-card button,
    .pwa-modal-content,
    .title-logo {
        transition: none !important;
        animation: none !important;
    }
}
