/* Цвета берутся из темы Telegram, запасные значения — для обычного браузера. */
:root {
    --bg: var(--tg-theme-bg-color, #ffffff);
    --text: var(--tg-theme-text-color, #1c1c1e);
    --hint: var(--tg-theme-hint-color, #8e8e93);
    --accent: var(--tg-theme-button-color, #2481cc);
    --accent-text: var(--tg-theme-button-text-color, #ffffff);
    --surface: var(--tg-theme-secondary-bg-color, #f2f2f7);
    --viewport: var(--tg-viewport-stable-height, 100dvh);
    --gap: 16px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.page {
    max-width: 480px;
    min-height: var(--viewport);
    margin: 0 auto;
    padding: var(--gap);
}

.title {
    margin: 0 0 var(--gap);
    font-size: 24px;
    line-height: 1.25;
}

.hint {
    margin: 8px 0;
    color: var(--hint);
    font-size: 15px;
}

.button {
    display: block;
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

a.button {
    text-align: center;
    text-decoration: none;
    line-height: 28px;
}

.button[hidden] {
    display: none;
}

.button--secondary {
    background: var(--surface);
    color: var(--text);
}

.link {
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    cursor: pointer;
}

/* Каталог и карточка проекта */

.catalog__lead {
    margin: -8px 0 var(--gap);
}

.card {
    display: block;
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
}

.card__title {
    display: block;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.3;
}

.card__summary {
    display: block;
    margin: 6px 0 10px;
    color: var(--hint);
    font-size: 15px;
}

.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 8px;
    background: #ffd60a33;
    color: #8a6d00;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 14px;
}

.meta__item {
    display: flex;
    gap: 6px;
    align-items: center;
}

.meta__dots {
    display: inline-flex;
    gap: 3px;
}

.meta__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hint);
    opacity: 0.3;
}

.meta__dot--on {
    background: var(--accent);
    opacity: 1;
}

.link--nav {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.link--back {
    display: inline-flex;
    align-items: center;
    margin: -8px 0 8px -12px;
    text-decoration: none;
}

.notice {
    margin: var(--gap) 0 24px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #ff950014;
    font-size: 15px;
}

.notice__title {
    margin: 0 0 4px;
    font-weight: 600;
}

.notice ul {
    margin: 0;
    padding-left: 20px;
}

.notice li + li {
    margin-top: 4px;
}

/* Временная форма развилок */

.choose__option {
    margin: 0 0 24px;
    padding: 0;
    border: 0;
}

.choose__question {
    margin-bottom: 8px;
    font-size: 20px;
    font-weight: 600;
}

.choice {
    display: flex;
    gap: 12px;
    align-items: center;
    min-height: 52px;
    margin-top: 8px;
    padding: 0 16px;
    border-radius: 12px;
    background: var(--surface);
}

.choice {
    padding-top: 12px;
    padding-bottom: 12px;
}

.choice__hint {
    display: block;
    margin-top: 2px;
    color: var(--hint);
    font-size: 14px;
}

.choice input {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

/* Режим работы: шаги */

.steps {
    display: flex;
    flex-direction: column;
    min-height: calc(var(--viewport) - 2 * var(--gap));
}

.steps__project {
    margin: 0;
    color: var(--hint);
    font-size: 15px;
}

.progress {
    height: 6px;
    margin: 8px 0;
    border-radius: 3px;
    background: var(--surface);
    overflow: hidden;
}

.progress__bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 0.2s ease;
}

.steps__counter {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.step {
    flex: 1;
    padding: 24px 0;
}

.step[hidden] {
    display: none;
}

.step__image {
    display: block;
    width: 100%;
    margin-top: var(--gap);
    border-radius: 16px;
}

.step__text {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.3;
}

.step__tip {
    margin: var(--gap) 0 0;
    padding: 12px 16px;
    border-left: 3px solid var(--accent);
    border-radius: 0 12px 12px 0;
    background: var(--surface);
    font-size: 16px;
}

.step__tip::before {
    content: "💡 Совет мастера";
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.step__check {
    display: flex;
    gap: 10px;
    margin: var(--gap) 0 0;
    font-size: 16px;
}

.step__check::before {
    content: "✓";
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #30a46c;
    color: #fff;
    font-weight: 700;
    line-height: 24px;
    text-align: center;
}

.step--done {
    text-align: center;
}

.step__emoji {
    margin: 24px 0 8px;
    font-size: 64px;
}

.feedback {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.steps__nav {
    position: sticky;
    bottom: 0;
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    background: var(--bg);
}

.steps__nav .button {
    flex: 1;
}

.steps__nav[hidden],
.link[hidden] {
    display: none;
}

/* Подготовка: что купить и какие инструменты */

.section-title {
    margin: 24px 0 8px;
    font-size: 20px;
}

.check-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-top: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface);
    cursor: pointer;
}

.check-item input {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    accent-color: #30a46c;
}

.check-item__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.check-item__title {
    font-weight: 600;
}

.check-item__details {
    font-size: 15px;
}

.check-item__note {
    color: var(--hint);
    font-size: 14px;
}

.check-item:has(input:checked) {
    opacity: 0.55;
}

.check-item:has(input:checked) .check-item__title {
    text-decoration: line-through;
}

.mistakes {
    margin-top: 24px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #e5484d14;
}

.mistakes summary {
    min-height: 28px;
    font-weight: 600;
    cursor: pointer;
}

.mistake {
    margin-top: 12px;
}

.mistake p {
    margin: 0;
    font-size: 15px;
}

.mistake__title {
    font-weight: 600;
}

.mistake__fix {
    color: #1e7a4f;
}

.prepare__nav {
    position: sticky;
    bottom: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    margin-top: 24px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
    background: var(--bg);
}

.prepare__nav[hidden] {
    display: none;
}

/* Мастер: вступление и вопросы по одному */

.wizard [hidden] {
    display: none;
}

.question {
    margin: 0 0 24px;
}

.question .choose__question {
    margin: 0 0 8px;
    font-size: 20px;
}

.question__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: -8px 0 8px -12px;
}

.question__counter {
    color: var(--hint);
    font-size: 15px;
}

[data-wizard] .choose__question {
    margin-bottom: 12px;
    font-size: 24px;
    line-height: 1.25;
}

[data-wizard] .choice {
    min-height: 64px;
    border: 2px solid transparent;
    font-weight: 600;
}

[data-wizard] .choice:has(input:checked) {
    border-color: var(--accent);
}

[data-wizard] .choice__hint {
    font-weight: 400;
}

.question__help {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface);
    font-size: 15px;
}

.question__help summary {
    min-height: 28px;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
}

.question__help p {
    margin: 8px 0 0;
}

.feedback-reasons {
    display: grid;
    gap: 8px;
    margin: 8px 0 16px;
    text-align: left;
}

.feedback-reasons .hint,
[data-feedback-thanks] {
    text-align: center;
}

.step--done [hidden] {
    display: none;
}

/* Плашка «Продолжить» в каталоге */

.continue {
    display: grid;
    gap: 2px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
}

.continue__label {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.85;
    text-transform: uppercase;
}

.continue__title {
    font-size: 18px;
    font-weight: 600;
}

.continue__step {
    font-size: 15px;
    opacity: 0.85;
}

