:root, :host {
    --fa-style-family-classic: 'Font Awesome 6 Free';
    --fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free';
}

html, body {
    overflow-x: hidden;
}

body {
    background-color: var(--page-bg-color);
    color: var(--page-fg-color);
    /*noinspection CssNoGenericFontName*/
    font-family: var(--font-family-sans);
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    max-width: 860px;
    padding: 0 5px;
    margin: auto;
}

input[type="text"], input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
}

p { margin-top: 0.5rem; margin-bottom: 0.5rem; }

ul.compact {
    margin: 0;
    padding: 0;
}
ul.compact > li {
    margin: 0 0 0 1rem;
}


h1 { font-size: 1.6rem; margin: 1rem 0 1.4rem 0; }
h2 { font-size: 1.4rem; margin-top: 1.4rem; }
h3 { font-size: 1.2rem; margin-bottom: 0.8rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.6rem; }

a {
    color: var(--a-fg-color);
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1); /* Soft subtle tint */
}

@media (hover: hover) {
    /* This CSS block will only target actual computer mice */
    a:hover {
        text-decoration: underline;
    }
}
/* A visual clue for clicky 'a' and non-clicky 'span'. */
[data-place]::before {
    content: "🏓\2060";
    font-size: 0.9em;
    margin-right: 0.25em;
    font-family: system-ui, -apple-system, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI", Roboto, "Noto Color Emoji", sans-serif;
    display: inline;
    pointer-events: none;
}

a[href^="https://www.google.com/maps/dir/"]::before {
    content: "\f124";
    font: var(--fa-font-solid);
    -webkit-font-smoothing: antialiased;
    font-size: 0.85em;
    opacity: 1;
    margin-right: 0.22em;
    display: inline; /* do not tear the text from the icon */
    pointer-events: none;
}

a.google-maps-place {
    isolation: isolate;
    white-space: nowrap;
}

a.google-maps-place::before {
    content: "\f3c5";
    font: var(--fa-font-solid);
    -webkit-font-smoothing: antialiased;
    opacity: 1;
    margin-right: 0.15em;
    display: inline-block; /* inline-block + nowrap on the whole link because we use linear-gradient. */
    pointer-events: none;

    background: linear-gradient(135deg, #ea4335 0%, #ea4335 30%, #fabc05 30%, #fabc05 52%, #34a853 52%, #34a853 63%, #4285f4 63%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;

    transform: scale(0.85); /* Make the icon slightly smaller... */
    transform-origin: 50% 60%; /* ...while preventing its top being clipped */
}

a.preview-link::before {
    content: "\f302";
    font: var(--fa-font-solid);
    font-size: 0.8em;
    margin-right: 0.25em;
    opacity: 0.65;
}

ul#toc, ul#toc ul { list-style-type: none; }
ul#toc { padding: 0; }
ul#toc ul { padding-inline-start: 1.5ch; }
ul#toc > li { padding-bottom: 0.5rem; }
ul#toc > li:last-child { padding-bottom: 0; }
#daysOfWeek li a {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 0 2px;
    display: inline-block;
}
#daysOfWeek li a.today {
    border-color: var(--a-fg-color);
}
#daysOfWeek li  + li::before {
    margin: 0 0.1rem;
}

ul.inline-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
 }

ul.inline-list li {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    padding-top: 0.2rem;
}

ul.inline-list li + li::before {
    content: "•";
    margin: 0 0.3rem;
    color: #BBB;
}

div#newsContainer {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px;
    border-radius: 0.5rem;
    border: 1px solid var(--table-border-color);
}

div#newsContainer > div {
    font-size: 0.8rem;
    font-style: italic;
    color: #888888;
    margin-top: 0.9rem;
    margin-bottom: 0.2rem;
}

div#newsContainer > div:first-child { margin-top: 0.2rem; }

details > summary {
    list-style: none;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "\f055";
    font: var(--fa-font-solid);
    -webkit-font-smoothing: antialiased;
    margin-right: 0.2rem;
}
details[open] summary::before {
    content: "\f056";
    font: var(--fa-font-solid);
    -webkit-font-smoothing: antialiased;
    margin-right: 0.2rem;
}

details > p {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

ul#moreNews {
    list-style-type: none;
    margin-top: 20px;
    padding: 0;
    line-height: 1.5;
    font-size: 0.8rem;
    font-style: italic;
    color: #888888;
}
@media (max-width: 767px) {
    #moreNews .desc { display: none; }
}

#venues {
    margin-bottom: 0.8rem;
}

