:root {
    --home-hero-height: 260px;
    --home-action-top: 169px;
    --home-action-width: 132px;
    --home-action-height: 47px;
    --home-section-heading-height: 44px;
    --home-forum-row-height: 92px;
    --home-forum-row-gap: 12px;
    --home-latest-margin: 26px;
    --home-latest-heading-height: 48px;
    --home-thread-list-height: 400px;
    --home-thread-row-height: 80px;
}

.home-page {
    font-family: var(--font-sans);
}

.welcome-card {
    position: relative;
    height: var(--home-hero-height);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.welcome-card__content {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 42px 34px;
}

.welcome-card h1 {
    color: var(--color-text);
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 42px;
}

.welcome-card p {
    margin-top: 8px;
    color: var(--color-text-secondary);
    font-size: 18px;
    font-weight: 500;
    line-height: 27px;
}

.welcome-card__actions {
    position: absolute;
    top: var(--home-action-top);
    left: 33px;
    display: flex;
    gap: 16px;
}

.welcome-card__actions .button {
    width: var(--home-action-width);
    height: var(--home-action-height);
    font-size: 17px;
    font-weight: 600;
}

.welcome-illustration {
    position: absolute;
    top: 29px;
    right: 39px;
    width: 340px;
    height: 206px;
    pointer-events: none;
}

.welcome-illustration__dome {
    position: absolute;
    top: 12px;
    left: 0;
    width: 260px;
    height: 166px;
    border-radius: 150px 150px 14px 14px;
    background: linear-gradient(145deg, rgba(231, 237, 251, 0.72), rgba(248, 249, 253, 0.2));
    opacity: 0.9;
}

.speech-bubble {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.speech-bubble i {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.speech-bubble--primary {
    top: 63px;
    left: 112px;
    z-index: 2;
    width: 118px;
    height: 88px;
    border-radius: 25px;
    background: linear-gradient(145deg, #dce7fb, #bdcff1);
    box-shadow: 0 18px 30px rgba(71, 126, 207, 0.09);
}

.speech-bubble--primary::after {
    position: absolute;
    bottom: -17px;
    left: 17px;
    width: 28px;
    height: 26px;
    background: inherit;
    clip-path: polygon(0 100%, 30% 0, 100% 0);
    content: "";
}

.speech-bubble--primary i {
    background: #247cf1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.speech-bubble--secondary {
    top: 108px;
    left: 205px;
    width: 103px;
    height: 70px;
    border-radius: 21px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 14px 30px rgba(52, 67, 96, 0.06);
}

.speech-bubble--secondary::after {
    position: absolute;
    right: 13px;
    bottom: -15px;
    width: 26px;
    height: 22px;
    background: inherit;
    clip-path: polygon(0 0, 70% 0, 100% 100%);
    content: "";
}

.speech-bubble--secondary i {
    width: 10px;
    height: 10px;
    background: #aeb5c1;
}

:root[data-theme="dark"] .welcome-illustration__dome {
    background: linear-gradient(145deg, rgba(20, 36, 62, 0.88), rgba(17, 25, 38, 0.15));
}

:root[data-theme="dark"] .speech-bubble--primary {
    background: linear-gradient(145deg, #147eff, #0059de);
    box-shadow: 0 20px 38px rgba(0, 91, 222, 0.2);
}

:root[data-theme="dark"] .speech-bubble--primary i {
    background: #c8e3ff;
    box-shadow: none;
}

:root[data-theme="dark"] .speech-bubble--secondary {
    background: #242a31;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
}

:root[data-theme="dark"] .speech-bubble--secondary i {
    background: #b7c2d2;
}

.forum-section {
    margin-top: 14px;
}

.section-heading,
.latest-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-heading {
    height: var(--home-section-heading-height);
    padding: 0 7px 0 6px;
}

.section-heading h2,
.latest-heading h2 {
    color: var(--color-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 24px;
}

.section-heading__link {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    min-height: 40px;
    padding: 0 2px 0 10px;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.section-heading__link:hover {
    color: var(--color-primary);
}

.section-heading__link .icon {
    width: 15px;
    height: 15px;
    stroke-width: 2;
}

.forum-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: var(--home-forum-row-height);
    column-gap: 13px;
    row-gap: var(--home-forum-row-gap);
}

.forum-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    min-width: 0;
    height: 100%;
    padding: 0 20px;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
    transition: border-color var(--transition-fast), background-color var(--transition-fast), box-shadow var(--transition-fast);
}

.forum-card:hover {
    border-color: rgba(20, 126, 255, 0.42);
    background: var(--color-surface-hover);
    box-shadow: 0 6px 20px rgba(24, 39, 75, 0.06);
}

.forum-card__icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
}

.forum-card__icon .icon {
    width: 21px;
    height: 21px;
    stroke-width: 1.9;
}

.forum-card__icon--blue {
    background: var(--color-blue-soft);
    color: var(--color-primary);
}

.forum-card__icon--green {
    background: var(--color-green-soft);
    color: var(--color-green);
}

.forum-card__icon--orange {
    background: var(--color-orange-soft);
    color: var(--color-orange);
}

.forum-card__icon--purple {
    background: var(--color-purple-soft);
    color: var(--color-purple);
}

.forum-card__icon--amber {
    background: var(--color-amber-soft);
    color: var(--color-amber);
}

.forum-card__icon--red {
    background: var(--color-red-soft);
    color: var(--color-red);
}

.forum-card__copy,
.forum-card__count,
.thread-row__copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.forum-card__copy {
    gap: 3px;
}

.forum-card__copy strong {
    overflow: hidden;
    color: var(--color-text);
    font-size: 17px;
    font-weight: 700;
    line-height: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-card__copy small {
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-card__count {
    align-items: flex-end;
    gap: 3px;
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.forum-card__count strong {
    color: var(--color-text-secondary);
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
}

.forum-card__count small {
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
}

.latest-section {
    margin-top: var(--home-latest-margin);
}

.latest-heading {
    height: var(--home-latest-heading-height);
    padding-left: 6px;
}

.thread-tabs {
    display: flex;
    align-items: center;
    align-self: flex-start;
    height: 38px;
    gap: 8px;
}

.thread-tabs__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 38px;
    border-radius: 6px;
    color: var(--color-text-secondary);
    font-size: 15px;
    font-weight: 600;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.thread-tabs__item:hover {
    color: var(--color-primary);
}

.thread-tabs__item.is-active {
    background: var(--color-surface-active);
    color: var(--color-primary);
}

.thread-tabs__refresh {
    display: inline-grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    outline: 0;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), opacity var(--transition-fast);
}

.thread-tabs__refresh:hover {
    background: var(--color-surface-active);
    color: var(--color-primary);
}

.thread-tabs__refresh:focus-visible {
    outline: 3px solid rgba(20, 126, 255, 0.35);
    outline-offset: 1px;
}

.thread-tabs__refresh:disabled {
    cursor: wait;
    opacity: 0.72;
}

.thread-tabs__refresh .icon {
    width: 19px;
    height: 19px;
    stroke-width: 1.9;
}

.thread-tabs__refresh.is-loading .icon {
    animation: thread-refresh-spin 720ms linear infinite;
}

.thread-list {
    display: grid;
    grid-auto-rows: var(--home-thread-row-height);
    min-height: var(--home-thread-list-height);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
}

.thread-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 76px 76px 100px;
    align-items: center;
    gap: 15px;
    min-height: var(--home-thread-row-height);
    padding: 0 20px 0 14px;
    color: var(--color-text);
    transition: background-color var(--transition-fast);
}

.thread-row + .thread-row {
    border-top: 1px solid var(--color-border);
}

.thread-row:hover {
    background: var(--color-surface-hover);
}

.thread-row.is-new {
    animation: thread-row-arrive 220ms ease-out both, thread-row-fresh 1600ms ease-out 160ms both;
}

.thread-list__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.thread-list__loading[hidden] {
    display: none;
}

.thread-list__loading-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: thread-refresh-spin 720ms linear infinite;
}

.thread-list__sentinel {
    height: 1px;
}

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

@keyframes thread-row-arrive {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes thread-row-fresh {
    0%,
    68% {
        background-color: rgba(20, 126, 255, 0.16);
    }

    100% {
        background-color: transparent;
    }
}

.thread-avatar {
    display: block;
    width: 38px;
    height: 38px;
    overflow: hidden;
    border: 1px solid rgba(126, 139, 158, 0.28);
    border-radius: 50%;
}

.thread-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thread-row__copy {
    gap: 2px;
    overflow: hidden;
}

.thread-row__copy strong {
    overflow: hidden;
    color: var(--color-text);
    font-size: 17px;
    font-weight: 700;
    line-height: 24px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 20px;
    overflow: hidden;
}

.thread-row__tags {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
}

.thread-tag {
    height: 19px;
    flex: 0 0 auto;
    padding: 0 7px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface-active);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 17px;
    white-space: nowrap;
}

.thread-row__meta small {
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.thread-stat {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 20px;
}

.thread-stat .icon {
    width: 17px;
    height: 17px;
    stroke-width: 1.7;
}

.thread-row__time {
    color: var(--color-text-secondary);
    font-size: 13px;
    font-style: normal;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    line-height: 20px;
    text-align: right;
    white-space: nowrap;
}

@media (max-width: 1050px) {
    .forum-card {
        gap: 12px;
        padding-inline: 15px;
    }

    .welcome-illustration {
        right: 20px;
        transform: scale(0.9);
        transform-origin: right center;
    }

    .thread-row {
        grid-template-columns: 38px minmax(0, 1fr) 62px 62px 90px;
        gap: 12px;
    }
}

@media (max-width: 820px) {
    .forum-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-illustration {
        opacity: 0.62;
    }

    .thread-row {
        grid-template-columns: 38px minmax(0, 1fr) 80px;
    }

    .thread-stat {
        display: none;
    }
}

@media (max-width: 640px) {
    :root {
        --home-section-heading-height: 40px;
        --home-forum-row-height: 72px;
        --home-forum-row-gap: 8px;
        --home-latest-margin: 14px;
        --home-latest-heading-height: 44px;
        --home-thread-list-height: 0px;
        --home-thread-row-height: 70px;
    }

    .welcome-card {
        height: auto;
        min-height: 0;
        overflow: hidden;
        border: 1px solid var(--color-border);
        border-radius: 7px;
        background: var(--color-surface);
        box-shadow: var(--shadow-card);
    }

    .welcome-card__content {
        padding: 18px 16px 16px;
    }

    .welcome-card h1 {
        font-size: 24px;
        line-height: 31px;
    }

    .welcome-card p {
        max-width: none;
        margin-top: 4px;
        font-size: 14px;
        font-weight: 500;
        line-height: 21px;
    }

    .welcome-card__actions {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 14px;
    }

    .welcome-card__actions .button {
        width: 100%;
        height: 44px;
        gap: 8px;
        font-size: 15px;
    }

    .welcome-illustration {
        display: none;
    }

    .forum-section {
        display: none;
    }

    .section-heading {
        padding: 0 4px;
    }

    .section-heading h2,
    .latest-heading h2 {
        font-size: 17px;
        line-height: 22px;
    }

    .section-heading__link {
        min-height: 36px;
        font-size: 13px;
    }

    .forum-grid {
        grid-template-columns: 1fr;
    }

    .forum-card {
        grid-template-columns: 34px minmax(0, 1fr) auto;
        gap: 10px;
        padding: 0 12px;
    }

    .forum-card__icon {
        width: 34px;
        height: 34px;
    }

    .forum-card__icon .icon {
        width: 19px;
        height: 19px;
    }

    .forum-card__copy {
        gap: 1px;
    }

    .forum-card__copy strong {
        font-size: 15px;
        line-height: 21px;
    }

    .forum-card__copy small {
        font-size: 13px;
        line-height: 18px;
    }

    .forum-card__count {
        gap: 0;
        margin-left: 0;
    }

    .forum-card__count strong {
        font-size: 14px;
        line-height: 18px;
    }

    .forum-card__count small {
        font-size: 12px;
        line-height: 16px;
    }

    .latest-section {
        margin-top: var(--home-latest-margin);
    }

    .latest-heading {
        height: var(--home-latest-heading-height);
        padding-left: 4px;
    }

    .thread-tabs {
        height: 36px;
        gap: 2px;
    }

    .thread-tabs__item {
        width: 52px;
        height: 36px;
        font-size: 14px;
    }

    .thread-tabs__refresh {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .thread-list {
        min-height: 0;
    }

    .thread-row {
        grid-template-columns: 34px minmax(0, 1fr) 68px;
        gap: 10px;
        padding: 0 12px;
    }

    .thread-avatar {
        width: 34px;
        height: 34px;
    }

    .thread-row__copy strong {
        font-size: 15px;
        line-height: 21px;
    }

    .thread-row__meta {
        gap: 6px;
        height: 18px;
    }

    .thread-row__tags {
        gap: 4px;
    }

    .thread-tag {
        height: 18px;
        padding: 0 5px;
        font-size: 11px;
        line-height: 16px;
    }

    .thread-row__meta small,
    .thread-row__time {
        font-size: 12px;
        line-height: 18px;
    }
}

@media (max-width: 430px) {
    .welcome-card__actions {
        gap: 8px;
    }

    .welcome-card__actions .button {
        width: 100%;
    }

    .latest-heading {
        height: var(--home-latest-heading-height);
        min-height: var(--home-latest-heading-height);
        padding-left: 2px;
    }

    .thread-tabs {
        height: 36px;
    }

    .thread-tabs__item {
        width: 48px;
        height: 36px;
    }

    .thread-tabs__refresh {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .thread-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }

    .thread-row__time {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .thread-tabs__refresh.is-loading .icon,
    .thread-list__loading-indicator,
    .thread-row.is-new {
        animation-duration: 1ms;
        animation-iteration-count: 1;
    }
}
