/* AcroGym.tech — SportTech design system */
:root {
    color-scheme: light;
    --ag-navy: #0b1320;
    --ag-navy-2: #14233a;
    --ag-blue: #1677f9;
    --ag-blue-hover: #075ed7;
    --ag-blue-soft: #eaf3ff;
    --ag-blue-bright: #36a0ff;
    --ag-ink: #0b1730;
    --ag-ink-soft: #142747;
    --ag-muted: #62728a;
    --ag-border: #e3eaf3;
    --ag-line: #e1eaf5;
    --ag-surface: #ffffff;
    --ag-page: #f4f8fd;
    --ag-radius: 16px;
    --ag-shadow: 0 10px 30px rgba(16, 39, 73, .07);
    --bs-primary: var(--ag-blue);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    padding-top: 76px;
    color: var(--ag-ink);
    background: var(--ag-page);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
tbody { background-color: #fff !important; }
::selection { color: #fff; background: var(--ag-blue); }
a { color: var(--ag-blue); text-decoration: none; }
a:hover { color: var(--ag-blue-hover); }

/* Bootstrap gutter override for main containers */
main, .container { --bs-gutter-x: 1.5rem; }

/* Header / brand */
.navbar-glass {
    min-height: 68px;
    padding: .55rem 0;
    background: rgba(255,255,255,.9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(20, 45, 78, .08);
    box-shadow: 0 4px 24px rgba(14, 32, 58, .045);
}
.navbar-glass > .container { gap: 1.25rem; }
.navbar-brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    margin-right: 1.25rem;
    padding: .2rem 0;
    color: var(--ag-navy) !important;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.055em;
    white-space: nowrap;
}
.brand-mark { display: inline-flex; width: 38px; flex: 0 0 38px; }
.brand-mark svg { display: block; width: 100%; height: 100%; }
.brand-mark-a { fill: var(--ag-blue); }
.brand-mark-g { fill: var(--ag-navy); }
.brand-mark-dot { fill: var(--ag-blue); }
.brand-word { color: var(--ag-navy); font-weight: 800; letter-spacing: -.055em; }
.brand-word > span { color: var(--ag-blue); }
.navbar-glass .navbar-nav { align-items: center; gap: .15rem; }
.navbar-glass .nav-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    margin: 0 .08rem;
    padding: .55rem .7rem;
    border-radius: 12px;
    color: #52627a;
    line-height: 1;
    transition: color .18s ease, background .18s ease, transform .18s ease;
}
.navbar-glass .nav-icon .bi { font-size: 1.15rem; }
.navbar-glass .nav-icon:hover { color: var(--ag-blue) !important; background: var(--ag-blue-soft); }
.navbar-glass .nav-icon:active { transform: scale(.96); }
.navbar-glass .nav-icon.active { color: var(--ag-blue); background: var(--ag-blue-soft); }
.navbar-glass .nav-icon.active::after { content: none; }
.navbar-glass .navbar-nav-admin { margin-left: .55rem; padding-left: .65rem; border-left: 1px solid var(--ag-border); }
.navbar-toggler { border: 1px solid var(--ag-border); border-radius: 12px; padding: .45rem .6rem; box-shadow: none !important; }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(22,119,249,.14) !important; }

/* Content rhythm */
.site-main { min-height: calc(100vh - 76px); padding-top: 1.8rem; padding-bottom: 3rem; }
.site-main > .row:first-child { margin-top: .25rem; }
h1, h2, h3, h4, h5, h6 { color: var(--ag-navy); font-weight: 750; letter-spacing: -.035em; line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.45rem, 2.4vw, 2rem); }
.text-muted, .form-text { color: var(--ag-muted) !important; }
hr { border-color: var(--ag-border); opacity: 1; }

