.ac-site-main:has(.codex-page) { padding: 0 !important; }
@media (max-width: 991.98px) {
    .ac-site-main:has(.codex-page) { padding: 0 !important; }
}
body:has(.codex-page),
.ac-site-main:has(.codex-page) { background: #12080a; }
body:has(.codex-page) footer {
    margin-top: 0;
    background: #12080a;
    border-top: 0;
    color: #94a3b8;
}
.codex-page {
    position: relative;
    overflow-x: hidden;
    min-height: calc(100dvh - 4.75rem);
    padding: 1rem clamp(0.8rem, 3vw, 2.4rem) 2.4rem;
    color: #e2e8f0;
    background:
        radial-gradient(900px 280px at 8% -8%, rgba(248, 113, 113, 0.18), transparent 55%),
        radial-gradient(820px 260px at 94% 108%, rgba(250, 204, 21, 0.12), transparent 52%),
        radial-gradient(640px 240px at 50% 0%, rgba(251, 146, 60, 0.1), transparent 46%),
        linear-gradient(180deg, #12080a 0%, #0b1220 48%, #111827 100%);
}
.codex-page::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(90deg, transparent 0 36px, rgba(250, 204, 21, 0.03) 36px 37px),
        repeating-linear-gradient(0deg, transparent 0 36px, rgba(248, 113, 113, 0.025) 36px 37px);
}
.codex-hero, .codex-hud, .codex-panel, .codex-toast { position: relative; z-index: 1; }
.codex-hero { text-align: center; margin-bottom: 0.9rem; }
.codex-kicker {
    display: inline-flex; align-items: center; gap: 0.4rem;
    font-size: 0.64rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: #fca5a5;
}
.codex-kicker i {
    width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #f87171;
    box-shadow: 0 0 12px #f87171; animation: codexPulse 1.6s ease-in-out infinite;
}
@keyframes codexPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.5; }
}
@keyframes codexRise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}
.codex-hero h1 {
    font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900; margin: 0.25rem 0 0.4rem;
    background: linear-gradient(90deg, #fff, #fca5a5 36%, #facc15 80%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.codex-hero > p { max-width: 42rem; margin: 0 auto 0.7rem; color: #94a3b8; }
.codex-orbs, .codex-hero-links, .codex-tabs, .codex-tools {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.4rem;
}
.codex-orbs { margin-bottom: 0.45rem; }
.codex-orb {
    min-width: 5.4rem; padding: 0.22rem 0.7rem; border-radius: 999px; text-align: center;
    border: 1px solid rgba(252, 165, 165, 0.28); background: rgba(127, 29, 29, 0.22);
}
.codex-orb b { display: block; font-weight: 900; }
.codex-orb span { font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.codex-orb.tone-ban span { color: #fca5a5; }
.codex-orb.tone-punish { border-color: rgba(251, 146, 60, 0.3); background: rgba(154, 52, 18, 0.22); }
.codex-orb.tone-punish span { color: #fdba74; }
.codex-orb.tone-warn { border-color: rgba(250, 204, 21, 0.3); background: rgba(113, 63, 18, 0.22); }
.codex-orb.tone-warn span { color: #fde68a; }
.codex-hud { margin: 0 auto 1rem; max-width: 64rem; }
.codex-tabs { margin-bottom: 0.55rem; }
.codex-chip {
    border-radius: 999px; padding: 0.34rem 0.78rem; font-weight: 800; font-size: 0.78rem;
    border: 1px solid rgba(252, 165, 165, 0.28); background: rgba(15, 23, 42, 0.55);
    color: #fecaca; text-decoration: none; cursor: pointer; font: inherit; appearance: none;
}
.codex-chip:hover { color: #fff; background: rgba(248, 113, 113, 0.16); }
.codex-chip.is-on { background: linear-gradient(90deg, #9f1239, #fb7185); border: 0; color: #fff; }
.codex-chip.tone-ban { color: #fecaca; }
.codex-chip.tone-punish { color: #fed7aa; border-color: rgba(251, 146, 60, 0.3); }
.codex-chip.tone-warn { color: #fde68a; border-color: rgba(250, 204, 21, 0.3); }
.codex-search {
    min-width: min(100%, 16rem); border-radius: 999px; padding: 0.42rem 0.85rem;
    border: 1px solid rgba(250, 204, 21, 0.28); background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0; font-size: 0.82rem; font-weight: 700; outline: none;
}
.codex-search:focus { box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.18); }
.codex-page.is-apps .codex-tools { display: none; }
.codex-panel { display: none; max-width: 64rem; margin: 0 auto; }
.codex-panel.is-on { display: block; }
.codex-chapter { margin-bottom: 1.35rem; }
.codex-chapter h2 {
    font-size: 1.02rem; font-weight: 900; margin: 0 0 0.7rem; line-height: 1.35;
}
.codex-chapter.tone-ban h2 { color: #fca5a5; }
.codex-chapter.tone-punish h2 { color: #fdba74; }
.codex-chapter.tone-warn h2 { color: #fde68a; }
.codex-chapter.tone-misc h2 { color: #7dd3fc; }
.codex-rule {
    --rule-c: #f87171;
    border-radius: 1rem;
    margin-bottom: 0.55rem;
    padding: 0.15rem 0.85rem 0.55rem;
    background: rgba(8, 12, 24, 0.72);
    border: 1px solid color-mix(in srgb, var(--rule-c) 32%, rgba(255,255,255,0.08));
    border-left: 5px solid var(--rule-c);
    animation: codexRise 0.4s cubic-bezier(.16,.84,.32,1) both;
    animation-delay: calc(var(--rise) * 40ms);
}
.codex-rule.tone-ban { --rule-c: #f87171; }
.codex-rule.tone-punish { --rule-c: #fb923c; }
.codex-rule.tone-warn { --rule-c: #facc15; }
.codex-rule[hidden] { display: none !important; }
.codex-rule summary {
    display: flex; align-items: center; gap: 0.65rem;
    cursor: pointer; list-style: none; padding: 0.7rem 0 0.45rem;
}
.codex-rule summary::-webkit-details-marker { display: none; }
.codex-id {
    flex-shrink: 0; font-weight: 900; font-variant-numeric: tabular-nums;
    color: #0b1220; background: var(--rule-c); border-radius: 999px;
    padding: 0.12rem 0.5rem; font-size: 0.78rem;
}
.codex-preview {
    color: #cbd5e1; font-weight: 700; font-size: 0.88rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}
.codex-rule[open] .codex-preview { display: none; }
.codex-desc {
    white-space: pre-wrap; line-height: 1.55; color: #e2e8f0; font-size: 0.95rem; margin-bottom: 0.55rem;
}
.codex-desc mark {
    background: #facc15; color: #0b1220; border-radius: 0.2rem; padding: 0 0.08em;
}
.codex-copy {
    border-radius: 999px; padding: 0.22rem 0.65rem; font-weight: 800; font-size: 0.72rem;
    border: 1px solid color-mix(in srgb, var(--rule-c) 40%, rgba(255,255,255,0.12));
    background: transparent; color: #e2e8f0; cursor: pointer;
}
.codex-copy:hover { background: color-mix(in srgb, var(--rule-c) 16%, transparent); color: #fff; }
.codex-copy.is-on { background: #4ade80; border: 0; color: #052e16; }
.codex-app {
    border-radius: 1.15rem; padding: 1rem 1.1rem;
    background: rgba(8, 12, 24, 0.72);
    border: 1px solid rgba(125, 211, 252, 0.28);
    margin-bottom: 0.75rem;
}
.codex-app h3 { font-size: 1.02rem; font-weight: 900; margin: 0 0 0.55rem; color: #7dd3fc; }
.codex-app p, .codex-app li { margin: 0 0 0.55rem; line-height: 1.55; color: #e2e8f0; }
.codex-app ol { margin: 0; padding-left: 1.2rem; }
.codex-app li:last-child { margin-bottom: 0; }
.codex-manifest {
    border-radius: 1.15rem; padding: 1.05rem 1.15rem; margin-bottom: 0.85rem;
    background: linear-gradient(180deg, rgba(113, 63, 18, 0.35), rgba(8, 12, 24, 0.78));
    border: 1px solid rgba(250, 204, 21, 0.32);
    box-shadow: 0 0 22px rgba(250, 204, 21, 0.08);
}
.codex-manifest p { margin: 0 0 0.7rem; line-height: 1.6; color: #fde68a; }
.codex-manifest p:last-child { margin-bottom: 0; }
.codex-meta { color: #94a3b8; font-size: 0.86rem; margin: 0 0 0.7rem; }
.codex-downloads { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.9rem; }
.codex-pdf {
    display: block; width: 100%; height: min(78vh, 62rem); margin: 0 0 0.9rem;
    border: 1px solid rgba(125, 211, 252, 0.28); border-radius: 1.15rem;
    background: rgba(8, 12, 24, 0.72);
}
.codex-note { display: block; margin-top: 0.45rem; color: #fdba74; font-size: 0.9rem; }
.codex-sign { text-align: right; color: #fca5a5; font-weight: 800; margin: 0.4rem 0 0; }
.codex-empty { display: none; text-align: center; color: #94a3b8; font-weight: 700; padding: 1.2rem; }
.codex-empty.is-on { display: block; }
.codex-chapter[hidden] { display: none !important; }
.codex-toast {
    position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%);
    border-radius: 999px; padding: 0.4rem 0.9rem; font-weight: 800; font-size: 0.8rem;
    background: #4ade80; color: #052e16; z-index: 40;
}
.codex-toast[hidden] { display: none !important; }
.codex-rule.is-hot { box-shadow: 0 0 0 2px var(--rule-c); }
.agents-grounds {
    margin: 0 0 0.75rem;
    padding-left: 1.2rem;
    color: #fde68a;
}
.agents-grounds li { margin: 0 0 0.4rem; line-height: 1.5; }
.agents-search-wrap { position: relative; margin: 0 0 0.9rem; max-width: 36rem; }
.agents-search { width: 100%; min-width: 0; }
.agents-suggest {
    margin-top: 0.45rem;
    border-radius: 1rem; overflow: hidden;
    border: 1px solid rgba(252, 165, 165, 0.28);
    background: rgba(8, 12, 24, 0.96);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}
.agents-suggest[hidden] { display: none !important; }
.agents-suggest-item {
    display: flex; flex-direction: column; gap: 0.15rem; width: 100%;
    text-align: left; padding: 0.7rem 0.9rem; border: 0; border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: transparent; color: #e2e8f0; cursor: pointer; font: inherit;
}
.agents-suggest-item:last-child { border-bottom: 0; }
.agents-suggest-item:hover,
.agents-suggest-item:focus-visible { background: rgba(248, 113, 113, 0.12); outline: none; }
.agents-suggest-item b { font-weight: 900; color: #fecaca; }
.agents-suggest-item span { font-size: 0.78rem; color: #94a3b8; }
.agents-card-actions {
    display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem;
}
.agents-admin.is-editing {
    border-color: rgba(250, 204, 21, 0.4);
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12);
}
.agents-card {
    border-radius: 1.15rem; padding: 1.05rem 1.15rem; margin-bottom: 0.9rem;
    background: linear-gradient(180deg, rgba(127, 29, 29, 0.38), rgba(8, 12, 24, 0.82));
    border: 1px solid rgba(248, 113, 113, 0.35);
    animation: codexRise 0.35s cubic-bezier(.16,.84,.32,1) both;
}
.agents-card-head {
    display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.7rem;
    margin-bottom: 0.85rem;
}
.agents-label {
    font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800; color: #fca5a5;
    margin-bottom: 0.25rem;
}
.agents-main { font-size: 1.35rem; font-weight: 900; color: #fff; }
.agents-status {
    display: inline-flex; align-items: center; border-radius: 999px; padding: 0.28rem 0.72rem;
    font-size: 0.72rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
    color: #450a0a; background: linear-gradient(90deg, #f87171, #facc15);
}
.agents-aliases { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.85rem; }
.agents-alias-chip {
    border-radius: 999px; padding: 0.22rem 0.65rem; font-size: 0.78rem; font-weight: 700;
    border: 1px solid rgba(250, 204, 21, 0.28); color: #fde68a; background: rgba(113, 63, 18, 0.28);
}
.agents-reasons { margin: 0; padding-left: 1.2rem; color: #e2e8f0; }
.agents-reasons li { margin: 0 0 0.45rem; line-height: 1.5; }
.agents-hint { margin-top: 0.35rem; }
.agents-admin { margin-top: 1.1rem; border-color: rgba(248, 113, 113, 0.28); }
.agents-admin h3 { color: #fca5a5; }
.agents-form { display: grid; gap: 0.85rem; }
.agents-field { display: grid; gap: 0.35rem; }
.agents-field > span { font-size: 0.78rem; font-weight: 800; color: #fecaca; }
.agents-field input, .agents-dyn-row input {
    border-radius: 0.85rem; padding: 0.55rem 0.8rem;
    border: 1px solid rgba(252, 165, 165, 0.28); background: rgba(15, 23, 42, 0.72);
    color: #e2e8f0; font: inherit; font-weight: 700; outline: none;
}
.agents-field input:focus, .agents-dyn-row input:focus { box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16); }
.agents-dyn-list { display: grid; gap: 0.4rem; margin-bottom: 0.4rem; }
.agents-dyn-row { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem; align-items: center; }
.agents-field > .codex-chip,
.agents-form-actions > .codex-chip {
    justify-self: start;
    width: auto;
}
.agents-admin-msg { font-size: 0.8rem; font-weight: 800; }
.agents-admin-msg.is-ok { color: #86efac; }
.agents-admin-msg.is-err { color: #fca5a5; }
@media (max-width: 700px) {
    .codex-page { padding: 0.85rem 0.7rem 1.8rem; }
    .codex-search { min-width: 0; width: 100%; }
    .agents-card-head { align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
    .codex-rule, .codex-kicker i, .agents-card { animation: none !important; }
}
