/* ==========================================================================
   TOI TEN LA CAU BE DE THUONG - PIXEL TROLL WEBSITE STYLES
   Font: UTM Avo Regular
   ========================================================================== */

/* UTM Avo Webfont Imports */
@font-face {
    font-family: 'UTM Avo';
    src: url('https://fonts.cdnfonts.com/s/72228/UTMAvo.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'UTM Avo';
    src: url('https://fonts.cdnfonts.com/s/72228/UTMAvoBold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
}

:root {
    --bg-dark: #120b18;
    --bg-card: rgba(28, 18, 42, 0.88);
    --primary-pink: #ff6b9d;
    --accent-pink: #ff9ebb;
    --sakura-petal: #ffc2d1;
    --neon-cyan: #00f0ff;
    --neon-yellow: #ffee00;
    --rage-red: #ff3366;
    --text-light: #fff0f5;
    --pixel-border: #4a2c5a;
    --font-main: 'UTM Avo', 'Montserrat', sans-serif;
    --font-pixel: 'UTM Avo', 'Press Start 2P', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    cursor: default;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Canvas for Falling Petals */
#petalCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* Background Ambient Glow */
.bg-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 107, 157, 0.18) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
    z-index: 0;
    animation: pulseGlow 6s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    0% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.15); opacity: 0.9; }
}

/* Floating Admin Access Button */
.admin-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(28, 18, 42, 0.9);
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    border-radius: 30px;
    padding: 10px 18px;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
    transition: all 0.2s ease;
}

.admin-float-btn:hover {
    transform: scale(1.08);
    background: var(--neon-cyan);
    color: #120b18;
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.6);
}

/* Main Container */
.container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 850px;
    margin: 2rem auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    text-align: center;
}

/* Story Header Section */
.story-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 3px solid var(--primary-pink);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    box-shadow: 0 8px 32px rgba(255, 107, 157, 0.25), inset 0 0 15px rgba(255, 107, 157, 0.1);
    backdrop-filter: blur(8px);
    width: 100%;
}

.pixel-badge {
    font-family: var(--font-main);
    font-size: 0.8rem;
    background: linear-gradient(90deg, #ff6b9d, #ff9ebb);
    color: #1a0614;
    padding: 6px 16px;
    border-radius: 20px;
    letter-spacing: 1px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 107, 157, 0.4);
}

.main-title {
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1.85rem;
    line-height: 1.4;
    color: var(--neon-yellow);
    text-shadow: 2px 2px 0px #b80058, 0 0 15px rgba(255, 238, 0, 0.5);
    margin-top: 0.25rem;
}

.story-subtitle {
    font-family: var(--font-main);
    font-size: 1.1rem;
    color: var(--accent-pink);
    max-width: 650px;
    line-height: 1.6;
    min-height: 50px;
}

.warning-banner {
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.1);
    border: 2px dashed var(--neon-cyan);
    padding: 8px 16px;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.blink {
    animation: blinkEffect 1s infinite steps(2, start);
    color: var(--rage-red);
}

@keyframes blinkEffect {
    to { opacity: 0; }
}

/* Stage & Avatar Canvas Wrapper */
.stage-section {
    display: flex;
    justify-content: center;
    width: 100%;
}

.avatar-wrapper {
    position: relative;
    width: 380px;
    height: 380px;
    border-radius: 20px;
    background: radial-gradient(circle at center, #2e1a38 0%, #15091c 100%);
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: visible;
    transition: transform 0.2s ease;
}

.avatar-wrapper:hover {
    transform: scale(1.02);
}

/* Retro Frame Border */
.pixel-frame-border {
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border: 4px solid var(--primary-pink);
    border-radius: 24px;
    pointer-events: none;
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.4);
}

.pixel-frame-border .corner {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--neon-yellow);
    border: 2px solid #000;
}

.corner.top-left { top: -6px; left: -6px; }
.corner.top-right { top: -6px; right: -6px; }
.corner.bottom-left { bottom: -6px; left: -6px; }
.corner.bottom-right { bottom: -6px; right: -6px; }

#avatarCanvas {
    width: 360px;
    height: 360px;
    border-radius: 16px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Dynamic Speech Bubbles Container */
.bubble-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 10;
}

/* Speech Bubble Styles */
.speech-bubble {
    position: absolute;
    background: #ffffff;
    color: #120b18;
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.95rem;
    padding: 10px 14px;
    border-radius: 12px;
    border: 3px solid #000;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.8), 0 0 15px rgba(255, 51, 102, 0.6);
    white-space: nowrap;
    animation: popAndFly 1.8s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

.speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 20px;
    border-width: 10px 8px 0;
    border-style: solid;
    border-color: #ffffff transparent;
    display: block;
    width: 0;
}

.speech-bubble.rage-text {
    background: #ff3366;
    color: #ffffff;
    font-size: 1.05rem;
    border-color: #ffee00;
    animation: ragePop 1.2s forwards ease-out;
}

@keyframes popAndFly {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(10px) rotate(-5deg);
    }
    15% {
        opacity: 1;
        transform: scale(1.1) translateY(-10px) rotate(3deg);
    }
    30% {
        transform: scale(1) translateY(-25px) rotate(-2deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.9) translateY(-90px) rotate(8deg);
    }
}

@keyframes ragePop {
    0% { opacity: 0; transform: scale(0.2) translateY(0); }
    20% { opacity: 1; transform: scale(1.3) translateY(-15px); }
    100% { opacity: 0; transform: scale(1) translateY(-110px) rotate(-10deg); }
}

