:root{
    --bg:#f7f8fa;
    --panel:#ffffff;
    --text:#111827;
    --muted:#6b7280;
    --hint:#9ca3af;
    --border:#e5e7eb;
    --accent:#2563eb;

    --radius:18px;
    --shadow:0 20px 50px rgba(0,0,0,.08);
    --maxw:980px;
    --pad: clamp(22px, 3.2vw, 38px);
    --control-h: 62px;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
    margin:0;
    font-family:"Mulish",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
    background:var(--bg);
    color:var(--text);
}

.screen{
    display:flex;
    flex-direction:column;
    min-height: 100vh;
}

header{
    position: static;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.header-inner{
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 10px clamp(16px, 4vw, 48px);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 14px;
}

.header-centered{
    justify-content: center;
}

.brand-centered{
    justify-content: center;
    gap: 10px;
}

.brand-title{
    font-size: 16px;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.brand-domain{
    font-size: 12px;
    font-weight: 900;
    color: var(--muted);
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    line-height: 1;
}

.brand{
    display:flex;
    align-items:center;
    gap: 10px;
    text-decoration:none;
    color: inherit;
    font-weight: 900;
    letter-spacing: -0.01em;
}

.logo{
    width: 34px;
    height: 34px;
    border-radius: 10px;

    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid var(--border);

    display:grid;
    place-items:center;

    box-shadow:
            0 1px 2px rgba(0,0,0,.04),
            inset 0 1px 0 rgba(255,255,255,.6);
}

.logo-emoji{
    font-size: 18px;
    line-height: 1;
    transform: translateY(1px); /* визуально центрируем */
}

.brand:hover .logo{
    box-shadow:
            0 4px 10px rgba(0,0,0,.08),
            inset 0 1px 0 rgba(255,255,255,.7);
}

#googleOverlay > div,
#googleOverlay iframe{
    border-radius: 999px !important;
}

main{
    flex: 1 0 auto;
    width: 100%;
    overflow: visible;
    display:grid;
    place-items:center;
    padding: 12px clamp(16px,4vw,48px) 28px;
}

.container{ width:100%; max-width:var(--maxw); }

.hero{ margin: 0 0 14px; }
.hero h1{
    margin: 0;
    font-size: clamp(26px, 4.2vw, 44px);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.02;
}
.hero p{
    margin: 10px 0 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--muted);
    line-height: 1.35;
}

.card{
    background: var(--panel);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--pad);
    display:grid;
    gap: 22px;
}

/* ===== 404 message card (new) ===== */
.notice{
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #fff;
    padding: 16px 16px;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap: 14px;
    margin-bottom: 26px;
}

.notice-left{
    display:flex;
    gap: 12px;
    align-items:flex-start;
    min-width: 0;
}

.notice-icon{
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display:grid;
    place-items:center;
    background: #f8fafc;
    border: 1px solid var(--border);
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
}

.notice-title{
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.05;
}

.notice-text{
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}

.view-badge{
    display:inline-flex;
    align-items:center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.view-badge .dot{
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--accent);
}

.row{
    display:grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items:start;
}

.row.full{
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
}

/* first row layout */
.row.first{
    grid-template-columns: 260px 1fr 1fr;
    align-items:start;
}
.row.first.months{
    grid-template-columns: 260px 1fr;
}
.row.first.months #currentAgeWrap{ display:none; }
.row.first.months #goalLabel{ grid-column: 2 / -1; }

