:root {
    --ink: #1a1650;
    --muted: #6b6a9c;
    --line: #ececf3;
    --accent: #6d5ae6;
    --accent-soft: #cfc8f3;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    padding: 40px 16px;
    background: #f2f2f4;
    color: var(--ink);
    font-family: 'Nunito', system-ui, sans-serif;
}

.card {
    max-width: 1560px;
    margin: 0 auto;
    padding: 40px 40px 28px;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 10px 40px rgba(26, 22, 80, .06);
}

h1 {
    margin: 0;
    text-align: center;
    font-size: clamp(28px, 4vw, 48px);
    font-weight: 800;
    letter-spacing: -.5px;
}

.subtitle {
    margin: 10px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 22px);
}

.legend {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 2px 14px;
    color: var(--muted);
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}
.legend__line {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, #b9aef0, #8fcdf2, #7fe3e8, #8fe6b8, #e1e98a, #f2cd4f);
}

/* ---------- как заполнять ---------- */

.howto {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 26px 0 0;
    padding: 0;
    list-style: none;
}
.howto__step {
    position: relative;
    padding: 20px 20px 18px 66px;
    border-radius: 18px;
    background: #f7f7fb;
    font-size: 15px;
    line-height: 1.45;
}
.howto__step h2 { margin: 0 0 6px; font-size: 17px; font-weight: 800; }
.howto__step p { margin: 0; color: #4a4874; }
.howto__note { margin-top: 10px !important; font-size: 13px; color: var(--muted) !important; }
.howto__num {
    position: absolute;
    top: 18px;
    left: 18px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
}

.howto__scale { display: flex; align-items: center; gap: 4px; margin-top: 12px; font-size: 13px; font-weight: 800; color: var(--muted); }
.howto__scale i { flex: 1; height: 16px; border-radius: 4px; background: var(--c); }
.howto__scale { align-items: flex-start; }
.howto__scale i { margin-top: 1px; }
.howto__scale span { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.howto__scale small { font-size: 11px; font-weight: 600; white-space: nowrap; }
.howto__scale span:first-child { margin-right: 4px; }
.howto__scale span:last-child { margin-left: 4px; }
.howto__scale .slot--1  { --c: #b9aef0; } .howto__scale .slot--2  { --c: #b3b6f5; }
.howto__scale .slot--3  { --c: #8fcdf2; } .howto__scale .slot--4  { --c: #85d9ee; }
.howto__scale .slot--5  { --c: #7fe3e8; } .howto__scale .slot--6  { --c: #8fe6b8; }
.howto__scale .slot--7  { --c: #a8eba0; } .howto__scale .slot--8  { --c: #e1e98a; }
.howto__scale .slot--9  { --c: #f2dc7c; } .howto__scale .slot--10 { --c: #f2cd4f; }

.howto__rates { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 14px; }
.howto__rates li { display: flex; align-items: center; gap: 10px; }
.howto__rates .rate__btn { width: 38px; padding: 2px 0; text-align: center; cursor: default; }

/* ---------- slots ---------- */

.slots {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 10px;
}

.slot {
    --c: #b9aef0;
    --bg: #ede9fe;
    display: flex;
    flex-direction: column;
    border: 2px dashed var(--c);
    border-radius: 16px;
    transition: background .15s, transform .15s;
}

.slot__drop {
    position: relative;
    aspect-ratio: 1;
}
.slot--1  { --c: #b9aef0; --bg: #ede9fe; }
.slot--2  { --c: #b3b6f5; --bg: #e4e5fd; }
.slot--3  { --c: #8fcdf2; --bg: #dcf0fc; }
.slot--4  { --c: #85d9ee; --bg: #d9f3fb; }
.slot--5  { --c: #7fe3e8; --bg: #d5f8fa; }
.slot--6  { --c: #8fe6b8; --bg: #daf8e8; }
.slot--7  { --c: #a8eba0; --bg: #e3fadd; }
.slot--8  { --c: #e1e98a; --bg: #f3f8cf; }
.slot--9  { --c: #f2dc7c; --bg: #fdf1c4; }
.slot--10 { --c: #f2cd4f; --bg: #fde7a3; }

.slot.is-over { background: var(--bg); transform: scale(1.02); }
.slot.is-target { background: color-mix(in srgb, var(--bg) 45%, #fff); cursor: pointer; }

.slot__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 10px 4px;
}
.slot__num {
    flex: none;
    min-width: 40px;
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--bg);
    font-weight: 800;
    font-size: 20px;
    text-align: center;
}
.slot__hint {
    min-width: 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.15;
}
.slot--1 .slot__hint, .slot--10 .slot__hint { color: var(--ink); }

.slot__empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #8a89b5;
    font-size: 16px;
    text-align: center;
}

.slot__plus {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 2px solid #a9a3dc;
    border-radius: 50%;
    color: #9d97d6;
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
}
.slot--10 .slot__plus { border-color: #f2c94c; color: #e6b830; }

.slot__drop > .sticker {
    position: absolute;
    inset: 6px;
    width: auto;
}
.slot:has(.slot__drop > .sticker) { border-style: solid; }
.slot:has(.slot__drop > .sticker) .slot__empty { display: none; }

/* оценка «компания даёт» под стикером */
.slot__rate {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 2px 8px 8px;
    visibility: hidden;
}
.slot:has(.slot__drop > .sticker) .slot__rate { visibility: visible; }
.slot__rate-label { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }

.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.rate__btn {
    --rc: #8f97ab;
    padding: 5px 0;
    border: 1.5px solid color-mix(in srgb, var(--rc) 45%, #fff);
    border-radius: 8px;
    background: #fff;
    color: var(--rc);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.rate__btn--m2 { --rc: #d6453b; }
.rate__btn--m1 { --rc: #e58a3a; }
.rate__btn--p1 { --rc: #67b85a; }
.rate__btn--p2 { --rc: #1f9e5c; }
.rate__btn:hover { background: color-mix(in srgb, var(--rc) 12%, #fff); }
.rate__btn.is-active { background: var(--rc); border-color: var(--rc); color: #fff; }

/* ---------- stickers ---------- */

.pool {
    margin-top: 28px;
    padding: 20px;
    border-radius: 18px;
    background: #f7f7fb;
}
.pool.is-over { background: #efedfb; }

.pool__hint b { color: var(--ink); }
.pool__hint {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 15px;
    text-align: center;
}
.pool:not(:has(.sticker)) .pool__hint::after { content: ' Все стикеры разложены.'; font-weight: 700; }

.pool__items {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    align-items: stretch;
    grid-auto-rows: 1fr; /* все стикеры одной высоты, даже в несколько рядов */
    gap: 10px;
    min-height: 40px;
}
.pool .sticker { width: auto; }

.sticker {
    display: flex;
    flex-direction: column;
    width: 200px;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(26, 22, 80, .1);
    cursor: grab;
    touch-action: none;
    user-select: none;
    transition: box-shadow .15s, transform .15s, opacity .15s;
}
.sticker__cap { flex: 1; padding: 8px 12px 12px; font-size: 13px; line-height: 1.35; color: #4a4874; }
.sticker__cap b { display: block; margin-bottom: 2px; font-size: 15px; color: var(--ink); hyphens: auto; overflow-wrap: anywhere; }
/* в ячейке подпись не нужна: там только картинка */
.slot__drop > .sticker .sticker__cap { display: none; }
.sticker:hover { box-shadow: 0 6px 18px rgba(26, 22, 80, .16); transform: translateY(-2px); }
.sticker img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; pointer-events: none; }
.slot__drop > .sticker img { height: 100%; aspect-ratio: auto; }
.sticker.is-dragging { opacity: .3; }
.sticker.is-selected { outline: 3px solid var(--accent); outline-offset: 2px; }

.ghost {
    background: #fff;
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(26, 22, 80, .28);
    transform: rotate(-3deg) scale(1.04);
}
.ghost img { display: block; width: 100%; aspect-ratio: 1; }

/* ---------- footer ---------- */

.footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.footer__left { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; }

.name { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; color: var(--muted); }
.name em { font-weight: 400; }
.name input {
    width: 260px;
    max-width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    color: var(--ink);
    outline: none;
}
.name input:focus { border-color: var(--accent); }

.counter { font-size: 20px; padding-bottom: 8px; }

.btn {
    padding: 16px 40px;
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: #5a47d4; }
.btn:disabled { background: var(--accent-soft); cursor: not-allowed; }

/* ---------- done ---------- */

.card--done { max-width: 560px; padding: 56px 32px; text-align: center; }
.done-icon {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: #daf8e8;
    color: #1f9d5c;
    font-size: 36px;
    font-weight: 800;
}

/* ---------- responsive ---------- */

/* 10 колонок в ряд — всё в ячейках компактнее */
.slot__head { padding: 8px 8px 2px; gap: 6px; align-items: flex-start; min-height: 56px; }
.slot__num { min-width: 30px; padding: 2px 7px; font-size: 16px; border-radius: 8px; }
.slot__hint { font-size: 12px; padding-top: 2px; }
.slot__empty { gap: 8px; font-size: 12px; padding: 0 6px; }
.slot__plus { width: 36px; height: 36px; font-size: 22px; }
.slot__rate { padding: 2px 5px 6px; }
.slot__rate-label { font-size: 11px; }
.rate { gap: 2px; }
.rate__btn { padding: 4px 0; font-size: 11px; border-radius: 6px; }
.pool .sticker__cap { padding: 6px 8px 8px; font-size: 11.5px; }
.pool .sticker__cap b { font-size: 13px; }

@media (max-width: 1100px) {
    .slots, .pool__items { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
    .slot__head { min-height: 0; align-items: center; }
    .slot__hint { font-size: 13px; }
    .pool .sticker__cap { font-size: 12.5px; }
    .pool .sticker__cap b { font-size: 14px; }
}

@media (max-width: 1000px) {
    .howto { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    body { padding: 16px; }

    .for-desktop { display: none; }
    .for-mobile { display: block; }
    .for-mobile[hidden] { display: none; }
    .legend { display: none; }

    /* ячейки — список: 10 сверху, 1 снизу */
    .slots { display: flex; flex-direction: column-reverse; gap: 8px; }
    .slot { border-width: 1.5px; border-radius: 14px; }
    .slot__head { min-height: 0; padding: 8px 8px 4px 10px; align-items: center; }
    .slot__num { font-size: 15px; min-width: 32px; }
    .slot__hint { font-size: 13px; }
    .slot__tools { gap: 4px; }
    .slot__tool, .slot__tool[data-act="up"], .slot__tool[data-act="down"] { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #f3f3f8; font-size: 16px; }

    .slot__drop { aspect-ratio: auto; min-height: 0; }
    .slot__empty { position: static; flex-direction: row; justify-content: flex-start; padding: 0 12px 10px; font-size: 13px; }
    .slot__empty .slot__plus { display: none; }
    .slot__drop > .sticker {
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        margin: 0 8px;
        padding: 6px;
        box-shadow: none;
        background: #f7f7fb;
    }
    .slot__drop > .sticker img { width: 56px; height: 56px; flex: none; border-radius: 10px; }
    .slot__drop > .sticker .sticker__cap { display: block; padding: 0; font-size: 12px; }
    .slot__drop > .sticker .sticker__cap span { display: none; }
    .slot__drop > .sticker .sticker__cap b { font-size: 15px; margin: 0; }
    .slot:not(:has(.slot__drop > .sticker)) .slot__rate { display: none; }
    .slot__rate { flex-direction: row; align-items: center; gap: 8px; padding: 8px 8px 10px; }
    .slot__rate-label { flex: none; font-size: 12px; text-align: left; }
    .rate { flex: 1; gap: 4px; }
    .rate__btn { padding: 8px 0; font-size: 14px; border-radius: 8px; }

    /* лоток — карточки в одну колонку, страница свободно прокручивается */
    .pool { padding: 14px 12px; }
    .pool__next {
        position: sticky;
        top: 8px;
        z-index: 5;
        margin: 0 0 10px;
        padding: 10px 12px;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(26, 22, 80, .12);
    }
    .pool__items { display: flex; flex-direction: column; gap: 8px; }
    .pool .sticker { flex-direction: row; align-items: center; gap: 12px; padding: 8px; touch-action: auto; cursor: pointer; }
    .pool .sticker img { width: 84px; height: 84px; flex: none; border-radius: 10px; }
    .pool .sticker__cap { padding: 0; font-size: 13px; }
    .pool .sticker__cap b { font-size: 15px; }
    .sticker:hover { transform: none; }

    .card { padding: 24px 16px 20px; border-radius: 20px; }
    .legend { font-size: 14px; }
    .footer { flex-direction: column; align-items: stretch; }
    .footer__left { flex-direction: column; align-items: stretch; gap: 12px; }
    .name input { width: 100%; }
    .counter { padding-bottom: 0; }
}

/* ---------- кнопки ↑ ↓ ✕ в ячейке ---------- */

.slot__tools { display: none; margin-left: auto; gap: 2px; }
.slot:has(.slot__drop > .sticker) .slot__tools { display: inline-flex; }
.slot__tool {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}
.slot__tool:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.slot__tool:disabled { opacity: .25; cursor: default; }
/* на широком экране двигают мышкой, оставляем только «убрать» */
@media (min-width: 761px) {
    .slot__tool[data-act="up"], .slot__tool[data-act="down"] { display: none; }
    .for-mobile { display: none; }
}

.pool__next { margin: -6px 0 14px; text-align: center; font-size: 15px; color: var(--ink); }
.pool__next b { display: inline-grid; place-items: center; min-width: 28px; padding: 1px 6px; border-radius: 8px; background: var(--accent); color: #fff; }
.slot.is-flash { background: var(--bg); }

/* ---------- увеличенный просмотр стикера при наведении ---------- */

.preview {
    position: fixed;
    z-index: 900;
    width: min(380px, 80vw);
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 20px 60px rgba(26, 22, 80, .3);
    pointer-events: none;
    opacity: 0;
    transform: scale(.96);
    transition: opacity .12s, transform .12s;
}
.preview.is-visible { opacity: 1; transform: none; }
.preview img { display: block; width: 100%; aspect-ratio: 1; }
.preview__text { padding: 4px 18px 16px; font-size: 15px; line-height: 1.4; }
.preview__text b { display: block; font-size: 17px; margin-bottom: 2px; }
