/* Anatomia das Formigas 3D */
.ant3d {
    --a3-bg1: #eef0ea;
    --a3-bg2: #c9cdc3;
    --a3-ink: #1d211b;
    --a3-muted: #5d6458;
    --a3-glass: rgba(255, 255, 255, .78);
    --a3-line: rgba(30, 40, 25, .12);
    --a3-accent: #7cb342;
    position: relative;
    height: min(calc(100svh - 72px), 900px);
    min-height: 460px;
    overflow: hidden;
    background: radial-gradient(120% 90% at 50% 38%, var(--a3-bg1) 0%, var(--a3-bg2) 100%);
    color: var(--a3-ink);
    font-family: inherit;
    isolation: isolate;
    user-select: none;
    -webkit-user-select: none;
    transition: background .5s ease;
}
.ant3d.xray {
    --a3-bg1: #0d1a26;
    --a3-bg2: #02060a;
    --a3-ink: #e6f2fb;
    --a3-muted: #9db3c4;
    --a3-glass: rgba(10, 22, 34, .72);
    --a3-line: rgba(160, 210, 255, .16);
}
.ant3d:fullscreen { height: 100vh; }
.ant3d:-webkit-full-screen { height: 100vh; }
.ant3d [hidden] { display: none !important; }
.a3-canvas { position: absolute; inset: 0; touch-action: none; }
.a3-canvas canvas { display: block; width: 100% !important; height: 100% !important; outline: none; }
.a3-canvas canvas:focus-visible { outline: 3px solid var(--a3-accent); outline-offset: -3px; }

.ant3d button { font: inherit; color: inherit; cursor: pointer; }
.ant3d svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* loading */
.a3-loading {
    position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center;
    z-index: 5; transition: opacity .5s ease, visibility .5s;
    background: inherit;
}
.a3-loading p { margin: 0; color: var(--a3-muted); font-weight: 500; }
.a3-loading-bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(0, 0, 0, .1); overflow: hidden; }
.a3-loading-bar span { display: block; height: 100%; width: 4%; background: var(--a3-accent); transition: width .2s; }
.a3-loading.done { opacity: 0; visibility: hidden; pointer-events: none; }
.a3-loading.error .a3-loading-bar { display: none; }

/* hint */
.a3-hint {
    position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
    font-size: .82rem; color: var(--a3-muted); background: var(--a3-glass);
    padding: 6px 14px; border-radius: 999px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    white-space: nowrap; pointer-events: none; z-index: 2;
    opacity: 0; transition: opacity .6s .4s;
}
.ant3d.ready .a3-hint { opacity: 1; }

/* view toolbar */
.a3-views {
    position: absolute; top: 14px; left: 14px; z-index: 3;
    display: flex; gap: 4px; padding: 4px; border-radius: 12px;
    background: var(--a3-glass); border: 1px solid var(--a3-line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.a3-views button {
    border: 0; background: transparent; border-radius: 8px; padding: 7px 10px; font-size: .86rem; font-weight: 500;
    display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px;
}
.a3-views button:hover { background: rgba(127, 127, 127, .14); }
.a3-views button[aria-pressed="true"] { background: #4f7a1f; color: #fff; }

/* control panel */
.a3-panel {
    position: absolute; top: 14px; right: 14px; z-index: 3; width: 268px; max-height: calc(100% - 28px); overflow: auto;
    display: grid; gap: 10px; align-content: start;
    scrollbar-width: thin;
}
.a3-block {
    background: var(--a3-glass); border: 1px solid var(--a3-line); border-radius: 14px; padding: 12px 14px;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    display: grid; gap: 10px;
}
.a3-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .88rem; }
.a3-row label, .a3-h { font-weight: 600; }
.a3-row output { font-variant-numeric: tabular-nums; color: var(--a3-muted); font-size: .85rem; }
.a3-links { font-size: .78rem; color: var(--a3-muted); }
.a3-links button { border: 0; background: none; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; }

.ant3d input[type="range"] { width: 100%; accent-color: var(--a3-accent); margin: 0; height: 22px; }

.a3-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 10px; background: rgba(127, 127, 127, .12); }
.a3-seg button { border: 0; background: transparent; border-radius: 8px; padding: 6px 8px; font-size: .85rem; font-weight: 600; }
.a3-seg button[aria-pressed="true"] { background: var(--a3-ink); color: var(--a3-bg1); }
.ant3d.xray .a3-seg button[aria-pressed="true"] { background: #9fd3ff; color: #06121d; }

.a3-systems { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.a3-systems label, .a3-ghost { display: flex; align-items: center; gap: 8px; font-size: .86rem; padding: 4px 2px; cursor: pointer; line-height: 1.25; }
.a3-systems input, .a3-ghost input { accent-color: var(--a3-accent); width: 16px; height: 16px; margin: 0; flex: none; }
.a3-systems .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 2px rgba(255, 255, 255, .5); }
.a3-ghost { border-top: 1px solid var(--a3-line); padding-top: 8px; }
.a3-ghost small { color: var(--a3-muted); }

/* info card */
.a3-card {
    position: absolute; left: 14px; bottom: 56px; z-index: 4; width: min(360px, calc(100% - 28px));
    background: var(--a3-glass); border: 1px solid var(--a3-line); border-radius: 16px; padding: 14px 16px 14px;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
    animation: a3in .25s ease;
}
@keyframes a3in { from { opacity: 0; transform: translateY(8px); } }
.a3-card-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font-size: 1.5rem; line-height: 1; padding: 4px 8px; color: var(--a3-muted); }
.a3-card-sys { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--a3-muted); font-weight: 600; }
.a3-card-sys::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.a3-card-title { margin: 4px 28px 0 0; font-size: 1.12rem; line-height: 1.25; }
.a3-card-tec { margin: 2px 0 8px; font-style: italic; color: var(--a3-muted); font-size: .84rem; }
.a3-card-desc { margin: 0 0 10px; font-size: .9rem; line-height: 1.5; }
.a3-card-ghost { margin: 0 0 8px; font-size: .82rem; line-height: 1.4; padding: 6px 10px; border-radius: 8px; background: rgba(111, 183, 255, .16); }
.a3-card-focus { border: 1px solid var(--a3-line); background: transparent; border-radius: 999px; padding: 5px 14px; font-size: .84rem; font-weight: 600; }
.a3-card-focus:hover { background: rgba(127, 127, 127, .12); }

