/*
 * ProChef Tools — оформлення.
 *
 * Мова взята з інтро: майже чорна сцена, два конуси прожекторів згори, мокра
 * підлога з кольоровими відблисками і чотири «стихії» з кадру — вогонь,
 * лайм, вода й полуниця. Кожен інструмент отримує свою стихію акцентом
 * (--accent), решта — від порталу ProChef: волосяні лінії замість рамок,
 * капсульні кнопки, білий текст як основний колір.
 */

@font-face {
    font-family: Unbounded;
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url('../fonts/unbounded-cyrillic-wght.woff2') format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: Unbounded;
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url('../fonts/unbounded-latin-ext-wght.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: Unbounded;
    font-style: normal;
    font-weight: 200 900;
    font-display: swap;
    src: url('../fonts/unbounded-latin-wght.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-cyrillic-wght.woff2') format('woff2-variations');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-latin-ext-wght.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-latin-wght.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Токени ─────────────────────────────────────────────────────────── */

:root {
    --bg: #050506;
    --bg-raised: #0b0c0f;
    --panel: rgba(255, 255, 255, .028);
    --panel-strong: rgba(255, 255, 255, .05);
    --line: rgba(244, 245, 247, .1);
    --line-strong: rgba(244, 245, 247, .2);
    --text: #f4f5f7;
    --muted: rgba(244, 245, 247, .62);
    --faint: rgba(244, 245, 247, .38);
    --gold: #c8a24c;

    /* Стихії з інтро. */
    --flame: #ff8a1f;
    --lime: #a6e22e;
    --water: #38bdf8;
    --berry: #ff2e55;
    --cheese: #ffd25a;

    --accent: var(--gold);
    --radius: 22px;
    --radius-sm: 14px;
    --shell: 1180px;
    --gutter: clamp(16px, 4vw, 32px);
    --font-display: Unbounded, "Segoe UI", system-ui, sans-serif;
    --font-body: Manrope, "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
    --ease: cubic-bezier(.22, .61, .36, 1);

    color-scheme: dark;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.55;
    font-feature-settings: "kern" 1, "liga" 1;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1,
h2,
h3 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.12;
    text-wrap: balance;
}

p {
    margin: 0;
}

a {
    color: inherit;
}

img,
svg,
video {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -100px;
    z-index: 100;
    padding: .6rem 1rem;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: 12px;
}

.site-utility-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.shell {
    width: 100%;
    max-width: calc(var(--shell) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* ── Сцена ──────────────────────────────────────────────────────────── */

.stage {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(120% 60% at 50% 0%, rgba(255, 244, 228, .045), transparent 60%),
        var(--bg);
}

/* Конус прожектора: вузький угорі, широкий унизу, розмитий — як світло в
   кадрі інтро. Робиться градієнтом із маскою-трапецією, без зображень. */
.stage__beam {
    position: absolute;
    top: -12vh;
    width: min(52vw, 640px);
    height: 92vh;
    background: linear-gradient(to bottom, rgba(255, 246, 232, .16), rgba(255, 246, 232, .04) 55%, transparent 85%);
    clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
    filter: blur(28px);
    opacity: .75;
}

.stage__beam--left {
    left: 4vw;
    transform: rotate(16deg);
    transform-origin: 50% 0;
}

.stage__beam--right {
    right: 2vw;
    transform: rotate(-22deg);
    transform-origin: 50% 0;
    opacity: .55;
}

/* Мокра підлога: кольорові відблиски стихій, розмиті й притиснуті до низу. */
.stage__floor {
    position: absolute;
    left: -10%;
    right: -10%;
    bottom: -14vh;
    height: 46vh;
    background:
        radial-gradient(18% 60% at 18% 50%, rgba(255, 46, 85, .2), transparent 70%),
        radial-gradient(16% 55% at 38% 55%, rgba(255, 138, 31, .2), transparent 70%),
        radial-gradient(16% 55% at 62% 55%, rgba(166, 226, 46, .14), transparent 70%),
        radial-gradient(18% 60% at 82% 50%, rgba(56, 189, 248, .18), transparent 70%);
    filter: blur(40px);
    opacity: .7;
}

/* ── Шапка ──────────────────────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid transparent;
    transition: background-color .3s ease, border-color .3s ease, backdrop-filter .3s ease;
}

.site-header.is-scrolled {
    background: rgba(5, 5, 6, .72);
    border-bottom-color: var(--line);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    backdrop-filter: blur(16px) saturate(140%);
}

.site-header__inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 68px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    text-decoration: none;
    flex: 0 0 auto;
}

.brand__mark {
    width: 34px;
    height: 34px;
}

.brand__text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.02rem;
    letter-spacing: -.01em;
}

.brand__tools {
    margin-left: .35em;
    color: var(--faint);
    font-weight: 400;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: auto;
}

.site-nav__link {
    position: relative;
    padding: .5rem .85rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s ease, background-color .2s ease;
}

.site-nav__link:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .05);
}

.site-nav__link.active {
    color: var(--text);
    background: rgba(255, 255, 255, .06);
}

.site-nav__link.active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 16px;
    height: 2px;
    margin-left: -8px;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* ── Меню мов ───────────────────────────────────────────────────────── */

.lang-menu {
    position: relative;
    flex: 0 0 auto;
}

.lang-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .75rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    list-style: none;
    transition: border-color .2s ease, color .2s ease;
}

.lang-menu__toggle::-webkit-details-marker {
    display: none;
}

.lang-menu__toggle:hover,
.lang-menu[open] .lang-menu__toggle {
    color: var(--text);
    border-color: var(--line-strong);
}

.lang-menu__toggle svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
}

.lang-menu__list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    width: min(380px, calc(100vw - 2 * var(--gutter)));
    margin: 0;
    padding: 8px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(13, 14, 17, .96);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .9);
}

