/* =========================================
   THE RYUZAKI FRAGMENTS (ACHIEVEMENTS)
   ========================================= */

#fragment-registry {
    position: fixed; inset: 0; z-index: 500;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    font-family: 'Share Tech Mono', 'Noto Sans JP', monospace;
}
#fragment-registry.is-open { pointer-events: auto; }

/* The CRT Power-On Flash */
#fragment-registry.is-open::before {
    content: '';
    position: absolute;
    top: 50%; left: 0; right: 0; height: 2px;
    background: var(--current-theme-color, #c68a95);
    box-shadow: 0 0 20px var(--current-theme-color, #c68a95);
    z-index: 501; pointer-events: none;
    animation: crtFlash 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes crtFlash {
    0% { transform: scaleX(0); opacity: 0; }
    30% { transform: scaleX(1); opacity: 1; }
    50% { transform: scaleX(1) scaleY(50); opacity: 1; }
    100% { transform: scaleX(1) scaleY(1000); opacity: 0; }
}

.fragment-panel {
    position: absolute; inset: 0;
    width: 100vw; height: 100vh;
    background: #050505; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    overflow-y: auto;
}

#fragment-registry.is-open .fragment-panel {
    visibility: visible;
    animation: crtScreenReveal 0.1s linear 0.4s forwards;
}

@keyframes crtScreenReveal {
    to { opacity: 1; }
}

/* Background Grid Overlay */
.fragment-panel::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: 
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 40px 40px; z-index: 0;
}

.fragment-content {
    position: relative; z-index: 10;
    width: min(600px, 90vw);
    padding: 60px 0;
    display: flex; flex-direction: column; align-items: center;
}

.fragment-close {
    position: absolute; top: 30px; right: 40px;
    background: none; border: none; color: #5a5f6b; font-size: 24px; cursor: pointer;
    line-height: 1; padding: 10px; z-index: 20; transition: color 0.2s;
}
.fragment-close:hover { color: #f4f4f2; text-shadow: 0 0 8px rgba(255,255,255,0.5); }

.fragment-title {
    color: #f4f4f2; font-size: 20px; font-weight: bold; letter-spacing: 6px;
    margin-bottom: 40px; text-align: center; width: 100%;
}

.fragment-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; width: 100%; }

