/* GLOBAL */
body {
    margin: 0;
    background: radial-gradient(circle at 25% 25%, #4b5d9a 0%, #2a345c 25%, #141a33 55%, #080a1a 75%, #000000 100%);
    background-size: 250% 250%;
    animation: bgPulse 16s ease-in-out infinite;
    color: white;
    font-family: 'Funnel Display', sans-serif;
    overflow: hidden;
}

@keyframes bgPulse {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* GRID */
.grid {
    display: grid;
    height: 100vh;
    width: 100vw;
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    grid-auto-flow: dense;
}

/* TILE BASE */
.tile {
    border-radius: 16px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(18px) saturate(160%);
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25), inset 0 0 20px rgba(255,255,255,0.05);
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
}

/* DRAMATIC OVERLAY GRADIENT ON TILES */
.tile::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background: radial-gradient(circle at 25% 25%, #4b5d9a 0%, #2a345c 25%, #141a33 55%, #080a1a 75%, #000000 100%);
    background-size: 250% 250%;
    animation: bgPulse 16s ease-in-out infinite;
    mix-blend-mode: overlay;
    opacity: 0.55;
    pointer-events: none;
}

.tile > * {
    position: relative;
    z-index: 3;
    min-height: 0;
}

/* CLOCK */
.clock { text-align: center; }
.time { font-size: 2.8rem; }
.date { opacity: .7; }

/* WEATHER */
[data-id="weather"] {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.weather-left { display: flex; flex-direction: column; gap: 4px; }
.temp { font-size: 2.6rem; }
.icon { font-size: 3rem; }
.details { font-size: 0.9rem; opacity: 0.8; }

/* NOTES, CALENDAR, NEWS — TOP ALIGN */
[data-id="notes"],
[data-id="calendar"],
[data-id="news"] {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* SCROLLABLE CONTENT */
#notes-box,
#calendar-view,
#news-view,
.events,
#news-articles {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* NOTES */
#notes-box {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 14px;
    color: #fff;
    resize: none;
    outline: none;
}

::placeholder { color: white; opacity: 1; }

/* MAIL */
.mail-widget {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    cursor: pointer;
}

.mail-label { font-size: 1.4rem; opacity: 0.85; text-align: center; }
.mail-emoji { font-size: 2.4rem; margin-top: 6px; opacity: 0.9; }

/* NEWS ITEM BASE */
.news-item {
    padding: 10px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
    border-left: 4px solid rgba(255,255,255,0.2);
}

.news-item a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.3;
    display: block;
}

.news-item a:hover { text-decoration: underline; opacity: 0.9; }

/* HEADERS */
.news-header,
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

/* EVENTS */
.event {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.08);
}

/* SPOTIFY */
[data-id="spotify"] iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    display: block;
    min-height: 0;
}

.spotify-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.sp-cover { width: 100%; border-radius: 8px; }
.sp-info { text-align: center; }
.sp-title { font-size: 1rem; font-weight: bold; }
.sp-artist { font-size: 0.85rem; opacity: 0.7; }

.sp-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.sp-controls button {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: white;
}

/* COORDINATES */
[data-id="clock"]      { grid-column: 1 / 3; grid-row: 1 / 2; }
[data-id="weather"]    { grid-column: 3 / 4; grid-row: 1 / 2; }
[data-id="calculator"] { grid-column: 4 / 5; grid-row: 1 / 3; }
[data-id="home"]       { grid-column: 3 / 4; grid-row: 2 / 3; }
[data-id="news"]       { grid-column: 5 / 7; grid-row: 1 / 4; }
[data-id="calendar"]   { grid-column: 1 / 3; grid-row: 2 / 5; }
[data-id="notes"]      { grid-column: 3 / 5; grid-row: 3 / 5; }
[data-id="mail1"]      { grid-column: 5 / 6; grid-row: 4 / 5; }
[data-id="mail2"]      { grid-column: 6 / 7; grid-row: 4 / 5; }

/* CALCULATOR */
[data-id="calculator"] {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 6px;
    gap: 6px;
    overflow: hidden;
}

.calc-display {
    background: rgba(255,255,255,0.12);
    padding: 4px 6px;
    border-radius: 8px;
    font-size: 1.1rem;
    text-align: right;
    border: 1px solid rgba(255,255,255,0.2);
    height: 28px;
    line-height: 28px;
    color: white;
}

.calc-display:focus {
    outline: none;
    caret-color: white;
}

.calc-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    flex: 1;
    min-height: 0;
}

.calc-buttons button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 4px;
    font-size: 0.85rem;
    color: white;
    cursor: pointer;
    backdrop-filter: blur(6px);
    min-height: 0;
}

.calc-buttons .zero { grid-column: span 2; }
.calc-buttons .equals { grid-column: span 3; }

/* HOME TILE */
[data-id="home"] {
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.home-emoji {
    font-size: 4.5rem;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* SETTINGS PANEL BASE */
#news-settings,
#calendar-settings {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 14px;
    padding: 14px;
    margin-top: 8px;
    backdrop-filter: blur(12px);
    animation: fadeIn 0.25s ease;
}

#news-source-list {
    overflow-y: scroll;
    max-height: 275px;
}

/* LIST ITEMS */
.calendar-item,
.news-source-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    gap: 10px;
}

/* LABEL TEXT */
.calendar-item span,
.news-source-item label {
    font-size: 1rem;
    flex: 1;
}

/* COLOUR PICKERS */
.calendar-item input[type=color],
.news-source-item input[type=color] {
    width: 36px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

/* DELETE BUTTON */
.cal-delete {
    background: rgba(255,80,80,0.25);
    border: 1px solid rgba(255,80,80,0.4);
    color: #ffb3b3;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.15s ease;
}

.cal-delete:hover {
    background: rgba(255,80,80,0.4);
    color: white;
}

/* FILE UPLOAD AREA */
#calendar-settings label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    cursor: pointer;
}

#calendar-settings input[type=file] { cursor: pointer; }

/* Fade animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}