/* Cards and content panels */
.card, .modal-content, .dropdown-menu {
    border: 1px solid var(--ag-border);
    border-radius: var(--ag-radius);
    background: var(--ag-surface);
    box-shadow: var(--ag-shadow);
}
.card { overflow: hidden; }
.card-header {
    padding: 1.15rem 1.35rem .85rem;
    color: var(--ag-ink);
    font-weight: 700;
    background: transparent;
    border-bottom: 1px solid var(--ag-border);
}
.card-body { padding: 1.35rem; }
.card-footer { padding: 1rem 1.35rem; background: #fbfcfe; border-top: 1px solid var(--ag-border); }

/* Buttons */
.btn {
    min-height: 40px;
    padding: .58rem 1.05rem;
    border-radius: 10px;
    font-weight: 650;
    letter-spacing: -.01em;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: #fff; background: var(--ag-blue); border-color: var(--ag-blue); box-shadow: 0 5px 14px rgba(22,119,249,.16); }
.btn-primary:hover, .btn-primary:focus { color: #fff; background: var(--ag-blue-hover); border-color: var(--ag-blue-hover); }
.btn-outline-primary { color: var(--ag-blue); border: 1px solid #b8d5ff; }
.btn-outline-primary:hover { color: #fff; background: var(--ag-blue); border-color: var(--ag-blue); }
.btn-light { color: var(--ag-ink); background: #f3f6fb; border: 1px solid var(--ag-border); }

/* Forms */
.form-label { margin-bottom: .4rem; color: #34445c; font-size: .92rem; font-weight: 650; }
.form-control, .form-select {
    min-height: 43px;
    padding: .6rem .8rem;
    color: var(--ag-ink);
    background-color: #fff;
    border: 1px solid #d9e2ee;
    border-radius: 10px;
}
.form-control::placeholder { color: #9aa7b8; }
.form-control:focus, .form-select:focus {
    color: var(--ag-ink);
    border-color: #78b0ff;
    box-shadow: 0 0 0 .22rem rgba(22,119,249,.12);
}
.form-check-input:checked { background-color: var(--ag-blue); border-color: var(--ag-blue); }

/* Homepage hero compatibility */
.hero-section {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
    color: #fff;
    background: radial-gradient(circle at 80% 20%, rgba(22,119,249,.3), transparent 35%), linear-gradient(130deg, #07111f 0%, #122642 100%);
    border: 1px solid rgba(117,166,231,.18);
    border-radius: 22px;
    margin-bottom: 2rem;
    box-shadow: 0 18px 42px rgba(8, 22, 42, .14);
}
.hero-section h1, .hero-section h2, .hero-section h3 { color: #fff; }
.hero-title { max-width: 780px; font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 800; letter-spacing: -.05em; line-height: 1.1; }
.hero-section .text-muted { color: #c2cee0 !important; }

/* Auth */
.auth-container { max-width: 470px; margin: 2rem auto; }
.auth-card { overflow: hidden; border-radius: 18px; }
.auth-card .card-body { padding: clamp(1.4rem, 4vw, 2.2rem); }

/* Element gallery */
.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 14px;
    padding: 14px;
    background: #eef3f9;
    border: 1px solid var(--ag-border);
    border-radius: 14px;
}
.element-card {
    min-width: 0;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    background: #fff;
    border: 1px solid #e2e9f2;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(15,35,65,.035);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.element-card:hover { transform: translateY(-2px); border-color: #a9ceff; box-shadow: 0 8px 18px rgba(20,70,130,.09); }
.element-card.selected { background: #eef6ff; border-color: var(--ag-blue); box-shadow: 0 0 0 3px rgba(22,119,249,.12); }
.element-card img { display: block; width: 100%; height: 105px; object-fit: contain; margin-bottom: 9px; background: #f8faff; border-radius: 8px; }
.element-card .code { margin-bottom: 4px; color: var(--ag-blue); font-size: .75rem; font-weight: 800; }
.element-card .name { color: var(--ag-ink); font-size: .9rem; font-weight: 700; line-height: 1.35; }
.element-card .cost { margin-top: 4px; color: var(--ag-muted); font-size: .75rem; overflow-wrap: anywhere; }

/* Alerts / toast */
.alert { border: 1px solid transparent; border-radius: 12px; }
#toastContainer .toast {
    overflow: hidden;
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 13px;
    box-shadow: 0 12px 35px rgba(8,20,40,.18);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
#toastContainer .toast.bg-success { background: rgba(20,135,90,.94) !important; }
#toastContainer .toast.bg-danger { background: rgba(194,48,65,.95) !important; }
#toastContainer .toast.bg-warning { color: #212529 !important; background: rgba(255,193,7,.96) !important; }
#toastContainer .toast.bg-info { color: #fff !important; background: rgba(22,119,249,.95) !important; }

/* Mobile menu */
.offcanvas { color: var(--ag-ink); background: #fff; border: 0; transition: transform .3s ease-in-out, visibility .3s ease-in-out; }
.offcanvas-header { padding: 1.25rem 1.25rem .8rem; border-bottom: 1px solid var(--ag-border); }
.offcanvas-body { padding: 1rem 1.1rem; }
.offcanvas .nav-link { padding: .8rem .9rem; color: #40516a; font-weight: 600; border-radius: 10px; }
.offcanvas .nav-link:hover, .offcanvas .nav-link:focus { color: var(--ag-blue) !important; background: var(--ag-blue-soft); }
.nav-link { transition: color .18s ease, background-color .18s ease; }

/* Motion */
.slide-left, .slide-right, .animate-on-scroll { opacity: 0; transition: opacity .65s ease, transform .65s ease; }
.slide-left { transform: translateX(-28px); }
.slide-right { transform: translateX(28px); }
.animate-on-scroll { transform: translateY(22px); }
.slide-left.visible, .slide-right.visible, .animate-on-scroll.visible { opacity: 1; transform: translate(0, 0); }
.ratio video { background: #edf2f8; border-radius: 12px; }
#editorSvg .part { cursor: grab; }
#editorSvg .part:active { cursor: grabbing; }
#editorSvg .part.selected { filter: drop-shadow(0 0 3px #ff8a3d); }

/* Footer */
.footer { margin-top: 3rem; padding: 1.5rem 0; color: var(--ag-muted); border-top: 1px solid var(--ag-border); }

/* Optional dark theme: add data-theme="dark" to body */
body[data-theme="dark"] {
    color-scheme: dark;
    --ag-ink: #e7eef8;
    --ag-muted: #a4b2c7;
    --ag-border: #25354b;
    --ag-surface: #111e30;
    --ag-page: #08111e;
    --ag-blue-soft: #122e51;
    --ag-shadow: 0 12px 32px rgba(0,0,0,.2);
    background: var(--ag-page);
}
body[data-theme="dark"] .navbar-glass { background: rgba(8,17,30,.9); border-bottom-color: #26364c; }
body[data-theme="dark"] .brand-word, body[data-theme="dark"] .navbar-brand, body[data-theme="dark"] h1, body[data-theme="dark"] h2, body[data-theme="dark"] h3, body[data-theme="dark"] h4, body[data-theme="dark"] h5, body[data-theme="dark"] h6 { color: #f4f7fc; }
body[data-theme="dark"] .brand-mark-g { fill: #f4f7fc; }
body[data-theme="dark"] .navbar-glass .nav-icon { color: #b4c2d7; }
body[data-theme="dark"] .card, body[data-theme="dark"] .modal-content, body[data-theme="dark"] .dropdown-menu { color: var(--ag-ink); background: var(--ag-surface); border-color: var(--ag-border); }
body[data-theme="dark"] .card-footer { background: #0d1929; border-color: var(--ag-border); }
body[data-theme="dark"] .form-control, body[data-theme="dark"] .form-select { color: var(--ag-ink); background-color: #0d1929; border-color: #34455e; }
body[data-theme="dark"] .form-label { color: #d2dceb; }
body[data-theme="dark"] .gallery-container { background: #0d1929; border-color: var(--ag-border); }
body[data-theme="dark"] .element-card { background: #111e30; border-color: #2a3b52; }
body[data-theme="dark"] .element-card .name { color: #e7eef8; }
body[data-theme="dark"] .element-card img { background: #f8faff; }
body[data-theme="dark"] .offcanvas { color: var(--ag-ink); background: #0b1727; }
body[data-theme="dark"] .offcanvas .btn-close { filter: invert(1); }
body[data-theme="dark"] .offcanvas .nav-link { color: #d2dceb; }
body[data-theme="dark"] .footer { border-color: var(--ag-border); }

@media (min-width: 992px) { .offcanvas.d-lg-none { display: none !important; } }
@media (max-width: 991.98px) {
    body { padding-top: 68px; }
    .navbar-glass { min-height: 62px; }
    .navbar-glass > .container { gap: .5rem; }
    .navbar-brand { font-size: 1.2rem; }
    .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
    .site-main { padding-top: 1.25rem; }
}
@media (max-width: 575.98px) {
    body { font-size: 14px; }
    .site-main { padding-right: 1rem; padding-left: 1rem; padding-bottom: 2rem; }
    .card-body { padding: 1rem; }
    .card-header { padding: 1rem 1rem .75rem; }
    .hero-section { padding: 1.6rem 1.25rem; border-radius: 16px; }
    .hero-title { font-size: 2rem; }
    .gallery-container { grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 10px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Homepage (index.html) — extracted from {% block style %}
   ========================================================= */
.ag-home { color: var(--ag-ink); overflow: hidden; }
.ag-home .section-eyebrow {
    color: var(--ag-blue); font-size: .76rem; font-weight: 800;
    letter-spacing: .16em; text-transform: uppercase; margin-bottom: .8rem;
}
.ag-home .section-heading {
    color: var(--ag-ink); font-weight: 800; letter-spacing: -.04em;
    line-height: 1.12;
}
.ag-home .text-muted { color: var(--ag-muted) !important; }
.ag-home .btn { border-radius: 999px; font-weight: 700; padding: .8rem 1.35rem; }
.ag-home .btn-primary {
    background: var(--ag-blue); border-color: var(--ag-blue);
    box-shadow: 0 8px 20px rgba(22,119,249,.2);
}
.ag-home .btn-primary:hover { background: #0864dc; border-color: #0864dc; transform: translateY(-1px); }
.ag-home .btn-outline-light:hover { color: var(--ag-ink); }

/* Hero */
.ag-hero {
    position: relative; isolation: isolate; overflow: hidden;
    border-radius: 26px; padding: clamp(2rem, 5vw, 4.8rem);
    margin: .5rem 0 2rem;
    color: #fff;
    background:
      radial-gradient(ellipse at 75% 42%, rgba(22,119,249,.34), transparent 36%),
      radial-gradient(ellipse at 98% 0%, rgba(54,160,255,.18), transparent 32%),
      linear-gradient(120deg, #071326 0%, #0b1b35 56%, #10294c 100%);
    box-shadow: 0 22px 60px rgba(8,25,52,.15);
}
.ag-hero::before, .ag-hero::after {
    content: ""; position: absolute; z-index: -1; border: 1px solid rgba(54,160,255,.22);
    border-radius: 50%; pointer-events: none;
}
.ag-hero::before { width: 460px; height: 460px; right: 8%; top: -40%; box-shadow: 0 0 0 32px rgba(22,119,249,.035), 0 0 0 74px rgba(22,119,249,.025); }
.ag-hero::after { width: 300px; height: 300px; right: 17%; bottom: -55%; }
.ag-hero-copy { position: relative; z-index: 2; max-width: 660px; }
.ag-hero h1 {
    color: #fff; font-size: clamp(2.35rem, 4.8vw, 4.25rem);
    font-weight: 850; letter-spacing: -.055em; line-height: 1.02; margin-bottom: 1.35rem;
}
.ag-hero h1 span { color: var(--ag-blue-bright); }
.ag-hero .ag-lead { color: #d9e6f8; max-width: 580px; font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.7; }
.ag-hero .ag-kicker {
    display: inline-flex; align-items: center; gap: .55rem; color: #c9e2ff;
    font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
    border: 1px solid rgba(104,174,255,.28); background: rgba(14,43,78,.55);
    padding: .5rem .8rem; border-radius: 999px; margin-bottom: 1.4rem;
}
.ag-hero .ag-kicker i { color: var(--ag-blue-bright); }
.ag-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; margin-top: 1.8rem; }
.ag-hero .btn-primary { background: linear-gradient(110deg, #1677f9, #299bff); border: 0; color: white; }
.ag-hero .btn-outline-light { border-color: rgba(219,235,255,.45); color: #f3f8ff; }
.ag-hero .ag-trust { display: flex; flex-wrap: wrap; gap: 1rem 1.4rem; margin-top: 1.8rem; color: #b7c9e0; font-size: .84rem; }
.ag-hero .ag-trust span { display: inline-flex; align-items: center; gap: .45rem; }
.ag-hero .ag-trust i { color: #50a8ff; }

/* Abstract AG / composition preview */
.ag-visual { min-height: 340px; display: flex; align-items: center; justify-content: center; position: relative; }
.ag-orbit { position: absolute; width: min(31vw, 350px); aspect-ratio: 1; border: 1px solid rgba(73,163,255,.3); border-radius: 50%; box-shadow: 0 0 0 22px rgba(43,131,255,.035), 0 0 0 55px rgba(43,131,255,.025); }
.ag-preview {
    position: relative; width: min(100%, 410px); padding: 1rem;
    background: rgba(10,26,49,.82); border: 1px solid rgba(145,194,255,.35);
    border-radius: 19px; box-shadow: 0 24px 65px rgba(0,0,0,.32);
    backdrop-filter: blur(14px); transform: rotate(1.2deg);
}
.ag-preview-top { display:flex; justify-content:space-between; align-items:center; color:#b8cde8; font-size:.72rem; padding: .15rem .25rem .85rem; }
.ag-preview-status { display:inline-flex; align-items:center; gap:.35rem; color:#80d9bd; }
.ag-preview-status::before { content:""; width:6px;height:6px;border-radius:50%;background:#43d6a5; }
.ag-preview-panel { display:grid; grid-template-columns: 1fr 1fr; gap:.65rem; }
.ag-preview-card { background:linear-gradient(145deg,rgba(28,58,96,.9),rgba(14,34,62,.92)); border:1px solid rgba(138,182,239,.15); border-radius:12px; padding:.9rem; min-height:112px; }
.ag-preview-label { color:#8ea8c9; font-size:.68rem; margin-bottom:.5rem; }
.ag-preview-value { color:#fff; font-size:1.45rem; font-weight:800; letter-spacing:-.04em; }
.ag-preview-sub { color:#8ea8c9; font-size:.68rem; margin-top:.25rem; }
.ag-bars { display:flex; align-items:end; gap:5px; height:45px; margin-top:.3rem; }
.ag-bars span { flex:1; border-radius:4px 4px 2px 2px; background:linear-gradient(180deg,#49b2ff,#1677f9); }
.ag-bars span:nth-child(1){height:38%}.ag-bars span:nth-child(2){height:58%}.ag-bars span:nth-child(3){height:45%}.ag-bars span:nth-child(4){height:78%}.ag-bars span:nth-child(5){height:65%}.ag-bars span:nth-child(6){height:100%}
.ag-pyramid { display:flex; flex-direction:column; align-items:center; justify-content:center; min-height:112px; gap:4px; }
.ag-pyramid span { display:block; height:13px; border:1px solid #70bdff; background:linear-gradient(90deg,rgba(22,119,249,.28),rgba(54,160,255,.65)); border-radius:5px; transform:skew(-18deg); }
.ag-pyramid span:nth-child(1){width:32%}.ag-pyramid span:nth-child(2){width:55%}.ag-pyramid span:nth-child(3){width:78%}
.ag-preview-footer { display:flex; align-items:center; justify-content:space-between; gap:.5rem; margin-top:.7rem; padding:.65rem .75rem; background:rgba(22,119,249,.12); border:1px solid rgba(54,160,255,.18); border-radius:10px; color:#d8e9ff; font-size:.72rem; }
.ag-preview-footer i { color:#59b5ff; font-size:1rem; }

/* Feature strip */
.ag-feature-strip { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1rem; margin:1.2rem 0 4.5rem; }
.ag-feature { display:flex; align-items:flex-start; gap:.85rem; background:var(--ag-surface); border:1px solid var(--ag-line); border-radius:15px; padding:1.1rem; }
.ag-feature-icon { flex:0 0 44px; width:44px;height:44px;display:grid;place-items:center;border-radius:13px;background:#eaf3ff;color:var(--ag-blue);font-size:1.25rem; }
.ag-feature strong { display:block; font-size:.96rem; margin:.05rem 0 .25rem; }
.ag-feature p { margin:0; color:var(--ag-muted); font-size:.82rem; line-height:1.5; }

/* Section and cards */
.ag-section { margin: 4rem 0; }
.ag-section-head { max-width: 650px; margin: 0 auto 2rem; text-align:center; }
.ag-section-head p { color:var(--ag-muted); line-height:1.7; }
.ag-feature-card, .ag-step-card {
    height:100%; background:var(--ag-surface); border:1px solid var(--ag-line);
    border-radius:18px; padding:1.5rem; transition:transform .2s ease,box-shadow .2s ease,border-color .2s ease;
}
.ag-feature-card:hover, .ag-step-card:hover { transform:translateY(-4px); border-color:#c4dcfb; box-shadow:0 16px 34px rgba(25,69,125,.08); }
.ag-feature-card .ag-icon { display:grid;place-items:center;width:50px;height:50px;border-radius:14px;background:#eaf3ff;color:var(--ag-blue);font-size:1.45rem;margin-bottom:1.1rem; }
.ag-feature-card h3 { font-size:1.08rem; font-weight:800; letter-spacing:-.02em; }
.ag-feature-card p, .ag-step-card p { color:var(--ag-muted); font-size:.92rem; line-height:1.65; margin-bottom:0; }
.ag-tools { background:linear-gradient(180deg,rgba(231,241,255,.45),rgba(244,248,253,0)); padding:2.5rem 0; border-radius:24px; }
.ag-tool-card { height:100%; min-height:280px; padding:clamp(1.5rem,3vw,2.3rem); border-radius:22px; overflow:hidden; position:relative; color:#fff; }
.ag-tool-card::after { content:"";position:absolute;width:190px;height:190px;border:1px solid rgba(255,255,255,.16);border-radius:50%;right:-65px;bottom:-85px;box-shadow:0 0 0 25px rgba(255,255,255,.035),0 0 0 55px rgba(255,255,255,.025); }
.ag-tool-blue { background:linear-gradient(130deg,#0b1b35,#124d91 110%); }
.ag-tool-cyan { background:linear-gradient(130deg,#07516b,#087f9e 110%); }
.ag-tool-card > * { position:relative;z-index:1; }
.ag-tool-symbol { width:54px;height:54px;display:grid;place-items:center;border-radius:16px;background:rgba(255,255,255,.12);border:1px solid rgba(255,255,255,.15);font-size:1.55rem; }
.ag-tool-card h3 { color:#fff;font-weight:800;letter-spacing:-.03em;margin:1.1rem 0 .65rem; }
.ag-tool-card p { color:#d4e6fa;line-height:1.65;max-width:460px; }
.ag-tool-card .btn { background:#fff;color:#0b3970;border:0; }
.ag-step-card { padding:1.7rem; }
.ag-step-number { display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--ag-blue);color:#fff;font-weight:800;margin-bottom:1.1rem;box-shadow:0 6px 16px rgba(22,119,249,.22); }
.ag-step-card h3 { font-size:1.05rem;font-weight:800; }
.ag-banner { border:1px solid #d9e8fa;border-radius:18px;background:linear-gradient(110deg,#eaf3ff,#fff);padding:1.5rem; }
.ag-banner .ag-banner-icon { width:48px;height:48px;display:grid;place-items:center;flex:0 0 48px;border-radius:14px;background:#fff;color:var(--ag-blue);font-size:1.3rem;box-shadow:0 3px 12px rgba(20,67,125,.07); }
.ag-final-cta { text-align:center; background:#fff; border:1px solid var(--ag-line); border-radius:24px; padding:clamp(2rem,5vw,3.5rem); position:relative; overflow:hidden; }
.ag-final-cta::before { content:"";position:absolute;width:260px;height:260px;border-radius:50%;border:1px solid #d9eaff;right:-100px;top:-160px;box-shadow:0 0 0 25px #f5f9ff,0 0 0 55px #f9fbff; }
.ag-final-cta > * { position:relative; }

/* Homepage responsive */
@media (max-width: 991.98px) {
    .ag-hero { padding:2.5rem; }
    .ag-visual { min-height:280px; margin-top:1rem; }
    .ag-orbit { width:260px; }
    .ag-feature-strip { grid-template-columns:repeat(2,minmax(0,1fr)); margin-bottom:3.5rem; }
}
@media (max-width: 575.98px) {
    .ag-hero { padding:1.65rem 1.25rem; border-radius:20px; }
    .ag-hero h1 { font-size:2.45rem; }
    .ag-hero-actions { align-items:stretch; }
    .ag-hero-actions .btn { width:100%; }
    .ag-visual { min-height:245px; }
    .ag-preview { padding:.7rem; }
    .ag-feature-strip { gap:.65rem; }
    .ag-feature { padding:.8rem; display:block; }
    .ag-feature-icon { margin-bottom:.65rem; }
    .ag-feature strong { font-size:.88rem; }
    .ag-feature p { font-size:.76rem; }
    .ag-section { margin:3rem 0; }
    .ag-banner { align-items:flex-start !important; padding:1.2rem; }
    .ag-banner .btn { margin-top:.5rem; }
}
@media (prefers-reduced-motion: reduce) {
    .ag-home *, .ag-home *::before, .ag-home *::after { transition:none !important; animation:none !important; scroll-behavior:auto !important; }
}


/* ===================== Layout редактора изображений ===================== */

/* Модалка на фиксированную высоту, чтобы внутри работал свой скролл */
.editor-modal-dialog {
    max-width: 96vw;
    width: 96vw;
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
    margin: 10px auto;
}
.editor-modal-dialog .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.editor-modal-dialog .modal-header,
.editor-modal-dialog .modal-footer {
    flex: 0 0 auto;
}
.editor-modal-dialog .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Двухколоночный layout: сайдбар + холст */
.editor-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: 100%;
    min-height: 0;
}

/* Сайдбар — скроллится только он */
.editor-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    padding: 0.75rem;
}

/* Прижатый блок сверху сайдбара: выбор фигуры/пола/части */
.editor-sidebar-pinned {
    position: sticky;
    top: -0.75rem;                 /* компенсация padding родителя */
    margin: -0.75rem -0.75rem 0.5rem;
    padding: 0.75rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 2;
}

/* Секции настроек */
.editor-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}
.editor-section:first-of-type {
    border-top: none;
    padding-top: 0;
}
.editor-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

/* Холст — занимает всё оставшееся место, SVG вписывается по пропорциям */
.editor-canvas {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 0.75rem;
    background: #fff;
}
.editor-canvas-inner {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    padding: 8px;
}
.editor-canvas-inner svg {
    width: 100%;
    height: 100%;
    max-height: 100%;
    display: block;
}
.editor-hint {
    flex: 0 0 auto;
    margin-top: 0.5rem;
    line-height: 1.3;
}

/* ===== Мобильные ===== */
@media (max-width: 767.98px) {
    .editor-layout {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 40vh) minmax(0, 1fr);
    }
    .editor-sidebar {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding: 0.5rem;
    }
    .editor-sidebar-pinned {
        top: -0.5rem;
        margin: -0.5rem -0.5rem 0.4rem;
        padding: 0.5rem;
    }
    .editor-canvas {
        padding: 0.5rem;
    }
    .editor-hint {
        display: none;   /* на телефоне подсказка ест место */
    }
}


/* ===================== Mobile / touch поддержка редактора ===================== */

/* 1) Ключевое: без этого страница скроллится под пальцем при drag */
#editorSvg {
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Сайдбар: плавный скролл и запрет «проваливания» прокрутки в body */
.editor-sidebar {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Кнопки модалки: без 300ms-задержки, без подсветки тапа */
#imageEditorModal button,
#imageEditorModal .btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 767.98px) {
    /* iOS Safari зумит на фокус, если font-size < 16px */
    #imageEditorModal .form-control,
    #imageEditorModal .form-select {
        font-size: 16px;
    }
    /* Удобнее попадать по кнопкам на тач-экране */
    #imageEditorModal .btn {
        min-height: 44px;
    }
    /* Ручка range-слайдера — крупнее (WebKit / Firefox) */
    #imageEditorModal .form-range {
        height: 28px;
    }
    #imageEditorModal .form-range::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }
    #imageEditorModal .form-range::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
}

/* ===================== Кастомный alert ===================== */
.ag-dialog-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(11, 19, 32, .55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1080;
    opacity: 0;
    transition: opacity .18s ease;
}
.ag-dialog-backdrop.show { opacity: 1; }
.ag-dialog-backdrop[hidden] { display: none; }

.ag-dialog {
    width: min(92vw, 460px);
    padding: 1.75rem 1.5rem 1.3rem;
    text-align: center;
    background: var(--ag-surface);
    border: 1px solid var(--ag-border);
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(8, 22, 42, .25);
    transform: scale(.94) translateY(6px);
    transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.ag-dialog-backdrop.show .ag-dialog { transform: scale(1) translateY(0); }

.ag-dialog-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin: 0 auto .85rem;
    border-radius: 16px;
    font-size: 1.6rem;
}
.ag-dialog-icon--info    { color: var(--ag-blue); background: var(--ag-blue-soft); }
.ag-dialog-icon--success { color: #14875a;        background: #e3f7ee; }
.ag-dialog-icon--danger  { color: #c23041;        background: #fdecee; }
.ag-dialog-icon--warning { color: #a36a00;        background: #fff4d9; }

.ag-dialog-title {
    margin: 0 0 .45rem;
    color: var(--ag-navy);
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -.02em;
}
.ag-dialog-body {
    margin-bottom: 1.25rem;
    color: var(--ag-muted);
    font-size: .95rem;
    line-height: 1.6;
    text-align: center;
    white-space: pre-line;       /* сохраняет \n из текста alert() */
    overflow-wrap: anywhere;
}
.ag-dialog-actions { display: flex; justify-content: center; gap: .6rem; }
.ag-dialog-actions .btn { min-width: 110px; }


/* Стили для быстрых тегов */
.quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
.quick-tag-btn {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    transition: all 0.15s ease;
}
.quick-tag-btn.active {
    background-color: #198754;
    color: white;
    border-color: #198754;
}