body {
    background-image: url("https://www.phantompeak.com/media/oi5msid1/widescreen-no-elements.png");
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    font-family: Hanley Pro Sans,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
}

/* Custom select wrapper */
.custom-select-wrapper {
  position: relative !important;
  width: 100%;
  max-width: 280px; /* Allows it to shrink on very small screens */
}

/* Custom select box */
.custom-select {
  box-sizing: border-box !important;
  color: #d0d0d0 !important;
  text-align: center !important;
  width: 100% !important;
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 32px 10px 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.07) !important;
  cursor: pointer !important;
  transition: border-color 0.3s ease-in-out !important, background 0.3s ease-in-out !important;
}

.custom-select:hover {
  background: rgba(255, 255, 255, 0.11) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

/* Dropdown arrow */
.custom-select::after {
  content: '\25BC' !important;
  position: absolute !important;
  right: 10px !important;
  font-size: 0.65em !important;
  color: rgba(255, 255, 255, 0.45) !important;
  pointer-events: none !important;
}

/* Options container */
.custom-options {
  color: #d0d0d0 !important;
  display: none !important;
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0 !important;
  width: 100% !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  background: rgba(10, 10, 15, 0.97) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  z-index: 1000 !important;
  overflow: hidden !important;
}

/* Option item */
.custom-option {
  padding: 10px 14px !important;
  cursor: pointer !important;
  font-size: 0.875rem !important;
  transition: background 0.2s ease-in-out !important, color 0.2s ease-in-out !important;
}

.custom-option:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

/* Show options when open */
.custom-select.open .custom-options {
  display: block !important;
}

/* Season controls layout */
.season-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  width: fit-content;
  margin: 8px auto 20px;
}

.season-arrow {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #d0d0d0;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.season-arrow:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.controls {
  margin: 20px;
}

.controls input {
  margin: 0.5rem;
  width: 50%;
  text-align: center;
	position: block;
}

.controls button {
  margin: 0.5rem;
  text-align: center;
}

.confirm-box p {
  color: black;
}

.trail-card-container {
  display: grid;
  grid-template-columns: repeat(4, 200px);
  gap: 20px;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  padding: 20px;
  margin: 0 auto;
}

.card {
  --bs-card-border-width: 0px;
  width: 200px;
  height: 300px;
  margin: 0;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

.card .front,
.card .back {
  width: 100%;
  height: 100%;
  position: absolute;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden; /* For Safari compatibility */
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); /* Smoother easing */
  will-change: transform; /* Tells the browser to optimize for movement */
}

.card .front {
  transform: rotateY(180deg);
}

.card .back {
  transform: rotateY(0deg);
}

.card .front img,
.card .back img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.card.flipped .front {
  transform: rotateY(0deg); /* Show the front */
}

.card.flipped .back {
  transform: rotateY(-180deg); /* Hide the back */
}

.confirm-box {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  z-index: 1;
}

.confirm-box p {
  margin: 0 0 10px 0;
}

.confirm-box button {
  margin: 5px;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  background-color: #28a745;
  color: white;
}

.confirm-box button:last-child {
  background-color: #dc3545;
  color: white;
}

.card-number {
  color: black;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  text-align: center;
  opacity: 0;
  z-index: 1;
}

.card:hover .card-number {
  opacity: 1;
}

.card.locked .front::before,
.card.locked .back::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 10px;
  z-index: 1;
  opacity: 1;
  transition: opacity 2s;
}

.card:not(.locked) .front::before,
.card:not(.locked) .back::before {
  opacity: 0;
}

/* Achievement cards */
.achievement-card {
  border-radius: 10px;
    --bs-card-border-width: 0px;
  width: 200px;
  height: 300px;
  margin: 0;
  transform-style: preserve-3d;
  perspective: 1000px;
  cursor: pointer;
  position: relative;
}

/* Ensure achievement tooltips are always on top of the image */
.achievement-card .back .card-number {
    z-index: 10 !important;
}