/* Status Badge below Avatar */
.status-badge {
    position: absolute;
    bottom: -18px;
    background: #1c122a;
    border: 2px solid var(--primary-pink);
    padding: 6px 16px;
    border-radius: 20px;
    font-family: var(--font-main);
    font-size: 0.85rem;
    color: var(--accent-pink);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    z-index: 5;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

.status-dot.angry {
    background: var(--rage-red);
    box-shadow: 0 0 10px var(--rage-red);
    animation: blinkEffect 0.3s infinite;
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    margin-top: 0.5rem;
}

.pixel-btn {
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 0.85rem;
    background: linear-gradient(180deg, #3d2154 0%, #200f30 100%);
    color: var(--text-light);
    border: 2px solid var(--primary-pink);
    border-radius: 12px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 0px var(--pixel-border), 0 6px 15px rgba(0,0,0,0.4);
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.pixel-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(180deg, #532c73 0%, #301747 100%);
    box-shadow: 0 6px 0px var(--pixel-border), 0 8px 20px rgba(255, 107, 157, 0.4);
    color: var(--neon-yellow);
}

.pixel-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0px var(--pixel-border);
}

.rage-btn {
    background: linear-gradient(180deg, #ff3366 0%, #990026 100%);
    border-color: var(--neon-yellow);
    color: #ffffff;
}

.rage-btn:hover {
    background: linear-gradient(180deg, #ff5580 0%, #cc0033 100%);
    box-shadow: 0 6px 0px #550011, 0 8px 25px rgba(255, 51, 102, 0.6);
}

.upload-btn {
    background: linear-gradient(180deg, #0088cc 0%, #004466 100%);
    border-color: var(--neon-cyan);
}

.upload-btn:hover {
    background: linear-gradient(180deg, #00aaff 0%, #006699 100%);
}

.submit-btn {
    background: linear-gradient(180deg, #00b359 0%, #006633 100%);
    border-color: #00ff88;
}

.submit-btn:hover {
    background: linear-gradient(180deg, #00e673 0%, #008040 100%);
}

/* Screen Shake Effect for Rage Mode */
.shake-screen {
    animation: screenShake 0.4s infinite cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenShake {
    10%, 90% { transform: translate3d(-2px, 1px, 0); }
    20%, 80% { transform: translate3d(3px, -2px, 0); }
    30%, 50%, 70% { transform: translate3d(-5px, 3px, 0); }
    40%, 60% { transform: translate3d(5px, -3px, 0); }
}

/* Footer Bio Card */
.footer-story {
    width: 100%;
    margin-top: 1rem;
}

.bio-card {
    background: var(--bg-card);
    border: 2px solid rgba(255, 107, 157, 0.3);
    border-radius: 14px;
    padding: 1.5rem;
    text-align: left;
    backdrop-filter: blur(6px);
}

.bio-card h3 {
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 1rem;
    color: var(--neon-cyan);
    margin-bottom: 1rem;
    border-bottom: 1px dashed rgba(255, 107, 157, 0.3);
    padding-bottom: 0.5rem;
}

.bio-card ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 1rem;
    color: #e0d0ea;
}

.bio-card code {
    background: rgba(255, 51, 102, 0.2);
    color: var(--neon-yellow);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-main);
    font-size: 0.85rem;
}

.copyright-text {
    font-size: 0.9rem;
    color: #8a709b;
    margin-top: 1.5rem;
}

.copyright-text code {
    color: var(--primary-pink);
    font-weight: bold;
}

/* Custom Petal Cursor */
.custom-cursor {
    position: fixed;
    pointer-events: none;
    font-size: 1.5rem;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
    opacity: 0.8;
}

/* ==========================================================================
   ADMIN MODAL & STANDALONE PAGE STYLES
   ========================================================================== */

.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 5, 15, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.admin-modal-content {
    position: relative;
    background: var(--bg-card);
    border: 3px solid var(--neon-cyan);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 10px 40px rgba(0, 240, 255, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: var(--accent-pink);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--rage-red);
}

.admin-view h2 {
    font-size: 1.4rem;
    color: var(--neon-yellow);
    margin-bottom: 0.5rem;
    text-align: center;
}

.admin-hint {
    font-size: 0.9rem;
    color: var(--accent-pink);
    text-align: center;
    margin-bottom: 1.5rem;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-align: left;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--neon-cyan);
}

.form-group input,
.form-group textarea {
    background: rgba(15, 8, 24, 0.9);
    border: 2px solid var(--pixel-border);
    border-radius: 10px;
    padding: 10px 14px;
    color: #ffffff;
    font-family: var(--font-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 10px rgba(255, 107, 157, 0.4);
}

.error-msg {
    color: var(--rage-red);
    font-size: 0.85rem;
    font-weight: bold;
    text-align: center;
    min-height: 20px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

/* Standalone Admin Page Body & Card */
.admin-page-body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    min-height: 100vh;
}

.admin-standalone-card {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    border: 3px solid var(--primary-pink);
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 650px;
    box-shadow: 0 10px 40px rgba(255, 107, 157, 0.3);
    text-align: center;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .main-title {
        font-size: 1.3rem;
    }
    
    .story-subtitle {
        font-size: 0.95rem;
    }

    .avatar-wrapper {
        width: 300px;
        height: 300px;
    }

    #avatarCanvas {
        width: 280px;
        height: 280px;
    }
    
    .pixel-btn {
        font-size: 0.75rem;
        padding: 10px 14px;
    }

    .admin-standalone-card {
        padding: 1.5rem;
    }
}
