* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
    background: #f7fbff;
    color: #10233f;
    font-family: Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

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

/* ===========================
   TOP BAR
=========================== */

.topbar {
    min-height: 82px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    background: linear-gradient(135deg, #35434d, #56646e);
}

.topbar-brand img {
    display: block;
    height: 46px;
    width: auto;
}

.user {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    font-size: 13px;
}

.user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 45vw;
}

.user a {
    padding: 6px 10px;
    background: #ffffff22;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.menu,
.back {
    font-size: 32px;
}

/* ===========================
   HEADING
=========================== */

.heading {
    padding: 26px 20px 18px;
    background: linear-gradient(#f4faff, #fff);
}

.heading h1 {
    margin: 0;
    font-size: 34px;
}

.heading p {
    margin: 7px 0 0;
    color: #6d829e;
    font-size: 20px;
    font-weight: 600;
}

/* ===========================
   DAYS
=========================== */

.days-wrap {
    position: relative;
    background: #fff;
}

.days {
    display: flex;
    gap: 10px;
    padding: 0 18px 22px;
    background: #fff;
    overflow-x: auto;
    scroll-snap-type: x proximity;
}

.days-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 47px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 14px #10233f40;
    color: #087bc1;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}

.days-arrow.visible {
    opacity: 1;
    pointer-events: auto;
}

.days-arrow-left {
    left: 6px;
}

.days-arrow-right {
    right: 6px;
}

.day {
    min-width: 92px;
    height: 94px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #e4ebf2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 15px #10233f0d;
    scroll-snap-align: start;
}

.day b {
    font-size: 20px;
}

.day span {
    margin-top: 7px;
    color: #6d829e;
}

.day.active {
    color: #fff;
    background: #087bc1;
}

.day.active span {
    color: #fff;
}

/* ===========================
   CATEGORIES
=========================== */

.categories {
    display: flex;
    gap: 14px;
    padding: 17px 14px 20px;
    background: #fff;
    border-block: 1px solid #edf1f5;
    overflow-x: auto;
}

.cat {
    min-width: 70px;
    text-align: center;
}

.cat i {
    display: grid;
    place-items: center;
    width: 55px;
    height: 55px;
    margin: auto;
    border-radius: 50%;
    background: #f4f8fc;
    font-style: normal;
    font-size: 27px;
}

.cat span {
    display: block;
    margin-top: 7px;
    font-size: 12px;
    font-weight: 700;
}

.cat.active i {
    color: #fff;
    background: #087bc1;
}

.cat.active span {
    color: #087bc1;
}

/* ===========================
   TIMELINE
=========================== */

.timeline {
    max-width: 1000px;
    margin: auto;
    padding: 28px 14px;
}

.time-group {
    margin-bottom: 30px;
}

.time-group header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.time-group header b {
    font-size: 28px;
}

.time-group header span {
    color: #6d829e;
    font-size: 13px;
}

.events-row-wrap {
    position: relative;
}

.events-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x proximity;
}

.events-arrow {
    top: 50%;
}

.events-arrow-left {
    left: -6px;
}

.events-arrow-right {
    right: -6px;
}

/* ===========================
   EVENT CARD
=========================== */

.event {
    display: block;
    flex: 0 0 clamp(8.5rem, 42vw, 11rem);
    min-height: clamp(6.5rem, 30vw, 8rem);
    padding: 0.75rem;
    border: 1px solid #e4ebf2;
    border-top: 0.25rem solid var(--c);
    border-radius: 0.75rem;
    background: #fff;
    box-shadow: 0 6px 18px #10233f14;
    scroll-snap-align: start;
    transition: box-shadow .15s, border-color .15s;
}

.event.sport {
    --c: #ff8a00;
}

.event.relax {
    --c: #8d43df;
}

.event.teambuilding {
    --c: #21a338;
}

.event.fun {
    --c: #ed1c24;
}

.event.info {
    --c: #087bc1;
}

.icon {
    font-size: 1.375rem;
    margin-bottom: 0.375rem;
}

.event h2 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.25;
}

.event p {
    margin: 0.375rem 0 0;
    color: #6d829e;
    font-size: 0.72rem;
}

.event:hover {
    border-color: #c7d6e4;
    box-shadow: 0 8px 22px #10233f22;
}

.event-link-hint {
    display: inline-block;
    margin-top: 0.625rem;
    color: #087bc1;
    font-size: 0.72rem;
    font-weight: bold;
}

/* ===========================
   BOTTOM NAVIGATION
=========================== */

.bottom {
    position: fixed;
    z-index: 5;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: 10px 5px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #087bc1;
    color: #fff;
    box-shadow: 0 -5px 20px #10233f29;
}

