* {
  box-sizing: border-box;
}

:root {
  --color-turquoise: #40e0d0;
  --color-turquoise-light: #b8f0eb;
  --animation-duration: 0.4s;
}

body {
  margin: 0;
  font-family: "Roboto Condensed", system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.75)),
    url("/assets/images/background-travel.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

#auth-header {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.5rem 1rem;
  padding-right: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#auth-header button {
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  cursor: pointer;
}

#app {
  flex: 1 1 auto;
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem;
  padding-top: 2.5rem;
}

.site-footer {
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding: 1rem 1rem 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: #3a3a3a;
}

.site-footer__nav {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
}

.site-footer a {
  color: #1a6b62;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: #0d4a44;
}

.site-footer__sep {
  color: #888;
  user-select: none;
}

/* Standalone legal pages (privacy.html, terms.html) */
main.legal-page {
  flex: 1 1 auto;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  padding-top: 2.5rem;
  padding-bottom: 2rem;
}

.legal-page h1 {
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin: 0 0 1rem;
  color: #2a2a2a;
}

.legal-page h2 {
  font-size: 1.125rem;
  margin: 1.5rem 0 0.5rem;
  color: #2a2a2a;
}

.legal-page h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1rem 0 0.35rem;
  color: #2a2a2a;
}

.legal-page p,
.legal-page li {
  margin: 0.5rem 0;
  color: #333;
}

.legal-page ul {
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}

.legal-page .legal-back {
  margin-bottom: 1.25rem;
}

.legal-page .legal-back a {
  color: #1a6b62;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-page .legal-meta {
  font-size: 0.9rem;
  color: #555;
  margin-bottom: 1.25rem;
}

/* Welcome splash (logged out): title + main + Login grouped and vertically centered */
.welcome-view {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  margin-bottom: 2rem;
  min-height: min(85vh, calc(100vh - 5rem));
  width: 100%;
  max-width: 100%;
  gap: 1.25rem;
}

.welcome-view__brand {
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 1rem;
  margin: 0;
  box-sizing: border-box;
}

.welcome-view__brand-title {
  margin: 0;
  font-family: "Dancing Script", cursive;
  font-weight: 700;
  font-size: clamp(1.85rem, 6.5vw, 3.35rem);
  line-height: 1.12;
  max-width: 100%;
  background: linear-gradient(to bottom, #000000, #4a4a4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* drop-shadow works with gradient text; text-shadow does not */
  filter: drop-shadow(0 0.06em 0.14em rgba(0, 0, 0, 0.28));
  overflow-wrap: anywhere;
}

@supports not (background-clip: text) {
  .welcome-view__brand-title {
    background: none;
    color: #2a2a2a;
    -webkit-text-fill-color: unset;
    filter: none;
    text-shadow: 0 0.08em 0.16em rgba(0, 0, 0, 0.22);
  }
}

.welcome-view__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  justify-content: center;
  column-gap: 4rem;
  row-gap: 2rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  min-height: 0;
}

.welcome-view__side {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
}

.welcome-view__side--left {
  justify-self: end;
}

.welcome-view__content {
  min-width: 0;
  max-width: 400px;
  justify-self: center;
}

.welcome-view__side--right {
  justify-self: start;
}

/* Welcome side photos: rectangular tiles, slight rotation on the frame in JS; drop shadow here */
.welcome-view__photo {
  padding: 0;
  background: transparent;
  transition: transform var(--animation-duration);
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.12));
}

.welcome-view__photo:hover {
  filter: drop-shadow(0 5px 14px rgba(0, 0, 0, 0.18));
}

.welcome-view__photo img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  opacity: 0.88;
  filter: saturate(0.88) brightness(1.03);
}

.welcome-view__text {
  margin: 0 0 1rem;
  line-height: 1.6;
  color: #444;
}

.welcome-view__text:last-child {
  margin-bottom: 0;
}

.welcome-view__login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 1rem 0.5rem;
  width: 100%;
}

.welcome-view__login-btn {
  padding: 0.95rem 3rem;
  font-size: 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--animation-duration), transform var(--animation-duration);
}

.welcome-view__login-btn:hover {
  opacity: 0.95;
}

.app-section {
  margin-bottom: 2rem;
}

.app-section__title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  min-height: 2.25rem;
}

.app-section__title-row h1 {
  margin: 0;
  color: #333;
  line-height: 1.2;
  display: flex;
  align-items: center;
}

.edit-done-btn {
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-done-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.app-section > h1 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #333;
}

.app-section h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #333;
}

.country-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 56px;
  min-width: 180px;
  max-width: 220px;
  padding: 0 0.5rem;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: rgba(255, 255, 255, 0.9);
}

.country-cell--edit {
  min-height: 56px;
  height: auto;
  padding: 0.4rem 0.5rem;
}

