:root {
    --bg-main: #0a0a0f;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --grid-line: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(0, 0, 0, 0.5);
    --accent: #FFB800;
    --accent-rgb: 255, 184, 0;
    --border-radius: 8px;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #1a0800;
    background-image: url('BackdroundWithoutText.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: var(--text-primary);
    font-family: 'Bahnschrift', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

.calendar-wrapper {
    width: 95vw;
    max-width: 1800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.calendar-container {
    width: min(100%, calc(85vh * 1.5));
    aspect-ratio: 3 / 2;
    background-image: url('calendar-container-bg.png');
    background-size: 100.1% 100.1%;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 0px;
    position: relative;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* The fixed-dimension physical canvas that scales dynamically */
.canvas-scaler {
    position: absolute;
    top: 0;
    left: 0;
    width: 1800px;
    height: 1200px;
    transform-origin: top left;
    display: flex;
    flex-direction: column;
    padding-top: 120px;
    box-sizing: border-box;
}

#calendar-grid {
    position: relative;
    width: 100%;
    /* Margin moved up to scaler padding for consistency */
    flex: 1 1 50%;
    display: flex;
    flex-direction: column;
}

.day-headers {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--grid-line);
    backdrop-filter: blur(10px);
    width: 100%;
    height: 45px;
    flex-shrink: 0;
}

.day-header {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: 1px;
    color: var(--text-primary);
    border-right: 1px solid var(--grid-line);
}

.day-header:last-child {
    border-right: none;
}

.events-area {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

.day-column {
    flex: 1;
    position: relative;
    border-right: 1px solid transparent;
}

/* Event Cards in the Grid */
.event-card {
    position: absolute;
    background: var(--card-bg);
    border-radius: 6px;
    padding: 4px 4px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    backdrop-filter: blur(8px);
    overflow: hidden;
    cursor: pointer;
    text-align: center;
}


.event-card .event-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    line-height: normal;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}


/* Details Section */
.events-details-container {
    flex: 0 0 auto;
    margin: 0 8px 8px 8px;
    display: grid;
    /* 4 columns */
    grid-template-columns: repeat(4, 1fr);
    grid-auto-columns: 1fr;
    grid-auto-rows: 1fr;
    gap: 8px;
    padding-bottom: 0px;
}

.detail-card {
    background: rgba(0, 0, 0, 0.75);
    border-radius: var(--border-radius);
    padding: 8px;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    position: relative;
    height: 200px;
    overflow: hidden;
    z-index: 1;
}

.card-blur-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -2;
    pointer-events: none;
    overflow: hidden;
    border-radius: var(--border-radius);
}

.bg-blur-slice {
    position: absolute;
    inset: -5px;
    /* Oversize a bit for offset safety */
    background-image: url('calendar-container-bg.png');
    background-size: 1800px 1200px;
    background-repeat: no-repeat;
    opacity: 0.1;
    /* Reduced from 0.15 */
}

.card-logo-bg {
    position: absolute;
    top: -40px;
    left: -40px;
    width: 312px;
    height: 312px;
    pointer-events: none;
    z-index: -1;
}

.logo-blur-slice {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.card-top-section {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
    /* Prevent pushing the footer down */
    min-height: 0;
    /* Essential for nested flex overflow */
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    /* Optional: soft fade at bottom of top section */
}

.card-info {
    flex-grow: 1;
}

.card-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding-left: 16px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 100px;
}

.qr-code {
    width: 90px;
    height: 90px;
    background: white;
    padding: 6px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}


.title-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.detail-card .event-title {
    font-weight: 700;
    font-size: 22px;
    color: var(--text-primary);
    white-space: normal;
    word-break: break-word;
    overflow: hidden;
}

.detail-card .event-time {
    display: flex;
    align-items: baseline;
    gap: 8px;
    line-height: 1.2;
}

.detail-card .event-time.main-time {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 2px;
}

.detail-card .event-time.main-time .time-day {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 800;
}

.detail-card .event-time.main-time .time-utc {
    opacity: 0.9;
}

.detail-card .event-time.sub-time {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
    padding-left: 0;
    /* Align with main time */
}

.grid-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--grid-line);
}


.detail-card .event-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.3;
    flex-grow: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.detail-card .event-footer {
    margin-top: 8px;
    /* Reduced to fit better */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
    /* Never get squished or pushed out */
}

.server-code {
    font-family: 'Space Mono', monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    letter-spacing: 1px;
    color: var(--accent);
    text-align: center;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 4px 6px;
}

.badge-container {
    display: flex;
    gap: 8px;
}

.discord-badge {
    background: #5865F2;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#save-png-btn {
    display: block;
    padding: 12px 32px;
    background: rgba(180, 60, 0, 0.7);
    color: #fff;
    border-radius: 8px;
    font-family: 'Bahnschrift', sans-serif;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

#save-png-btn:hover {
    transform: translateY(-1px);
}

#save-png-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.utc-disclaimer {
    display: flex;
    justify-content: flex-end;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 700;
    pointer-events: none;
    z-index: 100;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'Space Mono', monospace;
    margin-right: 16px;
    margin-bottom: 8px;
}