/* While the card is NOT flipped, make sure the back is the interactive side */
.achievement-card:not(.flipped) .back {
    z-index: 2;
    pointer-events: auto;
}

/* While the card IS flipped, the front is on top, so the back shouldn't hover */
.achievement-card.flipped .back {
    z-index: 1;
    pointer-events: none;
}

/* Ensure the generic card hover doesn't fight with our specific back-hover */
.achievement-card:hover .card-number {
    opacity: 0;
}

.achievement-card .back:hover .card-number {
    opacity: 1 !important;
}

.achievement-tooltip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 80%;
  max-width: 160px;
}

.achievement-hint {
  display: block;
  font-size: 0.72em;
  color: #555;
  line-height: 1.4;
}

@media only screen and (max-width: 600px) {

	.card:hover .card-number {
    opacity: 0;
  }

  .trail-card-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
  }

  /* Cards now scale with the fluid grid while maintaining the 2:3 card ratio */
  .card {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3; 
    margin: 0;
	transform-style: preserve-3d;
  }

  /* Make sure season controls don't overflow */
  .season-controls {
    gap: 10px;
    width: 100%;
    justify-content: center;
  }

  /* Keeps the confirm box safely inside the smaller card bounds */
  .confirm-box {
    font-size: 0.75em;
    padding: 10px;
    width: 85%;
    box-sizing: border-box;
	
  }

  /* Stacks the Yes/No buttons so they are easier to tap */
  .confirm-box button {
    margin: 4px 0;
    padding: 8px;
    width: 100%;
    display: block;
	min-height: 44px; 
    font-size: 16px; /* Prevents iOS from zooming in on click */
  }

  .card-number {
    font-size: 0.8em;
    padding: 10px;
    width: 85%;
    box-sizing: border-box;
  }

  .popup {
    bottom: 24px;
	left: 25%;
	width: 100%;
	max-width: 400px;
	margin: 0;
	text-align: center;
	box-sizing: border-box;
  }
  
  .popup--exit {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
}

/* ============================================================
   SIDEBAR LAYOUT
   ============================================================ */

:root {
  --sidebar-width: 280px;
  --sidebar-bg: rgba(10, 10, 15, 0.97);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #d0d0d0;
  --sidebar-accent: #fac132;
  --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --toggle-size: 44px;
  --toggle-offset: 16px;
}

/* --- Hamburger toggle button --- */
.sidebar-toggle {
  position: fixed;
  top: var(--toggle-offset);
  left: var(--toggle-offset);
  z-index: 1100;
  width: var(--toggle-size);
  height: var(--toggle-size);
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  transition: background var(--sidebar-transition), left var(--sidebar-transition);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sidebar-toggle:hover {
  background: rgba(30, 30, 40, 0.95);
}

.sidebar-open .sidebar-toggle {
  left: calc(var(--sidebar-width) + var(--toggle-offset));
}

.hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--sidebar-text);
  border-radius: 2px;
  transition: transform var(--sidebar-transition), opacity var(--sidebar-transition), width var(--sidebar-transition);
}

