html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  transition: background-color 0.3s, color 0.3s;
  overflow: hidden;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
*, *::before, *::after {
  box-sizing: inherit;
}
:root {
  /*colors*/
  --bg: #ffffff;
  --text: #000000;
  --button-bg: #f0f0f0;
  --land: #ffffff;
  --sea: #ffffff;
  --border: #888888;
  --modal-bg: #ffffff;
  --modal-shadow: rgba(0, 0, 0, 0.1);
  --permanent-dot-color: #000000;
}
[data-theme="dark"] {
  --bg: #121212;
  --text: #ffffff;
  --button-bg: #333333;
  --land: #000000;
  --sea: #000000;
  --border: #444444;
  --modal-bg: #2c2c2c;
  --modal-shadow: rgba(0, 0, 0, 0.5);
  --permanent-dot-color: #ffffff;
}
#map {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
#map path {
  transition: fill 0.3s ease, stroke 0.3s ease;
}
.dot-permanent {
  fill: var(--permanent-dot-color);
  transition: fill 0.3s ease;
}
.buttons {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10;
  align-items: flex-start;
}
.buttons button {
  width: 150px;
  position: relative; /* Needed for loader positioning */
  display: flex;
  justify-content: center;
  align-items: center;
}
.button-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#hereForYouContainer {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}
#hereForYouContainer.hidden {
  display: none;
}
#hereForYouButton {
  background-color: var(--text);
  color: var(--bg);
  border: 1px solid var(--bg);
}
[data-theme="dark"] #hereForYouButton {
  border: 1px solid var(--text);
}

/* Mobile Portrait Styles */
@media (max-width: 600px) and (orientation: portrait) {
  .buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px; 
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    justify-items: center;
    align-items: initial;
    right: auto;
  }
  .button-group {
    display: contents;
  }
  .buttons button {
    width: 150px;
  }
  #hereForYouContainer {
    grid-column: 1 / -1;
    justify-content: center;
  }
  #hereForYouButton {
    width: 100%;
  }
}

/* Mobile Landscape Styles */
@media (max-height: 600px) and (orientation: landscape) {
  .buttons {
    left: 20px;
    right: 20px;
    bottom: 0px;
    transform: none;
    width: auto;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0;
  }
  .button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .left-group {
    align-items: flex-start;
  }
  .right-group {
    align-items: flex-end;
  }
  .buttons button {
    width: auto;
    padding: 10px 15px;
  }
  #hereForYouContainer {
    position: absolute;
    bottom: 93px;
    left: 0;
    width: auto;
  }
}

.btn-love { background-color: #AA4499; color: white; }
.btn-thank-you { background-color: #EEAA77; color: white; }
.btn-forgive-you { background-color: #44AA99; color: white; }
.btn-forgive-me { background-color: #332288; color: white; }

button, .menu-item {
  padding: 10px 15px;
  border: none;
  border-radius: 10px;
  background-color: var(--button-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
  font-weight: 500;
  text-shadow: none; 
}
button:hover, .menu-item:hover { transform: translateY(-2px); }
button:disabled { 
  cursor: not-allowed; 
  opacity: 0.7; 
  transform: translateY(0);
}

/* Loading Spinner Styles */
.loader {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
}
.btn-here .loader {
  border-color: var(--bg);
  border-bottom-color: transparent;
}
button.loading .loader {
  display: block;
}
button.loading .button-text {
  visibility: hidden;
  opacity: 0;
}
/* Swapped transform order to translate first, then rotate */
@keyframes rotation {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}


#toggleTheme {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 40px;
  height: 40px;
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  padding: 0;
  box-shadow: none;
}
#toggleTheme svg {
  stroke: var(--text);
  width: 24px;
  height: 24px;
}
[data-theme="light"] .moon-icon { display: block; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: block; }


.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.modal-content {
  background-color: var(--modal-bg);
  color: var(--text);
  padding: 25px 30px;
  border-radius: 12px;
  box-shadow: 0 5px 15px var(--modal-shadow);
  text-align: center;
  max-width: 90%;
  width: 350px;
}
.modal-content h3 { margin-top: 0; }
.modal-content p { margin: 0 0 20px 0; line-height: 1.6; }
.modal-content button { padding: 10px 25px; }

.hamburger {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  width: 40px;
  height: 40px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s;
  padding: 0;
  box-shadow: none;
  border: none;
}

.hamburger-icon {
  width: 24px;
  height: 24px;
  display: block;
  pointer-events: none;
}
.menu-dropdown {
  position: absolute;
  top: 42px;
  left: 12px;
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  min-width: 160px;
  padding: 8px 0;
  z-index: 30;
  display: none;
  flex-direction: column;
  transition: opacity 0.2s;
}
.menu-dropdown.visible { display: flex; }
.menu-item {
  padding: 12px 20px;
  background: none;
  color: inherit;
  text-align: left;
  font-size: 15px;
  width: 100%;
  transition: background 0.2s;
  box-shadow: none;
  border: none;
}