.country-cell img {
  width: 40px;
  height: 28px;
  object-fit: cover;
  flex-shrink: 0;
}

.country-cell span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.country-cell__main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  flex: 1;
  gap: 0.15rem;
}

.country-cell--has-media {
  cursor: pointer;
}

.country-cell--has-media .country-cell__time {
  color: var(--color-turquoise);
  text-decoration: underline;
}

.country-cell--edit .country-cell__name {
  flex: 0 1 auto;
  min-width: 0;
}

.country-cell__time {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 300;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-cell__delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #c00;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.country-cell__delete:hover {
  background: #f5f5f5;
}

.country-cell--compact {
  height: 38px;
  min-width: 0;
  max-width: none;
  padding: 0 0.4rem;
}

.country-cell--compact img {
  width: 28px;
  height: 20px;
}

.country-cell--compact .country-cell__name {
  font-size: 0.9rem;
}

.visited-grid .country-cell {
  transition: opacity var(--animation-duration) ease-out;
}

.visited-grid .country-cell.cell-fade-out {
  opacity: 0;
}

.visited-grid .country-cell.cell-fade-in {
  opacity: 0;
}

.visited-grid .country-cell.cell-fade-in.visible {
  opacity: 1;
}

.visited-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  max-width: 680px;
  transition: opacity var(--animation-duration) ease-out;
}

.visited-grid.visited-grid--enter {
  opacity: 0;
}

.visited-grid.visited-grid--enter.visible {
  opacity: 1;
}

.visited-empty {
  color: #888;
  font-style: italic;
}

.visit-list-frame {
  max-width: 680px;
  margin-bottom: 0.75rem;
}

/* Content: border on left, top, right only; no border between content and tab row. */
.visit-list-content {
  margin: 0;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.visit-list-tabs {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  padding-top: 0;
  gap: 0;
  position: relative;
}

/* Horizontal connector lines from content edge to active tab (no border between content and selected tab). */
.visit-list-tabs::before,
.visit-list-tabs::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 1px;
  background: #ddd;
}
.visit-list-tabs::before {
  width: 0;
}
.visit-list-tabs::after {
  left: auto;
  right: 0;
  width: 80%;
}
.visit-list-frame--tab-1 .visit-list-tabs::before {
  width: 20%;
}
.visit-list-frame--tab-1 .visit-list-tabs::after {
  width: 60%;
}
.visit-list-frame--tab-2 .visit-list-tabs::before {
  width: 40%;
}
.visit-list-frame--tab-2 .visit-list-tabs::after {
  width: 40%;
}
.visit-list-frame--tab-3 .visit-list-tabs::before {
  width: 60%;
}
.visit-list-frame--tab-3 .visit-list-tabs::after {
  width: 20%;
}
.visit-list-frame--tab-4 .visit-list-tabs::before {
  width: 80%;
}
.visit-list-frame--tab-4 .visit-list-tabs::after {
  width: 0;
}

.visit-list-tabs__tab {
  flex: 1;
  padding: 0.4rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #333;
  transition: background-color var(--animation-duration) ease-out;
}

.visit-list-tabs__tab:hover:not(.visit-list-tabs__tab--active) {
  background: rgba(0, 0, 0, 0.04);
}

/* Selected tab: border only on left, right, bottom; continuous with content. No top border = no line between tab and content. */
.visit-list-tabs__tab--active {
  font-weight: 600;
  background: var(--color-turquoise-light);
  color: #333;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 6px 6px;
}
.visit-list-tabs__tab--active:first-child {
  border-radius: 0 0 0 6px;
}
.visit-list-tabs__tab--active:last-child {
  border-radius: 0 0 6px 0;
}
.visit-list-tabs__tab--active:only-child {
  border-radius: 0 0 6px 6px;
}
.visit-list-tabs__tab--active:hover {
  background: #8ee6df;
}

/* Statistics tab: grid of circle graph cells */
.statistics-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.5rem;
  max-width: 680px;
  padding: 1.5rem 0;
}

.statistics-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.statistics-cell__circle-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  flex-shrink: 0;
}

.statistics-cell__svg {
  width: 100%;
  height: 100%;
  display: block;
}

.statistics-cell__percent {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: #000;
  pointer-events: none;
}

.statistics-cell__name {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
  color: #333;
}

.visit-list-map {
  min-height: 350px;
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
}

/* Ocean: transparent so page background shows (override svgMap default #d9ecff). */
.visit-list-map .svgMap-map-wrapper {
  background-color: transparent;
}

.visit-map-tooltip__visit-link {
  color: var(--color-turquoise);
  text-decoration: underline;
  cursor: pointer;
}

