.macros-forum {
    --macro-accent: #b66cff;
    --macro-accent-rgb: 182, 108, 255;
    width: min(1500px, calc(100% - 32px));
    min-height: 70vh;
    margin: 0 auto;
    padding: 24px 0 64px;
    color: #edf7ff;
}

.macros-forum [hidden] { display: none !important; }

.macros-forum-head {
    display: flex;
    min-height: 106px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(135, 174, 210, 0.18);
}

.macros-forum-head > div:first-child > span,
.macro-forum-product,
.macro-forum-modal-panel > header span {
    color: #c898ff;
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
}

.macros-forum-head h1 {
    margin: 4px 0 5px;
    font-size: clamp(25px, 3vw, 38px);
    line-height: 1;
    letter-spacing: 0;
}

.macros-forum-head p { margin: 0; color: #91a4b9; font-size: 13px; }
.macros-forum-head p strong { color: #d9c4f5; }

.macros-forum-head-count {
    display: grid;
    min-width: 82px;
    place-items: center;
    padding: 12px;
    border-left: 1px solid rgba(var(--macro-accent-rgb), 0.35);
}

.macros-forum-head-count strong { font-size: 25px; line-height: 1; }
.macros-forum-head-count span { margin-top: 5px; color: #899caf; font-size: 10px; font-weight: 900; text-transform: uppercase; }

.macros-forum-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, 210px) minmax(240px, 520px);
    gap: 10px;
    align-items: end;
    padding: 18px 0;
}

.macros-forum-sort,
.macros-forum-search { display: grid; gap: 6px; }
.macros-forum-sort > span { color: #8699ad; font-size: 10px; font-weight: 900; text-transform: uppercase; }

.macros-forum select,
.macros-forum input[type="search"] {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #24384c;
    border-radius: 6px;
    outline: none;
    background: #09131f;
    color: #eef8ff;
    font: inherit;
    font-size: 12px;
}

.macros-forum select:focus,
.macros-forum input[type="search"]:focus { border-color: rgba(var(--macro-accent-rgb), 0.8); box-shadow: 0 0 0 3px rgba(var(--macro-accent-rgb), 0.1); }

.macros-forum-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.macro-forum-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 330px;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
    border: 1px solid #223549;
    border-radius: 8px;
    background: #0b1522;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
    transition: transform 220ms cubic-bezier(.22, 1, .36, 1), border-color 220ms ease, opacity 180ms ease;
}

@supports (content-visibility: auto) {
    .macros-forum-grid > .macro-forum-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 360px;
    }
}

.macro-forum-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #6bdcff, var(--macro-accent), transparent 80%);
    opacity: 0.62;
}

.macro-forum-card:hover { transform: translateY(-3px); border-color: rgba(var(--macro-accent-rgb), 0.52); }
.macro-forum-card.is-filtered { display: none; }
.macro-forum-card.is-moving { animation: macroCardIn 260ms cubic-bezier(.22, 1, .36, 1) both; }

