/* ---------------- ECOGUESSR / ARTLE MERGED STYLES ---------------- */

html {
  font-size: 80%;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --green: #647b67;
  --green-light: #dfe8dd;
  --green-soft: #eef2e9;
  --green-dark: #405846;
  --green-deep: #2e4134;
  --brown: #4a392d;
  --brown-soft: #806f60;
  --cream: #f5f5ed;
  --surface: #ffffff;
  --text: #202820;
  --muted: #6e776e;
  --border: #d6ddd3;
  --correct: #426f50;
  --wrong: #9a4f48;
  --selected: #826f49;
  --map-border: rgba(245, 245, 237, 0.94);
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

a {
  color: var(--green-dark);
}

/* ---------------- HEADER ---------------- */
header {
  width: 100%;
  background: var(--green-deep);
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding: 1.1rem 2rem;
}

header a.header-home {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 1.5rem;
  margin: -0.5rem -1.5rem;
  border-radius: 4px;
  transition: opacity 0.15s;
}

header a.header-home:hover {
  opacity: 0.82;
}

header h1 {
  font-family: 'Playfair Display', serif;
  color: var(--green-light);
  font-size: 2rem;
  letter-spacing: 0.04em;
  pointer-events: none;
}

header span {
  color: #aebcac;
  font-size: 0.85rem;
  font-weight: 300;
  letter-spacing: 0.12em;
  pointer-events: none;
}

/* ---------------- SHARED LAYOUT ---------------- */
.container {
  width: 100%;
  max-width: 580px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

#home-container {
  align-items: center;
  justify-content: flex-start;
  min-height: 85vh;
  padding: 0 2rem 4rem;
  gap: 2.5rem;
  max-width: 800px;
  text-align: center;
}

body.page-index #home-container > main {
  margin-top: 3rem;
}

.hero-h2 {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  color: var(--green-dark);
  margin-bottom: 1.5rem;
}

.hero-p {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto 2rem;
  line-height: 1.55;
}

.home-divider {
  width: min(300px, 100%);
  min-width: min(300px, 100%);
  height: 0;
  flex: 0 0 auto;
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 auto 1rem;
}

.mode-title {
  font-weight: 300;
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.mode-desc-text {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
  min-height: 1.2rem;
  line-height: 1.45;
}

/* ---------------- LOGIN BAR ---------------- */
.login-bar {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.75rem;
  text-align: left;
}

.login-bar-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.login-bar-text {
  font-size: 1rem;
  color: var(--text);
}

.login-name {
  color: var(--green-dark);
  font-weight: 600;
}

.login-meta {
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---------------- BUTTONS ---------------- */
.btn-pill {
  flex-shrink: 0;
  display: inline-block;
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-pill-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green-dark);
}

.btn-pill-primary:hover {
  background: var(--green-dark);
}

.btn-pill-outline {
  background: transparent;
  color: var(--brown);
  border-color: var(--border);
}

.btn-pill-outline:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

a.btn-play-sm,
button.btn-play-sm,
span.btn-play-sm {
  flex-shrink: 0;
  display: inline-block;
  box-sizing: border-box;
  padding: 0.85rem 1.75rem;
  margin: 0;
  background: var(--green);
  color: #fff;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 500;
  font-style: normal;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  transition: background 0.2s, transform 0.2s;
}

a.btn-play-sm:hover,
button.btn-play-sm:hover:not(:disabled) {
  background: var(--green-dark);
  color: #fff;
  transform: translateY(-2px);
}

button.btn-play-sm:disabled,
.disabled-control {
  background: #c8cec5 !important;
  color: #757d74 !important;
  cursor: not-allowed !important;
  pointer-events: none;
  transform: none !important;
}

.btn-secondary {
  background: var(--brown) !important;
}

.btn-secondary:hover:not(:disabled) {
  background: #34271f !important;
}

/* ---------------- HOME TOP ROW ---------------- */
.top-row {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: stretch;
  gap: 1.25rem;
}

.top-row .login-bar,
.top-row .daily-card {
  max-width: none;
  width: auto;
}

.top-row .login-bar {
  flex: 0 0 30%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.top-row .login-bar-info {
  width: 100%;
  align-items: center;
  text-align: center;
}

.top-row .login-bar .btn-pill {
  align-self: center;
}

.top-row .daily-card {
  flex: 1;
}

/* ---------------- CARD SYSTEM ---------------- */
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.3rem;
  color: var(--brown);
  margin-bottom: 0.35rem;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.muted-coming-soon {
  color: #929991;
}

.daily-card,
.option-card,
.pool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.daily-card {
  width: 100%;
  max-width: 700px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  text-align: left;
}

.daily-info {
  flex: 1;
}

.daily-icon-wrap,
.option-icon-wrap,
.pool-icon-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--green-light);
  overflow: hidden;
}