/* FIXED ALIGNMENT: Converted row structure to flexible row split layout */
.fragment-row {
    display: flex; flex-direction: row; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    transition: border-color 0.4s ease, background 0.4s ease, transform 0.2s ease;
}
.fragment-row:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(4px); }
.fragment-row.met { border-left-color: var(--current-theme-color, #c68a95); background: rgba(255,255,255,0.05); }
.fragment-row.just-revealed { animation: fragmentReveal 0.5s ease; }

@keyframes fragmentReveal {
    0% { background: rgba(255, 255, 255, 0.15); }
    100% { background: rgba(255, 255, 255, 0.05); }
}

.fragment-row-left { display: flex; flex-direction: column; gap: 4px; }
.fragment-id { font-size: 11px; letter-spacing: 3px; color: #5a5f6b; }
.fragment-codename { font-size: 13px; color: #888; line-height: 1.5; letter-spacing: 1px; }
.fragment-status { font-size: 13px; color: #5a5f6b; letter-spacing: 1px; text-align: right; }

.fragment-row.met .fragment-codename { color: var(--current-theme-color, #c68a95); font-weight: bold; text-shadow: 0 0 4px rgba(255,255,255,0.2); }
.fragment-row.met .fragment-status { color: var(--current-theme-color, #c68a95); font-weight: bold; text-shadow: 0 0 4px rgba(255,255,255,0.2); }

/* FIXED: Changed from bright vibrant green back to stable typography white */
.fragment-terminal-msg {
    color: #f4f4f2; 
    font-size: 13px; letter-spacing: 2px;
    margin-top: 20px; text-align: center;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
    width: 100%;
}

.fragment-minting-console {
    color: var(--current-theme-color, #c68a95);
    font-size: 13px; letter-spacing: 2px; line-height: 1.8;
    white-space: pre-line; margin-top: 30px; text-align: left;
    width: 100%; max-width: 400px;
    text-shadow: 0 0 8px rgba(255,255,255,0.2);
}

.fragment-theme-hint {
    color: #5a5f6b; font-size: 10px; letter-spacing: 2px;
    margin-top: 12px; font-style: italic; text-align: center;
}

.fragment-sync-row, .fragment-cert-row {
    display: none; flex-direction: column; align-items: center; gap: 16px;
    margin-top: 30px; padding-top: 30px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    width: 100%;
}

.fragment-preview-row {
    display: none; flex-direction: column; align-items: center; gap: 24px;
    margin-top: 30px; padding-top: 30px;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    width: 100%;
}

.fragment-sync-row.is-visible, .fragment-cert-row.is-visible, .fragment-preview-row.is-visible {
    display: flex; opacity: 1; transform: translateY(0);
}

.fragment-sync-msg { font-size: 12px; letter-spacing: 2px; color: #888; text-align: center; }

.fragment-name-input {
    width: 100%; max-width: 400px; background: #000; border: 1px solid rgba(255, 255, 255, 0.2);
    color: #f4f4f2; font-family: inherit; font-size: 14px; letter-spacing: 3px;
    padding: 14px; text-align: center; text-transform: uppercase; border-radius: 4px;
}
.fragment-name-input:focus { outline: none; border-color: var(--current-theme-color, #c68a95); box-shadow: 0 0 10px rgba(255,255,255,0.1); }

.fragment-btn {
    background: none; border: 1px solid rgba(255, 255, 255, 0.3);
    color: #f4f4f2; font-family: inherit; font-size: 13px; letter-spacing: 2px;
    padding: 12px 24px; cursor: pointer; border-radius: 4px;
    transition: all 0.2s ease;
}
.fragment-btn:hover { 
    border-color: var(--current-theme-color, #c68a95); 
    color: var(--current-theme-color, #c68a95); 
    background: rgba(255,255,255,0.02);
}

.preview-wrapper {
    position: relative; width: 100%; max-width: 480px; cursor: zoom-in;
}

.cert-preview {
    width: 100%; height: auto;
    border: 1px solid rgba(255,255,255,0.15); border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    animation: previewFadeIn 0.8s ease;
    transition: filter 0.2s;
}
.preview-wrapper:hover .cert-preview { filter: brightness(0.85); }

.preview-click-hint {
    position: absolute; bottom: 15px; right: 15px; background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2); color: #888; font-size: 9px;
    letter-spacing: 1px; padding: 4px 8px; border-radius: 2px; pointer-events: none;
    opacity: 0; transition: opacity 0.2s;
}
.preview-wrapper:hover .preview-click-hint { opacity: 1; }

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

.fragment-postcert-actions {
    display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%;
}

/* HIGH QUALITY FULLSCREEN LIGHTBOX STYLES */
.fragment-lightbox {
    position: fixed; inset: 0; background: rgba(5,5,5,0.96);
    z-index: 600; display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: zoom-out;
    padding: 40px; box-sizing: border-box;
}

.fragment-lightbox img {
    max-width: 100%; max-height: 82vh; object-fit: contain;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 30px 70px rgba(0,0,0,0.9);
    animation: lightboxZoom 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes lightboxZoom {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    margin-top: 24px; color: #5a5f6b; font-size: 12px; letter-spacing: 3px;
    transition: color 0.2s;
}
.fragment-lightbox:hover .lightbox-close { color: #f4f4f2; }

/* The One-Time Hint */
.fragment-hint {
    position: absolute; bottom: 40px; width: 100%; text-align: center;
    color: #5a5f6b; font-size: 11px; letter-spacing: 3px; font-family: inherit;
    animation: hintFlicker 3s infinite; pointer-events: none;
}
@keyframes hintFlicker {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}