:root {
    --bg-main: #081536;
    --bg-hero: #071228;
    --bg-card: rgba(63, 84, 120, 0.58);
    --bg-card-dark: #1d2f52;
    --text-main: #f7faff;
    --text-muted: #c4d4ee;
    --accent: #13d6ff;
    --accent-2: #1f73ff;
    --border-soft: rgba(255, 255, 255, 0.12);
    --container-width: 1180px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background: linear-gradient(180deg, #08193d 0%, #061435 100%);
    line-height: 1.45;
    overflow-x: hidden;
    transition: background 0.45s ease, color 0.35s ease;
}

.preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at 50% 35%, #123980 0%, #071735 65%, #041028 100%);
    transition: opacity 0.55s ease, visibility 0.55s ease;
}

.preloader-center {
    position: relative;
    width: 120px;
    height: 120px;
    display: grid;
    place-items: center;
}

.preloader-ring {
    width: 92px;
    height: 92px;
    border: 3px solid rgba(255, 255, 255, 0.16);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spinRing 0.85s linear infinite;
}

.preloader-logo {
    position: absolute;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #e6f4ff;
}

body.loaded .preloader {
    opacity: 0;
    visibility: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(100%, var(--container-width));
    margin-inline: auto;
    padding-inline: 26px;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 72px;
    display: flex;
    align-items: center;
    background: rgba(5, 18, 50, 0.55);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(8px);
    transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 31px;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    margin-right: 16px;
}

.nav-links a {
    font-size: 14px;
    font-weight: 600;
    color: rgba(231, 239, 255, 0.9);
    padding: 6px 10px;
    border-radius: 7px;
    border: 1px solid transparent;
    transition: 0.24s ease;
}

.nav-links a:hover,
.nav-links a.active {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.08);
}

.theme-btn {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #ffd84a;
    display: grid;
    place-items: center;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.theme-btn:hover {
    transform: rotate(12deg) scale(1.05);
}

.hero {
    min-height: 100svh;
    position: relative;
    background: var(--bg-hero) url('../img/background.jpg') center/cover no-repeat;
    display: flex;
    align-items: center;
    text-align: center;
    --hero-overlay-x: 0px;
    --hero-overlay-y: 0px;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(4, 14, 42, 0.58) 0%, rgba(8, 21, 54, 0.9) 82%, rgba(8, 21, 54, 1) 100%),
        radial-gradient(circle at 45% 65%, rgba(18, 46, 99, 0.6), rgba(6, 17, 49, 0.4));
    transform: translate3d(var(--hero-overlay-x), var(--hero-overlay-y), 0);
    transition: transform 0.35s ease-out;
}

.hero .container {
    position: relative;
    z-index: 2;
}

.hero-content {
    max-width: 720px;
    margin-inline: auto;
    padding-top: 44px;
}

.hero-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #08d2ff;
    box-shadow: 0 0 0 6px rgba(8, 210, 255, 0.18), 0 0 35px rgba(8, 210, 255, 0.4);
    margin-bottom: 18px;
    animation: avatarFloat 4.5s ease-in-out infinite;
}

