.char-dossier {
    width: min(820px, 100%);
    max-width: 820px;
    min-width: 0;
    box-sizing: border-box;
}

.char-dossier .dossier-body,
.dossier-tab-stage,
.dossier-tab-panel { min-width: 0; max-width: 100%; }

.dossier-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 18px;
    padding: 1px;
    background: #282324;
    border: 1px solid #302b2c;
}

.dossier-tabs button {
    min-width: 0;
    min-height: 46px;
    padding: 8px 7px;
    color: #827a7b;
    font: 700 9px/1.25 "Courier New", monospace;
    background: #080809;
    border: 0;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.dossier-tabs button:hover,
.dossier-tabs button:focus-visible { color: #e5dddd; background: #120a0b; outline: 1px solid #7e282c; outline-offset: -2px; }
.dossier-tabs button[aria-selected="true"] { color: #f0e8e9; background: rgba(138, 3, 3, .2); box-shadow: inset 0 -2px var(--blood-red); }
.dossier-tab-panel[hidden] { display: none !important; }
.dossier-tab-panel:not([hidden]) { animation: dossierPanelIn 220ms ease-out both; }

@keyframes dossierPanelIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.dossier-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dossier-data-grid .detail-section { min-height: 170px; margin: 0; }
.dossier-muted { color: #70696a; }

.intel-console-head,
.materials-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
    padding: 0 0 12px;
    border-bottom: 1px solid #332d2e;
}
.intel-console-head > div,
.materials-head { color: #746d6e; font: 9px/1.4 "Courier New", monospace; letter-spacing: 1px; }
.intel-console-head strong,
.materials-head strong { display: block; margin-top: 4px; color: #c9c1c2; font-size: 12px; }
.intel-perspective-badge { padding: 7px 9px; color: #c7bfc0; font: 700 9px "Courier New", monospace; border: 1px solid #51494a; background: #09090a; }

.intelligence-layer-list { display: grid; gap: 10px; }
.intelligence-layer { border: 1px solid #302b2c; border-left: 2px solid #665f60; background: rgba(9, 9, 10, .88); }
.intelligence-layer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 12px; border-bottom: 1px solid #292526; }
.intelligence-layer-head strong { color: #c4bcbd; font: 700 10px/1.4 "Courier New", monospace; }
.intelligence-layer-head strong,
.intelligence-layer-head span { min-width: 0; overflow-wrap: anywhere; }
.intelligence-layer-head span { color: #756e6f; font: 8px/1.4 "Courier New", monospace; text-align: right; }
.intelligence-layer-body { padding: 14px 15px; color: #aaa2a3; font: 12px/1.65 "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.intel-character-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    margin: -5px 2px;
    padding: 3px 6px;
    color: #d4b0b2;
    font: inherit;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: rgba(197, 31, 36, .72);
    text-underline-offset: 3px;
    border: 1px solid transparent;
    background: rgba(138, 3, 3, .08);
    cursor: pointer;
    touch-action: manipulation;
    transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.intel-character-link:hover,
.intel-character-link:focus-visible { color: #fff; border-color: #7e282c; background: rgba(138, 3, 3, .2); outline: none; }
.intel-character-link:active { background: rgba(197, 31, 36, .28); }
.intelligence-layer.is-confirmed { border-left-color: #557f68; }
.intelligence-layer.is-rumor { border-left-color: #8a7547; }
.intelligence-layer.is-classified { border-left-color: var(--blood-red); background: linear-gradient(110deg, rgba(138,3,3,.12), rgba(8,8,9,.92) 45%); }
.intelligence-layer.is-perspective { border-left-color: #654f7e; }
.intelligence-layer.is-disinformation { border: 1px dashed #a53b3f; border-left: 2px solid #a53b3f; }

.dossier-materials-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 12px;
}

.dossier-material-card {
    display: grid;
    grid-template-columns: clamp(112px, 18vw, 148px) minmax(0, 1fr);
    min-width: 0;
    min-height: 112px;
    padding: 0;
    overflow: hidden;
    color: #8d8586;
    text-align: left;
    border: 1px solid #302b2c;
    background: #09090a;
    cursor: pointer;
    touch-action: manipulation;
    transition: border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.dossier-material-thumb {
    position: relative;
    display: grid;
    place-items: center;
    min-width: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    color: #8a7e80;
    border-right: 1px solid #302b2c;
    background:
        linear-gradient(rgba(197, 31, 36, .07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(197, 31, 36, .07) 1px, transparent 1px),
        #070708;
    background-size: 18px 18px;
}

.dossier-material-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 56%, rgba(0, 0, 0, .74));
}

.dossier-material-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(.72) contrast(1.08);
    transition: filter 220ms ease, transform 220ms ease;
}

.dossier-material-type {
    font: 700 11px/1 "Courier New", monospace;
    letter-spacing: .16em;
}

.dossier-material-body {
    display: grid;
    align-content: center;
    gap: 9px;
    min-width: 0;
    padding: 15px;
}

.dossier-material-index {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: #a53b3f;
    font: 700 10px "Courier New", monospace;
}

.dossier-material-action { color: #776f70; font-size: 8px; }
.dossier-material-card strong { color: #cbc3c4; font: 700 11px/1.45 "Courier New", monospace; overflow-wrap: anywhere; }
.dossier-material-card small { color: #756e6f; font: 8px/1.4 "Courier New", monospace; overflow-wrap: anywhere; }
.dossier-material-card:hover,
.dossier-material-card:focus-visible {
    color: #fff;
    border-color: #8f292e;
    background: rgba(138, 3, 3, .1);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .36);
    outline: none;
    transform: translateY(-2px);
}
.dossier-material-card:hover .dossier-material-thumb img,
.dossier-material-card:focus-visible .dossier-material-thumb img { filter: saturate(.92) contrast(1.12); transform: scale(1.025); }
.dossier-material-card:active { transform: translateY(0) scale(.992); }
.dossier-module-empty { padding: 28px 16px; color: #716a6b; font: 10px/1.5 "Courier New", monospace; text-align: center; border: 1px dashed #302b2c; }

.material-preview-modal {
    z-index: 6500;
    padding: 24px;
    overscroll-behavior: contain;
}

body.material-preview-open { overflow: hidden; }

.material-preview-wrapper { width: 100%; max-width: 1040px; }
.material-preview-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    width: 100%;
    max-height: calc(100dvh - 48px);
    padding: 24px;
    overflow: hidden;
    background: #050506;
    box-shadow: 0 26px 80px rgba(0, 0, 0, .76), 0 0 0 1px rgba(197, 31, 36, .18);
}

.material-preview-shell .close-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--blood-bright);
    border: 1px solid rgba(197, 31, 36, .54);
    background: #09090a;
    touch-action: manipulation;
}

.material-preview-shell .close-btn:hover,
.material-preview-shell .close-btn:focus-visible { color: #fff; border-color: var(--blood-bright); outline: none; }

.material-preview-header {
    min-width: 0;
    padding: 0 58px 18px 0;
    border-bottom: 1px solid #3a1518;
}

.material-preview-header h2 { margin: 12px 0 6px; font-size: clamp(18px, 3vw, 30px); overflow-wrap: anywhere; }
.material-preview-header p { margin: 0; color: #81797a; font: 9px/1.4 "Courier New", monospace; letter-spacing: .08em; }

.material-preview-stage {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 220px;
    margin: 18px 0;
    overflow: auto;
    border: 1px solid #292526;
    background:
        radial-gradient(circle at 50% 42%, rgba(111, 11, 16, .12), transparent 48%),
        #020203;
}

.material-preview-stage img,
.material-preview-stage video {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - 270px);
    object-fit: contain;
}

.material-preview-stage audio { width: min(620px, calc(100% - 32px)); }
.material-preview-stage iframe { width: 100%; min-height: min(64vh, 720px); height: 100%; border: 0; background: #fff; }

.material-preview-subjects {
    display: grid;
    grid-template-columns: minmax(150px, .34fr) minmax(0, 1fr);
    gap: 16px;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid #302b2c;
    border-left: 2px solid #8f292e;
    background: rgba(11, 10, 11, .94);
}

.material-preview-subjects.hidden { display: none; }
.material-preview-subjects-head { display: grid; align-content: center; gap: 5px; }
.material-preview-subjects-head span { color: #756e6f; font: 8px/1.4 "Courier New", monospace; letter-spacing: .08em; }
.material-preview-subjects-head strong { color: #c9c1c2; font: 700 10px/1.4 "Courier New", monospace; }
.material-preview-subject-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.material-subject-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    color: #d8d0d1;
    font: 700 9px/1.3 "Courier New", monospace;
    text-align: left;
    border: 1px solid #5f3437;
    background: rgba(138, 3, 3, .12);
    cursor: pointer;
    touch-action: manipulation;
    transition: color 180ms ease, border-color 180ms ease, background 180ms ease;
}
.material-subject-link::before { content: '[ '; color: #b91d22; }
.material-subject-link::after { content: ' ]'; color: #b91d22; }
.material-subject-link:hover,
.material-subject-link:focus-visible { color: #fff; border-color: var(--blood-bright); background: rgba(138, 3, 3, .26); outline: none; }
.material-subject-link.is-unavailable { color: #736b6c; border-style: dashed; background: transparent; cursor: default; }

.material-preview-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    color: #6f6869;
    font: 8px/1.4 "Courier New", monospace;
    border-top: 1px solid #262223;
}

.material-preview-dismiss {
    min-height: 44px;
    padding: 9px 14px;
    color: #cfc7c8;
    font: 700 9px "Courier New", monospace;
    border: 1px solid #51484a;
    background: #09090a;
    cursor: pointer;
    touch-action: manipulation;
}

.material-preview-dismiss:hover,
.material-preview-dismiss:focus-visible { color: #fff; border-color: var(--blood-bright); outline: none; }

@media (max-width: 760px) {
    .dossier-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dossier-data-grid { grid-template-columns: 1fr; }
    .material-preview-subjects { grid-template-columns: 1fr; }
}

@media (max-width: 440px) {
    .char-dossier { width: 100%; }
    .char-dossier .dossier-body { padding-right: 0; padding-left: 0; }
    .dossier-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dossier-tabs button { min-height: 48px; font-size: 8px; }
    .intel-console-head { align-items: stretch; flex-direction: column; }
    .intel-perspective-badge { align-self: flex-start; }
    .intelligence-layer-head { align-items: flex-start; flex-direction: column; }
    .intelligence-layer-head span { text-align: left; }
    .dossier-material-card { grid-template-columns: 104px minmax(0, 1fr); min-height: 96px; }
    .dossier-material-thumb { width: 104px; min-height: 96px; border-right: 1px solid #302b2c; }
    .dossier-material-body { gap: 7px; padding: 11px; }
    .dossier-material-action { display: none; }
    .material-preview-modal { padding: 0; }
    .material-preview-wrapper { min-height: 100dvh; }
    .material-preview-shell { min-height: 100dvh; max-height: 100dvh; padding: 16px; border-right: 0; border-left: 0; }
    .material-preview-header { padding-right: 52px; }
    .material-preview-stage { min-height: 0; margin: 14px 0; }
    .material-preview-stage img,
    .material-preview-stage video { max-height: calc(100dvh - 244px); }
    .material-preview-footer { align-items: stretch; flex-direction: column; }
    .material-preview-footer > span { display: none; }
    .material-preview-dismiss { width: 100%; }
}

@media (pointer: coarse) {
    .intel-character-link { min-height: 44px; margin-top: -10px; margin-bottom: -10px; padding-right: 8px; padding-left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .dossier-tab-panel:not([hidden]) { animation: none; }
    .dossier-tabs button,
    .intel-character-link,
    .material-subject-link,
    .dossier-material-card,
    .dossier-material-thumb img { transition: none; }
}
