/**
 * ============================================================================
 * CODEX VOLO ET BELLUM - SHARD 3D INSPECTOR (CRYSTALLOGRAPHIC CODEX)
 * Renaissance Leonardo Manuscript Alchemical 3D Crystal Viewer
 * Author: Yura (Senior Game Engineer)
 * ============================================================================
 */

.shard-inspector-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #100804 url('assets/wood-table.jpg') center center / cover no-repeat !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    opacity: 1;
    padding: 16px;
    box-sizing: border-box;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.shard-inspector-modal.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.shard-inspector-box {
    position: relative;
    width: 96% !important;
    max-width: 1440px !important;
    height: 94% !important;
    max-height: 820px !important;
    background: #e8d7b8 url('assets/deckle-paper.jpg') repeat;
    background-size: cover;
    border: 2px solid #5a3e1b;
    border-radius: 8px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), inset 0 0 60px rgba(90, 56, 20, 0.35);
    display: flex;
    flex-direction: column;
    padding: 20px 26px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: #26180a;
}

/* Brass Corner Ornaments */
.shard-brass-corner {
    position: absolute;
    width: 28px;
    height: 28px;
    border: 3px solid #b89355;
    pointer-events: none;
}

.shard-brass-corner.tl {
    top: 6px;
    left: 6px;
    border-right: none;
    border-bottom: none;
}

.shard-brass-corner.tr {
    top: 6px;
    right: 6px;
    border-left: none;
    border-bottom: none;
}

.shard-brass-corner.bl {
    bottom: 6px;
    left: 6px;
    border-right: none;
    border-top: none;
}

.shard-brass-corner.br {
    bottom: 6px;
    right: 6px;
    border-left: none;
    border-top: none;
}

/* Modal Header */
.shard-insp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #7c5828;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.shard-insp-title-group h2 {
    margin: 0;
    font-family: 'Cinzel', 'Palatino Linotype', Georgia, serif;
    font-size: 23.5px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #2d1908;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.45);
    display: flex;
    align-items: center;
    gap: 12px;
}

.shard-tier-pill {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 12.5px;
    font-weight: 800;
    padding: 4px 11px;
    border-radius: 4px;
    letter-spacing: 0.9px;
    line-height: 1.15;
    text-transform: uppercase;
}

.shard-tier-pill.normal {
    background: #0284c7;
    color: #fff;
}

.shard-tier-pill.great {
    background: #ea580c;
    color: #fff;
}

.shard-tier-pill.rare {
    background: #eab308;
    color: #1a1205;
}

.shard-tier-pill.very_rare {
    background: #9333ea;
    color: #fff;
}

.shard-tier-pill.legend {
    background: #06b6d4;
    color: #042f2e;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.shard-insp-title-group p {
    margin: 4px 0 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 500;
    letter-spacing: 0.15px;
    line-height: 1.4;
    color: #5c3d1e;
}

.shard-insp-close-btn {
    background: #6b4423;
    border: 1.5px solid #3f280e;
    border-radius: 6px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    line-height: 1;
    color: #fef3c7;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.15s, transform 0.12s;
}

.shard-insp-close-btn:hover {
    background: #85542b;
    color: #ffffff;
}

/* Two-Column Body Workspace */
.shard-insp-workspace {
    flex: 1;
    display: flex;
    gap: 18px;
    min-height: 0;
}

/* Left: 3D Viewport (narrower to give right codex panel more room) */
.shard-3d-viewport-wrapper {
    flex: 0 0 32%;
    max-width: 32%;
    min-width: 240px;
    position: relative;
    border: 1.5px solid #8e6a39;
    border-radius: 6px;
    background: radial-gradient(circle at 50% 50%, #16181f 0%, #0d0e14 60%, #050608 100%);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 4px 15px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.shard-3d-canvas-container {
    flex: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    position: relative;
    cursor: grab;
}

.shard-3d-canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.shard-3d-canvas-container:active {
    cursor: grabbing;
}

/* CAD Overlay Controls */
.shard-viewport-hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.shard-hud-tag {
    background: rgba(16, 13, 10, 0.82);
    border: 1px solid rgba(212, 185, 130, 0.65);
    color: #efe6d0;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Consolas', 'Cascadia Mono', 'SFMono-Regular', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.8px;
}

.shard-3d-controls-bar {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    background: #0f0c0a;
    border: 1px solid #7c5828;
    border-radius: 20px;
    padding: 4px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.shard-ctrl-btn {
    background: transparent;
    border: none;
    color: #eadbc0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.25px;
    line-height: 1.2;
    padding: 5px 12px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.shard-ctrl-btn:hover {
    background: rgba(210, 185, 144, 0.2);
    color: #ffd875;
}

.shard-ctrl-btn.active {
    background: #8b6508;
    color: #fff;
}

/* Right: Crystallographic Codex Panel */
.shard-codex-panel {
    flex: 1 1 68%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Lore & Inventory Card */
.shard-meta-card {
    background: rgba(223, 205, 171, 0.4);
    border: 1.5px solid #8e6a39;
    border-radius: 6px;
    padding: 14px 16px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.1);
}

.shard-meta-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 10px;
}

.shard-meta-icon {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.shard-meta-name-block {
    display: flex;
    flex-direction: column;
}

.shard-meta-name-block h3 {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 27.5px;
    font-weight: 800;
    color: #2b1605;
    letter-spacing: 0.25px;
    line-height: 1.25;
}

.shard-meta-stock-badge {
    font-size: 19.5px;
    color: #5b3d1c;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.15px;
    margin-top: 4px;
}

.shard-meta-desc {
    font-size: 20px;
    line-height: 1.6;
    color: #36220e;
    font-style: normal;
    font-weight: 500;
    margin: 0;
    border-top: 1px dashed rgba(124, 88, 40, 0.35);
    padding-top: 11px;
}

/* Technical Crystallography Specs */
.shard-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 19.5px;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 250, 240, 0.55);
    border: 1px solid #a88a5d;
    border-radius: 6px;
    overflow: hidden;
}

.shard-specs-table th,
.shard-specs-table td {
    padding: 9px 14px;
    text-align: left;
    line-height: 1.45;
    border-bottom: 1px solid rgba(124, 88, 40, 0.25);
}

.shard-specs-table th {
    background: rgba(184, 134, 11, 0.14);
    color: #5c3e1d;
    font-size: 17px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    width: 38%;
}

.shard-specs-table td {
    color: #211408;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.1px;
}

.shard-specs-table tr:last-child th,
.shard-specs-table tr:last-child td {
    border-bottom: none;
}

/* Synthesis Stoichiometry Reference */
.shard-recipes-ref-box {
    background: rgba(223, 205, 171, 0.35);
    border: 1px solid #8e6a39;
    border-radius: 6px;
    padding: 12px 14px;
}

.shard-recipes-ref-title {
    font-size: 17.5px;
    font-weight: 800;
    color: #4a2e10;
    letter-spacing: 0.7px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shard-recipe-pill-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.shard-recipe-mini-item {
    font-size: 17.5px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
    letter-spacing: 0.1px;
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(124, 88, 40, 0.25);
    border-radius: 0;
    padding: 6px 4px;
    color: #291a0a;
}

.shard-recipe-mini-item:last-child {
    border-bottom: none;
}

.shard-recipe-mini-item b {
    color: #1b4d2e;
}