.bottom a {
    text-align: center;
    font-size: 22px;
}

.bottom svg {
    width: 22px;
    height: 22px;
    display: block;
    margin: 0 auto;
    opacity: .8;
}

.bottom small {
    display: block;
    font-size: 11px;
    margin-top: 4px;
}

.bottom .active {
    text-decoration: underline;
    text-underline-offset: 7px;
}

.bottom .active svg {
    opacity: 1;
}

.nav-icon-wrap {
    position: relative;
    display: inline-block;
}

.nav-badge-dot {
    position: absolute;
    top: -1px;
    right: -5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff3b30;
    border: 2px solid #087bc1;
}

/* ===========================
   AUTH
=========================== */

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #edf8ff, #fff);
}

.auth-card {
    width: min(100%, 430px);
    padding: 28px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 35px #10233f1f;
}

.auth-card h1 {
    margin-top: 0;
}

.auth-card label {
    display: block;
    margin-top: 15px;
    font-weight: bold;
}

.auth-card input,
.auth-card select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border: 1px solid #e4ebf2;
    border-radius: 9px;
    font: inherit;
    color: inherit;
    background: #fff;
}

.primary,
.secondary {
    display: block;
    width: 100%;
    margin-top: 20px;
    padding: 14px;
    border: 0;
    border-radius: 9px;
    text-align: center;
    font-weight: bold;
    cursor: pointer;
}

.primary {
    background: #087bc1;
    color: #fff;
}

.secondary {
    background: #eaf2f8;
}

.error,
.success {
    padding: 12px;
    margin: 14px 0;
    border-radius: 9px;
}

.error {
    background: #ffe9eb;
    color: #9b111e;
}

.success {
    background: #e8f7eb;
    color: #146b26;
}

.pending {
    padding: 12px;
    margin: 14px 0;
    border-radius: 9px;
    background: #fff4e0;
    color: #9a6400;
}

.paid-hint {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 9px;
    background: #fff4e0;
    color: #9a6400;
    font-size: 13px;
    line-height: 1.5;
}

/* ===========================
   DETAIL
=========================== */

.detail {
    max-width: 700px;
    margin: auto;
    padding: 28px 20px;
}

.bigicon {
    font-size: 64px;
}

.label {
    display: inline-block;
    margin-top: 12px;
    color: #087bc1;
    font-weight: bold;
}

.detail h1 {
    font-size: 32px;
}

.meta {
    line-height: 1.9;
    color: #6d829e;
}

.detail p {
    line-height: 1.6;
}

.button {
    margin-top: 20px;
}

/* ===========================
   TÝMOVÝ VÝBĚR
=========================== */

.team-picker {
    margin-top: 18px;
}

.team-picker-label {
    margin: 0 0 8px;
    font-weight: bold;
    color: #243c54;
}

.team-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid #e4ebf2;
    border-radius: 9px;
    cursor: pointer;
}

.team-option input {
    width: 18px;
    height: 18px;
}

.team-option span {
    display: flex;
    flex-direction: column;
    font-weight: 600;
}

.team-option small {
    font-weight: 400;
    color: #6d829e;
}

.team-option:has(input:checked) {
    border-color: #087bc1;
    background: #eaf5fc;
}

.team-option.disabled {
    opacity: .5;
    cursor: not-allowed;
    background: #f6f6f6;
}

.team-members-preview {
    margin-top: 3px;
    font-size: 12px;
    font-style: italic;
}

.team-mates {
    margin: -6px 0 14px;
    color: #6d829e;
    font-size: 13px;
}

/* ===========================
   INFO
=========================== */