#maps { margin-bottom: 0; }
div.maps {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between; /* On wide screens, push children apart */
}

div.maps div {
    display: inline-block;
    vertical-align: top;
    max-width: 400px;
    width: 48%; /* Almost half, so they fit side by side with some space */
    margin-top: 10px;
}
div.maps img {
    margin-top: 10px;
    border-radius: 0.5rem;
    max-width: 100%; /* scale within container */
    height: auto;
}
div.maps details {
    width: 100%;
}
/* For narrow devices, stack images aligned left */
@media (max-width: 600px) {
    div.maps {
        flex-direction: column;
        align-items: flex-start; /* Align items to left edge */
    }
    div.maps div {
        width: 100%;  /* Full width, so stacked */
        margin-bottom: 10px; /* spacing between stacked items */
    }
    div.maps div:last-child {
        margin-bottom: 0; /* spacing between stacked items */
    }
}

#shareVenue {
    margin-top: 1.5rem;
    padding: 0.8rem;
    border: 1px solid var(--table-border-color);
    border-radius: 0.5rem;
    background-color: var(--table-bg-color);
}

#shareVenue h2 {
    margin-top: 0;
}

#shareVenue label {
    display: block;
    margin-bottom: 0.4rem;
}

#shareVenue .hint {
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    color: #888888;
}

#shareVenueSearch {
    box-sizing: border-box;
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--table-border-color);
    background-color: var(--page-bg-color);
    color: var(--page-fg-color);
}

#shareVenueStatus {
    min-height: 1.2rem;
    margin-top: 0.45rem;
    font-size: 0.9rem;
    color: #888888;
}

#shareVenueSelected {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

#shareVenueSelected[hidden] {
    display: none;
}

#shareVenueLink {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.45rem;
    border: 1px solid var(--table-border-color);
    background-color: var(--page-bg-color);
    color: var(--page-fg-color);
}

#shareVenueCopy {
    white-space: nowrap;
}

tr.shared-place-highlight > td {
    animation: shared-place-highlight 5s ease-out;
}

@keyframes shared-place-highlight {
    0% { background-color: var(--today-highlight); }
    100% { background-color: transparent; }
}


.ui-autocomplete {
    box-sizing: border-box;
    max-width: calc(100vw - 16px);
    overflow-x: hidden;
    background-color: var(--table-bg-color);
    color: var(--page-fg-color);
    border: 1px solid var(--table-border-color);
    box-shadow: 0 4px 12px var(--box-shadow-color);
}

.ui-autocomplete .ui-menu-item-wrapper,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-focus,
.ui-widget-content .ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-widget-content .ui-autocomplete .ui-menu-item-wrapper.ui-state-focus {
    box-sizing: border-box;
    margin: 0;
    padding: 3px 1em 3px 0.4em;
    border: 1px solid transparent;
    outline: none;
    font-weight: normal;
    line-height: normal;
}

.ui-autocomplete .ui-menu-item-wrapper.ui-state-active,
.ui-autocomplete .ui-menu-item-wrapper.ui-state-focus {
    background-color: var(--th-bg-color);
    color: var(--page-fg-color);
}

.ui-autocomplete .share-venue-result {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ui-autocomplete .share-venue-result-title {
    font-weight: bold;
}

.ui-autocomplete .share-venue-result-meta {
    font-size: 0.85rem;
    opacity: 0.8;
    white-space: normal;
    overflow-wrap: anywhere;
}

table {
    background-color: var(--table-bg-color);
    border-collapse: collapse;
    word-break: break-word;
    border: 1px solid var(--table-border-color);
}

tr {
    border-bottom: 1px solid var(--table-border-color);
}

th {
    background-color: var(--th-bg-color);
}

th, td {
    padding: 10px;
    border-width: 0;
}

@media (max-width: 600px) {
    h1 { font-size: 1.3rem; }
    th, td { padding: 6px; }
}

caption {
    font-size: 1.4rem;
    font-weight: bold;
    margin-top: 2rem;
    text-align: left;
    padding-bottom: 1rem;
}

/* START rounding borders of tables 'Clubs' and 'Courts'. */
table#t_clubs { border-collapse: separate; border-spacing: 0; border-radius: 0.5rem; }
table#t_clubs th:first-of-type { border-top-left-radius: 0.5rem; }
table#t_clubs th:last-of-type { border-top-right-radius: 0.5rem; }
table#t_clubs th, td { border-bottom: 1px solid var(--table-border-color); }
table#t_clubs tr:last-of-type td { border-bottom: 0; }

table#t_courts { border-collapse: separate; border-spacing: 0; border-radius: 0.5rem; }
table#t_courts th:first-of-type { border-top-left-radius: 0.5rem; }
table#t_courts th:last-of-type { border-top-right-radius: 0.5rem; }
table#t_courts th, td { border-bottom: 1px solid var(--table-border-color); }
table#t_courts tr:last-of-type td { border-bottom: 0; }
/* END rounding borders of tables 'Clubs' and 'Courts'. */

table#t_courts td:last-of-type { text-align:center; }

.warn {
    font-size: small;
    color: red;
}

#schedule { margin-block-end: 0.8rem; }

#schedule_error { color: red; padding-top: 1rem; display: none; }
#schedule_error_time { padding-right: 1rem; }

#changelogContainer {
    max-height: 100px;
    overflow-y: auto;
    padding: 6px;
    margin-top: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--table-border-color);
    font-size: 0.9rem;
    font-style: italic;
}