.visit-list-by-continent {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.visit-list-by-continent__section {
  margin-bottom: 0.5rem;
}

.visit-list-by-continent__section:last-child {
  margin-bottom: 0;
}

.visit-list-by-continent__title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}

.add-visit-form button[type="submit"],
.add-visit-form__add-btn {
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  cursor: pointer;
}

.add-visit-form__add-row {
  padding-top: 0.75rem;
}

.add-visit-form__add-row .add-visit-form__add-btn {
  height: 2.25rem;
  min-height: 2.25rem;
  box-sizing: border-box;
  padding: 0.35rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.add-visit-form__row .add-visit-form__add-btn {
  margin-left: 0.25rem;
  height: 2.25rem;
  min-height: 2.25rem;
  box-sizing: border-box;
  padding: 0.35rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.add-visit-form select,
.add-visit-form input {
  border-radius: 4px;
  border: 1px solid #ccc;
  padding: 0.35rem;
  font-family: inherit;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.add-visit-form input.invalid,
.add-visit-form select.invalid,
.add-visit-form .add-visit-form__row input.invalid {
  border: 1px solid #c00 !important;
  border-radius: 4px;
}

.add-visit-form input.invalid:focus,
.add-visit-form .add-visit-form__row input.invalid:focus {
  outline: 2px solid #c00;
  outline-offset: -2px;
  border: 1px solid #c00 !important;
}

.add-visit-form__year {
  width: 5rem;
}

.add-visit-form input[type="number"] {
  -moz-appearance: textfield;
}

.add-visit-form input[type="number"]::-webkit-outer-spin-button,
.add-visit-form input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.add-visit-form__row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.add-visit-form__row .country-dropdown {
  margin-bottom: 0;
}

.add-visit-form__row .month-dropdown {
  display: flex;
  align-items: stretch;
  margin-bottom: 0;
  height: 2.25rem;
}

.add-visit-form__row .month-dropdown__trigger {
  flex: 1;
  min-height: 0;
}

.add-visit-form__row .country-dropdown__input,
.add-visit-form__row input,
.add-visit-form__row select,
.add-visit-form__row .month-dropdown__trigger {
  height: 2.25rem;
  box-sizing: border-box;
  padding: 0.35rem 0.5rem;
  line-height: 1.25;
}

/* Match country dropdown input font so placeholder matches "Select country" */
.add-visit-form__date-input,
.add-visit-form__date-input::placeholder {
  font-family: inherit;
  font-size: 1rem;
}

.add-visit-form__date-input::placeholder {
  color: #999;
}

.add-visit-form__visit-time-label {
  font-size: 0.95rem;
  color: #333;
  margin: 0 0 0 1.5rem;
  padding: 0;
  align-self: stretch;
  height: 2.25rem;
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  line-height: 1.25;
}

.add-visit-form__visit-time-hint {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.add-visit-form__row .add-visit-form__media-url {
  flex: 1;
  min-width: 14rem;
}

.add-visit-form__media-url,
.add-visit-form__media-url::placeholder {
  font-family: inherit;
  font-size: 1rem;
}

.add-visit-form__media-url::placeholder {
  color: #999;
}

.add-visit-form__media-url-hint {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

/* Share section */
.share-section__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.share-section__url-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 0.95rem;
  background: #f8f8f8;
  color: #333;
}

.share-section__copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.share-section__copy-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.share-section__copy-btn svg {
  flex-shrink: 0;
}

.share-section__explanation {
  color: #666;
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}

.share-home-wrap {
  margin-top: 1rem;
  text-align: center;
}

.share-home-btn {
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.auth-header__home-btn {
  margin-right: 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  cursor: pointer;
}

/* Country dropdown (custom component) */
.country-dropdown {
  position: relative;
  max-width: 320px;
  margin-bottom: 0.5rem;
}

.country-dropdown__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border-radius: 4px;
  border: 1px solid #ccc;
  padding: 0.35rem 0.5rem;
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: #333;
}

.country-dropdown__input:focus {
  outline: 2px solid var(--color-turquoise);
  outline-offset: -2px;
  border-color: var(--color-turquoise);
}

.country-dropdown__panel[hidden] {
  display: none !important;
}

.country-dropdown__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  max-height: 280px;
  display: flex;
  flex-direction: column;
}

.country-dropdown__list {
  overflow-y: auto;
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.country-dropdown__item {
  cursor: pointer;
  border-radius: 4px;
  transition: opacity var(--animation-duration) ease-out;
}

.country-dropdown__item:hover {
  background: rgba(64, 224, 208, 0.15);
}

.country-dropdown__item.country-dropdown__item--enter {
  opacity: 0;
}

.country-dropdown__item.country-dropdown__item--enter.visible {
  opacity: 1;
}

/* Month dropdown (custom component) */
.month-dropdown {
  position: relative;
  min-width: 10rem;
}

.month-dropdown__trigger {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: 0 0.5rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  outline: none;
}

.month-dropdown__trigger:focus {
  outline: 2px solid var(--color-turquoise);
  outline-offset: -2px;
  border-color: var(--color-turquoise);
}

.month-dropdown__trigger--placeholder {
  background: #fff;
  color: #666;
}

.month-dropdown__trigger--value {
  background: #fff;
  color: #333;
  font-weight: normal;
}

.month-dropdown__panel[hidden] {
  display: none !important;
}

.month-dropdown__panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.25rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
}

.month-dropdown__list {
  padding: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.month-dropdown__item {
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  font-weight: normal;
  background: #fff;
}

.month-dropdown__item:hover {
  background: rgba(64, 224, 208, 0.15);
}

/* Tooltip (custom component) - border is drawn by SVG so it includes the beak */
.tooltip {
  position: fixed;
  z-index: 1000;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  font-family: "Roboto Condensed", system-ui, sans-serif;
  font-size: 0.9rem;
  background: #fafbfc;
  color: #333;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  max-width: 16rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--animation-duration) ease-out;
}

.tooltip.tooltip--visible {
  opacity: 1;
}

.tooltip__content {
  position: relative;
  z-index: 1;
}

.tooltip__border {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tooltip[data-placement="above"] .tooltip__border {
  height: calc(100% + 6px);
}

.tooltip[data-placement="below"] .tooltip__border {
  top: -6px;
  height: calc(100% + 6px);
}

.tooltip[data-placement="left"] .tooltip__border {
  width: calc(100% + 6px);
}

.tooltip[data-placement="right"] .tooltip__border {
  left: -6px;
  width: calc(100% + 6px);
}

.tooltip__border path {
  stroke: var(--color-turquoise);
  stroke-width: 1;
  fill: none;
}

/* Beak fill (triangle in background color) - border is drawn by SVG path */
.tooltip::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  z-index: 0;
}

.tooltip[data-placement="above"]::after {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #fafbfc;
  border-bottom: none;
}

.tooltip[data-placement="below"]::after {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #fafbfc;
  border-top: none;
}

.tooltip[data-placement="left"]::after {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #fafbfc;
  border-left: none;
}

.tooltip[data-placement="right"]::after {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #fafbfc;
  border-right: none;
}

.tooltip[hidden] {
  display: none !important;
}

/* Add-friend section (when logged in and viewing shared visits) */
.add-friend-section {
  margin-top: 1rem;
  padding: 2rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.add-friend-section__box {
  border: 1px solid #000;
  border-radius: 10px;
  padding: 2.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.add-friend-section__text {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  text-align: center;
}

.add-friend-section__text:last-child {
  margin-bottom: 0;
}

.add-friend-section__btn {
  padding: 0.75rem 2.5rem;
  font-size: 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--color-turquoise);
  background: var(--color-turquoise-light);
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--animation-duration), transform var(--animation-duration);
}

.add-friend-section__btn:hover {
  background: #9ee9e3;
  opacity: 0.95;
}

/* Friends list section (when logged in, not in shared mode) */
.friends-section__title {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.friends-section__empty {
  margin: 0;
  color: #666;
  font-size: 0.95rem;
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 680px;
}

.friend-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  min-height: 48px;
  transition: background 0.15s ease;
}

.friend-cell:hover {
  background: #f8f8f8;
}

.friend-cell__link-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  cursor: pointer;
}

.friend-cell__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.friend-cell__name {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friend-cell__view {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--color-turquoise);
  text-decoration: underline;
}

.friend-cell__delete {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid #c00;
  background: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

.friend-cell__delete:hover {
  background: #f5f5f5;
}

@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }
  #auth-header {
    padding-bottom: 1.75rem;
  }
  #app {
    padding-top: 5rem;
  }
  #auth-header::after {
    content: "";
    position: absolute;
    right: 0;
    width: 100vw;
    bottom: 0;
    border-bottom: 1px solid #000;
  }
  .visited-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .country-cell {
    min-width: 0;
    max-width: 100%;
  }
  .add-visit-form__media-url {
    min-width: 0;
    overflow-wrap: break-word;
  }
  .month-dropdown {
    min-width: 0;
  }
  .share-section__url-input {
    overflow-wrap: break-word;
    word-break: break-word;
  }
  .welcome-view__photo img {
    width: 56px;
    height: 56px;
  }
  .welcome-view__inner {
    column-gap: 1.5rem;
  }
  .welcome-view__brand {
    padding: 0 0.75rem;
  }
}

@media (max-width: 400px) {
  #app {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

@media (hover: none) {
  .svgMap-tooltip,
  .tooltip {
    display: none !important;
  }
}