.a3-tip {
    position: absolute; z-index: 4; pointer-events: none; font-size: .8rem; font-weight: 600;
    background: var(--a3-ink); color: var(--a3-bg1); padding: 4px 9px; border-radius: 6px; white-space: nowrap;
}

.a3-panel-toggle { display: none; }

/* mobile */
@media (max-width: 760px) {
    .ant3d { height: min(calc(100svh - 120px), 640px); min-height: 380px; }
    .a3-views { top: 10px; left: 10px; right: 10px; overflow-x: auto; scrollbar-width: none; }
    .a3-views button { flex: none; }
    .a3-panel {
        top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 58%;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        transform: translateY(105%); transition: transform .3s ease;
    }
    .ant3d.panel-open .a3-panel { transform: none; }
    .a3-panel-toggle {
        display: inline-flex; align-items: center; gap: 6px; position: absolute; right: 10px; bottom: 12px; z-index: 4;
        border: 1px solid var(--a3-line); background: var(--a3-glass); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: .88rem;
        backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        transition: bottom .3s ease;
    }
    .ant3d.panel-open .a3-panel-toggle { bottom: calc(58% + 8px); }
    .a3-hint { bottom: 64px; font-size: .74rem; }
    .ant3d.ready .a3-hint { animation: a3fade 1s 6s forwards; }
    @keyframes a3fade { to { opacity: 0; } }
    .a3-card { left: 10px; right: 10px; width: auto; bottom: 62px; max-height: 50%; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .a3-card { animation: none; }
    .a3-panel, .a3-panel-toggle { transition: none; }
}

/* page around the viewer */
.a3-page { background: #f6f7f3; }
.a3-intro { max-width: 960px; margin: 0 auto; padding: 28px 20px 18px; text-align: center; }
.a3-intro h1 { font-family: Montserrat, Inter, sans-serif; font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0 0 10px; line-height: 1.15; color: #1d211b; }
.a3-lead { margin: 0 auto; max-width: 760px; font-size: clamp(.98rem, 2vw, 1.1rem); line-height: 1.6; color: #4a5245; }
.a3-content { max-width: 960px; margin: 0 auto; padding: 36px 20px 56px; color: #2a2f27; line-height: 1.65; }
.a3-content h2 { font-family: Montserrat, Inter, sans-serif; font-size: clamp(1.3rem, 3vw, 1.7rem); margin: 34px 0 12px; color: #1d211b; }
.a3-content h2:first-child { margin-top: 0; }
.a3-how ul { padding-left: 1.2em; margin: 0; display: grid; gap: 6px; }
.a3-sys { background: #fff; border: 1px solid rgba(30, 40, 25, .1); border-radius: 14px; margin: 10px 0; overflow: hidden; }
.a3-sys > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; font-weight: 600; font-size: 1.05rem; }
.a3-sys > summary::-webkit-details-marker { display: none; }
.a3-sys > summary::after { content: ''; margin-left: 8px; width: 9px; height: 9px; border-right: 2px solid #7a8274; border-bottom: 2px solid #7a8274; transform: rotate(45deg); transition: transform .2s; flex: none; }
.a3-sys[open] > summary::after { transform: rotate(-135deg); }
.a3-sys-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.a3-sys-name { flex: 1; }
.a3-sys-n { font-size: .8rem; color: #6c7466; background: #eef0ea; border-radius: 999px; padding: 2px 9px; font-weight: 600; }
.a3-sys-desc { margin: 0 16px 8px; color: #4a5245; }
.a3-sys dl { margin: 0; padding: 0 16px 10px; }
.a3-item { padding: 10px 0; border-top: 1px solid rgba(30, 40, 25, .08); }
.a3-item dt { font-weight: 600; color: #1d211b; }
.a3-tec { font-weight: 400; font-style: italic; color: #737b6d; font-size: .9em; }
.a3-item dd { margin: 3px 0 0; color: #3e453a; font-size: .95rem; }
.a3-item.is-ghost dt { color: #2f6ea3; }
.a3-badge { font-style: normal; font-size: .72rem; font-weight: 600; color: #2f6ea3; background: rgba(111, 183, 255, .18); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.a3-note { font-size: .88rem; color: #6c7466; }
@media (max-width: 760px) {
    .a3-intro { padding: 18px 16px 12px; }
    .a3-content { padding: 26px 16px 44px; }
}

.a3-warn { margin: 0; padding: 10px 12px; border-radius: 12px; background: #fff3cd; color: #5c4400; font-size: .84rem; line-height: 1.4; }
.ant3d button:focus-visible, .ant3d input:focus-visible { outline: 2px solid var(--a3-accent); outline-offset: 2px; }