.lang-menu__item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .65rem;
    border-radius: 10px;
    color: var(--muted);
    font-size: .9rem;
    text-decoration: none;
}

.lang-menu__item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .05);
}

.lang-menu__item.is-current {
    color: var(--text);
    background: rgba(200, 162, 76, .12);
}

.lang-menu__code {
    display: inline-block;
    min-width: 1.8rem;
    color: var(--faint);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
}

/* ── Основа ─────────────────────────────────────────────────────────── */

.site-main {
    flex: 1 0 auto;
    outline: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    color: var(--faint);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 26px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.tool-icon {
    width: 1.25em;
    height: 1.25em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

/* ── Головна ────────────────────────────────────────────────────────── */

.hero__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: clamp(.5rem, 2vh, 1.5rem);
    text-align: center;
}

.hero__scene {
    position: relative;
    width: min(900px, 100%);
}

/* Краї кадру розчиняються в тлі сторінки, як на порталі: ні рамки, ні тіні —
   будь-яка з них знову окреслила б прямокутник відео. */
.hero__video {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    -webkit-mask-image:
        linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%),
        linear-gradient(to bottom, transparent 0, #000 8%, #000 86%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to right, transparent 0, #000 4%, #000 96%, transparent 100%),
        linear-gradient(to bottom, transparent 0, #000 8%, #000 86%, transparent 100%);
    mask-composite: intersect;
}

.hero__replay {
    position: absolute;
    right: 9%;
    bottom: 14%;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(5, 5, 6, .55);
    color: var(--muted);
    cursor: pointer;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: color .2s ease, border-color .2s ease;
}

.hero__replay:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.hero__replay[hidden] {
    display: none;
}

.hero .eyebrow {
    margin-top: clamp(.5rem, 2vh, 1.25rem);
}

.hero__title {
    max-width: 18ch;
    margin-top: .9rem;
    font-size: clamp(2rem, 5.2vw, 3.9rem);
    background: linear-gradient(180deg, #ffffff 30%, rgba(244, 245, 247, .62));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero__lead {
    max-width: 46rem;
    margin-top: 1.1rem;
    color: var(--muted);
    font-size: clamp(1rem, 1.5vw, 1.15rem);
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: clamp(2.2rem, 6vh, 4rem);
}

.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .7rem;
    min-height: 250px;
    padding: 1.5rem 1.4rem 1.3rem;
    overflow: hidden;
    isolation: isolate;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .012));
    text-decoration: none;
    transition: transform .35s var(--ease), border-color .35s ease, box-shadow .35s ease;
}

