/* Relationship panel and mobile family view */
.death-screen h1 {
    font: 700 clamp(38px,5vw,60px)/1.05 "Playfair Display",serif;
    margin: 0 0 14px;
}

.death-screen {
    text-align: center;
    padding: 100px 20px;
}

.death-screen .primary {
    min-width: 220px;
}

.relationship-column {
    display: grid;
    gap: 10px;
    align-content: start;
}

.partner-panel {
    border: 1px solid #bfd4c5;
    background: #f0f6f1;
    border-radius: 12px;
    padding: 10px;
}

.partner-panel summary {
    list-style: none;
    cursor: pointer;
    text-align: center;
}

.partner-panel summary::-webkit-details-marker {
    display: none;
}

.partner-panel summary>strong {
    display: block;
    margin: 7px 0;
}

.partner-panel summary>strong span {
    color: var(--green);
    font-size: .8em;
}

.relationship-stability label {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--muted);
}

@media(max-width:850px) {
    .relationship-column {
        max-width: 300px;
        margin: auto;
        width: 100%;
    }
}

.breakup-effects {
    display: block;
    margin: -5px 0 10px;
    color: var(--danger-ink);
    text-align: center;
}

.intimacy-choice {
    display: grid;
    gap: 5px;
    margin-top: 12px;
    font-size: 10px;
    color: var(--muted);
}

.intimacy-choice select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: white;
    color: var(--ink);
}

.pregnancy-badge {
    display: block;
    margin-top: 12px;
    padding: 10px;
    text-align: center;
    background: #ffe4e1;
    color: #b52f2f;
    border: 2px solid #d64a42;
    border-radius: 8px;
    font-weight: 900;
    letter-spacing: .12em;
}

.death-risk-explanation {
    max-width: 720px;
    margin: 0 auto 25px;
    padding: 15px;
    background: var(--danger-surface);
    color: #943b35;
    border-radius: 10px;
}

.dynasty-tree {
    overflow: auto;
    padding: 25px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: max-content;
}

@media(max-width:600px) {
    .dynasty-tree {
        align-items: flex-start;
    }
}

.partner-deceased {
    display: block;
    margin-top: 10px;
    padding: 8px;
    text-align: center;
    background: #eee;
    color: #6d2727;
    border-radius: 7px;
}

.bereavement-effects {
    padding: 12px;
    border-radius: 9px;
    background: var(--danger-surface);
    color: #913b35;
}

.death-age-details {
    margin: 0 auto 30px;
    max-width: 720px;
}

.death-age-details summary {
    list-style: none;
    cursor: pointer;
}

.death-age-details summary::-webkit-details-marker {
    display: none;
}

.death-age-details summary span {
    display: block;
}

.death-age-details .final-age {
    margin-bottom: 10px;
}

.pregnancy-chance summary {
    cursor: pointer;
    color: var(--green);
    font-weight: 800;
}

.pregnancy-chance small {
    display: block;
    padding: 7px;
    background: var(--detail-surface);
    border-radius: 6px;
}

.death-cause-prominent {
    max-width: 760px;
    margin: 0 auto 30px;
    padding: 22px;
    border: 2px solid #b33f37;
    border-radius: 12px;
    background: var(--danger-surface);
    color: #8d2f29;
    font: 700 clamp(20px,3vw,30px)/1.35 "Playfair Display",serif;
    white-space: pre-line;
}

.partner-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.parenthood-refusal {
    margin-top: 8px;
    line-height: 1.4;
}

.parenthood-ready {
    margin-top: 8px;
    line-height: 1.4;
    color: var(--green);
    background: var(--green2);
}

.death-estate-summary {
    width: min(620px,100%);
    margin: 0 auto 22px;
    padding: 14px 18px;
    border: 1px solid #b7d1bf;
    border-radius: 12px;
    background: #edf6ef;
    color: var(--green);
    text-align: left;
}

.death-estate-summary p {
    margin: 4px 0;
}

.menopause-note {
    margin: 10px 0 4px;
    padding: 9px 10px;
    border-radius: 8px;
    background: #edf4ee;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.menopause-stability {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 9px;
}