.info-page {
    max-width: 500px;
    margin: auto;
    padding: 10px 16px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-card {
    padding: 20px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 22px #10233f14;
}

.info-card h2 {
    margin: 0 0 6px;
    font-size: 17px;
}

.info-hint {
    margin: 0 0 16px;
    color: #6d829e;
    font-size: 13px;
    line-height: 1.5;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid #eef2f7;
}

.info-row:first-of-type {
    border-top: 0;
}

.info-row strong {
    display: block;
    font-size: 14px;
}

.info-row small {
    display: block;
    margin-top: 2px;
    color: #6d829e;
    font-size: 12.5px;
}

.info-color-dot {
    flex: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.info-color-dot.blue {
    background: #087bc1;
}

.info-color-dot.green {
    background: #21a338;
}

.info-color-dot.yellow {
    background: #FFD700;
}

/* ===========================
   INSTRUKTOR -- PŘEHLED TÝMŮ
=========================== */

.instr-team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.instr-team-card {
    padding: 16px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px #10233f14;
}

.instr-team-card.full {
    background: #fff6f6;
    box-shadow: 0 5px 16px #9b111e14;
}

.instr-team-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.instr-team-card-heading strong {
    color: #243c54;
    font-size: 14px;
}

.instr-team-count {
    flex: none;
    font-weight: 800;
    font-size: 12.5px;
    color: #087bc1;
}

.instr-progress {
    height: 6px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #e4ebf2;
    overflow: hidden;
}

.instr-progress-bar {
    height: 100%;
    border-radius: 999px;
    background: #087bc1;
}

.instr-team-card.full .instr-progress-bar {
    background: #9b111e;
}

.instr-team-free {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: #146b26;
    font-weight: 700;
}

.instr-team-full-label {
    margin: 0 0 10px;
    font-size: 12.5px;
    color: #9b111e;
    font-weight: 700;
}

.instr-roster {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instr-roster li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    background: #f6f9fc;
}

.instr-roster li > div {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.instr-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 50%;
    background: #eaf5fc;
    color: #087bc1;
    font-size: 12px;
    font-weight: 800;
}

.instr-initial.lg {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.instr-roster li strong {
    font-size: 13px;
    color: #243c54;
}

.instr-roster li small {
    display: block;
    color: #6d829e;
    font-size: 11.5px;
}

.instr-roster-empty {
    padding: 10px;
    color: #6d829e;
    font-size: 12.5px;
}

.instr-participant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 18px 0 0;
}

.instr-participant-list .instr-roster li {
    padding: 12px;
    box-shadow: 0 5px 16px #10233f14;
}

.team-name-field {
    display: block;
    margin: 4px 0 16px;
    font-weight: bold;
    font-size: 13px;
    color: #243c54;
}

.team-name-field input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border: 1px solid #e4ebf2;
    border-radius: 9px;
    font-size: 16px;
    font-weight: normal;
}

/* ===========================
   MY EVENTS
=========================== */

.my-event {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding: 17px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 16px #10233f14;
    font-size: 28px;
}

.my-event span {
    font-size: 16px;
    font-weight: bold;
}

.my-event small {
    display: block;
    margin-top: 5px;
    color: #6d829e;
    font-size: 12px;
    font-weight: normal;
}

.my-event.overlap {
    border: 1px solid #f3c2c6;
    background: #fff6f6;
}

.my-event span .my-event-warning {
    display: inline-flex;
    align-items: center;
    margin-top: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #ffe9eb;
    color: #9b111e;
    font-size: 11px;
    font-weight: 700;
}

.my-event span .my-event-pending {
    display: inline-flex;
    align-items: center;
    margin-top: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #fff4e0;
    color: #9a6400;
    font-size: 11px;
    font-weight: 700;
}

.my-event span .my-event-teammates {
    display: block;
    margin-top: 4px;
    color: #087bc1;
    font-size: 11px;
    font-weight: 600;
}

.empty {
    padding: 40px 20px;
    color: #6d829e;
    text-align: center;
}

.my-events-day {
    margin: 26px 0 12px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .3px;
    color: #6d829e;
}

.my-events-day:first-of-type {
    margin-top: 4px;
}

/* ===========================
   AUTH BRAND
=========================== */

.auth-brand {
    text-align: center;
    margin-bottom: 8px;
}

.auth-logo-img {
    display: block;
    max-width: 280px;
    width: 100%;
    height: auto;
    margin: 0 auto 6px;
}

.auth-brand small {
    display: block;
    margin-top: 4px;
    color: #6d829e;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

/* ===========================
   PROGRAM PAGE
=========================== */

body.program-page {
    background-image: url("../img/pozadi.webp");
    background-size: cover;
    background-position: top center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* ===========================
   MAP PAGE
=========================== */

.map-page {
    max-width: 500px;
    margin: auto;
    padding: 10px 16px 28px;
}

.map-note {
    margin: 0 0 16px;
    color: #6d829e;
    font-size: 13px;
    line-height: 1.5;
}

.map-card {
    padding: 10px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 22px #10233f14;
}

.camp-map {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
}

/* ===========================
   FRIEND CODE CHIP
=========================== */

.announcement-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    margin: 10px 14px 18px;
    border-radius: 14px;
    background: #fff4e0;
    border: 1px solid #f4d090;
    color: #7a4a00;
    box-shadow: 0 14px 30px #7a4a0038, 0 3px 8px #7a4a0022;
    animation: announcement-pop .45s cubic-bezier(.26, 1.6, .5, 1) both;
}

@keyframes announcement-pop {
    0% { transform: scale(.85) translateY(-10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.announcement-icon {
    flex: none;
    font-size: 20px;
    line-height: 1.4;
}

.announcement-banner p {
    flex: 1;
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 600;
}

.announcement-close {
    flex: none;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: #ffffff77;
    color: #7a4a00;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.overlap-alert {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 30px;
    height: 30px;
    line-height: 1;
    text-align: center;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 0 rgba(255, 59, 48, .6);
    text-decoration: none;
    font-size: 15px;
    animation: overlap-pulse 1.6s infinite, overlap-blink 1.2s infinite;
}

.overlap-alert::before {
    content: '⚠️';
}

@keyframes overlap-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, .55); }
    70% { box-shadow: 0 0 0 9px rgba(255, 59, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

@keyframes overlap-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

.user-faculty {
    padding: 6px 10px;
    border-radius: 999px;
    background: #ffffff22;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
    white-space: nowrap;
}

/* Každá fakulta má vlastní barvu, ať jsou na první pohled rozeznatelné. */
.user-faculty[data-faculty="FF"] { background: #cfe8fb; color: #0b5f96; }
.user-faculty[data-faculty="PdF"] { background: #fff3c4; color: #8a6d00; }
.user-faculty[data-faculty="PF"] { background: #e6d6fb; color: #5b2a99; }
.user-faculty[data-faculty="PřF"] { background: #ffe1c2; color: #a3540a; }
.user-faculty[data-faculty="FZV"] { background: #d9f2d0; color: #2f7a1e; }
.user-faculty[data-faculty="LF"] { background: #ffd3d6; color: #9b111e; }
.user-faculty[data-faculty="FTK"] { background: #b8ddc0; color: #1b5e20; }
.user-faculty[data-faculty="CMTF"] { background: #f0e3fb; color: #7a3fa0; }

.friend-code-chip {
    padding: 7px 9px;
    border: 0;
    background: #ffffff22;
    color: inherit;
    border-radius: 7px;
    font: inherit;
    font-weight: 700;
    letter-spacing: .3px;
    cursor: pointer;
}

.friend-code-chip.copied {
    background: #21a338;
    color: #fff;
}

/* ===========================
   FRIENDS PAGE
=========================== */

.friends-page {
    max-width: 500px;
    margin: auto;
    padding: 10px 16px 28px;
}

.friends-code-card {
    padding: 22px;
    margin-bottom: 18px;
    border-radius: 18px;
    text-align: center;
    background: #fff;
    box-shadow: 0 8px 22px #10233f14;
}

.friends-code-label {
    margin: 0 0 10px;
    color: #6d829e;
    font-size: 13px;
    font-weight: 600;
}

.friend-code-chip-big {
    padding: 12px 22px;
    background: #eaf5fc;
    color: #087bc1;
    border-radius: 12px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

.friend-code-chip-big.copied {
    background: #e8f7eb;
    color: #146b26;
}

.friends-code-hint {
    margin: 12px 0 0;
    color: #6d829e;
    font-size: 12px;
}

.friends-add-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 24px;
}

.friends-add-form label {
    flex: 1;
    font-weight: bold;
    font-size: 13px;
    color: #243c54;
}

.friends-add-form input {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 12px;
    border: 1px solid #e4ebf2;
    border-radius: 9px;
    font-size: 16px;
}

.friends-add-form button {
    flex: 1;
    padding: 12px 18px;
    white-space: nowrap;
}

.friends-section-title {
    margin: 26px 0 12px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .3px;
    color: #6d829e;
}

.friend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 16px #10233f14;
}

.friend-row-name {
    font-weight: 700;
    color: #10233f;
}

.friend-row-link {
    display: flex;
    flex-direction: column;
}

.friend-row-link small {
    margin-top: 3px;
    color: #087bc1;
    font-size: 12px;
    font-weight: 600;
}

.friend-row-actions {
    display: flex;
    gap: 8px;
}

.friend-row-actions form {
    margin: 0;
}

.friend-btn {
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}

.friend-btn-accept {
    background: #087bc1;
    color: #fff;
}

.friend-btn-decline {
    background: #ffe9eb;
    color: #9b111e;
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width: 600px) {
    .topbar-brand img {
        height: 36px;
    }

    .user {
        font-size: 11px;
    }

    .heading h1 {
        font-size: 29px;
    }
}

@media (max-width: 380px) {
    .heading {
        padding: 20px 16px 14px;
    }

    .heading h1 {
        font-size: 25px;
    }

    .heading p {
        font-size: 16px;
    }

    .day {
        min-width: 80px;
        height: 84px;
    }

    .detail h1 {
        font-size: 26px;
    }
}