#changelog { margin-top: 0.3rem; }

#changelog li::marker { content: "- "; }
#changelog li { margin-left: 0.4rem; }
.diff-link span.date {
    font-family: monospace;
    font-size: 0.75rem;
    opacity: 0.9;
    margin-right: 0.5rem;
}

/* START DIFF DIALOG */
.ui-corner-all {border-radius: 0.3rem !important;}
.ui-dialog .ui-dialog-content {
    padding: 0.5rem;
}
pre a { color: var(--a-fg-color) !important; text-decoration: underline; cursor: pointer; }
span.diff-removed {
    background-color: var(--diff-removed-bg);
    color: var(--diff-removed-fg);
    text-decoration-line: line-through;
}
span.diff-added {
    background-color: var(--diff-added-bg);
    color: var(--diff-added-fg);
}
button.diff-nav-prev:disabled, button.diff-nav-next:disabled {
    opacity: 10%;
}
/* END DIFF DIALOG */

#scheduleContainer > ul {
    list-style: none;
    padding-left: 0;
    margin-top: 0;
}

#scheduleContainer h3 {
    margin-bottom: 0;
    padding-bottom: 0.8rem;
}

#scheduleContainer h3.today,
#scheduleContainer ul.today {
    border-left: 3px solid var(--today-highlight);
    padding-left: 0.8rem;
}

#scheduleContainer > ul > li {
    padding-top: 0.2em;
    padding-bottom: 0.2em;
    padding-left: 1.5em;
    text-indent: -1.5em;  /* Matches padding-left value */
}

#scheduleContainer ul li ul li  {
    padding-bottom: 0.2em;
    text-indent: 0;
}
#scheduleContainer ul li ul li::marker {
    font-size: 1.2em;
}

#scheduleContainer li ul {
    padding-left: 1em;
    list-style: initial;
}

.br-optional {
    display: none;
}
@media (max-width: 359px) {
    .br-optional {
        display: block;
    }
}

span.ranked {
    background-color: var(--ranked-bg);
}
span.unranked {
    background-color: var(--unranked-bg);
}

span.rankRange {
    white-space: nowrap;
    color: var(--high-contrast-text-color);
    border-radius: 3px;
}

i.fa-cart-shopping {
    font-size: 0.85em;
    vertical-align: middle;
}

#lang-switcher {
    float: right;
    padding-right: 10px;
}

div#copyright {
    margin: 2.25rem 0 1.25rem 0;
}

#backToTop {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: calc(50% - 430px);
    z-index: 99;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #aaa;
    color: #111;
    text-decoration: none;
    width: 50px;
    height: 50px;
    cursor: pointer;
}

#backToTop:hover {
    background-color: #888;
}

@media (max-width: 900px) { /* Fallback for narrow screens */
    #backToTop {
        right: 20px;
    }
}

div#placeInfoOverlay {
    display:none;
    position:absolute;
    z-index:10000;
    border: 1px solid var(--table-border-color);
    box-shadow:0 4px 12px var(--box-shadow-color);
}

#placeInfoOverlay table,
#placeInfoOverlay td,
#placeInfoOverlay th {
    background-color: var(--table-bg-color);
    opacity: 1;
}

#placeInfoOverlay tr:nth-child(1) td { font-weight: bold; }

#shareVenueToast {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    z-index: 10001;
    max-width: min(92vw, 520px);
    padding: 0.7rem 1rem;
    border-radius: 0.5rem;
    background-color: var(--diff-added-bg);
    color: var(--diff-added-fg);
    border: 2px solid var(--diff-added-fg);
    box-shadow: 0 4px 12px var(--box-shadow-color);
    text-align: center;
    font-weight: bold;
}