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);
}
[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);
}
#map {
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
}
.buttons {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  flex-direction: column; /* Default: stack button groups vertically on left */
  gap: 10px;
  z-index: 10;
  align-items: flex-start; /* Align groups to the left */
}
.buttons button {
  width: 150px; /* Fixed width for buttons */
}
.button-group {
  display: flex;
  flex-direction: column; /* Stack buttons within each group by default */
  gap: 10px;
}

/* Mobile Portrait Styles - Refactored to use CSS Grid */
@media (max-width: 600px) and (orientation: portrait) {
  .buttons {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Create a 2-column grid */
    left: 50%;
    transform: translateX(-50%);
    width: 320px; /* Adjusted width for grid layout */
    justify-items: center; /* Center buttons within their grid cell */
    /* Reset properties not needed for grid */
    align-items: initial;
    right: auto;
  }
  .button-group {
    /* The groups no longer need special display properties */
    display: contents; /* This is the simplest way to make grid work on the buttons directly */
  }
  .buttons button {
    width: 150px; /* Maintain button width */
    /* Flex properties are not needed for grid children */
  }
}

/* Mobile Landscape Styles - Unchanged, as this is a solid flexbox implementation */
@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;
  }
}

.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: 0 1px 2px rgba(0,0,0,0.2); 
}
button:hover, .menu-item:hover { transform: translateY(-2px); }
button:disabled { cursor: not-allowed; opacity: 0.7; }

#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;
}