/* ==========================================================
   Genesis — Asylonia AI Companion
   Build 01.1 Polish Final
   ========================================================== */

.asylonia-genesis-companion {
    --genesis-navy-950: #061a2e;
    --genesis-navy-900: #08243f;
    --genesis-navy-800: #0c3157;
    --genesis-navy-700: #174a79;
    --genesis-navy-600: #2d6396;
    --genesis-blue-100: #dceaf7;
    --genesis-blue-050: #edf5fb;
    --genesis-cream: #fff9ed;
    --genesis-gold: #e4bd62;
    --genesis-gold-deep: #b57b22;
    --genesis-line: rgba(255, 235, 191, 0.34);
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 22000;
    color: #f8fbff;
    font-family: inherit;
}

body.asylonia-auth-pending .asylonia-genesis-companion,
body.asylonia-auth-gate-open .asylonia-genesis-companion {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.asylonia-genesis-companion [hidden] {
    display: none !important;
}

/*
 * Full-screen city maps keep their own controls along the lower edge.
 * Lift Genesis above that control strip instead of competing for space.
 */
.page-genesis-block .asylonia-genesis-companion,
.page-neo-nomad-block .asylonia-genesis-companion,
.page-verified-resident-block .asylonia-genesis-companion,
.page-shop-block .asylonia-genesis-companion,
.page-office-block .asylonia-genesis-companion,
.page-factory-block .asylonia-genesis-companion {
    bottom: 82px;
}

.genesis-launcher {
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 20px;
    border: 1px solid rgba(255, 224, 154, 0.72);
    border-radius: 999px;
    color: #fff7df;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 228, 164, 0.18), transparent 38%),
        linear-gradient(180deg, #295d8f 0%, #123f6d 100%);
    box-shadow:
        0 18px 44px rgba(5, 24, 43, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.genesis-launcher:hover,
.genesis-launcher:focus-visible {
    transform: translateY(-2px);
    filter: brightness(1.04);
    box-shadow:
        0 22px 50px rgba(5, 24, 43, 0.34),
        0 0 0 3px rgba(228, 189, 98, 0.14);
    outline: none;
}

.genesis-launcher-icon {
    color: #ffe8a8;
    font-size: 1.35rem;
    font-variation-settings: 'FILL' 1, 'wght' 650, 'GRAD' 0, 'opsz' 28;
}

.genesis-panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(390px, calc(100vw - 30px));
    max-height: min(730px, calc(100vh - 116px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 230, 175, 0.44);
    border-radius: 25px;
    color: #f8fbff;
    background:
        radial-gradient(circle at 88% 0%, rgba(129, 195, 255, 0.20), transparent 32%),
        linear-gradient(180deg, #214f7d 0%, #2f6598 52%, #315f8d 100%);
    box-shadow:
        0 28px 84px rgba(5, 20, 37, 0.38),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    transform-origin: right bottom;
    animation: genesis-panel-enter 0.2s ease-out;
}

.genesis-panel[hidden] {
    display: none !important;
}

.genesis-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px 17px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(5, 28, 51, 0.18);
}

.genesis-brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.genesis-brand-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 230, 175, 0.42);
    border-radius: 15px;
    color: #ffe7a3;
    background: rgba(5, 25, 45, 0.34);
    box-shadow: 0 0 20px rgba(255, 218, 132, 0.12);
    font-size: 1.45rem;
    font-variation-settings: 'FILL' 1, 'wght' 650, 'GRAD' 0, 'opsz' 30;
}

.genesis-brand div {
    min-width: 0;
}

.genesis-brand strong,
.genesis-brand span {
    display: block;
}

.genesis-brand strong {
    color: #ffe5a0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.28rem;
    line-height: 1.05;
}

.genesis-brand div span {
    margin-top: 4px;
    color: rgba(248, 252, 255, 0.84);
    font-size: 0.82rem;
}

.genesis-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.genesis-icon-button {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 11px;
    color: #fff6dc;
    background: transparent;
    cursor: pointer;
}

.genesis-icon-button:hover,
.genesis-icon-button:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.genesis-icon-button .material-symbols-outlined {
    font-size: 1.25rem;
}

.genesis-status-row {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.genesis-mode-badge,
.genesis-allowance {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 11px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.20);
    background: rgba(7, 32, 56, 0.22);
    color: rgba(255, 255, 255, 0.90);
    font-size: 0.74rem;
    font-weight: 850;
}

.genesis-mode-badge .material-symbols-outlined {
    font-size: 1rem;
}

.genesis-mode-badge.is-citizen {
    border-color: rgba(108, 232, 158, 0.42);
    background: rgba(19, 124, 69, 0.32);
    color: #eafff1;
}

.genesis-mode-badge.is-guest {
    border-color: rgba(255, 232, 175, 0.42);
    color: #fff3ce;
}

.genesis-allowance {
    color: #fff0bf;
}

.genesis-body {
    min-height: 250px;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.34) transparent;
}

.genesis-loading-state {
    min-height: 250px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    text-align: center;
    color: rgba(248, 252, 255, 0.80);
}

.genesis-loading-orb {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: #ffe2a0;
    animation: genesis-spin 0.85s linear infinite;
}

.genesis-loading-state p {
    margin: 0;
}

.genesis-guest-view,
.genesis-citizen-view {
    display: grid;
    gap: 13px;
}

.genesis-message {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.genesis-message-user {
    justify-content: flex-end;
}

.genesis-avatar {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    margin-top: 4px;
    border-radius: 999px;
    color: #ffe7a3;
    background: #0a2c4c;
    border: 1px solid rgba(255, 226, 161, 0.42);
}

.genesis-avatar .material-symbols-outlined {
    font-size: 1rem;
    font-variation-settings: 'FILL' 1, 'wght' 650, 'GRAD' 0, 'opsz' 22;
}

.genesis-message-card {
    max-width: calc(100% - 39px);
    padding: 12px 13px;
    border: 1px solid rgba(7, 37, 65, 0.14);
    border-radius: 16px 16px 16px 5px;
    color: #10243a;
    background: linear-gradient(180deg, #edf5fb 0%, #d9e8f5 100%);
    box-shadow: 0 9px 22px rgba(4, 25, 45, 0.10);
}

.genesis-message-user .genesis-message-card {
    border-radius: 16px 16px 5px 16px;
    border-color: rgba(255, 225, 153, 0.30);
    color: #fffaf0;
    background: linear-gradient(180deg, #477eb2 0%, #326796 100%);
}

.genesis-message-card p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.91rem;
    line-height: 1.55;
}

.genesis-message-tools {
    display: flex;
    justify-content: flex-end;
    margin-top: 9px;
}

.genesis-copy-button {
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 9px;
    border: 1px solid rgba(9, 47, 81, 0.18);
    border-radius: 9px;
    color: #143c62;
    background: rgba(255, 255, 255, 0.58);
    cursor: pointer;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 850;
}

.genesis-copy-button:hover,
.genesis-copy-button:focus-visible {
    background: #fff;
    outline: none;
}

.genesis-copy-button .material-symbols-outlined {
    font-size: 0.92rem;
}

.genesis-message.is-pending .genesis-message-card p::after {
    content: "";
    width: 18px;
    height: 8px;
    display: inline-block;
    margin-left: 7px;
    border-radius: 999px;
    background:
        radial-gradient(circle at 3px 4px, #2d6396 2px, transparent 2.5px),
        radial-gradient(circle at 9px 4px, #2d6396 2px, transparent 2.5px),
        radial-gradient(circle at 15px 4px, #2d6396 2px, transparent 2.5px);
    animation: genesis-typing 1s ease-in-out infinite;
}

.genesis-guest-guide,
.genesis-register-card {
    border: 1px solid rgba(255, 255, 255, 0.20);
    border-radius: 18px;
    background: rgba(7, 34, 60, 0.20);
}

.genesis-guest-guide {
    padding: 14px;
}

.genesis-guest-guide > strong {
    color: #fff7df;
    font-size: 0.88rem;
}

.genesis-guest-topics {
    display: grid;
    gap: 5px;
    margin-top: 9px;
}

.genesis-guest-topics button {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 8px;
    border: 0;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.91);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 0.83rem;
    font-weight: 750;
}

.genesis-guest-topics button:hover,
.genesis-guest-topics button:focus-visible,
.genesis-guest-topics button.is-active {
    color: #fff7df;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.genesis-guest-topics .material-symbols-outlined {
    color: #ffe4a0;
    font-size: 1.05rem;
}

.genesis-guest-answer {
    margin-top: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    color: #16324f;
    background: #e5f0f9;
    font-size: 0.84rem;
    line-height: 1.5;
}

.genesis-register-card {
    padding: 14px;
    border-color: rgba(255, 222, 145, 0.52);
    background:
        radial-gradient(circle at 90% 0%, rgba(255, 222, 145, 0.11), transparent 40%),
        rgba(6, 31, 55, 0.30);
}

.genesis-register-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #ffe7a9;
}

.genesis-register-heading .material-symbols-outlined {
    font-size: 1.12rem;
}

.genesis-register-card p {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.88);
    font-size: 0.84rem;
    line-height: 1.5;
}

.genesis-register-methods {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.genesis-register-methods span {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 11px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    font-weight: 850;
}

.genesis-register-methods strong {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    color: #3572b8;
    background: #fff;
    font-family: Arial, sans-serif;
    font-size: 0.82rem;
}

.genesis-register-methods .material-symbols-outlined {
    font-size: 1.05rem;
}

.genesis-exit-guest {
    width: 100%;
    min-height: 45px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    border: 1px solid rgba(255, 235, 189, 0.74);
    border-radius: 12px;
    color: #10263e;
    background: linear-gradient(180deg, #ffe9b3 0%, #dcaf50 100%);
    cursor: pointer;
    font: inherit;
    font-weight: 950;
}

.genesis-exit-guest:hover,
.genesis-exit-guest:focus-visible {
    filter: brightness(1.04);
    outline: 3px solid rgba(255, 228, 162, 0.16);
}

.genesis-exit-guest .material-symbols-outlined {
    font-size: 1.08rem;
}

.genesis-register-card small {
    display: block;
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.76);
    text-align: center;
    font-size: 0.73rem;
}

.genesis-messages {
    display: grid;
    gap: 12px;
}

.genesis-quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.genesis-quick-actions button {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 9px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 11px;
    color: #fff;
    background: rgba(10, 48, 82, 0.18);
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 850;
}

.genesis-quick-actions button:hover,
.genesis-quick-actions button:focus-visible {
    border-color: #ffe3a0;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.genesis-quick-actions .material-symbols-outlined {
    color: #ffe2a0;
    font-size: 1rem;
}

.genesis-composer {
    display: grid;
    grid-template-columns: 1fr 44px;
    gap: 8px;
    padding: 10px 14px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 28, 50, 0.16);
}

.genesis-composer textarea {
    width: 100%;
    min-height: 44px;
    max-height: 130px;
    resize: none;
    overflow-y: auto;
    padding: 11px 13px;
    border: 1px solid rgba(7, 37, 65, 0.16);
    border-radius: 14px;
    color: #10243a;
    background: #edf5fb;
    font: inherit;
    font-size: 0.88rem;
    line-height: 1.4;
}

.genesis-composer textarea:focus {
    border-color: #ffe093;
    outline: 3px solid rgba(255, 225, 151, 0.18);
}

.genesis-composer textarea:disabled {
    opacity: 0.72;
}

.genesis-send {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 232, 181, 0.78);
    border-radius: 999px;
    color: #12304d;
    background: linear-gradient(180deg, #ffe9af 0%, #dcae4e 100%);
    cursor: pointer;
}

.genesis-send:hover,
.genesis-send:focus-visible {
    filter: brightness(1.04);
    outline: 3px solid rgba(255, 225, 151, 0.16);
}

.genesis-send:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.genesis-send .material-symbols-outlined {
    font-size: 1.3rem;
    font-weight: 800;
}

.genesis-composer-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 16px 8px;
    color: rgba(255, 255, 255, 0.67);
    background: rgba(5, 28, 50, 0.16);
    font-size: 0.66rem;
}

.genesis-footer {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(5, 26, 47, 0.21);
}

.genesis-footer-button,
.genesis-footer-link {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 8px;
    border: 0;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.90);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 850;
    text-decoration: none;
}

.genesis-footer-button:hover,
.genesis-footer-button:focus-visible,
.genesis-footer-link:hover,
.genesis-footer-link:focus-visible {
    color: #fff6d8;
    background: rgba(255, 255, 255, 0.10);
    outline: none;
}

.genesis-footer .material-symbols-outlined {
    font-size: 1rem;
}

.genesis-privacy-note {
    margin: 0;
    padding: 8px 14px 10px;
    color: rgba(255, 255, 255, 0.58);
    background: rgba(5, 24, 43, 0.28);
    text-align: center;
    font-size: 0.65rem;
    line-height: 1.35;
}

.genesis-system-message {
    padding: 10px 12px;
    border: 1px solid rgba(255, 230, 175, 0.42);
    border-radius: 13px;
    color: #fff4d1;
    background: rgba(7, 31, 54, 0.38);
    font-size: 0.82rem;
    line-height: 1.45;
}

@keyframes genesis-panel-enter {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes genesis-spin {
    to { transform: rotate(360deg); }
}

@keyframes genesis-typing {
    0%, 100% { opacity: 0.35; transform: translateY(1px); }
    50% { opacity: 1; transform: translateY(-1px); }
}

@media (max-width: 640px) {
    .asylonia-genesis-companion {
        right: 12px;
        bottom: 14px;
    }

    .page-genesis-block .asylonia-genesis-companion,
    .page-neo-nomad-block .asylonia-genesis-companion,
    .page-verified-resident-block .asylonia-genesis-companion,
    .page-shop-block .asylonia-genesis-companion,
    .page-office-block .asylonia-genesis-companion,
    .page-factory-block .asylonia-genesis-companion {
        bottom: 74px;
    }

    .genesis-launcher {
        min-height: 50px;
        padding: 0 16px;
    }

    .genesis-panel {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: calc(100dvh - 16px);
        border-radius: 22px;
    }

    .genesis-header {
        min-height: 68px;
        padding: 13px 14px;
    }

    .genesis-body {
        padding: 12px;
    }

    .genesis-composer-meta span:last-child {
        display: none;
    }

    .genesis-quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .genesis-panel,
    .genesis-loading-orb,
    .genesis-message.is-pending .genesis-message-card p::after,
    .genesis-launcher {
        animation: none !important;
        transition: none !important;
    }
}