@media(max-width:850px) {
    .relationship-column>.portrait-label,
    .relationship-column>.profile-silhouette {
        display: none;
    }

    .partner-panel {
        padding: 0;
        border: 0;
        background: transparent;
    }

    .partner-panel>.portrait-label {
        margin: 0 0 4px;
        text-align: left;
    }

    .relationship-stability {
        margin-top: 7px;
        padding: 7px;
    }

    .pregnancy-badge,
    .menopause-note {
        margin-top: 7px;
        padding: 7px;
    }
}

.breakup-confirmation {
    width: min(520px,100%);
}

.breakup-confirmation>p:not(.eyebrow) {
    color: var(--muted);
}

@media(max-width:850px) {
    .mobile-person-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .mobile-person-row>i {
        color: #9da49f;
        font-size: 22px;
        font-style: normal;
    }

    .mobile-family-card .menopause-note,
    .mobile-family-card .menopause-stability {
        display: block;
        font-size: 14px;
        line-height: 1.5;
    }

    .mobile-family-card {
        padding: 4px 13px 12px;
    }

    .mobile-family-view {
        width: 100%;
        min-width: 0;
    }

    .mobile-family-view .partner-panel {
        width: 100%;
        max-width: none;
        text-align: left;
    }

    .mobile-family-view .relationship-stability {
        padding-top: 12px;
    }

    .mobile-family-view .relationship-stability label,
    .mobile-family-view .intimacy-choice,
    .mobile-family-view .intimacy-choice small,
    .mobile-family-view .pregnancy-chance summary,
    .mobile-family-view .menopause-note,
    .mobile-family-view .menopause-stability,
    .mobile-family-view .breakup-effects,
    .mobile-family-view .plan-error,
    .mobile-family-view .living-standard-lock {
        font-size: 13px;
        line-height: 1.45;
    }

    .mobile-family-view .intimacy-choice {
        gap: 8px;
        margin-top: 16px;
    }

    .mobile-family-view .intimacy-choice select {
        min-height: 44px;
        font: 400 16px "DM Sans",sans-serif;
    }

    .mobile-family-view .pregnancy-chance {
        margin: 0;
    }

    .mobile-family-view .pregnancy-chance summary {
        padding: 8px 0;
    }

    .mobile-family-view .pregnancy-chance small {
        display: block;
        padding: 8px;
        overflow-wrap: anywhere;
    }

    .mobile-family-view .mobile-breakup {
        margin: 0;
    }

    .mobile-family-view>.breakup-effects {
        margin: -6px 0 0;
    }

    .mobile-person-row {
        display: grid;
        grid-template-columns: 48px minmax(0,1fr) auto auto;
        align-items: center;
        gap: 11px;
        width: 100%;
        padding: 10px 0;
        border: 0;
        border-bottom: 1px solid #ece8de;
        background: transparent;
        color: var(--ink);
        font-family: inherit;
        text-align: left;
        cursor: pointer;
    }

    .mobile-person-avatar {
        display: grid;
        overflow: hidden;
        background: linear-gradient(145deg,#dbe9df,#bad0c0);
        color: var(--green);
        font: 800 22px "Playfair Display",serif;
        place-items: center;
        width: 48px;
        height: 48px;
        border-radius: 14px;
        font-size: 19px;
    }

    .mobile-person-avatar.child {
        background: linear-gradient(145deg,#efe6d5,#dfc99e);
    }

    .mobile-person-row>span:nth-child(2) {
        display: grid;
        gap: 2px;
        min-width: 0;
    }

    .mobile-person-row strong {
        overflow: hidden;
        font-size: 15px;
        text-overflow: ellipsis;
        overflow-wrap: anywhere;
    }

    .mobile-person-row small,
    .mobile-person-row em {
        color: #5f6c63;
        font-size: 13px;
        font-style: normal;
    }

    .mobile-person-row>b {
        color: var(--green);
        font-size: 13px;
        white-space: nowrap;
    }

    .mobile-family-actions {
        display: grid;
        grid-template-columns: repeat(auto-fit,minmax(90px,1fr));
        gap: 7px;
        padding-top: 10px;
        border-top: 1px solid #ece8de;
    }

    .mobile-family-actions button {
        min-height: 44px;
        padding: 6px;
        border: 1px solid #a9c6b2;
        border-radius: 9px;
        background: #eff6f0;
        color: var(--green);
        font: 800 13px "DM Sans",sans-serif;
        cursor: pointer;
    }

    .mobile-family-actions button:disabled {
        opacity: .45;
        cursor: not-allowed;
    }
}

main:has(>.death-screen) {
    padding-bottom: 12px;
}

main>.death-screen {
    padding: 24px 0 0;
}

.partner-identity-row {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 12px;
}

.partner-card-portrait {
    flex: 0 0 72px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    cursor: zoom-in;
    overflow: hidden;
}

.partner-card-portrait .mobile-person-avatar {
    width: 100%;
    height: 92px;
    border-radius: 10px;
}

.partner-card-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.partner-card-profile>span {
    display: grid;
    gap: 4px;
}

.partner-card-profile small {
    color: var(--muted);
    font: 600 12px/1.2 "DM Sans",sans-serif;
}

.partner-card-profile strong {
    font: 700 22px/1.2 "Playfair Display",serif;
    overflow-wrap: anywhere;
}

.partner-card-profile em {
    font: 500 16px/1.2 "DM Sans",sans-serif;
    color: var(--muted);
}

.partner-card-profile i {
    font-size: 24px;
    font-style: normal;
    margin-left: 8px;
}

@media(max-width:850px) {
    .partner-card-portrait {
        flex-basis: 56px;
    }

    .partner-card-portrait .mobile-person-avatar {
        height: 72px;
    }
}

/* Partner search */
.partner-candidates {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 18px;
    margin: 32px 0;
}

.partner-candidate {
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 16px;
    padding: 18px;
    color: var(--ink);
    cursor: pointer;
}

.partner-candidate:hover {
    border-color: var(--green);
    box-shadow: 0 12px 30px #1f684b18;
}

.partner-candidate h2 {
    font: 700 22px "Playfair Display",serif;
    margin: 10px 0 3px;
}

.partner-candidate>strong {
    font-size: 11px;
    color: var(--gold);
}

.candidate-summary b {
    float: right;
}

.partner-candidate em {
    display: block;
    color: var(--green);
    font-style: normal;
    font-weight: 700;
    margin-top: 14px;
}

@media(max-width:850px) {
    .partner-candidates {
        grid-template-columns: 1fr;
    }
}

.partner-candidate h2 span {
    font-size: .7em;
    color: var(--green);
    margin-left: .25em;
}

.candidate-stat {
    padding: 5px 7px;
    border-radius: 6px;
    font-weight: 600;
}

.candidate-stat b {
    width: auto!important;
}

.candidate-stat.positive {
    background: #e3f3e8;
}

.candidate-stat.negative {
    background: #f9e3df;
}

.candidate-stat.medium {
    background: #fff0cf;
    color: #996510;
}

.candidate-axis {
    grid-column: span 2;
    padding: 5px 7px;
    background: #eef0ec;
    border-radius: 6px;
    color: var(--muted);
}

.candidate-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-top: 12px;
    font-size: 10px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.candidate-attempt {
    width: 100%;
    margin-top: 14px;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: var(--green);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.candidate-attempt.unavailable {
    background: #d8d8d3;
    color: #777;
    cursor: not-allowed;
}

.candidate-description {
    margin: 4px 0 12px;
    color: var(--muted);
    font-style: italic;
}

.partner-discovery-actions {
    display: grid;
    gap: 8px;
}

.finder-launch:disabled {
    border-color: var(--line);
    background: #eee;
    color: #999;
    cursor: not-allowed;
}

.finder-launch:disabled b {
    color: #999;
}

.candidate-wealth {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .65rem .8rem;
    border-radius: 9px;
    background: var(--support-surface);
    color: var(--green);
    margin: .45rem 0 .8rem;
}

.candidate-requirements {
    margin: .7rem 0;
    padding: .8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #faf9f5;
}

.candidate-requirements h3 {
    margin: 0 0 .65rem;
    font-size: .85rem;
}

.candidate-requirements h4 {
    margin: .65rem 0 .35rem;
    color: var(--muted);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.candidate-requirements p {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0;
    font-size: .72rem;
}

.candidate-requirements p strong {
    text-align: right;
}

.candidate-requirements p.met strong {
    color: var(--green);
}

.candidate-requirements p.unmet {
    color: var(--danger-ink);
}

.candidate-requirements p.unmet strong:after {
    content: " ✕";
}

.parenthood-preferences {
    margin-top: 1rem;
}

@media(max-width:850px) {
    .mobile-empty-family button small {
        font: 600 13px "DM Sans",sans-serif;
    }

    .mobile-empty-family .plan-error {
        color: var(--danger-ink);
        text-align: left;
    }

    .mobile-empty-family {
        display: grid;
        justify-items: center;
        gap: 8px;
        padding: 24px 18px;
        border: 1px solid #ddd9ce;
        border-radius: 17px;
        background: #fffdf8;
        text-align: center;
    }

    .mobile-empty-family>span {
        font-size: 38px;
        color: #bb8f50;
    }

    .mobile-empty-family h3 {
        margin: 0 0 12px;
        font: 800 21px "Playfair Display",serif;
    }

    .mobile-empty-family p {
        margin: 0 0 5px;
        color: #5f6c63;
        font-size: 13px;
        line-height: 1.45;
    }

    .mobile-empty-family button {
        display: flex;
        align-items: center;
        gap: 6px 12px;
        min-height: 48px;
        font-size: 15px;
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
        margin: 0;
    }
}

/* Partner profile dialog */
.partner-modal {
    position: relative;
    width: min(850px,100%);
    max-height: 90vh;
    overflow: auto;
    background: var(--card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 25px 80px #0006;
}

.partner-modal h2 {
    font: 700 34px "Playfair Display",serif;
    margin: 0 0 20px;
}

.partner-metrics,
.partner-axes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.partner-metrics .metric,
.partner-axes .metric {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
}

.partner-metrics summary,
.partner-axes summary {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.partner-axes {
    margin-top: 20px;
}

@media(max-width:600px) {
    .partner-metrics,
    .partner-axes {
        grid-template-columns: 1fr;
    }

    .partner-modal {
        padding: 22px;
    }
}

.partner-axes .metric {
    background: #edf5ef;
    border-color: var(--family-line);
}

.current-partner-profile {
    width: min(620px,100%);
}

.current-partner-profile h2 {
    padding-right: 25px;
}

.current-partner-profile h2 small {
    font: 500 .7em "DM Sans",sans-serif;
    color: var(--muted);
    white-space: nowrap;
}

.partner-profile-stats {
    display: grid;
    gap: 6px;
    margin-block: 12px;
}

.partner-stat-row {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 6px;
    align-items: start;
}

.partner-stat-row.pair {
    grid-template-columns: repeat(2,minmax(0,1fr));
}

.partner-profile-stats .metric {
    min-width: 0;
    margin: 0;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--card);
}

.partner-profile-stats .metric summary {
    display: grid;
    gap: 2px;
    padding: 0;
    border: 0;
}

.partner-profile-stats .metric summary>small {
    color: var(--muted);
    font: 500 11px/1.2 "DM Sans",sans-serif;
}

.partner-profile-stats .metric summary>span {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0;
    border: 0;
}

.partner-profile-stats .metric strong {
    font: 700 20px/1.1 "DM Sans",sans-serif;
    color: var(--ink);
}

.partner-profile-stats .metric .change {
    font-size: 12px;
}

.current-partner-profile .partner-axes {
    margin-block: 12px;
}

@media(max-width:850px) {
    .current-partner-profile {
        padding: 18px 12px;
    }
}

/* Children */
.children-panel {
    margin-top: 12px;
    border-top: 1px solid #cfddd2;
    padding-top: 10px;
}

.children-panel summary {
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 700;
}

.children-list {
    display: grid;
    gap: 6px;
    margin: 10px 0;
}

.children-list>span {
    display: flex;
    justify-content: space-between;
    padding: 7px;
    background: var(--detail-surface);
    border-radius: 7px;
}

.children-list small {
    color: var(--muted);
}

.children-list i {
    font-style: normal;
    margin-left: 5px;
}

.child-open {
    display: flex;
    justify-content: space-between;
    width: 100%;
    border: 0;
    background: transparent;
    padding: .35rem 0;
    cursor: pointer;
    text-align: left;
}

@media(max-width:850px) {
    .intimacy-choice,
    .children-panel {
        margin-top: 7px;
    }

    .children-list {
        gap: 4px;
        margin: 6px 0;
    }

    .child-open {
        padding: 6px 8px;
    }

    .mobile-family-card,
    .mobile-children-card {
        overflow: hidden;
        border: 1px solid #ddd9ce;
        border-radius: 17px;
        background: #fffdf8;
        box-shadow: 0 7px 24px #273b2f0a;
    }

    .mobile-children-card {
        padding: 13px;
    }

    .mobile-children-list .mobile-person-row:last-child {
        border-bottom: 0;
    }
}

/* Family tree and descendant dialogs */
.genealogy {
    text-align: left;
    list-style: none;
    border-left: 2px solid var(--family-line);
    margin: 10px 0;
    padding-left: 16px;
}

.genealogy li {
    margin: 7px 0;
}

.genealogy span {
    font-size: 12px;
}

.genealogy small {
    display: block;
    color: var(--muted);
}

.genealogy em {
    color: var(--danger-ink);
}

.family-popup {
    position: relative;
    width: min(560px,100%);
    background: var(--card);
    border-radius: 18px;
    padding: 35px;
    display: grid;
    gap: 18px;
}

.family-popup h2 {
    font: 700 28px "Playfair Display",serif;
    margin: 0;
}

.family-popup label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.family-popup input {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.death-screen>.genealogy {
    max-width: 700px;
    margin: 25px auto;
    text-align: left;
}

.tree-couple {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tree-couple>i {
    display: block;
    width: 34px;
    height: 2px;
    background: #8eaa98;
}

.tree-person {
    display: grid;
    min-width: 105px;
    padding: 9px 12px;
    border: 1px solid #9fb8a7;
    background: #f4faf5;
    border-radius: 9px;
    text-align: center;
    font-weight: 700;
    font-size: 12px;
}

.tree-person small {
    font-weight: 400;
    color: var(--muted);
    font-size: 9px;
    margin-top: 3px;
}

.tree-person.founder {
    border: 2px solid var(--gold);
    background: #fff8e9;
}

.tree-person.deceased {
    opacity: .65;
}

.tree-person b {
    color: var(--danger-ink);
}

.tree-family {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tree-children {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 30px;
}

.tree-branch:before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    height: 14px;
    border-left: 2px solid #8eaa98;
}

.tree-branch:only-child:before {
    top: -14px;
    height: 28px;
}

.tree-children:has(>.tree-branch:only-child):after {
    display: none;
}

.children-panel .tree-children {
    gap: 10px;
}

.children-panel .tree-person {
    min-width: 80px;
    padding: 6px;
    font-size: 10px;
}

@media(max-width:600px) {
    .tree-children {
        gap: 12px;
    }

    .tree-person {
        min-width: 85px;
    }
}

.tree-open {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--green);
    border-radius: 7px;
    background: var(--action-surface);
    color: var(--green);
    font-weight: 800;
    cursor: pointer;
}

button.tree-person {
    font-family: inherit;
    color: var(--ink);
    cursor: pointer;
}

.tree-children:after {
    content: "";
    position: absolute;
    top: 16px;
    left: calc(12.5%);
    right: calc(12.5%);
    border-top: 2px solid #8eaa98;
    display: none;
}

.tree-branch {
    position: relative;
    padding-top: 14px;
    border-top: 2px solid #8eaa98;
}

.tree-branch:first-child {
    border-top-left-radius: 0;
}

.tree-branch:first-child:after {
    content: "";
    position: absolute;
    top: -2px;
    left: 0;
    width: 50%;
    border-top: 3px solid var(--card);
}

.tree-branch:last-child:after {
    content: "";
    position: absolute;
    top: -2px;
    right: 0;
    width: 50%;
    border-top: 3px solid var(--card);
}

.tree-branch:only-child {
    border-top: 0;
}

.tree-branch:only-child:after {
    display: none;
}

.tree-children:before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #8eaa98;
    height: 30px;
}

.tree-node-actions {
    position: relative;
    display: flex;
    justify-content: center;
}

.tree-collapse {
    position: absolute;
    right: 2px;
    top: 2px;
    border: 0;
    border-radius: 50%;
    background: #e6efe9;
    color: var(--green);
    cursor: pointer;
    font-weight: 800;
}

.tree-person.dynasty-partner {
    border-color: #aab8cf;
    background: #eef2f8;
}

.genealogy-viewport {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 12px 4px 18px;
    touch-action: pan-x pan-y;
    scrollbar-gutter: stable;
}

.genealogy-viewport>.dynasty-tree {
    width: max-content;
    min-width: 100%;
    overflow: visible;
    padding: 18px 10px;
}

.genealogy-modal {
    width: min(1100px,96vw);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.genealogy-modal>.genealogy-viewport {
    flex: 1;
}

.tree-couple>.tree-person {
    width: 118px;
    max-width: 118px;
    overflow-wrap: anywhere;
}

@media(max-width:850px) {
    .tree-couple>.tree-person {
        width: 98px;
        min-width: 98px;
        max-width: 98px;
    }
}

/* Descendant time and gifts */
.gift-open {
    margin-top: 7px;
    background: #fff8e9;
    border-color: var(--gold);
    color: #76551d;
}

.gift-open:disabled {
    cursor: not-allowed;
    opacity: .5;
}

.gift-modal {
    width: min(680px,96vw);
}

.gift-description {
    margin: -8px 0 16px;
    color: var(--muted);
    line-height: 1.5;
}

.gift-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: var(--support-surface);
}

.gift-balance strong {
    font-size: 20px;
    color: var(--green);
}

.gift-amount {
    display: grid;
    gap: 7px;
    font-weight: 800;
}

.gift-amount>div {
    display: grid;
    grid-template-columns: auto minmax(100px,1fr) auto;
    gap: 8px;
}

.gift-amount button,
.gift-amount input {
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    font: inherit;
}

.gift-amount button {
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.gift-amount input {
    text-align: center;
}

.gift-recipients {
    display: grid;
    gap: 7px;
    margin: 18px 0;
}

.gift-recipient-heading {
    display: grid;
    gap: 4px;
    margin-bottom: 3px;
}

.gift-recipient-heading small {
    color: var(--muted);
    font-weight: 400;
}

.gift-recipient {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 11px;
    align-items: center;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.gift-recipient input {
    width: 18px;
    height: 18px;
    accent-color: var(--green);
}

.gift-recipient span {
    min-width: 0;
}

.gift-recipient strong,
.gift-recipient small {
    display: block;
}

.gift-recipient small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.gift-recipient>b {
    color: var(--green);
    white-space: nowrap;
}

@media(max-width:600px) {
    .gift-amount>div {
        grid-template-columns: 1fr 1fr;
    }

    .gift-amount input {
        grid-column: 1/-1;
        grid-row: 1;
    }

    .gift-recipient {
        align-items: start;
    }

    .gift-recipient>b {
        grid-column: 2/-1;
    }
}

.descendant-time-preview-summary {
    margin: 12px 0 -7px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff8e9;
    color: #76551d;
    font-size: 11px;
    font-weight: 800;
}

.descendant-time-recipient>span {
    display: grid;
    gap: 3px;
}

.descendant-time-effect {
    margin-top: 7px!important;
    padding-top: 7px;
    border-top: 1px solid var(--line);
    font-size: 11px!important;
}

.descendant-time-effect em {
    display: block;
    margin-bottom: 3px;
    color: var(--ink);
    font-style: normal;
    font-weight: 800;
}

.descendant-time-effect.worldview {
    color: #5e6f90!important;
}

.descendant-time-balance {
    margin-bottom: 12px;
}

@media(max-width:850px) {
    .descendant-time-modal input,
    .gift-modal input {
        font-size: 16px;
        min-height: 44px;
    }

    .modal-backdrop:has(.descendant-time-modal),
    .modal-backdrop:has(.gift-modal) {
        align-items: end;
        padding: 0;
        background: #17251d99;
    }

    .descendant-time-modal,
    .gift-modal {
        width: min(560px,100%);
        max-height: 88dvh;
        border-radius: 22px 22px 0 0;
        padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
        animation: mobile-sheet-in .18s ease-out;
    }

    .descendant-time-modal h2,
    .gift-modal h2 {
        font-size: 27px;
    }
}

@media(prefers-reduced-motion:reduce) {
    .descendant-time-modal,
    .gift-modal {
        animation: none;
    }
}
