/* CSS Variables для темизации */
:host {
    --bg-primary: #fff;
    --bg-secondary: #fafafa;
    --bg-content: #fafafa;
    --text-primary: #1d1f20;
    --text-secondary: #313131;
    --text-muted: #6d6d6d;
    --border-color: #e0e0e0;
    --border-footer: #d9d9d9;
    --link-color: #0051c3;
    --link-hover: #ee730a;
    --checkbox-border: #6d6d6d;
    --checkbox-active: #c44d0e;
    --checkbox-checked-bg: #4CAF50;
    --success-color: #038127;
    --error-color: #de1303;
    --logo-text-fill: #000;
}

/* Темная тема - адаптивная */
@media (prefers-color-scheme: dark) {
    :host {
        --bg-primary: #222;
        --bg-secondary: #222;
        --bg-content: #222;
        --text-primary: #fff;
        --text-secondary: #d9d9d9;
        --text-muted: #bbb;
        --border-color: #666;
        --border-footer: #444;
        --link-color: #fff;
        --link-hover: #ee730a;
        --checkbox-border: #dadada;
        --checkbox-active: #fbad41;
        --checkbox-checked-bg: #4CAF50;
        --success-color: #0aa937;
        --error-color: #ffa299;
        --logo-text-fill: #fff;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:host {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.15;
    -webkit-font-smoothing: antialiased;
    color: #d9d9d9;
    background-color: var(--bg-primary);
    min-height: 100vh;
}

.main-wrapper {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    border-spacing: 0;
    justify-content: flex-start;
}

.main-content {
    margin: 8rem auto;
    max-width: 60rem;
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 720px) {
    .main-content {
        margin-top: 4rem;
    }
}

/* Заголовок с иконкой */
.zone-name-title {
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 3.75rem;
    overflow-wrap: break-word;
    display: flex;
    align-items: center;
    color: #d9d9d9;
}

@media (max-width: 720px) {
    .zone-name-title {
        font-size: 1.5rem;
        line-height: 1.75rem;
        margin-bottom: 1rem;
    }
}

.heading-favicon {
    height: 2rem;
    width: 2rem;
    margin-right: 0.5rem;
}

@media (max-width: 720px) {
    .heading-favicon {
        height: 1.5rem;
        width: 1.5rem;
    }
}

/* Заголовок челленджа */
.h2 {
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 2.25rem;
    color: #d9d9d9;
}

@media (max-width: 720px) {
    .h2 {
        font-size: 1.25rem;
        line-height: 1.5rem;
    }
}

/* Сообщение */
.core-msg {
    font-size: 1.5rem;
    line-height: 2.25rem;
    font-weight: 400;
    overflow-wrap: break-word;
    color: #d9d9d9;
}

@media (max-width: 720px) {
    .core-msg {
        font-size: 1rem;
        line-height: 1.5rem;
    }
}

.spacer {
    margin: 2rem 0;
}

/* Ссылки */
a {
    background-color: transparent;
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

/* Контент с чекбоксом */
#content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-color);
    background-color: var(--bg-content);
    height: 63px;
    user-select: none;
    min-width: 290px;
}

#challenge-stage {
    display: flex;
}

/* Чекбокс контейнер */
.cb-c {
    display: flex;
    align-items: center;
    margin-left: 11px;
    cursor: pointer;
    text-align: left;
}

.cb-lb {
    cursor: pointer;
    padding-left: 15px;
}

.cb-lb-t {
    display: flex;
    flex-flow: row-reverse nowrap;
    place-content: center flex-end;
    align-items: center;
    padding-left: 2px;
    color: #d9d9d9;
}

/* Кастомный чекбокс */
.Lend_input {
    position: relative;
    width: 25px;
    height: 25px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 2px solid var(--checkbox-border);
    border-radius: 4px;
    background-color: var(--bg-content);
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    animation: appear 0.7s ease-out;
}

.Lend_input:hover,
.Lend_input:focus {
    border-color: var(--checkbox-active);
}

.Lend_input:checked {
    background-color: var(--checkbox-checked-bg);
    border-color: var(--checkbox-checked-bg);
    box-shadow: 0 0 5px var(--checkbox-checked-bg);
}

.Lend_input:checked::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: white;
}

@keyframes appear {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Брендинг */
#branding {
    display: flex;
    flex-direction: column;
    margin: 0 16px 0 0;
    text-align: right;
}

#logo {
    margin-bottom: 1px;
    height: 26px;
}

.logo-text {
    fill: var(--logo-text-fill);
}

#terms {
    display: flex;
    justify-content: space-evenly;
    line-height: 10px;
    color: var(--text-muted);
    font-size: 8px;
    font-style: normal;
}

#terms a {
    text-decoration: underline;
    line-height: 10px;
    color: var(--text-muted);
    font-size: 8px;
    font-weight: 400;
    font-style: normal;
}

#terms a:hover {
    color: var(--link-hover);
}

.link-spacer {
    margin: 0 3px;
}

/* Футер */
.footer {
    font-size: 0.75rem;
    line-height: 1.125rem;
    margin: 0 auto;
    max-width: 60rem;
    width: 100%;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.footer-inner {
    border-top: 1px solid #d9d9d9;
    padding-bottom: 1rem;
    padding-top: 1rem;
}

.diagnostic-wrapper {
    margin-bottom: 0.5rem;
}

.footer .ray-id {
    text-align: center;
    color: #d9d9d9;
}

.footer .ray-id code {
    font-family: monaco, courier, monospace;
    color: #d9d9d9;
}

#footer-text {
    text-align: center;
    color: #d9d9d9;
}

/* Скрытый текст для краулеров */
.hidden-text {
    position: absolute;
    left: -9999px;
}

/* Анимации */
@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes scale-up-center {
    0% {
        transform: scale(0.01);
    }
    100% {
        transform: scale(1);
    }
}

/* RTL поддержка */
.rtl .heading-favicon {
    margin-left: 0.5rem;
    margin-right: 0;
}

.rtl .cb-lb-t {
    padding-right: 2px;
    padding-left: 0;
}

.rtl #branding {
    margin: 0 0 0 16px;
    text-align: center;
}

.rtl .cb-c {
    margin-right: 11px;
    margin-left: 0;
    text-align: right;
}

/* Адаптивность для мобильных */
@media (max-width: 720px) {
    .diagnostic-wrapper {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }
}
