/* Check CPU bit architecture (cpu_bit_checker) — стили. Токены инструмента поверх темы сайта
   (assets/css/theme.css). Префикс .cpubit (короткие классы конфликтуют с Bootstrap — урок voice_recorder).
   Семейство карточек — как у my_hostname/resolution; большой зелёный ответ — наследие legacy. */

.cpubit {
    --cpubit-w: 800px;
    --cpubit-surface: var(--tls-surface);
    --cpubit-border:  var(--tls-border);
    --cpubit-muted:   var(--tls-text-muted);
    --cpubit-green:   #5eac38;             /* большой ответ — зелёный legacy (как my_hostname) */
    --cpubit-warn:    #b3771d;
    /* «тёмный кремний»: плата и чип героя */
    --cpubit-board-1:   #101d2c;           /* плата: градиент, верх */
    --cpubit-board-2:   #0b1420;           /* плата: градиент, низ */
    --cpubit-chip-1:    #1d2937;           /* корпус чипа */
    --cpubit-chip-2:    #131c28;
    --cpubit-chip-edge: #2e405a;
    --cpubit-pin:       #8fa3b8;           /* ножки */
    --cpubit-glow-64:   #7dff9a;           /* свечение: зелёный */
    --cpubit-glow-32:   #ffb562;           /* тёплый янтарь */
    --cpubit-glow-unk:  #ffc46b;           /* «не знаю» */
    --cpubit-dim:       #93a7bd;           /* приглушённый текст на плате */
    --cpubit-bits-fz: clamp(3rem, 12vw, 5.2rem);
    --cpubit-pad: 20px;
    --cpubit-gap: 12px;
    max-width: var(--cpubit-w);
    margin: 0 auto;
}


/* =====================================================================
   Карточки (общий вид)
   ===================================================================== */
.cpubit__card {
    background: var(--cpubit-surface);
    border: 1px solid var(--cpubit-border);
    border-radius: var(--tls-radius);
    box-shadow: var(--tls-shadow);
    padding: var(--cpubit-pad);
    min-width: 0;
}

/* =====================================================================
   Герой: большой ответ
   ===================================================================== */
.cpubit__hero {
    text-align: center;
    position: relative;
    overflow: hidden;
    border-color: #223146;
    background:
        radial-gradient(circle at 16% 18%, rgba(96, 150, 255, .10), transparent 42%),
        radial-gradient(circle at 84% 82%, rgba(96, 255, 170, .07), transparent 40%),
        linear-gradient(160deg, var(--cpubit-board-1), var(--cpubit-board-2) 65%);
}
/* дорожки платы: тонкая сетка */
.cpubit__hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(122, 164, 255, .06) 0 1px, transparent 1px 54px),
        repeating-linear-gradient(90deg, rgba(122, 164, 255, .06) 0 1px, transparent 1px 54px);
}
.cpubit__hero > * { position: relative; }

.cpubit__head {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
}
.cpubit__hero .cpubit__label { color: var(--cpubit-dim); }
.cpubit__label {
    font-size: .85rem; letter-spacing: .08em; text-transform: uppercase;
    color: var(--cpubit-muted);
}