.icon-placeholder {
  width: 26px;
  height: 26px;
  object-fit: contain;
  filter: grayscale(1) sepia(0.35) hue-rotate(70deg) saturate(0.8) brightness(0.72);
}

.is-disabled {
  background: #f1f2ed;
}

.is-disabled .card-title,
.is-disabled .card-desc {
  opacity: 0.72;
}

/* ---------------- DIFFICULTY ---------------- */
.difficulty-section {
  width: 100%;
}

.difficulty-section .mode-title {
  padding-top: 10px;
}

.mode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 1rem;
}

.btn-difficulty,
.pool-row,
.btn-mode {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--brown);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-difficulty {
  padding: 0.7rem 1.4rem;
  font-size: 1.1rem;
}

.btn-mode {
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
}

.btn-difficulty:hover:not(:disabled),
.pool-row:hover:not(:disabled),
.btn-mode:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--green-soft);
}

.btn-difficulty.active,
.pool-row.active,
.btn-mode.active {
  background: var(--green-dark);
  color: var(--cream);
  border-color: var(--green-dark);
}

.btn-difficulty.active:hover:not(:disabled),
.pool-row.active:hover:not(:disabled),
.btn-mode.active:hover:not(:disabled) {
  background: var(--green-dark);
  color: var(--cream);
  border-color: var(--green-dark);
}

.btn-difficulty:disabled,
.pool-row:disabled,
.btn-mode:disabled {
  color: #9aa098;
  background: #f0f1ed;
  border-color: #dfe3dc;
  cursor: not-allowed;
  opacity: 0.78;
}

/* ---------------- MODES + POOLS ---------------- */
.home-grid {
  width: 100%;
  max-width: 900px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: 'modes pool';
  gap: 1.5rem;
  align-items: start;
  text-align: left;
}

.home-col {
  grid-area: modes;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  min-width: 0;
}

.home-grid > .pool-card {
  grid-area: pool;
  width: 100%;
  min-width: 0;
}

.option-card {
  flex: 1;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.option-card-header,
.pool-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.option-card-header .card-title,
.pool-card-header .card-title {
  margin-bottom: 0;
}

.option-card .btn-play-sm {
  width: 100%;
  margin-top: auto;
}

.pool-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pool-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.pool-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pool-group {
  min-width: 0;
}

.pool-group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 0.55rem;
}

.pool-scroll-box {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 5px;
}

.pool-scroll-location {
  max-height: 190px;
}

.pool-scroll-type {
  max-height: 190px;
}

.pool-scroll-box::-webkit-scrollbar {
  width: 8px;
}

.pool-scroll-box::-webkit-scrollbar-track {
  background: var(--green-soft);
  border-radius: 999px;
}

.pool-scroll-box::-webkit-scrollbar-thumb {
  background: #aebaaa;
  border-radius: 999px;
}

.pool-scroll-box::-webkit-scrollbar-thumb:hover {
  background: var(--green);
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 1rem;
  text-align: left;
}

