@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Outfit:wght@400;600;700;800&display=swap');
@import url('./variables.css');
@import url('./animations.css');
@import url('./components.css');
@import url('./minigame.css');

*
{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body
{
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.05) 0%, transparent 40%);
}

#app
{
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

/* Header & Status Bar */
header.app-header
{
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.header-top
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.logo-group
{
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-title
{
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.date-badge
{
    background: rgba(255, 255, 255, 0.05);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-grid
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 0.75rem;
}

.stat-card
{
    background: rgba(10, 13, 20, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-info
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-bar-outer
{
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.stat-bar-inner
{
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s;
}

/* Content Layout */
.main-layout
{
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.narrative-panel
{
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-subtle);
    height: 100%;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.story-container
{
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-bottom: 0.75rem;
    padding-right: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.story-log-entry
{
    line-height: 1.6;
    font-size: 1.05rem;
    color: var(--text-primary);
    animation: fadeIn 0.3s ease-out;
}

.story-log-entry.event-entry
{
    border-left: 3px solid var(--accent-amber);
    padding-left: 0.75rem;
    background: rgba(245, 158, 11, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.story-log-entry.danger-entry
{
    border-left: 3px solid var(--accent-red);
    padding-left: 0.75rem;
    background: rgba(239, 68, 68, 0.05);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.story-log-entry.phase-entry
{
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent-blue);
    margin: 0.5rem 0;
}

body[data-phase="morning"] .story-log-entry.phase-entry
{
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.35);
    color: var(--accent-amber);
}

body[data-phase="evening"] .story-log-entry.phase-entry
{
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.35);
    color: var(--accent-purple);
}

body[data-phase="night"] .story-log-entry.phase-entry
{
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.35);
    color: #818cf8;
}

.story-log-entry.day-entry
{
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.15), transparent);
    border-top: 1px solid rgba(251, 191, 36, 0.35);
    border-bottom: 1px solid rgba(251, 191, 36, 0.35);
    padding: 0.75rem;
    text-align: center;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-gold);
    margin: 0.75rem 0;
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.story-log-entry.comment-neutral-entry
{
    background: linear-gradient(90deg, rgba(100, 116, 139, 0.08), rgba(100, 116, 139, 0.14), rgba(100, 116, 139, 0.08));
    border-left: 3px solid rgba(148, 163, 184, 0.55);
    border-radius: 0 6px 6px 0;
    padding: 0.6rem 0.85rem;
    margin: 0.4rem 0 0.4rem 0.25rem;
    font-style: italic;
    font-size: 0.88rem;
    color: #cbd5e1;
    opacity: 0.9;
}

.story-log-entry.comment-negative-entry
{
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.06), rgba(239, 68, 68, 0.12), rgba(239, 68, 68, 0.06));
    border-left: 3px solid rgba(248, 113, 113, 0.6);
    border-radius: 0 6px 6px 0;
    padding: 0.6rem 0.85rem;
    margin: 0.4rem 0 0.4rem 0.25rem;
    font-style: italic;
    font-size: 0.88rem;
    color: #fca5a5;
    opacity: 0.9;
}


/* Dynamic Phase Themes */
body[data-phase="morning"]
{
    background-image: 
        radial-gradient(circle at 50% 5%, rgba(245, 158, 11, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.08) 0%, transparent 40%);
}

body[data-phase="work"]
{
    background-image: 
        radial-gradient(circle at 50% 5%, rgba(56, 189, 248, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 85%, rgba(168, 85, 247, 0.05) 0%, transparent 40%);
}

body[data-phase="evening"]
{
    background-image: 
        radial-gradient(circle at 50% 5%, rgba(168, 85, 247, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 85% 15%, rgba(239, 68, 68, 0.08) 0%, transparent 40%);
}

body[data-phase="night"]
{
    background-image: 
        radial-gradient(circle at 50% 5%, rgba(30, 41, 59, 0.5) 0%, transparent 60%),
        radial-gradient(circle at 15% 85%, rgba(15, 23, 42, 0.8) 0%, transparent 40%);
}

.action-buttons-container
{
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    z-index: 2;
}

/* Sidebar Panels */
.sidebar
{
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.sidebar-card
{
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    box-shadow: var(--shadow-subtle);
}

.sidebar-title
{
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.info-row
{
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.info-label
{
    color: var(--text-secondary);
}

.info-value
{
    font-weight: 600;
    color: var(--text-primary);
}

/* Custom Scrollbar */
::-webkit-scrollbar
{
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track
{
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb
{
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover
{
    background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 900px)
{
    #app
    {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .main-layout
    {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .narrative-panel
    {
        height: 60vh;
        height: 60dvh;
        min-height: 380px;
    }

    .sidebar
    {
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 600px)
{
    .hide-mobile
    {
        display: none;
    }

    .status-grid
    {
        grid-template-columns: repeat(2, 1fr);
    }

    .narrative-panel
    {
        padding: 1rem;
        height: 55vh;
        height: 55dvh;
        min-height: 340px;
    }
}