/* Animate to X when open */
.sidebar-open .sidebar-toggle .hamburger-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-open .sidebar-toggle .hamburger-bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
.sidebar-open .sidebar-toggle .hamburger-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile overlay --- */
.sidebar-overlay {
    display: block; /* Keep it block but use visibility */
    visibility: hidden;
    pointer-events: none; 
    z-index: 900;
    transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-open .sidebar-overlay {
    visibility: visible;
    pointer-events: auto;
    opacity: 1;
}

/* --- Sidebar panel --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  z-index: 1000;
  transform: translateX(calc(-1 * var(--sidebar-width)));
  transition: transform var(--sidebar-transition);
  overflow-y: hidden;
  overflow-x: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.sidebar-open .sidebar {
  transform: translateX(0);
  pointer-events: auto; 
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  padding: 0 0 24px 0;
  min-height: 100%;
}

/* --- Sidebar header --- */
.sidebar-header {
  display: flex;
  align-items: center;
  height: 64px;
  padding: 0 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* --- Sections --- */
.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-section--bottom {
  margin-top: auto;
  border-bottom: none;
}

.sidebar-label {
  display: block;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* --- Auth layout --- */
.sidebar-auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.3s ease;
}

.sidebar-logged-in {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.3s ease;
}

.auth-message {
  margin: 0;
  font-size: 0.78rem;
  color: var(--sidebar-accent);
  text-align: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  min-height: 1em;
  line-height: 1.4;
}

.auth-message.visible {
  opacity: 1;
}

.auth-message--error {
  color: #e74c3c;
}

.sidebar-user-label {
  color: var(--sidebar-text);
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

.sidebar-user-email {
  color: var(--sidebar-accent);
  word-break: break-all;
}

/* --- Password wrapper --- */
.password-wrapper {
  position: relative;
}

.password-wrapper .sidebar-input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.35);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.password-toggle:hover {
  color: rgba(255, 255, 255, 0.8);
}

.password-toggle svg {
  width: 15px;
  height: 15px;
  display: block;
}

/* --- Inputs --- */
.sidebar-input {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  color: #fff;
  padding: 9px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--sidebar-transition), background var(--sidebar-transition);
  outline: none;
}

.sidebar-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.sidebar-input:focus {
  border-color: var(--sidebar-accent);
  background: rgba(255, 255, 255, 0.1);
}

/* --- Buttons --- */
.sidebar-btn {
  padding: 9px 14px;
  border: 2px solid var(--sidebar-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--sidebar-transition), border-color var(--sidebar-transition), color var(--sidebar-transition);
  white-space: nowrap;
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}

.sidebar-btn--primary {
  background: #3c899b;
  border-color: #fac132;
  color: #fff;
}

.sidebar-btn--primary:hover {
  background: #073153;
  border-color: #fac132;
}

.sidebar-btn--danger {
  background: rgba(192, 57, 43, 0.2);
  border-color: rgba(192, 57, 43, 0.4);
  color: #e74c3c;
}

.sidebar-btn--danger:hover {
  background: rgba(192, 57, 43, 0.35);
  border-color: #c0392b;
  color: #ff6b6b;
}

.sidebar-btn--full {
  width: 100%;
}

.sidebar-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.sidebar-btn-row .sidebar-btn {
  flex: 1;
}


/* --- Main content area --- */
.main-content {
  transition: margin-left var(--sidebar-transition);
  min-height: 100vh;
}

@media (min-width: 601px) {
  .sidebar-open .main-content {
    margin-left: var(--sidebar-width);
  }
  .main-content {
    padding-top: 72px;
  }
}

@media (max-width: 600px) {
  .sidebar-overlay {
    display: block;
  }
  .main-content {
    padding-top: 68px;
  }
  .sidebar-open .sidebar-toggle {
    left: var(--toggle-offset);
  }
}

/* ============================================================
   POPUP NOTIFICATIONS
   ============================================================ */

.popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  background: rgba(15, 15, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 3px solid var(--popup-accent, #5a9fd4);
  border-radius: 8px;
  padding: 12px 16px;
  color: #e0e0e0;
  font-size: 0.875rem;
  max-width: 280px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.popup--exit {
  opacity: 0;
  transform: translateY(8px);
}

.popup--error {
  --popup-accent: #e74c3c;
}

.popup--success {
  --popup-accent: #fac132;
}

/* ============================================================
   CLEAR COLLECTION MODAL
   ============================================================ */

.clear-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.clear-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.clear-modal {
  background: rgba(15, 15, 20, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 28px 24px;
  max-width: 340px;
  width: calc(100% - 48px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.clear-modal-overlay.active .clear-modal {
  transform: scale(1);
}

.clear-modal-text {
  color: #d0d0d0;
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 20px 0;
}

.clear-modal-btns {
  display: flex;
  gap: 10px;
}

.clear-modal-btns .sidebar-btn {
  flex: 1;
}
