@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

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

body > div:first-child,
body > div:nth-child(3) {
    position: fixed;
    top: 24px;
    z-index: 10;
}

body > div:first-child svg,
body > div:nth-child(3) svg {
    width: 150px;
    height: auto;
}

body > div:first-child {
    left: 24px;
    fill: #c51523;
}

body > div:nth-child(3) {
    right: 24px;
    fill: #0085b7;
}

@keyframes drift {
    0% {
        transform: translate(-25%, -25%) translate(0px, 0px);
    }

    25% {
        transform: translate(-25%, -25%) translate(25px, -25px);
    }

    50% {
        transform: translate(-25%, -25%) translate(-25px, 25px);
    }

    75% {
        transform: translate(-25%, -25%) translate(-25px, -25px);
    }

    100% {
        transform: translate(-25%, -25%) translate(0px, 0px);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

body {
    background: linear-gradient(90deg,rgba(39, 66, 92, 1) 0%, rgba(25, 46, 61, 1) 100%);
    background-size: 300% 300%;
    animation: gradientShift 120s ease infinite;

    overflow: hidden;

    font-family: 'Roboto', sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
}


.tiles {
    display: grid;
    grid-template-columns: repeat(4, 150px);
    grid-template-rows: repeat(2, 150px);
    gap: 8px;
    position: absolute;
    left: 33%;
    top: 37%;
    transform: translate(-50%, -50%);
    animation: drift 150s ease-in-out infinite;
}

.tile {
    background: #00d736;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    position: relative;
    transition: filter 0.15s ease, transform 0.15s ease;
    border-radius: 20px;
}

.tile:active {
    transform: scale(0.96);
    filter: brightness(0.9);
}

.tile-2x1 {
    grid-column: span 2;
}

.tile-2x2 {
    grid-column: span 2;
    grid-row: span 2;
}

.green {
    background: linear-gradient(135deg, #3a923a, #2c8f2c, #18a518);
    background-size: 300% 300%;
    animation: gradientShift 25s ease infinite;
}
.red {
    background: linear-gradient(135deg, #ee4040, #c91f2d, #971421);
    background-size: 300% 300%;
    animation: gradientShift 28s ease infinite;
}
.orange {
    background: linear-gradient(135deg, #cf651e, #a05111, #b35609);
    background-size: 300% 300%;
    animation: gradientShift 22s ease infinite;
}
.purple {
    background: linear-gradient(135deg, #5c2d91, #7a3dbf, #4a2478);
    background-size: 300% 300%;
    animation: gradientShift 30s ease infinite;
}
.teal {
    background: linear-gradient(135deg, #008272, #00a896, #006b5e);
    background-size: 300% 300%;
    animation: gradientShift 26s ease infinite;
}
.yellow {
    background: linear-gradient(135deg, #ffd700, #ffe84d, #f0c800);
    background-size: 300% 300%;
    animation: gradientShift 24s ease infinite;
    color: #1a1a2e;
}
.pink {
    background: linear-gradient(135deg, #b4009e, #d900be, #960083);
    background-size: 300% 300%;
    animation: gradientShift 27s ease infinite;
}
.dark {
    background: linear-gradient(135deg, #2d2d2d, #3d3d3d, #1e1e1e);
    background-size: 300% 300%;
    animation: gradientShift 20s ease infinite;
}

.tile-label {
    font-size: 21px;
    font-weight: 600;
    letter-spacing: 0.5px;
    line-height: 1;
}

.tile-desc {
    font-size: 16px;
    margin-top: 3px;
}

.tile-icon {
    height: 64px;
    width: 64px;
}

.tile-big-label {
    font-size: 56px;
    font-weight: bold;
    line-height: 1;
}

.tile-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.tile-bottom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: center;
}

.counter {
    display: flex;
    align-items: center;
    font-size: 56px;
    font-weight: 100;
    line-height: 1;
    align-items: center;
}

.digit-wrapper {
    overflow: hidden;
    height: 1em;
}

.digit-reel {
    display: flex;
    flex-direction: column;
}

.digit-reel span {
    font-family: 'Roboto', sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    height: 1em;
    display: block;
}

.separator {
    font-family: 'Roboto', sans-serif;
    font-optical-sizing: auto;
    font-weight: 600;
    font-style: normal;
    height: 1em;
    display: block;
    margin: 0 2px;
    line-height: 1;
}


/* ── Popup overlay ── */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    align-items: center;
}
.popup-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ── Popup window ── */
.popup {
    background: #1a1a1a;
    border-radius: 20px;
    width: min(600px, 90vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 32px 80px rgba(0,0,0,0.6);
    transform: scale(0.88) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.popup-overlay.active .popup {
    transform: scale(1) translateY(0);
}

#info-body {
    display:block;
}

/* ── Popup header ── */
.popup-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    border-radius: 20px 20px 0 0;
    flex-shrink: 0;
}
.popup-header img {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
    opacity: 0.9;
}
.popup-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.02em;
}
.popup-close {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
}
.popup-close:hover {
    background: rgba(255,255,255,0.28);
    transform: scale(1.1);
}

/* ── Popup body ── */
.popup-body {
    padding: 20px 24px 28px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.6;

    scrollbar-width: none;
}
.popup-body p {
    margin: 0 0 10px;
    color: #aaa;
    font-size: 0.88rem;
}

/* ── Color accents per tile ── */
.popup-header.green  { background: #2e7d32; }
.popup-header.red    { background: #c62828; }
.popup-header.orange { background: #e65100; }
.popup-header.teal   { background: #00695c; }

/* ── Weather ── */
.popup-weather-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}
.popup-weather-card {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
}
.popup-weather-card .val {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}
.popup-weather-card .lbl {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* ── Empty state ── */
.popup-empty {
    text-align: center;
    padding: 32px 0;
    color: #666;
    font-size: 0.9rem;
}
.popup-empty svg {
    opacity: 0.25;
    margin-bottom: 12px;
    display: block;
    margin-inline: auto;
}

/* ── Events table ── */
.events-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.88rem;
    align-items: center;
}
.events-table thead th {
    text-align: left;
    padding: 8px 12px;
    color: #555;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    align-items: center;
}
.ev-row {
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.12s;
}
.ev-row:hover {
    background: rgba(255,255,255,0.04);
}
.ev-row-clickable {
    cursor: pointer;
}
.ev-row.row-past {
    opacity: 0.45;
}
.events-table td {
    padding: 10px 12px;
    vertical-align: middle;
    color: #ddd;
    align-items: center;
}
.ev-name {
    font-weight: 600;
    color: #f0f0f0 !important;
    word-break: break-word;
    white-space: normal;
    align-items: center;
}
.ev-date {
    white-space: nowrap;
    color: #aaa !important;
    font-size: 0.82rem;
    align-items: center;
}
.ev-time {
    color: #666;
    font-size: 0.78rem;
}
.ev-chevron {
    text-align: right;
    padding-right: 14px !important;
    user-select: none;
}
.ev-chevron span {
    color: #555;
    font-size: 1.1rem;
    display: inline-block;
    transform-origin: center center;
    transition: transform 0.2s, color 0.2s;
    line-height: 1;
    width: 1em;
    text-align: center;
}
.ev-chevron.open span {
    transform: rotate(90deg);
    color: #aaa;
}
.ev-desc-row {
    display: none;
}
.ev-desc-row.open {
    display: table-row;
}
.ev-desc-row td {
    padding: 0 12px !important;
}
.ev-desc-inner {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    color: #999;
    font-size: 0.85rem;
    line-height: 1.6;
    border-left: 2px solid rgba(198,40,40,0.4);
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}
.event-badge {
    display: inline-block;
    background: rgba(198, 40, 40, 0.25);
    color: #ef9a9a;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
.event-badge.past {
    background: rgba(255,255,255,0.06);
    color: #555;
}

/* ── Loading ── */
.popup-loading {
    text-align: center;
    padding: 40px 0;
    color: #666;
    font-size: 0.9rem;
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Countdown cards ── */
.cd-card {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 3px solid #e65100;
}
.cd-card:last-child { margin-bottom: 0; }
.cd-card.cd-past {
    opacity: 0.45;
    border-left-color: #444;
}
.cd-name {
    font-size: 1rem;
    font-weight: 700;
    color: #f0f0f0;
    margin-bottom: 2px;
}
.cd-date-lbl {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 12px;
}

/* 6-column grid:
   row 1: [miesięcy = 2col] [tyg.rob. = 2col] [tygodni = 2col]
   row 2: [dni = 2col] [godzin = 2col] [minut = 2col]
   row 3: [sekund = 6col]
*/
.cd-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.cd-block {
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    grid-column: span 2;
    align-items: center;
}
.cd-block-wide {
    grid-column: 1 / -1;
}
.cd-break {
    grid-column: 1 / -1;
    height: 0;
}
.cd-val {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cd-val-sec {
    font-size: 1.1rem;
    color: #fff;
}
.cd-lbl {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.07em;
}


/* ── Ticker bar (pasek) ── */
.ticker-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: calc(100% / 1.5);
    transform-origin: bottom left;
    transform: scale(1.5);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow: hidden;
    height: 28px;
    display: flex;
    align-items: center;
    z-index: 9999;
    border-top: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    will-change: transform;
}

.ticker-track span {
    padding-right: 4px;
    padding-left: 0px;
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.03em;
}