/* Відблиск стихії: невидимий у спокої, розгорається з-під картки на наведенні. */
.tool-card__glow {
    position: absolute;
    inset: auto -30% -60% -30%;
    z-index: -1;
    height: 85%;
    background: radial-gradient(50% 50% at 50% 50%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%);
    opacity: .16;
    filter: blur(24px);
    transition: opacity .45s ease, transform .45s var(--ease);
}

.tool-card__icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: 1.3rem;
}

.tool-card__title {
    margin-top: .4rem;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.tool-card__text {
    color: var(--muted);
    font-size: .93rem;
}

.tool-card__cta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: auto;
    padding-top: .6rem;
    color: var(--accent);
    font-size: .88rem;
    font-weight: 600;
}

.tool-card__cta .tool-icon {
    transition: transform .3s var(--ease);
}

.tool-card:hover {
    transform: translateY(-4px);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 28px 60px -34px color-mix(in srgb, var(--accent) 80%, transparent);
}

.tool-card:hover .tool-card__glow {
    opacity: .55;
    transform: translateY(-12%);
}

.tool-card:hover .tool-card__cta .tool-icon {
    transform: translateX(4px);
}

.principles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.25rem, 3vw, 2.5rem);
    margin-top: clamp(3rem, 8vh, 5rem);
    padding-top: clamp(2rem, 5vh, 3rem);
    border-top: 1px solid var(--line);
}

.principle .tool-icon {
    width: 26px;
    height: 26px;
    color: var(--gold);
}

.principle h2 {
    margin-top: .9rem;
    font-size: 1rem;
}

.principle p {
    margin-top: .45rem;
    color: var(--muted);
    font-size: .93rem;
}

/* ── Сторінки інструментів ──────────────────────────────────────────── */

.tool-page {
    padding-top: clamp(1.5rem, 5vh, 3rem);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1.1rem;
}

.tool-header__icon {
    display: inline-grid;
    place-items: center;
    width: 56px;
    height: 56px;
    flex: 0 0 auto;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    box-shadow: 0 0 40px -10px color-mix(in srgb, var(--accent) 70%, transparent);
    color: var(--accent);
    font-size: 1.5rem;
}

.tool-header__title {
    font-size: clamp(1.6rem, 3.6vw, 2.5rem);
}

.tool-header__lead {
    margin-top: .35rem;
    color: var(--muted);
}

.workbench {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    margin-top: clamp(1.5rem, 4vh, 2.25rem);
}

.panel {
    position: relative;
    padding: clamp(1.1rem, 2.5vw, 1.6rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .015));
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.panel--output {
    position: sticky;
    top: 84px;
}

.panel--controls {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.panel__note {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    margin-top: 1.1rem;
    color: var(--faint);
    font-size: .84rem;
}

.panel__note .tool-icon {
    margin-top: .1rem;
    color: var(--accent);
}

.panel__action {
    align-self: stretch;
    margin-top: .25rem;
}

/* Поле з секретом: велике, моноширинне, переноситься по символах. */
.secret {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: 1.1rem 1.1rem 1.1rem 1.3rem;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .45);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .02), 0 20px 50px -30px color-mix(in srgb, var(--accent) 60%, transparent);
}

.secret__value {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 1.5em;
    font-family: var(--font-mono);
    font-size: clamp(1.15rem, 2.3vw, 1.55rem);
    line-height: 1.45;
    letter-spacing: .02em;
    overflow-wrap: anywhere;
    word-break: break-all;
    user-select: all;
}

.secret--token .secret__value {
    font-size: clamp(.98rem, 1.8vw, 1.2rem);
}

.secret__value.is-empty {
    color: var(--faint);
    font-family: var(--font-body);
    font-size: 1rem;
    user-select: none;
}

.ch-digit {
    color: var(--lime);
}

.ch-symbol {
    color: var(--flame);
}

.secret__actions {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    flex: 0 0 auto;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    cursor: pointer;
    font-size: 1.05rem;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease, transform .15s ease;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, .06);
}