.pool-row .chev {
  opacity: 0.5;
  font-size: 1.1rem;
}

/* ---------------- GAME PAGE ---------------- */
.game-container {
  width: 100%;
  max-width: 1280px;
  padding: 1.5rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.game-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.game-title {
  font-family: 'Playfair Display', serif;
  font-size: 2.15rem;
  color: var(--green-dark);
}

.game-settings-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.game-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

.viewer-section {
  background: #1e241f;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

#panorama {
  height: min(72vh, 760px);
  min-height: 520px;
  width: 100%;
}

.viewer-status {
  align-items: center;
  background: rgba(31, 42, 34, 0.80);
  border-radius: 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  left: 50%;
  max-width: calc(100% - 32px);
  padding: 14px 18px;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
}

.viewer-loading-image {
  display: block;
  height: auto;
  max-height: 150px;
  max-width: min(220px, 70vw);
  object-fit: contain;
}

.viewer-status.is-error .viewer-loading-image {
  display: none;
}

.viewer-status.is-hidden {
  display: none;
}

#map {
  aspect-ratio: 1 / 1;
  background: #d9ded7;
  border: 2px solid var(--map-border);
  border-radius: 8px;
  bottom: 18px;
  height: auto;
  overflow: hidden;
  position: absolute;
  right: 18px;
  transition: width 220ms ease, box-shadow 220ms ease;
  width: clamp(220px, 24%, 300px);
  z-index: 5;
}

@media (hover: hover) and (pointer: fine) {
  #map:hover {
    box-shadow: 0 8px 28px rgba(25, 34, 28, 0.28);
    width: clamp(340px, 40%, 450px);
  }
}

.location-marker {
  appearance: none;
  background: var(--green-dark);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  height: 18px;
  margin: 0;
  padding: 0;
  transition: background-color 120ms ease, height 120ms ease, width 120ms ease;
  width: 18px;
}

.location-marker:hover,
.location-marker:focus-visible {
  height: 22px;
  width: 22px;
}

.location-marker.is-selected,
.location-marker.is-correct {
  height: 24px;
  width: 24px;
}

.location-marker.is-selected {
  background: var(--selected);
}

.location-marker.is-correct {
  background: var(--correct);
}

.location-marker.is-incorrect {
  background: var(--wrong);
}

.maplibregl-popup.location-popup .maplibregl-popup-content {
  border-radius: 5px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  padding: 8px 10px;
  color: var(--text);
}

.maplibregl-ctrl-group button {
  cursor: pointer;
}

.maplibregl-canvas {
  outline: none;
}

.game-submit-button {
  min-width: 150px;
}

.game-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  min-height: 78px;
  padding: 1.2rem 1.4rem;
  scroll-margin-top: 1rem;
}

.round-copy-block {
  flex: 1;
  min-width: 0;
}

.round-message {
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  text-align: left;
}

.daily-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.9rem;
  margin-top: 0.55rem;
  text-align: left;
}

.daily-share-row[hidden] {
  display: none !important;
}

.daily-share-text {
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 500;
}

.daily-save-status {
  color: var(--muted);
  font-size: 0.82rem;
}

.round-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  flex-shrink: 0;
}

.copy-result-button[hidden],
.next-location-button[hidden] {
  display: none !important;
}

.next-location-button {
  flex-shrink: 0;
}

.game-login-bar {
  max-width: none;
}

/* ---------------- INFO + ABOUT ---------------- */
.info-container {
  width: 100%;
  max-width: 720px;
  padding: 3rem 2rem 4rem;
}

.info-container .hero-h2 {
  font-size: 3rem;
}

.paragraph-section {
  margin: 2rem 0;
}

.paragraph-section .mode-title {
  margin-bottom: 1rem;
  color: var(--green-dark);
  font-weight: 500;
}

.paragraph-section p {
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.7;
}

.paragraph-section a {
  color: var(--green-dark);
}