label{
    display:grid;
    gap: 8px;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

input, select{
    font: inherit;
    font-size: 20px;
    height: var(--control-h);
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    outline: none;
    line-height: 1;
}

input::placeholder{ color: var(--hint); }

input:focus, select:focus{
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.hidden{ display:none !important; }

.divider{ height: 1px; background: var(--border); }

.inline{
    display:flex;
    align-items:center;
    gap: 12px;
    font-size: 18px;
}

.inline input[type="checkbox"]{
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    padding: 0;
    border-radius: 6px;
    border: 0;
    box-shadow: none;
}

.toggle{
    height: var(--control-h);
    display:grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow:hidden;
    background: #f3f4f6;
}
.toggle button{
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display:flex;
    align-items:center;
    justify-content:center;
    font-family: inherit;
    font-size: 18px;
    font-weight: 800;
    color: var(--muted);
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
    user-select:none;
    -webkit-tap-highlight-color: transparent;
    height: 100%;
}
.toggle button + button{ border-left: 1px solid var(--border); }
.toggle button.active{
    background: #fff;
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}

.result{
    font-size: 22px;
    font-weight: 900;
    padding: 18px;
    border-radius: 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.error{
    color:#dc2626;
    font-weight: 800;
    font-size: 16px;
    margin: 0;
    display: none;
}
.error:not(:empty){
    display:block;
    margin-top: 10px;
}

.shareRow{
    display:flex;
    gap: 14px;
    align-items:center;
    flex-wrap: wrap;
}

/* NEW: right area takes all free space and pushes visits to the far right */
.shareRowRight{
    flex: 1 1 auto;
    display:flex;
    align-items:center;
    gap: 14px;
    min-width: 240px;
}

/* “пружина” между блоками */
.shareLeft{ flex: 1 1 auto; display:flex; }
.shareRight{ flex: 0 0 auto; display:flex; justify-content:flex-end; }

/* чтобы shareSuccess не растягивался без нужды */
.shareLeft #shareSuccess{ flex: 0 1 auto; }

/* чтобы ссылка+copy не растягивались на всю ширину без нужды */
#shareSuccess{
    flex: 0 1 auto;
}

.shareRow button{
    font: inherit;
    font-size: 18px;
    font-weight: 900;
    padding: 14px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
}
.shareRow button:disabled{ cursor:not-allowed; opacity:.55; }

/* ===== Share success UI ===== */
.shareSuccess{
    display:flex;
    align-items:stretch;
    gap:12px;
    flex-wrap:wrap;
}

.shareLink{
    min-height: calc(12px + 12px + 18px);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    display:inline-flex;
    align-items:center;
    max-width: 100%;
    padding: 12px 18px;
    border-radius: 999px;
    background: #f8fafc;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.02);
    user-select: text;
    -webkit-user-select: text;
}

.copyBtn{
    min-height: calc(12px + 12px + 18px);
    font: inherit;
    font-size: 16px;
    font-weight: 900;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    display:inline-flex;
    align-items:center;
    gap: 10px;
    line-height: 1;
    transition: box-shadow .15s ease, transform .08s ease, border-color .15s ease;
}
.copyBtn:active{ transform: translateY(1px); }
.copyBtn:hover{
    border-color: rgba(17,24,39,.22);
    box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.copyBtn .icon{
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

/* ===== FIXED: lock all fields (real lock, not just pointer-events) ===== */
body.locked input:not(#copyBtn):not(#shareBtn),
body.locked select{
    opacity:.65;
    background:#f3f4f6;
}
body.locked label{ cursor: default; }
body.locked .toggle{ opacity:.75; }

footer{
    padding: 26px clamp(16px,4vw,48px) 34px;
    background: transparent;
}

.footer-inner{
    max-width: var(--maxw);
    margin: 0 auto;
    border-top: 1px solid var(--border);
    padding-top: 16px;
    display:grid;
    gap: 14px;
}

.disclaimer{
    color: #7b8494;
    font-size: 13px;
    line-height: 1.55;
    font-weight: 600;
    max-width: 920px;
}

.disclaimer strong{
    display:block;
    color: #6b7280;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 6px;
}

/* Cookie consent */
.cookie{
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 40;
    display: block;
}

.cookie-inner{
    max-width: var(--maxw);
    margin: 0 auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 18px 36px rgba(0, 0, 0, .12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
}

.cookie-text{
    min-width: 0;
}

.cookie-text strong{
    display: block;
    font-size: 15px;
    font-weight: 900;
    margin-bottom: 4px;
}

.cookie-text span{
    display: block;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
}

.cookie-actions{
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.cookie-btn{
    appearance: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 999px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    padding: 10px 14px;
    cursor: pointer;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.cookie-btn:hover{
    border-color: rgba(17,24,39,.25);
    box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.cookie-btn.primary{
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.cookie-btn.ghost{
    background: #fff;
}

@media (max-width: 900px){
    .row{ grid-template-columns: 1fr; }
    .row.full{ grid-template-columns: 1fr; }
    .row.first{ grid-template-columns: 1fr; }
    .row.first.months{ grid-template-columns: 1fr; }
    .row.first.months #goalLabel{ grid-column: auto; }

    .hero h1{ font-size: 42px; }
    .hero p{ font-size: 16px; }

    .shareRow{ flex-direction: column; align-items: stretch; }
    .shareRow button{ width: 100%; }

    .shareRowRight{
        width:100%;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .shareRight{
        justify-content: flex-end;
    }

    .shareRight .view-badge{
        align-self: flex-end;
    }

    /* бейдж пусть будет справа, но не ломает сетку */
    .view-badge{ margin-left:auto; }

    .shareSuccess{ width:100%; }
    .shareLink{ width:100%; }
    .copyBtn{ width:100%; justify-content:center; }

    .brand-domain{ display:none; }
    .disclaimer{ font-size: 12.5px; }

    .cookie{
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .cookie-inner{
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-actions{
        width: 100%;
    }

    .cookie-btn{
        flex: 1 1 0;
        text-align: center;
    }
}

@media (max-width: 680px){
    body{
        font-size: 14px;
    }

    .hero h1{
        font-size: clamp(21px, 7.8vw, 30px);
    }

    .hero p{
        font-size: 13px;
    }

    label{
        font-size: 14px;
    }

    input, select{
        font-size: 16px;
    }

    .inline{
        font-size: 14px;
    }

    .result{
        font-size: 16px;
        padding: 14px;
    }

    .shareRow button{
        font-size: 14px;
        padding: 12px 16px;
    }

    .shareLink{
        font-size: 13px;
    }

    .copyBtn{
        font-size: 13px;
    }
}