.icon-btn:active {
    transform: scale(.94);
}

.icon-btn.is-done {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.icon-btn--small {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: .9rem;
}

/* Індикатор стійкості: колір рівня, а не плавний градієнт — рівнів п'ять. */
.meter {
    --level-color: var(--berry);
    margin-top: 1.1rem;
}

.meter[data-level="1"] { --level-color: #ff5a3d; }
.meter[data-level="2"] { --level-color: var(--cheese); }
.meter[data-level="3"] { --level-color: var(--lime); }
.meter[data-level="4"] { --level-color: #34d399; }

.meter__track {
    height: 6px;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(255, 255, 255, .07);
}

.meter__fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--level-color);
    box-shadow: 0 0 14px var(--level-color);
    transition: width .35s var(--ease), background-color .35s ease;
}

.meter__meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-top: .6rem;
    color: var(--muted);
    font-size: .88rem;
}

.meter__meta strong {
    color: var(--text);
}

.meter strong[data-meter-label] {
    color: var(--level-color);
}

.meter__caption {
    color: var(--faint);
}

.secret-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 340px;
    margin: 1.1rem 0 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    counter-reset: secrets 1;
}

.secret-list li {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .5rem .45rem .8rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, .3);
    counter-increment: secrets;
}

.secret-list li::before {
    content: counter(secrets);
    min-width: 1.4rem;
    color: var(--faint);
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
}

.secret-list code {
    flex: 1 1 auto;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: .92rem;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem 2rem;
    margin: 1.1rem 0 0;
}

.facts div:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.facts dt {
    color: var(--faint);
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.facts dd {
    margin: 0;
    color: var(--muted);
}

.facts dd strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Елементи форми ─────────────────────────────────────────────────── */

.controls-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.controls-group[hidden],
.field[hidden],
.switch[hidden] {
    display: none;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    min-width: 0;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
}

.field__label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}

.field__value {
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .95rem;
    font-variant-numeric: tabular-nums;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="tel"],
.field input[type="email"],
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: .7rem .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
    color: var(--text);
    font-size: 1rem;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field textarea {
    resize: vertical;
    min-height: 96px;
}

.field select {
    appearance: none;
    padding-right: 2.4rem;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    cursor: pointer;
}

.field select option {
    background: var(--bg-raised);
    color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--accent) 70%, transparent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--faint);
}

.field--color input[type="color"] {
    width: 100%;
    height: 46px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, .35);
    cursor: pointer;
}

/* Повзунок: доріжка з заповненням кольором інструмента. */
input[type="range"] {
    width: 100%;
    height: 28px;
    margin: 0;
    background: transparent;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Чіпи наборів символів і сегментований перемикач — сховані нативні поля
   з підписом, що реагує на :checked. Клавіатура й диктор працюють як з
   звичайними checkbox/radio. */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.chips legend {
    width: 100%;
    margin-bottom: .45rem;
    padding: 0;
}

.chip,
.segmented label,
.tab {
    position: relative;
    cursor: pointer;
}

.chip input,
.segmented input,
.tab input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip > span[aria-hidden="true"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    height: 42px;
    padding: 0 .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(0, 0, 0, .3);
    color: var(--faint);
    font-family: var(--font-mono);
    font-weight: 600;
    transition: all .2s ease;
}

.chip input:checked + span {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}

.chip input:focus-visible + span,
.segmented input:focus-visible + span,
.tab input:focus-visible + span,
.switch input:focus-visible + .switch__track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(0, 0, 0, .35);
}

.segmented span {
    display: block;
    padding: .55rem .9rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    transition: all .25s var(--ease);
}

.segmented input:checked + span {
    color: var(--bg);
    background: var(--text);
    box-shadow: 0 6px 18px -8px rgba(255, 255, 255, .5);
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.tab span {
    display: inline-block;
    padding: .5rem .95rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 600;
    transition: all .2s ease;
}

.tab:hover span {
    color: var(--text);
}

.tab input:checked + span {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.switch {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
    font-size: .93rem;
    cursor: pointer;
}

.switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.switch__track {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .4);
    transition: background-color .25s ease, border-color .25s ease;
}

.switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--faint);
    transition: transform .25s var(--ease), background-color .25s ease;
}