/* ---------------- PROFILE ---------------- */
#profile-container {
  min-height: 72vh;
}

.profile-status {
  padding: 3rem 0;
  text-align: center;
}

.profile-card,
.profile-auth-card,
.profile-auth-error {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2rem;
}

.profile-auth-card[hidden],
.profile-auth-step[hidden],
.profile-card[hidden],
.profile-auth-error[hidden],
.profile-status[hidden] {
  display: none;
}

.profile-auth-heading {
  font-family: 'Playfair Display', serif;
  color: var(--green-dark);
  font-size: 2rem;
  margin-bottom: 0.7rem;
}

.profile-auth-copy {
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

.profile-auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-auth-label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--brown);
  font-size: 0.92rem;
  font-weight: 500;
}

.profile-auth-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  padding: 0.85rem 0.9rem;
  outline: none;
}

.profile-auth-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(100, 123, 103, 0.12);
}

.profile-auth-code-input {
  letter-spacing: 0.28em;
  font-size: 1.2rem;
}

.profile-auth-message {
  min-height: 1.25rem;
  color: var(--muted);
}

.profile-auth-message.error {
  color: var(--wrong);
}

.profile-auth-message.success {
  color: var(--correct);
}

.profile-auth-secondary {
  align-self: flex-start;
  padding: 0.7rem 1.2rem;
}

.profile-auth-verified-email {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  margin-bottom: 1rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.profile-auth-verified-email span {
  color: var(--muted);
}

.profile-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.profile-label {
  color: var(--muted);
}

.profile-value {
  color: var(--brown);
  font-weight: 600;
  text-align: right;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-top: 1.6rem;
}

.profile-stat {
  background: var(--green-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 1rem;
  text-align: center;
}

.profile-stat-value {
  display: block;
  font-family: 'Playfair Display', serif;
  color: var(--green-dark);
  font-size: 1.8rem;
}

.profile-stat-label {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  margin-top: 1.5rem;
}

/* ---------------- FOOTER ---------------- */
footer {
  width: 100%;
  margin-top: auto;
  padding: 2rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--green-dark);
}

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 720px) {
  .top-row {
    flex-direction: column;
  }

  .top-row .login-bar {
    flex-basis: auto;
  }

  .login-bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .login-bar-info {
    align-items: center;
  }

  .home-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      'modes'
      'pool';
  }

  .daily-card {
    flex-direction: column;
    text-align: center;
  }

  .option-card {
    text-align: center;
    align-items: center;
  }

  .option-card-header {
    justify-content: center;
  }

  .pool-card-header {
    flex-direction: column;
    text-align: center;
  }

  .game-container {
    padding: 1rem 1rem 2.5rem;
  }

  .game-settings-row {
    align-items: center;
  }

  #panorama {
    height: 68vh;
    min-height: 430px;
  }

  #map {
    bottom: 12px;
    right: 12px;
    width: clamp(190px, 42%, 270px);
  }

  .game-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .round-actions {
    width: 100%;
  }

  .round-actions .btn-pill,
  .round-actions .btn-play-sm {
    flex: 1;
  }
}

@media (max-width: 520px) {
  #home-container {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .hero-h2 {
    font-size: 2.7rem;
  }

  .game-settings-row {
    align-items: stretch;
    flex-direction: column;
  }

  .game-submit-button {
    width: 100%;
  }

  .round-actions {
    flex-direction: column;
  }

  .round-actions .btn-pill,
  .round-actions .btn-play-sm {
    width: 100%;
  }

  #panorama {
    min-height: 390px;
  }

  #map {
    width: min(52%, 230px);
  }


  .profile-stats {
    grid-template-columns: 1fr;
  }

  .profile-actions {
    flex-direction: column;
  }

  .info-container {
    padding: 2rem 1.2rem 3rem;
  }
}


@media (max-width: 620px) {
  .pool-scroll-location,
  .pool-scroll-type {
    max-height: 180px;
  }
}