.hero h1 {
    font-size: clamp(2.7rem, 5.2vw, 5rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
}

.hero-role {
    color: var(--accent);
    font-size: clamp(1.05rem, 1.6vw, 1.8rem);
    font-weight: 500;
}

.hero-school {
    margin-top: 6px;
    color: #d0ddf6;
}

.hero-desc {
    max-width: 770px;
    margin: 28px auto 0;
    color: #deebff;
    font-size: clamp(1rem, 1.45vw, 1.7rem);
    line-height: 1.45;
}

.hero-socials {
    margin-top: 26px;
    display: flex;
    justify-content: center;
    gap: 14px;
}

.hero-socials a {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 19px;
    background: rgba(70, 88, 124, 0.56);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #edf4ff;
    transition: transform 0.28s ease, background 0.28s ease, border-color 0.28s ease;
}

.hero-socials a:hover {
    transform: translateY(-6px) scale(1.05);
    border-color: rgba(19, 214, 255, 0.6);
    background: rgba(19, 214, 255, 0.15);
}

.scroll-down {
    margin-top: 24px;
    display: inline-flex;
    color: var(--accent);
    font-size: 20px;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(19, 214, 255, 0.5);
    border-radius: 999px;
    position: relative;
    animation: arrowBob 1.45s ease-in-out infinite;
}

.scroll-down::before {
    content: '';
    position: absolute;
    inset: -8px;
    border: 1px solid rgba(19, 214, 255, 0.45);
    border-radius: inherit;
    animation: arrowPulse 1.8s ease-out infinite;
}

section,
footer {
    padding: 105px 0;
    background: var(--bg-main);
}

.projects,
.contact {
    background: linear-gradient(180deg, #04134a 0%, #10295f 100%);
}

h2 {
    text-align: center;
    font-size: clamp(2.35rem, 4.5vw, 3.7rem);
    line-height: 1.1;
    margin-bottom: 18px;
}

.section-lead {
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.12rem;
    line-height: 1.58;
}

.feature-grid {
    margin-top: 48px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.feature-card,
.skills-card,
.contact-card {
    background: linear-gradient(130deg, rgba(61, 85, 122, 0.55), rgba(48, 68, 103, 0.75));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 13px;
    padding: 18px 16px;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
}

.project-card,
.campaign-card,
.rpg-note,
.btn {
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease, color 0.35s ease;
}

.feature-card:hover,
.skills-card:hover,
.contact-card:hover,
.project-card:hover,
.campaign-card:hover,
.rpg-note:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 32px rgba(7, 19, 52, 0.3);
    border-color: rgba(19, 214, 255, 0.28);
}

.feature-icon {
    width: 46px;
    height: 46px;
    border-radius: 11px;
    background: linear-gradient(130deg, #2084ff, #0bc4e6);
    display: grid;
    place-items: center;
    margin-bottom: 13px;
    font-size: 18px;
}

.feature-card h3 {
    font-size: 2rem;
    margin-bottom: 9px;
}

.feature-card p {
    color: #d3e0f4;
    font-size: 1.06rem;
}

.projects-switch {
    margin: 30px auto 38px;
    width: min(340px, 100%);
    background: rgba(39, 58, 94, 0.85);
    border-radius: 12px;
    padding: 4px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.projects-switch button {
    border: none;
    color: #9cb1d8;
    background: transparent;
    font-weight: 700;
    border-radius: 9px;
    padding: 8px;
}

.projects-switch button.active {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card-dark);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.project-content {
    padding: 18px;
}

.project-content h3 {
    font-size: 2rem;
    margin-bottom: 6px;
}

.project-content p {
    color: #d2dff6;
    font-size: 1.08rem;
}

.tags {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tags span {
    font-size: 0.72rem;
    font-weight: 700;
    color: #c8d5f2;
    background: #2c4a96;
    border-radius: 999px;
    padding: 4px 9px;
}

.project-links {
    margin-top: 12px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.project-links a {
    font-size: 1rem;
    color: #13d6ff;
    font-weight: 600;
}

.project-links a:last-child {
    color: #9ab1db;
}

.skills-grid {
    margin-top: 46px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.skills-card {
    padding: 24px 24px;
}

.skills-card h3 {
    font-size: 2.7rem;
    margin-bottom: 20px;
}

.progress-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-bottom: 16px;
}

.progress-item span,
.progress-item strong {
    color: #d5e4fe;
    font-size: 1.1rem;
}

.progress-item strong {
    color: var(--accent);
    font-size: 0.95rem;
}

.bar {
    grid-column: 1 / -1;
    height: 7px;
    border-radius: 99px;
    background: rgba(180, 203, 245, 0.25);
}

.bar div {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.rpg-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.subheading {
    margin-top: 56px;
    text-align: center;
    font-size: clamp(2.2rem, 4vw, 3.1rem);
}

.section-lead.small {
    margin-top: 12px;
}

.campaign-grid {
    margin-top: 34px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.campaign-card {
    background: linear-gradient(150deg, #08152f, #102145);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px;
}

.campaign-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.campaign-top h4 {
    font-size: 2rem;
}

.status {
    font-size: 0.77rem;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 700;
}

.ongoing {
    background: #1ecf64;
}

.test {
    background: #f0c200;
    color: #16213f;
}

.done {
    background: #6f8cbf;
}

.campaign-card .system {
    margin-top: 8px;
    color: #13d6ff;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 1.02rem;
}

.campaign-card p {
    color: #d3def3;
    font-size: 1.05rem;
}

.rpg-note {
    margin: 38px auto 0;
    max-width: 820px;
    color: #deebff;
    line-height: 1.68;
    background: linear-gradient(90deg, #2e57d4, #0c8aac);
    border-radius: 13px;
    padding: 19px 24px;
    font-size: 1.05rem;
}

.contact-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 120px;
}

.contact-card .feature-icon {
    margin-bottom: 0;
}

.contact-card h3 {
    font-size: 2rem;
}

.contact-card p {
    color: #1ad8ff;
    font-size: 1.2rem;
}

.btn {
    margin: 36px auto 0;
    display: flex;
    width: fit-content;
    background: linear-gradient(90deg, #2375ff, #0ab8d8);
    color: #edf8ff;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 1rem;
    box-shadow: 0 10px 22px rgba(14, 42, 104, 0.35);
}

.btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 28px rgba(14, 42, 104, 0.44);
}

.copyright {
    margin-top: 46px;
    text-align: center;
    color: #a4b9dd;
    font-size: 0.9rem;
}

.reveal {
    opacity: 0;
    transform: translateY(34px) scale(0.985);
    filter: blur(8px);
    transition: opacity 0.65s ease, transform 0.65s ease, filter 0.65s ease;
    transition-delay: var(--reveal-delay, 0ms);
}

.reveal.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}

@keyframes arrowBob {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(7px);
    }
}

@keyframes arrowPulse {
    0% {
        opacity: 0.8;
        transform: scale(0.78);
    }

    100% {
        opacity: 0;
        transform: scale(1.25);
    }
}

@keyframes avatarFloat {
    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-7px);
    }
}

@keyframes spinRing {
    to {
        transform: rotate(360deg);
    }
}

body[data-theme="light"] {
    --bg-main: #edf4ff;
    --bg-hero: #d8e8ff;
    --bg-card: rgba(240, 248, 255, 0.92);
    --bg-card-dark: #f4f9ff;
    --text-main: #13274b;
    --text-muted: #4a628f;
    --accent: #0a86e6;
    --accent-2: #3a6fff;
    background: linear-gradient(180deg, #e8f2ff 0%, #dde9ff 100%);
}

body[data-theme="light"] .navbar {
    background: rgba(231, 241, 255, 0.86);
    border-bottom-color: rgba(36, 70, 123, 0.16);
    box-shadow: 0 5px 18px rgba(21, 44, 86, 0.1);
}

body[data-theme="light"] .nav-links a {
    color: #294069;
}

body[data-theme="light"] .nav-links a:hover,
body[data-theme="light"] .nav-links a.active {
    border-color: rgba(20, 64, 133, 0.35);
    background: rgba(27, 73, 151, 0.08);
}

body[data-theme="light"] .theme-btn {
    background: rgba(30, 79, 157, 0.08);
    border-color: rgba(30, 79, 157, 0.26);
    color: #264f98;
}

body[data-theme="light"] .hero-overlay {
    background:
    linear-gradient(180deg, rgba(208, 226, 255, 0.62) 0%, rgba(220, 234, 255, 0.86) 82%, rgba(230, 240, 255, 0.95) 100%),
    radial-gradient(circle at 45% 65%, rgba(117, 169, 255, 0.34), rgba(193, 220, 255, 0.18));
}

body[data-theme="light"] .preloader {
    background: radial-gradient(circle at 50% 35%, #d6e6ff 0%, #c2d9ff 65%, #b7d0ff 100%);
}

body[data-theme="light"] .preloader-logo {
    color: #17386e;
}

body[data-theme="light"] .hero-school,
body[data-theme="light"] .hero-desc,
body[data-theme="light"] .feature-card p,
body[data-theme="light"] .project-content p,
body[data-theme="light"] .campaign-card p,
body[data-theme="light"] .section-lead,
body[data-theme="light"] .copyright,
body[data-theme="light"] .progress-item span,
body[data-theme="light"] .project-links a:last-child {
    color: #3f5684;
}

body[data-theme="light"] .hero-socials a {
    color: #1c3156;
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(40, 77, 138, 0.2);
}

body[data-theme="light"] section,
body[data-theme="light"] footer {
    background: transparent;
}

body[data-theme="light"] .projects,
body[data-theme="light"] .contact {
    background: linear-gradient(180deg, #d8e6ff 0%, #e8f1ff 100%);
}

body[data-theme="light"] .feature-card,
body[data-theme="light"] .skills-card,
body[data-theme="light"] .contact-card,
body[data-theme="light"] .project-card,
body[data-theme="light"] .campaign-card {
    background: linear-gradient(135deg, rgba(246, 251, 255, 0.96), rgba(233, 243, 255, 0.97));
    border-color: rgba(53, 92, 160, 0.16);
}

body[data-theme="light"] .tags span {
    background: #d2e3ff;
    color: #315488;
}

body[data-theme="light"] .bar {
    background: rgba(53, 98, 170, 0.24);
}

body[data-theme="light"] .rpg-note {
    background: linear-gradient(90deg, #b4d0ff, #95d8f1);
    color: #1e3663;
}

body[data-theme="light"] .scroll-down {
    border-color: rgba(0, 127, 221, 0.45);
}

body[data-theme="light"] .scroll-down::before {
    border-color: rgba(0, 127, 221, 0.35);
}

body[data-theme="light"] .calendar-kicker {
    color: #1751a7;
    border-color: rgba(18, 112, 216, 0.35);
    background: rgba(18, 112, 216, 0.11);
}

body[data-theme="light"] .calendar-hero-meta span,
body[data-theme="light"] .card-badge,
body[data-theme="light"] .status-pill,
body[data-theme="light"] .calendar-links a {
    color: #2b4776;
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.75);
}

body[data-theme="light"] .calendar-card {
    background: linear-gradient(140deg, rgba(245, 250, 255, 0.98), rgba(232, 243, 255, 0.97));
    border-color: rgba(53, 92, 160, 0.16);
    box-shadow: 0 10px 24px rgba(20, 54, 110, 0.11);
}

body[data-theme="light"] .calendar-toolbar button {
    color: #24406b;
    border-color: rgba(53, 92, 160, 0.24);
    background: rgba(255, 255, 255, 0.78);
}

body[data-theme="light"] .calendar-toolbar button:hover {
    background: rgba(255, 255, 255, 1);
}

body[data-theme="light"] .calendar-toolbar {
    border-color: rgba(53, 92, 160, 0.16);
    background: rgba(255, 255, 255, 0.72);
}

body[data-theme="light"] .calendar-grid-card,
body[data-theme="light"] .calendar-side,
body[data-theme="light"] .day-cell,
body[data-theme="light"] .upcoming-events article,
body[data-theme="light"] .event-item {
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.85);
}

body[data-theme="light"] .day-cell small,
body[data-theme="light"] .upcoming-events p,
body[data-theme="light"] .calendar-weekdays,
body[data-theme="light"] .date-header,
body[data-theme="light"] .event-calendar,
body[data-theme="light"] .event-time {
    color: #4c6794;
}

body[data-theme="light"] .day-cell:hover,
body[data-theme="light"] .upcoming-events article:hover,
body[data-theme="light"] .event-item:hover {
    border-color: rgba(21, 111, 209, 0.32);
    background: rgba(248, 252, 255, 0.98);
}

body[data-theme="light"] .event-dot {
    color: #1a5ca8;
    border-color: rgba(21, 111, 209, 0.35);
    background: rgba(21, 111, 209, 0.12);
}

body[data-theme="light"] .calendar-fallback {
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.85);
}


@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .preloader {
        display: none;
    }
}

@media (max-width: 1100px) {
    .project-grid,
    .rpg-grid,
    .campaign-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .feature-card h3,
    .project-content h3,
    .campaign-top h4 {
        font-size: 1.7rem;
    }

    .skills-card h3,
    .contact-card h3 {
        font-size: 2.1rem;
    }
}

@media (max-width: 780px) {
    .nav-links {
        display: none;
    }

    .project-grid,
    .skills-grid,
    .rpg-grid,
    .campaign-grid,
    .contact-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .hero {
        min-height: 92svh;
    }

    .hero-avatar {
        width: 104px;
        height: 104px;
    }

    .hero-role {
        font-size: 1.2rem;
    }

    .hero-desc {
        font-size: 1rem;
    }

    .feature-card,
    .skills-card,
    .contact-card {
        padding: 16px;
    }

    .feature-card h3,
    .project-content h3,
    .campaign-top h4,
    .skills-card h3,
    .contact-card h3 {
        font-size: 1.55rem;
    }

    .feature-card p,
    .project-content p,
    .campaign-card p,
    .contact-card p,
    .progress-item span,
    .progress-item strong,
    .rpg-note {
        font-size: 0.98rem;
    }
}


.portfolio-header {
    max-width: 1120px;
    margin: 0 auto;
    text-align: center;
}

.calendar-hero {
    margin-top: 72px;
    padding: 32px 20px 16px;
}

.calendar-kicker {
    display: inline-block;
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #d9f4ff;
    border: 1px solid rgba(19, 214, 255, 0.42);
    background: rgba(19, 214, 255, 0.12);
}

.portfolio-header h1 {
    font-size: clamp(2.2rem, 4.4vw, 3.45rem);
    margin-bottom: 10px;
}

.portfolio-lead {
    color: var(--text-muted);
    font-size: 1.06rem;
    max-width: 760px;
    margin: 0 auto;
}

.calendar-hero-meta {
    margin: 20px auto 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.calendar-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    color: #e0edff;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 8px 13px;
}

.calendar-page {
    max-width: 1180px;
    margin: 0 auto;
    padding: 92px 20px 48px;
    display: grid;
    gap: 14px;
}

.calendar-card {
    background: linear-gradient(150deg, rgba(26, 44, 82, 0.86), rgba(16, 34, 66, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 12px 26px rgba(6, 16, 42, 0.28);
}

.calendar-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.calendar-card h2 {
    text-align: left;
    font-size: 1.28rem;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.card-badge {
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #dce9ff;
    padding: 6px 10px;
}

.calendar-card p {
    color: var(--text-muted);
    margin-bottom: 14px;
}

.calendar-interaction-hint {
    margin-top: -4px;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    color: #d9e7ff;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.calendar-toolbar button {
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 10px;
    min-height: 38px;
    padding: 9px 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.calendar-toolbar button:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.14);
}

.calendar-toolbar button.primary {
    background: linear-gradient(90deg, #2375ff, #0ab8d8);
    border-color: rgba(255, 255, 255, 0.26);
    box-shadow: 0 6px 16px rgba(22, 105, 211, 0.28);
}

.view-switch {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(0, 0, 0, 0.16);
}

.view-switch button {
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
}

.view-switch button.active,
.view-switch button[aria-selected="true"] {
    background: rgba(19, 214, 255, 0.18);
    border-color: rgba(19, 214, 255, 0.48);
    color: #e8f7ff;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.86rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: #d5e4fd;
}

.status-pill[data-state="success"] {
    color: #c8ffe4;
    border-color: rgba(30, 207, 100, 0.45);
    background: rgba(30, 207, 100, 0.16);
}

.status-pill[data-state="warning"] {
    color: #ffe7ae;
    border-color: rgba(240, 194, 0, 0.46);
    background: rgba(240, 194, 0, 0.17);
}

.status-pill[data-state="error"] {
    color: #ffd6d6;
    border-color: rgba(255, 99, 99, 0.45);
    background: rgba(255, 99, 99, 0.16);
}

.month-label {
    min-width: 180px;
    font-size: 1rem;
    text-transform: capitalize;
    text-align: center;
}

.calendar-custom-wrap {
    outline: none;
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.calendar-grid-card {
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: linear-gradient(160deg, rgba(16, 31, 62, 0.94), rgba(10, 24, 47, 0.95));
    padding: 16px;
    box-shadow: 0 14px 28px rgba(5, 14, 38, 0.36);
}

.calendar-3d-board {
    transform: none;
}

.calendar-custom-wrap:focus-visible .calendar-grid-card {
    border-color: rgba(19, 214, 255, 0.46);
    box-shadow: 0 0 0 2px rgba(19, 214, 255, 0.18), 0 24px 46px rgba(5, 14, 38, 0.45);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
    color: #d0defb;
    font-size: 0.86rem;
    text-align: center;
    font-weight: 700;
    min-width: 700px;
}

.calendar-weekdays.is-week span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.calendar-weekdays.is-week small {
    font-size: 0.72rem;
    font-weight: 500;
    color: #a9c4ea;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 9px;
    min-width: 700px;
}

.month-grid:not(.is-week) {
    gap: 6px;
}

/* Widok tygodnia - siatka godzinowa */
.month-grid.is-week {
    display: block;
    min-width: 920px;
}

.week-grid-header,
.week-grid-row {
    display: grid;
    grid-template-columns: 70px repeat(7, minmax(0, 1fr));
}

.week-grid-header {
    position: sticky;
    top: 0;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    background: #0c1b3f;
}

.week-grid-corner,
.week-day-header {
    padding: 9px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.week-grid-corner {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #b9cdee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-day-header:last-child {
    border-right: 0;
}

.week-day-header {
    display: grid;
    justify-items: center;
    gap: 2px;
}

.week-day-header.is-today {
    background: rgba(19, 214, 255, 0.16);
}

.week-day-name {
    font-size: 0.74rem;
    font-weight: 700;
    color: #e5f2ff;
}

.week-day-date {
    font-size: 0.72rem;
    color: #a9c4ea;
}

.week-grid-body {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

.week-grid-row {
    min-height: 42px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.week-grid-row:first-child {
    border-top: 0;
}

.week-hour-label {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #a9c4ea;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.week-slot {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 6px;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    align-content: center;
    gap: 2px;
    min-width: 0;
    position: relative;
}

.week-slot:last-child {
    border-right: 0;
}

.week-slot.is-free {
    background: rgba(255, 255, 255, 0.03);
}

.week-slot.is-busy {
    background: color-mix(in srgb, var(--slot-color, #13d6ff) 14%, transparent);
    box-shadow: inset 0 0 0 1px var(--slot-color, #13d6ff);
}

.week-slot.is-free::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(157, 232, 191, 0.55);
}

.week-slot.is-today {
    outline: 1px solid rgba(19, 214, 255, 0.35);
    outline-offset: -1px;
}

.week-slot-title {
    font-size: 0.66rem;
    color: #f0f6ff;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.25;
    max-width: 100%;
    font-weight: 600;
    display: block;
}

.day-cell {
    min-height: 100px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border-radius: 12px;
    padding: 10px;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.month-grid:not(.is-week) .day-cell {
    min-height: 84px;
    padding: 6px;
    gap: 4px;
    border-radius: 10px;
}

.day-cell:hover {
    transform: translateY(-1px);
    border-color: rgba(19, 214, 255, 0.32);
    background: rgba(255, 255, 255, 0.08);
}

.day-cell header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 0;
}

.month-grid:not(.is-week) .day-cell header {
    margin-bottom: 2px;
}

.day-cell strong {
    font-size: 0.95rem;
    font-weight: 700;
}

.month-grid:not(.is-week) .day-cell strong {
    font-size: 0.86rem;
}

.day-cell small {
    font-size: 0.72rem;
    color: #b5c8ec;
    font-weight: 500;
}

.month-grid:not(.is-week) .day-cell small {
    font-size: 0.62rem;
}

.day-cell.is-empty {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.05);
}

.day-cell.is-today {
    border-color: rgba(19, 214, 255, 0.58);
    box-shadow: inset 0 0 0 1px rgba(19, 214, 255, 0.3), 0 0 0 1px rgba(19, 214, 255, 0.15);
    background: linear-gradient(160deg, rgba(19, 214, 255, 0.15), rgba(255, 255, 255, 0.05));
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.month-grid:not(.is-week) .day-events {
    gap: 3px;
}

.event-dot,
.event-more {
    font-size: 0.68rem;
    border-radius: 999px;
    width: fit-content;
    padding: 2px 6px;
}

.event-dot {
    color: #eaf6ff;
    border: 1px solid color-mix(in srgb, var(--event-color, #13d6ff) 58%, white 20%);
    background: color-mix(in srgb, var(--event-color, #13d6ff) 26%, transparent);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: auto;
    max-width: 100%;
    border-radius: 8px;
    padding: 3px 5px;
}

.month-grid:not(.is-week) .event-dot {
    padding: 2px 4px;
    border-radius: 6px;
    gap: 1px;
}

.event-time {
    font-size: 0.62rem;
    font-weight: 700;
    color: #f6fbff;
    border-radius: 999px;
    padding: 1px 5px;
    background: rgba(0, 0, 0, 0.18);
}

.month-grid:not(.is-week) .event-time {
    font-size: 0.55rem;
    padding: 1px 4px;
}

.event-name {
    flex: 0;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.65rem;
    font-weight: 600;
    color: #f2f8ff;
}

.month-grid:not(.is-week) .event-name {
    font-size: 0.6rem;
    line-height: 1.1;
}

.event-category {
    font-size: 0.58rem;
    font-weight: 700;
    color: #b9ddff;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.month-grid:not(.is-week) .event-category {
    font-size: 0.53rem;
}

.event-more {
    color: #d6e7ff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.09);
}

.calendar-legend {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.78rem;
    color: #d6e7ff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.legend-item:hover {
    border-color: rgba(19, 214, 255, 0.38);
    background: rgba(19, 214, 255, 0.12);
}

.legend-item.is-off {
    opacity: 0.55;
    background: rgba(255, 255, 255, 0.02);
}

.legend-item:focus-visible {
    outline: 2px solid rgba(19, 214, 255, 0.65);
    outline-offset: 1px;
}

.legend-item i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--legend-color, var(--accent));
}

.calendar-events-section {
    margin-top: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(1, 6, 20, 0.32);
    padding: 10px;
}

.calendar-events-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-events-head h3 {
    margin: 0;
    font-size: 1.03rem;
}

.calendar-footer {
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    background: rgba(10, 23, 47, 0.72);
    text-align: center;
}

.calendar-footer-author {
    margin: 0;
    color: #e9f3ff;
    font-size: 0.86rem;
    font-weight: 600;
}

.calendar-footer-copy {
    margin: 4px 0 0;
    color: #a8bfdc;
    font-size: 0.74rem;
}

.site-footer-minimal {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(6, 18, 42, 0.8);
    padding: 12px 16px 14px;
    text-align: center;
}

.site-footer-author {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: #e9f3ff;
}

.site-footer-copy {
    margin: 4px 0 0;
    font-size: 0.74rem;
    color: #a8bfdc;
}

.events-subtitle {
    font-size: 0.84rem;
    color: #afc3e8;
}

.upcoming-events {
    display: grid;
    gap: 16px;
}

.no-events {
    color: #b5c8ec;
    font-size: 0.9rem;
    margin: 0;
}

.date-group {
    display: grid;
    gap: 8px;
}

.date-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: #d0defb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.events-list {
    display: grid;
    gap: 7px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.event-item:hover {
    border-color: rgba(19, 214, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.event-badge {
    flex-shrink: 0;
    width: 4px;
    height: 48px;
    border-radius: 6px;
    background: var(--event-color, var(--accent));
}

.event-content {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 3px;
}

.event-item h4 {
    font-size: 0.9rem;
    margin: 0;
    color: #f0f6ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-calendar {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a9c4ea;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.event-time {
    display: block;
    font-size: 0.8rem;
    color: #b5c8ec;
}

.event-link {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(19, 214, 255, 0.12);
    border: 1px solid rgba(19, 214, 255, 0.26);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.event-link:hover {
    background: rgba(19, 214, 255, 0.22);
    border-color: rgba(19, 214, 255, 0.48);
    box-shadow: 0 4px 12px rgba(19, 214, 255, 0.16);
}

.upcoming-color {
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 10px;
    background: var(--event-color, var(--accent));
}

.calendar-fallback {
    margin-top: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 14px;
    background: rgba(1, 6, 20, 0.35);
    padding: 14px;
}

.calendar-fallback p {
    margin-bottom: 10px;
}

#fallbackFrame {
    width: 100%;
    min-height: 640px;
    border: 0;
    border-radius: 10px;
}

.calendar-links {
    margin-top: 14px;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.calendar-links a {
    color: #dff1ff;
    font-size: 0.88rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    padding: 6px 11px;
}

.calendar-links a:hover {
    border-color: rgba(19, 214, 255, 0.45);
    color: var(--accent);
}

body[data-theme="light"] .calendar-kicker {
    color: #1751a7;
    border-color: rgba(18, 112, 216, 0.35);
    background: rgba(18, 112, 216, 0.11);
}

body[data-theme="light"] .calendar-hero-meta span,
body[data-theme="light"] .card-badge,
body[data-theme="light"] .status-pill,
body[data-theme="light"] .calendar-links a {
    color: #2b4776;
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.75);
}

body[data-theme="light"] .calendar-card {
    background: linear-gradient(140deg, rgba(245, 250, 255, 0.98), rgba(232, 243, 255, 0.97));
    border-color: rgba(53, 92, 160, 0.16);
    box-shadow: 0 10px 24px rgba(20, 54, 110, 0.11);
}

body[data-theme="light"] .calendar-interaction-hint {
    color: #476692;
}

body[data-theme="light"] .calendar-grid-card,
body[data-theme="light"] .calendar-events-section,
body[data-theme="light"] .upcoming-events article,
body[data-theme="light"] .event-item,
body[data-theme="light"] .calendar-fallback {
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.85);
}

body[data-theme="light"] .day-cell {
    border-color: rgba(53, 92, 160, 0.24);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(247, 251, 255, 0.94));
}

body[data-theme="light"] .day-cell small,
body[data-theme="light"] .upcoming-events p,
body[data-theme="light"] .calendar-weekdays,
body[data-theme="light"] .events-subtitle,
body[data-theme="light"] .date-header,
body[data-theme="light"] .event-calendar,
body[data-theme="light"] .event-time {
    color: #4c6794;
}

body[data-theme="light"] .day-cell:hover,
body[data-theme="light"] .upcoming-events article:hover,
body[data-theme="light"] .event-item:hover {
    border-color: rgba(21, 111, 209, 0.32);
    background: rgba(248, 252, 255, 0.98);
}

body[data-theme="light"] .event-dot {
    color: #194d8a;
}

body[data-theme="light"] .event-name {
    color: #1d4b88;
}

body[data-theme="light"] .event-category {
    color: #255c9d;
}

body[data-theme="light"] .event-time {
    color: #1d4b88;
    background: rgba(255, 255, 255, 0.85);
}

body[data-theme="light"] .event-item h4 {
    color: #173f76;
}

body[data-theme="light"] .view-switch {
    border-color: rgba(53, 92, 160, 0.24);
    background: rgba(255, 255, 255, 0.74);
}

body[data-theme="light"] .view-switch button.active,
body[data-theme="light"] .view-switch button[aria-selected="true"] {
    color: #1a4f8f;
    border-color: rgba(21, 111, 209, 0.34);
    background: rgba(21, 111, 209, 0.14);
}

body[data-theme="light"] .calendar-weekdays.is-week small {
    color: #5f7da9;
}

body[data-theme="light"] .week-grid-header {
    background: #f4f8ff;
    border-color: rgba(53, 92, 160, 0.2);
}

body[data-theme="light"] .week-grid-corner,
body[data-theme="light"] .week-day-header {
    background: rgba(45, 90, 153, 0.06);
    border-right-color: rgba(53, 92, 160, 0.16);
}

body[data-theme="light"] .week-grid-corner {
    color: #416899;
}

body[data-theme="light"] .week-day-header.is-today {
    background: rgba(21, 111, 209, 0.16);
}

body[data-theme="light"] .week-day-name {
    color: #0f3a70;
}

body[data-theme="light"] .week-day-date {
    color: #5f7da9;
}

body[data-theme="light"] .week-grid-body {
    border-color: rgba(53, 92, 160, 0.2);
}

body[data-theme="light"] .week-grid-row {
    border-top-color: rgba(53, 92, 160, 0.12);
}

body[data-theme="light"] .week-hour-label {
    color: #416899;
    border-right-color: rgba(53, 92, 160, 0.16);
    background: rgba(45, 90, 153, 0.05);
}

body[data-theme="light"] .week-slot {
    border-right-color: rgba(53, 92, 160, 0.14);
}

body[data-theme="light"] .week-slot.is-free {
    background: rgba(45, 90, 153, 0.04);
}

body[data-theme="light"] .week-slot.is-busy {
    background: color-mix(in srgb, var(--slot-color, #0b5ba8) 12%, white 88%);
    box-shadow: inset 0 0 0 1px var(--slot-color, #0b5ba8);
}

body[data-theme="light"] .week-slot.is-free::after {
    background: rgba(15, 132, 81, 0.45);
}

body[data-theme="light"] .week-slot.is-today {
    outline: 1px solid rgba(21, 111, 209, 0.45);
    outline-offset: -1px;
}

body[data-theme="light"] .week-slot-title {
    color: #1a3e6f;
}

body[data-theme="light"] .legend-item {
    color: #365682;
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(255, 255, 255, 0.82);
}

body[data-theme="light"] .legend-item:hover {
    border-color: rgba(21, 111, 209, 0.32);
    background: rgba(248, 252, 255, 0.98);
}

body[data-theme="light"] .legend-item.is-off {
    opacity: 0.62;
    background: rgba(255, 255, 255, 0.6);
}

body[data-theme="light"] .calendar-footer {
    border-color: rgba(53, 92, 160, 0.2);
    background: rgba(243, 249, 255, 0.9);
}

body[data-theme="light"] .calendar-footer-author {
    color: #163a69;
}

body[data-theme="light"] .calendar-footer-copy {
    color: #53729e;
}

body[data-theme="light"] .site-footer-minimal {
    border-top-color: rgba(53, 92, 160, 0.2);
    background: rgba(243, 249, 255, 0.9);
}

body[data-theme="light"] .site-footer-author {
    color: #163a69;
}

body[data-theme="light"] .site-footer-copy {
    color: #53729e;
}

@media (max-width: 780px) {
    .calendar-hero {
        margin-top: 66px;
        padding-top: 36px;
    }

    .calendar-hero-meta {
        justify-content: flex-start;
    }

    .calendar-card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-card {
        padding: 18px;
    }

    .calendar-page {
        padding-top: 86px;
    }

    .calendar-toolbar {
        padding: 8px;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .calendar-toolbar button {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 0.82rem;
    }

    .view-switch {
        order: 0;
    }

    .month-label {
        min-width: auto;
        width: 100%;
        text-align: center;
    }

    .status-pill {
        width: 100%;
        justify-content: center;
    }

    .month-grid {
        gap: 6px;
        min-width: 620px;
    }

    .calendar-weekdays {
        min-width: 620px;
    }

    .month-grid.is-week {
        min-width: 760px;
    }

    .day-cell {
        min-height: 88px;
        padding: 8px;
    }

    .month-grid.is-week .day-cell {
        min-height: 112px;
    }

    .event-dot {
        font-size: 0.68rem;
        padding: 5px 7px;
    }

    .event-time {
        font-size: 0.64rem;
    }

    .event-name {
        font-size: 0.68rem;
    }

    .calendar-events-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-footer {
        padding: 11px 12px;
    }

    #fallbackFrame {
        min-height: 560px;
    }
}

@media (max-width: 640px) {
    .calendar-page {
        padding: 82px 10px 28px;
        gap: 10px;
    }

    .calendar-card {
        padding: 12px;
        border-radius: 12px;
    }

    .calendar-card h2 {
        font-size: 1.08rem;
    }

    .calendar-toolbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "prev label next"
            "today today today"
            "view view view"
            "refresh refresh refresh"
            "status status status";
        gap: 6px;
        align-items: stretch;
    }

    #prevMonthBtn {
        grid-area: prev;
    }

    #nextMonthBtn {
        grid-area: next;
    }

    #periodLabel {
        grid-area: label;
        width: 100%;
        text-align: center;
    }

    #todayBtn {
        grid-area: today;
        width: 100%;
    }

    .view-switch {
        grid-area: view;
        justify-self: center;
        width: 100%;
        justify-content: center;
    }

    #refreshPublicBtn,
    #publicStatus {
        grid-column: auto;
        width: 100%;
    }

    #refreshPublicBtn {
        grid-area: refresh;
    }

    #publicStatus {
        grid-area: status;
    }

    .calendar-custom-wrap {
        margin-inline: -4px;
        padding-inline: 4px;
    }

    .calendar-weekdays {
        min-width: 100%;
        grid-template-columns: repeat(7, minmax(40px, 1fr));
        font-size: 0.76rem;
        gap: 6px;
    }

    .month-grid {
        min-width: 100%;
        grid-template-columns: repeat(7, minmax(40px, 1fr));
        gap: 5px;
    }

    .month-grid.is-week {
        min-width: 760px;
    }

    .week-grid-header,
    .week-grid-row {
        grid-template-columns: 58px repeat(7, minmax(0, 1fr));
    }

    .week-grid-row {
        min-height: 34px;
    }

    .week-hour-label,
    .week-grid-corner {
        font-size: 0.66rem;
    }

    .week-slot {
        padding: 3px 4px;
    }

    .week-slot-title {
        font-size: 0.6rem;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .calendar-events-section {
        padding: 8px;
    }

    .day-cell {
        min-height: 80px;
        padding: 6px;
    }

    .event-dot {
        font-size: 0.64rem;
        padding: 4px 6px;
    }

    .event-name {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .event-item {
        align-items: flex-start;
        gap: 8px;
        padding: 8px;
    }

    .event-badge {
        height: 38px;
    }

    .event-item h4 {
        font-size: 0.82rem;
    }

    .event-time,
    .event-calendar {
        font-size: 0.72rem;
    }

    #fallbackFrame {
        min-height: 440px;
    }
}

@media (max-width: 480px) {
    .calendar-page {
        padding: 80px 8px 24px;
    }

    .calendar-toolbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    .calendar-toolbar button {
        min-height: 32px;
        padding: 6px 8px;
        font-size: 0.78rem;
    }

    .view-switch button {
        min-height: 30px;
        padding: 5px 10px;
    }

    .status-pill {
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    .calendar-weekdays,
    .month-grid {
        min-width: 100%;
        grid-template-columns: repeat(7, minmax(36px, 1fr));
    }

    .month-grid.is-week {
        min-width: 720px;
    }

    .week-grid-header,
    .week-grid-row {
        grid-template-columns: 52px repeat(7, minmax(0, 1fr));
    }

    .week-slot {
        padding: 2px 3px;
    }

    .week-slot-title {
        font-size: 0.56rem;
    }

    .day-cell {
        min-height: 78px;
        padding: 6px;
    }

    .calendar-weekdays {
        font-size: 0.72rem;
    }

    .event-dot {
        padding: 4px 5px;
        font-size: 0.62rem;
    }

    .event-time {
        font-size: 0.58rem;
    }

    .calendar-footer {
        margin-top: 10px;
    }
}