.macro-forum-card-top { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; }
.macro-forum-avatar {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(var(--macro-accent-rgb), 0.55);
    border-radius: 8px;
    background: linear-gradient(145deg, #16384b, #21143a);
    color: #fff;
    font-size: 15px;
    font-weight: 950;
}
.macro-forum-avatar img { width: 100%; height: 100%; object-fit: cover; }
.macro-forum-product { padding: 6px 8px; border: 1px solid rgba(var(--macro-accent-rgb), 0.28); border-radius: 5px; background: rgba(var(--macro-accent-rgb), 0.08); }

.macro-forum-card h2 { margin: 14px 0 4px; color: #f5f9ff; font-size: 17px; line-height: 1.25; overflow-wrap: anywhere; }
.macro-forum-author { margin: 0; color: #71869a; font-size: 11px; }
.macro-forum-author strong { color: #b9c8d7; }
.macro-forum-description { min-height: 51px; margin: 15px 0; color: #9aacbf; font-size: 12px; line-height: 1.45; }

.macro-forum-meta,
.macro-forum-stats { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.macro-forum-meta span,
.macro-forum-import-count,
.macro-forum-vote { min-height: 30px; padding: 0 9px; border: 1px solid #263b50; border-radius: 5px; background: #0b1826; color: #91a5ba; font-size: 10px; font-weight: 800; }
.macro-forum-meta span { display: inline-flex; align-items: center; }
.macro-forum-meta strong { margin-right: 4px; color: #d9e7f4; }
.macro-forum-stats { margin-top: 8px; }
.macro-forum-import-count { display: inline-flex; align-items: center; gap: 4px; color: #63efb2; }
.macro-forum-vote { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.macro-forum-vote-icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 16px; }
.macro-forum-vote-icon svg { width: 16px; height: 16px; display: block; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.macro-forum-vote.is-like { border-color: rgba(34, 197, 94, 0.62); background: rgba(34, 197, 94, 0.09); color: #8df0b2; box-shadow: 0 0 11px rgba(34, 197, 94, 0.2), inset 0 0 9px rgba(34, 197, 94, 0.05); }
.macro-forum-vote.is-dislike { border-color: rgba(255, 82, 91, 0.62); background: rgba(255, 82, 91, 0.09); color: #ff9ea5; box-shadow: 0 0 11px rgba(255, 82, 91, 0.2), inset 0 0 9px rgba(255, 82, 91, 0.05); }
.macro-forum-vote.is-like.is-active { border-color: #22c55e; background: rgba(34, 197, 94, 0.18); color: #dfffee; box-shadow: 0 0 20px rgba(34, 197, 94, 0.52), inset 0 0 12px rgba(34, 197, 94, 0.14); }
.macro-forum-vote.is-dislike.is-active { border-color: #ff7072; background: rgba(255, 112, 114, 0.16); color: #ffe5e7; box-shadow: 0 0 20px rgba(255, 82, 91, 0.52), inset 0 0 12px rgba(255, 82, 91, 0.14); }
.macro-forum-vote.is-locked { opacity: 0.5; cursor: help; }

.macro-forum-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 8px; margin-top: auto; padding-top: 16px; }
.macro-forum-button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid #9857db;
    border-radius: 6px;
    background: #a85bed;
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 950;
    cursor: pointer;
    transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease;
}
.macro-forum-button:hover { filter: brightness(1.1); }
.macro-forum-button:active { transform: scale(0.98); }
.macro-forum-button.is-secondary { border-color: #2b4157; background: #101d2b; color: #c9d6e2; }
.macro-forum-button:disabled { opacity: 0.45; cursor: not-allowed; }

.macro-forum-detail { display: grid; gap: 16px; }
.macro-forum-detail-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.macro-forum-detail-summary > div { display: grid; gap: 5px; padding: 12px; border: 1px solid #25394d; border-radius: 6px; background: #091521; }
.macro-forum-detail-summary span { color: #7f93a8; font-size: 10px; text-transform: uppercase; }
.macro-forum-detail-summary strong { color: #edf6ff; font-size: 12px; overflow-wrap: anywhere; }
.macro-forum-code-head { display: flex; justify-content: space-between; gap: 15px; color: #dce8f3; font-size: 12px; }
.macro-forum-code-head span { color: #8497aa; font-size: 11px; }
.macro-forum-source-protected { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 92px; padding: 16px; border: 1px solid #665126; border-radius: 6px; color: #ffd574; background: #1d180d; text-align: left; }
.macro-forum-source-protected > span { font-size: 22px; }
.macro-forum-source-protected > div { display: grid; gap: 4px; }
.macro-forum-source-protected strong { color: #ffe29a; font-size: 13px; }
.macro-forum-source-protected small { color: #b9aa84; font-size: 11px; }
.macro-forum-detail pre { max-height: 360px; margin: 0; padding: 14px; overflow: auto; border: 1px solid #25394d; border-radius: 6px; background: #050c14; color: #bce7ff; font: 12px/1.55 Consolas, monospace; white-space: pre; }
.macro-forum-captures { display: flex; gap: 8px; overflow-x: auto; }
.macro-forum-captures button { width: 150px; height: 88px; flex: 0 0 150px; padding: 0; overflow: hidden; border: 1px solid #2a4055; border-radius: 5px; background: #07101a; cursor: zoom-in; }
.macro-forum-captures img { width: 100%; height: 100%; object-fit: contain; }

.macro-forum-modal,
.macro-forum-lightbox {
    --macro-accent: #b66cff;
    --macro-accent-rgb: 182, 108, 255;
    position: fixed;
    z-index: 10080;
    inset: 0;
    display: grid;
    width: 100vw;
    height: 100dvh;
    place-items: center;
    padding: 20px;
    color: #edf7ff;
}
.macro-forum-modal[hidden],
.macro-forum-lightbox[hidden] { display: none !important; }
body.macro-forum-modal-open { overflow: hidden; }
.macro-forum-modal-backdrop,
.macro-forum-lightbox > button { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(0, 6, 12, 0.82); backdrop-filter: blur(8px); }
.macro-forum-modal-panel { position: relative; z-index: 1; width: min(820px, 100%); max-height: min(760px, calc(100dvh - 40px)); overflow: hidden; border: 1px solid rgba(var(--macro-accent-rgb), 0.48); border-radius: 8px; background: #09131f; box-shadow: 0 28px 90px rgba(0,0,0,.55); animation: macroModalIn 220ms cubic-bezier(.22,1,.36,1) both; }
.macro-forum-modal-panel.is-import { width: min(430px, 100%); }
.macro-forum-modal-panel > header { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 18px; border-bottom: 1px solid #203347; }
.macro-forum-modal-panel > header h2 { margin: 0; font-size: 18px; }
.macro-forum-modal-panel > header button,
.macro-forum-lightbox > div > button { width: 36px; height: 36px; border: 1px solid #2b4054; border-radius: 6px; background: #101c29; color: #edf7ff; font-size: 21px; cursor: pointer; }
.macro-forum-modal-body { max-height: calc(100vh - 130px); padding: 18px; overflow: auto; }
.macro-forum-modal-panel form { display: grid; gap: 10px; padding: 16px; }
.macro-forum-modal-panel form label { display: grid; gap: 7px; color: #aebdca; font-size: 11px; font-weight: 850; }
.macro-forum-modal-panel form select { position: relative; z-index: 2; width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid #2a4056; border-radius: 6px; outline: none; background: #07111c; color: #edf7ff; font: inherit; cursor: pointer; }
.macro-forum-modal-panel form select:focus { border-color: rgba(var(--macro-accent-rgb), .85); box-shadow: 0 0 0 3px rgba(var(--macro-accent-rgb), .12); }
.macro-forum-modal-panel form select:disabled { opacity: .48; cursor: not-allowed; }
.macro-forum-import-name { margin: 0 0 4px; color: #d9c3ef; font-size: 12px; font-weight: 900; overflow-wrap: anywhere; }
.macro-forum-import-note,
.macro-forum-form-warning { margin: 0; padding: 11px; border-left: 2px solid #8953bd; background: rgba(var(--macro-accent-rgb), .07); color: #9eafc0; font-size: 11px; line-height: 1.45; }
.macro-forum-form-error { padding: 10px; border: 1px solid #8d3543; border-radius: 5px; background: #271017; color: #ffabb6; font-size: 11px; }
.macro-forum-modal-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 8px; margin-top: 4px; }
.macro-forum-modal-actions .macro-forum-button { min-width: 120px; }

.macro-forum-lightbox { z-index: 10120; }
.macro-forum-lightbox > div { position: relative; display: grid; width: min(1100px, 100%); max-height: calc(100vh - 40px); place-items: center; }
.macro-forum-lightbox > div > button { position: absolute; z-index: 2; top: 8px; right: 8px; }
.macro-forum-lightbox img { max-width: 100%; max-height: calc(100vh - 40px); object-fit: contain; border: 1px solid #30465b; border-radius: 6px; background: #050a10; }

.macro-forum-toast { position: fixed; z-index: 10200; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 14px; border: 1px solid #2f9467; border-radius: 6px; background: #082319; color: #c5ffe2; box-shadow: 0 18px 45px rgba(0,0,0,.45); font-size: 12px; font-weight: 800; }
.macros-forum-empty { display: grid; min-height: 220px; place-items: center; align-content: center; gap: 7px; color: #8295a7; }
.macros-forum-empty strong { color: #dbe8f3; font-size: 16px; }

@keyframes macroModalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes macroCardIn { from { opacity: .35; transform: translateY(7px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) { .macros-forum-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 650px) {
    .macros-forum { width: min(100% - 20px, 1500px); padding-top: 16px; }
    .macros-forum-head { align-items: flex-start; }
    .macros-forum-head-count { min-width: 58px; }
    .macros-forum-toolbar, .macros-forum-grid { grid-template-columns: 1fr; }
    .macro-forum-card { min-height: 310px; }
    .macro-forum-detail-summary { grid-template-columns: 1fr; }
    .macro-forum-code-head { flex-direction: column; gap: 3px; }
    .macro-forum-modal, .macro-forum-lightbox { padding: 10px; }
}

@media (prefers-reduced-motion: reduce) { .macro-forum-card, .macro-forum-modal-panel { animation: none; transition: none; } }