.switch input:checked + .switch__track {
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.switch input:checked + .switch__track::after {
    transform: translateX(18px);
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.switch input:checked ~ span:last-child {
    color: var(--text);
}

.presets {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.presets legend {
    width: 100%;
    margin-bottom: .45rem;
    padding: 0;
}

.preset {
    padding: .45rem .85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.preset:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.preset.is-active {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.disclosure {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.disclosure summary {
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.disclosure summary::-webkit-details-marker {
    display: none;
}

.disclosure summary::after {
    content: "+";
    float: right;
    color: var(--faint);
}

.disclosure[open] summary::after {
    content: "−";
}

.disclosure[open] summary {
    margin-bottom: 1rem;
}

/* Капсульна кнопка порталу (біле на чорному). */
.pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .75rem 1.4rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, transform .2s var(--ease);
}

.pill-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, .07);
    border-color: rgba(244, 245, 247, .4);
    transform: translateY(-1px);
}

.pill-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.1rem;
}

.liquid-button.theme-dark {
    width: 100%;
    font-family: var(--font-body);
}

/* ── QR ─────────────────────────────────────────────────────────────── */

.qr-preview {
    position: relative;
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .35);
}

.qr-preview.is-transparent {
    background-color: #1a1b1f;
    background-image:
        linear-gradient(45deg, #26272c 25%, transparent 25%),
        linear-gradient(-45deg, #26272c 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #26272c 75%),
        linear-gradient(-45deg, transparent 75%, #26272c 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.qr-preview__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    image-rendering: pixelated;
    box-shadow: 0 30px 70px -40px color-mix(in srgb, var(--accent) 80%, transparent);
    transition: opacity .2s ease;
}

.qr-preview[data-busy] .qr-preview__image {
    opacity: .55;
}

.qr-preview__message {
    max-width: 24ch;
    color: var(--faint);
    text-align: center;
}

.qr-preview[data-state="error"] .qr-preview__message {
    color: #ff8fa3;
}

.qr-warning {
    margin-top: .8rem;
    color: var(--cheese);
    font-size: .88rem;
    text-align: center;
}

.workbench--qr .button-row {
    justify-content: center;
}

/* ── Тест швидкості ─────────────────────────────────────────────────── */

.speed {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
        "gauge metrics"
        "gauge facts"
        "action action";
    gap: 16px 28px;
    align-items: center;
    margin-top: clamp(1.5rem, 4vh, 2.25rem);
    padding: clamp(1.25rem, 3vw, 2.25rem);
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 6px);
    background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .01));
}

.gauge {
    grid-area: gauge;
    position: relative;
    width: min(100%, 420px);
    margin: 0 auto;
    aspect-ratio: 1;
}

.gauge__svg {
    width: 100%;
    height: 100%;
}

.gauge__track,
.gauge__value {
    fill: none;
    stroke-width: 14;
    stroke-linecap: round;
}

.gauge__track {
    stroke: rgba(255, 255, 255, .07);
}

.gauge__value {
    stroke: url(#gauge-heat);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    filter: drop-shadow(0 0 8px rgba(255, 46, 85, .45));
    transition: stroke-dashoffset .35s var(--ease);
}

.gauge__ticks text {
    fill: var(--faint);
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    text-anchor: middle;
}

.gauge__readout {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 6%;
    text-align: center;
}

.gauge__phase {
    min-height: 1.4em;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
}

.gauge__number {
    font-family: var(--font-display);
    font-size: clamp(2.1rem, 5.4vw, 3.3rem);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.03em;
    line-height: 1.05;
}

.gauge__unit {
    color: var(--faint);
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .06em;
}

.speed[data-phase="ping"] .gauge__phase,
.speed[data-phase="download"] .gauge__phase,
.speed[data-phase="upload"] .gauge__phase {
    color: var(--accent);
}

.speed[data-phase="error"] .gauge__phase,
.speed[data-phase="limited"] .gauge__phase {
    color: #ff8fa3;
}

.speed__action {
    grid-area: action;
    display: flex;
    justify-content: center;
}

.speed__action .liquid-button {
    width: min(100%, 320px);
}

.metrics {
    grid-area: metrics;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, .3);
    transition: border-color .3s ease, box-shadow .3s ease;
}

.metric__label {
    color: var(--faint);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.metric__value strong {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.metric__value small {
    color: var(--faint);
    font-size: .8rem;
}

.metric.is-done {
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.metric--down.is-done {
    box-shadow: 0 18px 40px -28px var(--water);
    border-color: color-mix(in srgb, var(--water) 45%, transparent);
}

.metric--up.is-done {
    box-shadow: 0 18px 40px -28px var(--flame);
    border-color: color-mix(in srgb, var(--flame) 45%, transparent);
}

.facts--speed {
    grid-area: facts;
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.facts--speed dd {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.facts--speed [data-info-row="server"] dd {
    color: var(--water);
    font-weight: 700;
}

/* ── Поради, статус, підвал ─────────────────────────────────────────── */

.tips {
    margin-top: clamp(2rem, 6vh, 3.5rem);
    padding-top: clamp(1.5rem, 4vh, 2rem);
    border-top: 1px solid var(--line);
}

.tips__title {
    font-size: 1.05rem;
}

.tips ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 2rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.tips li {
    position: relative;
    padding-left: 1.1rem;
    color: var(--muted);
    font-size: .93rem;
}

.tips li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .62em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.status-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-top: clamp(4rem, 14vh, 9rem);
    text-align: center;
}

.status-page__code {
    font-family: var(--font-display);
    font-size: clamp(4rem, 14vw, 8rem);
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(120deg, var(--berry), var(--flame) 45%, var(--cheese));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.status-page h1 {
    font-size: clamp(1.4rem, 3vw, 2rem);
}

.status-page__text,
.status-page__trace {
    max-width: 40rem;
    color: var(--muted);
}

.status-page__trace code {
    font-family: var(--font-mono);
    font-size: .85rem;
}

.site-footer {
    margin-top: clamp(3rem, 10vh, 6rem);
    border-top: 1px solid var(--line);
}

.site-footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 2rem;
    padding-top: 1.4rem;
    padding-bottom: calc(1.6rem + env(safe-area-inset-bottom));
    color: var(--faint);
    font-size: .85rem;
}

.site-footer__note {
    max-width: 52rem;
}

.site-footer__meta {
    display: flex;
    gap: .5rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 50;
    padding: .7rem 1.2rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(13, 14, 17, .94);
    color: var(--text);
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity .25s ease, transform .3s var(--ease);
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ── Вужчі екрани ───────────────────────────────────────────────────── */

@media (max-width: 1080px) {
    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .speed {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "gauge"
            "action"
            "metrics"
            "facts";
    }
}

@media (max-width: 860px) {
    .workbench {
        grid-template-columns: minmax(0, 1fr);
    }

    .panel--output {
        position: static;
    }

    .tips ul,
    .principles {
        grid-template-columns: minmax(0, 1fr);
    }

    /* На вузькому екрані навігація переходить у власний рядок під логотипом
       і гортається вбік — чотири пункти завжди на виду, без «бургера». */
    .site-header__inner {
        flex-wrap: wrap;
        row-gap: 0;
        min-height: 0;
        padding-top: .6rem;
    }

    .lang-menu {
        margin-left: auto;
    }

    .site-nav {
        order: 3;
        width: calc(100% + 2 * var(--gutter));
        margin: .35rem calc(-1 * var(--gutter)) 0;
        padding: 0 var(--gutter) .55rem;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .site-nav::-webkit-scrollbar {
        display: none;
    }

    .site-nav__link {
        padding: .45rem .7rem;
        font-size: .88rem;
    }
}

@media (max-width: 560px) {
    .tools-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .tool-card {
        min-height: 0;
    }

    .field-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .tool-header {
        align-items: flex-start;
    }

    .tool-header__icon {
        width: 46px;
        height: 46px;
        border-radius: 13px;
        font-size: 1.25rem;
    }

    .hero__replay {
        right: 4%;
        bottom: 8%;
    }

    .metric__value strong {
        font-size: 1.3rem;
    }

    .lang-menu__list {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
