/* Fonts & Custom Settings */
@font-face {
    font-family: 'RetroNumbers';
    src: local('Times New Roman'), local('Times'), local('Liberation Serif');
    unicode-range: U+0030-0039;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-color: #000000;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --panel-bg: rgba(255, 255, 255, 0.04);
    --header-bg: rgba(0, 0, 0, 0.75);
    --border-color: rgba(255, 255, 255, 0.1);
    --arcade-gold: #ffcc00;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'RetroNumbers', 'Georgia', 'Times New Roman', Times, serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Hide scrollbars */
body::-webkit-scrollbar {
    display: none;
}
body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Container limits viewport width to simulate phone experience */
.bio-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 3rem;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

/* Header styles matching Customizer */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: 0.75rem;
    align-items: center;
    padding: 1rem;
    background-color: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 9999;
}

.header::after {
    content: "";
    grid-column: 3;
    display: block;
}

.back-button {
    grid-column: 1;
    justify-self: start;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    transition: color 0.2s;
    font-size: 0.75rem;
}

.back-button svg {
    width: 16px;
    height: 16px;
}

.back-button:hover {
    color: var(--text-secondary);
}

.header-title {
    grid-column: 2;
    font-size: 0.85rem;
    white-space: nowrap;
    margin: 0;
    font-family: 'RetroNumbers', 'Georgia', 'Times New Roman', Times, serif;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
    justify-self: center;
}

.back-button,
.header-title,
.char-id-tag,
.char-name-title,
.supporter-label,
.panel-section-title,
.stat-name,
.stat-val {
    filter: url(#chromatic-aberration);
}

/* Card layout grid */
.card-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

/* Left Panel - Character Preview */
.sprite-panel {
    background-color: #111111;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.sprite-container {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sprite-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.35)) drop-shadow(0 0 8px rgba(255, 255, 255, 0.18)) url(#chromatic-aberration);
}

/* Right Panel - Info details */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.char-id-tag {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.char-name-title {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--arcade-gold);
    text-transform: uppercase;
    text-shadow: 
        -1.5px -1.5px 0 #000, 1.5px -1.5px 0 #000, -1.5px 1.5px 0 #000, 1.5px 1.5px 0 #000,
        -2.5px -2.5px 0 #000, 2.5px -2.5px 0 #000, -2.5px 2.5px 0 #000, 2.5px 2.5px 0 #000,
        0 0 8px rgba(255, 204, 0, 0.3);
    letter-spacing: 1px;
}

.panel-section-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 2px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

/* Supporter Information Box */
.supporter-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.supporter-label {
    font-size: 0.55rem;
    font-weight: bold;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.supporter-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.25);
}

.supporter-tier {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--arcade-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Background Bio Box */
.bio-text-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.bio-desc {
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.6;
}

/* Stats Progress Bar Rows */
.stats-box {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-name {
    width: 80px;
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.stat-bar-bg {
    flex-grow: 1;
    height: 10px;
    background-color: #1a1a1a;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.1, 0.8, 0.2, 1);
    box-shadow: 0 0 8px currentColor;
}

/* Colored themes for Stats */
.starch-color {
    background-color: var(--arcade-gold);
    color: var(--arcade-gold);
}

.steel-color {
    background-color: #94a3b8;
    color: #94a3b8;
}

.spice-color {
    background-color: #ff4444;
    color: #ff4444;
}

.sweet-color {
    background-color: #ff66cc;
    color: #ff66cc;
}

.stat-val {
    width: 25px;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-secondary);
    text-align: right;
}

/* --- VHS CRT Scanline Overlays --- */
.vhs-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        rgba(0, 0, 0, 0) 0px,
        rgba(0, 0, 0, 0) 1px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 3px
    );
    background-size: 100% 3px;
    animation: scanlines-scroll 10s linear infinite;
    pointer-events: none;
    z-index: 10000; /* Placed above header and all content layers */
    overflow: hidden;
}

.vhs-overlay::before {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    filter: blur(1px);
    animation: tracking-roll 6s linear infinite;
    z-index: 3;
    opacity: 0;
}

.vhs-overlay::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 5;
}

@keyframes scanlines-scroll {
    from { background-position: 0 0; }
    to { background-position: 0 120px; }
}

@keyframes tracking-roll {
    0% { top: -20px; opacity: 0; }
    8% { opacity: 0.5; }
    33% { top: 100%; opacity: 0.5; }
    34% { opacity: 0; }
    100% { top: 100%; opacity: 0; }
}