.cpubit__report-btn {
    display: inline-flex; align-items: center; gap: .35rem;
    border: 1px solid #33475f; background: rgba(255, 255, 255, .04); border-radius: 8px;
    padding: .25rem .6rem; font-size: .8rem; color: #9fc0ff; cursor: pointer;
    white-space: nowrap;
}
.cpubit__report-btn:hover { border-color: #9fc0ff; }
.cpubit__report-btn:focus { outline: none; }

.cpubit__answer { margin-top: .9rem; }

.cpubit__chipwrap { position: relative; display: inline-block; margin: 6px 14px 10px; max-width: calc(100% - 28px); }

/* ножки корпуса */
.cpubit__pins { position: absolute; pointer-events: none; }
.cpubit__pins--top, .cpubit__pins--bottom {
    left: 16px; right: 16px; height: 7px;
    background: repeating-linear-gradient(90deg, var(--cpubit-pin) 0 7px, transparent 7px 19px);
}
.cpubit__pins--top { top: -7px; }
.cpubit__pins--bottom { bottom: -7px; }
.cpubit__pins--left, .cpubit__pins--right {
    top: 16px; bottom: 16px; width: 7px;
    background: repeating-linear-gradient(0deg, var(--cpubit-pin) 0 7px, transparent 7px 19px);
}
.cpubit__pins--left { left: -7px; }
.cpubit__pins--right { right: -7px; }

/* корпус чипа */
.cpubit__chip {
    position: relative;
    min-width: min(430px, 100%);
    padding: 1.5rem 1.8rem 1.3rem;
    background: linear-gradient(155deg, var(--cpubit-chip-1), var(--cpubit-chip-2));
    border: 1px solid var(--cpubit-chip-edge);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
}
/* key-dot — метка первого пина, как на настоящем корпусе */
.cpubit__chip::after {
    content: ''; position: absolute; top: 10px; left: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #31435c; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}

.cpubit__bits {
    display: block;
    font-size: var(--cpubit-bits-fz);
    font-weight: 700; line-height: 1.05;
    color: var(--cpubit-glow-64);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 18px rgba(125, 255, 154, .45), 0 0 52px rgba(125, 255, 154, .22);
}
.cpubit__answer[data-bits="32"] .cpubit__bits {
    color: var(--cpubit-glow-32);
    text-shadow: 0 0 18px rgba(255, 181, 98, .45), 0 0 52px rgba(255, 181, 98, .22);
}
.cpubit__answer[data-state="done"] .cpubit__bits { animation: cpubit-on .5s ease-out, cpubit-glow 3.4s ease-in-out .5s infinite; }
@keyframes cpubit-on { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes cpubit-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(.82); }
}
@media (prefers-reduced-motion: reduce) {
    .cpubit__answer[data-state="done"] .cpubit__bits { animation: none; }
}
.cpubit__answer[data-state="loading"] .cpubit__bits {
    font-size: 1.4rem; font-weight: 400; color: var(--cpubit-dim); text-shadow: none; padding: 1rem 0;
}
.cpubit__answer[data-state="unknown"] .cpubit__bits {
    font-size: clamp(1.6rem, 6vw, 2.4rem); color: var(--cpubit-glow-unk);
    text-shadow: 0 0 18px rgba(255, 196, 107, .35); padding: .5rem 0 .15rem;
}

.cpubit__arch { display: block; margin-top: .2rem; font-size: 1.15rem; color: #c3d3e8; }

.cpubit__note {
    margin: .75rem auto 0; max-width: 620px;
    font-size: .88rem; color: var(--cpubit-dim);
}


/* Цепочка вывода: браузер → ОС → процессор */
.cpubit__chain {
    display: flex; align-items: stretch; justify-content: center; gap: .55rem;
    margin-top: 1rem; flex-wrap: wrap;
}
.cpubit__link {
    display: flex; flex-direction: column; align-items: center; gap: .15rem;
    border: 1px solid #33475f; border-radius: 10px;
    padding: .5rem .9rem; min-width: 118px;
    background: rgba(255, 255, 255, .04);
}
.cpubit__link--cpu {
    border-color: rgba(125, 255, 154, .55); background: rgba(125, 255, 154, .07);
    box-shadow: 0 0 16px rgba(125, 255, 154, .12);
}
.cpubit__link-what {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--cpubit-dim);
}
.cpubit__link-what .bi { color: #9fc0ff; }
.cpubit__link--cpu .cpubit__link-what .bi { color: var(--cpubit-glow-64); }
.cpubit__link-val { font-size: 1.05rem; font-weight: 700; color: #dbe7f5; }
.cpubit__link--cpu .cpubit__link-val { color: var(--cpubit-glow-64); text-shadow: 0 0 12px rgba(125, 255, 154, .4); }
.cpubit__arrow { align-self: center; color: #55708f; }

.cpubit__copy-fallback { margin: .6rem 0 0; font-size: .85rem; color: #ff9f9f; }
.cpubit__report-text {
    display: block; width: 100%; margin-top: .6rem;
    font-size: .85rem; font-family: Consolas, Menlo, monospace;
    background: rgba(255, 255, 255, .05); color: #d7e3f2;
    border: 1px solid #33475f; border-radius: var(--tls-radius); padding: .6rem .75rem;
}
.cpubit__report-text:focus { outline: none; box-shadow: none; border-color: var(--cpubit-border); }

/* тост «скопировано» */
.cpubit__toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
    background: #1f2733; color: #fff; font-size: .88rem; padding: .5rem .9rem;
    border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); z-index: 1085;
}

/* =====================================================================
   Сетка карточек деталей
   ===================================================================== */
.cpubit__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));  /* minmax(0,1fr) — равные колонки, см. _common.md */
    gap: var(--cpubit-gap);
    margin-top: var(--cpubit-gap);
}

.cpubit__grid .cpubit__card { display: flex; flex-direction: column; padding: .9rem 1rem; }

.cpubit__card-head {
    display: flex; align-items: center; gap: .5rem;
    color: var(--cpubit-muted); font-size: .82rem;
    letter-spacing: .04em; text-transform: uppercase;
}
.cpubit__card-head .bi {
    color: var(--tls-accent); font-size: 1rem;
    background: #e8eefc; border-radius: 8px; padding: .3rem;
}
.cpubit__card-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cpubit__card-value {
    margin-top: .45rem;
    font-size: 1.25rem; font-weight: 700; line-height: 1.2;
    overflow-wrap: anywhere;
}

.cpubit__card-sub { margin-top: auto; padding-top: .35rem; font-size: .8rem; color: var(--cpubit-muted); }

.cpubit__more { display: inline-block; margin-top: .2rem; font-size: .8rem; text-decoration: none; }
.cpubit__more:hover { text-decoration: underline; }

/* Пояснения («How it works») — общий блок движка (.tool-explain), стили в assets/css/app.css. */

/* =====================================================================
   Адаптив
   ===================================================================== */
@media (max-width: 560px) {

    .cpubit__card { padding: 14px; }
    .cpubit__label { font-size: .74rem; }
    .cpubit__arch { font-size: 1rem; }
    .cpubit__note { font-size: .82rem; }

    .cpubit__chipwrap { margin: 4px 10px 8px; max-width: calc(100% - 20px); }
    .cpubit__chip { min-width: 0; width: 100%; padding: 1.1rem 1rem 1rem; }
    .cpubit__pins--top, .cpubit__pins--bottom { height: 5px; left: 12px; right: 12px; }
    .cpubit__pins--top { top: -5px; } .cpubit__pins--bottom { bottom: -5px; }
    .cpubit__pins--left, .cpubit__pins--right { width: 5px; top: 12px; bottom: 12px; }
    .cpubit__pins--left { left: -5px; } .cpubit__pins--right { right: -5px; }

    .cpubit__grid { grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }

    .cpubit__chain { gap: .4rem; }
    .cpubit__link { min-width: 0; flex: 1 1 0; padding: .45rem .4rem; }
    .cpubit__link-val { font-size: .95rem; }
    .cpubit__arrow { display: none; }
    .cpubit__grid .cpubit__card { padding: .7rem .8rem; }
    .cpubit__card-value { font-size: 1.1rem; margin-top: .3rem; }
}
