* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #6a4c93 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Home Page Styles */
#homePage {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #6a4c93 100%);
    padding: 2rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-content {
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.logo-section {
    margin-bottom: 3rem;
}

.kas-logo {
    background: #ffd700;
    color: #000;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin: 0 auto 1.5rem;
}

.brand-text h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.5;
    margin-bottom: 2rem;
}

.calendar-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.calendar-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.nav-button {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.weekday {
    text-align: center;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    padding: 0.5rem 0;
}

.calendar-dates {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

.calendar-date {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: transparent;
    color: #fff;
}

.calendar-date.has-stories {
    background: rgba(139, 69, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.calendar-date.has-stories:hover {
    background: rgba(139, 69, 255, 0.9);
    transform: scale(1.05);
}
.calendar-date:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.calendar-date.has-stories:hover {
    background: rgba(139, 69, 255, 0.9);
}
.calendar-date.other-month {
    color: rgba(255, 255, 255, 0.3);
    cursor: default;
}

.calendar-date.other-month:hover {
    background: transparent;
    transform: none;
}

.calendar-date.selected {
    background: rgba(74, 158, 255, 0.8);
    color: #fff;
    transform: scale(1.05);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.calendar-date.selected.has-stories {
    background: rgba(74, 158, 255, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.story-count {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #ff1744;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.9);
    z-index: 10;
}

.calendar-date.selected .story-count {
    background: #ff1744;
    border: 2px solid white;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.legend-box {
    position: relative;
    width: 24px;
    height: 24px;
    background: rgba(139, 69, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
}

.legend-count {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 14px;
    height: 14px;
    background: #ff1744;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.legend-date {
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
}

.selected-dot {
    background: rgba(255, 255, 255, 0.5);
}

.empty-state {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

/* Story View Styles */
#storyPage {
    background: #000;
    position: relative;
    overflow: hidden;
}

.story-content {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.story-container {
    min-height: 100vh;
}

.story-card {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    scroll-snap-align: start;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #6a4c93 100%);
}

.story-header {
    padding: 1.5rem 1.5rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.story-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.story-kas-logo {
    background: #ffd700;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Ensures the image stays within the box */
    padding: 0;
}
.story-kas-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.story-brand-text h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.25rem;
}

.story-date {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.story-image-section {
    height: 26vh;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    margin-top: 0;
}

.story-image {
    width: 100%;
    height: 90%;
    object-fit: cover;
    border-radius: 0;
}

.story-content-area {
    height: 60vh;
    padding: 2rem 1.5rem 8rem;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.story-source {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
}

.story-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 1rem;
}

.story-snippet {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.story-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.story-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.read-more-btn {
    background: #4a9eff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1.5rem;
    align-self: flex-start;
}

.read-more-btn:hover {
    background: #357abd;
    transform: translateY(-2px);
}

.read-more-btn:active {
    transform: translateY(0);
}

.old-read-more {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #4a9eff;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.story-navigation {
    position: fixed;
    top: 88%;
    right: 1rem;
    transform: translateY(-50%);
    z-index: 20;
}

.story-counter {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
}

.story-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
}

.story-link-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    margin-left: 0.5em;
    color: inherit;
    vertical-align: middle;
    padding: 0;
}
.story-link-btn:hover {
    text-decoration: underline;
    color: #1e3c72;
}

.nav-left {
    display: flex;
    align-items: center;
}

.nav-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.sponsor-logo {
    height: 24px;
    width: auto;
}

.nav-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.home-active {
    color: #4a9eff;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4a9eff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: #fff;
    font-size: 1.1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .home-content {
        padding: 0 0.5rem;
    }
    
    .brand-text h1 {
        font-size: 1.75rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .calendar-container {
        padding: 1.25rem;
    }
    
    .story-header {
        padding: 1.5rem 1rem 1rem;
    }
    
    .story-content-area {
        padding: 0.2rem 1rem 8rem;
    }
    
    .story-title {
        font-size: 1.3rem;
    }
    
    .story-bottom-nav {
        gap: 2rem;
    }
}

@media (max-width: 480px) {
    .kas-logo {
        width: 80px;
        height: 80px;
        font-size: 1rem;
    }
    
    .brand-text h1 {
        font-size: 1.5rem;
    }
    
    .calendar-container {
        padding: 1rem;
    }
    
    .calendar-date {
        font-size: 0.8rem;
    }
    
    .story-title {
        font-size: 1.2rem;
    }
    
    .story-snippet {
        font-size: 0.95rem;
    }
}