:root {
  --bg: #f7f4ef;
  --card: #ffffff;
  --text: #2c2825;
  --muted: #6b6560;
  --accent: #c45c3e;
  --border: #e3ddd4;
  --shadow: 0 1px 3px rgba(44, 40, 37, 0.06);
  --font-serif: "Fraunces", Georgia, serif;
  --font-sans: "Source Sans 3", system-ui, sans-serif;
  --radius: 8px;
  --max-width: 1180px;
  --wiggle-line: url("../assets/brand-wiggle.svg");
  --wiggle-line-small: url("../assets/brand-wiggle-small.svg");
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.storage-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.storage-consent-overlay[hidden] {
  display: none;
}

.storage-consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 40, 37, 0.55);
}

.storage-consent {
  position: relative;
  z-index: 1;
  padding: 1rem;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(44, 40, 37, 0.15);
}

.storage-consent-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.storage-consent-text {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.storage-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.storage-consent-actions .btn-inspire,
.storage-consent-actions .btn-set-intention {
  flex: 1 1 14rem;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  line-height: 1.3;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.app-error {
  max-width: 28rem;
  margin: 4rem auto;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
}

/* —— Layout —— */

.layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

.layout-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

@media (max-width: 768px) {
  .layout {
    gap: 1rem;
  }

  .hero {
    padding: 1.5rem 1rem 1.25rem;
  }

  .layout-columns {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }
}

/* —— Hero —— */

.logo {
  display: block;
  width: 13.5rem;
  height: auto;
  margin: 0 auto 0.625rem;
}

.site-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 600;
  margin: 0;
  line-height: 1.12;
}

.title-wiggle {
  display: block;
  width: min(100%, 17.5rem);
  height: auto;
  margin-top: 0.55rem;
}

.site-subtitle {
  margin: 1.25rem auto 1rem;
  max-width: 26rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.intention-zone {
  width: 100%;
  max-width: min(27rem, 100%);
  margin: 0 auto;
}

.intention-zone[hidden],
.intention-display[hidden] {
  display: none;
}

.intention-input {
  display: block;
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.intention-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.intention-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.intention-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.intention-set-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-intention-help {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
}

.btn-intention-help:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-intention-help-mark {
  display: block;
  margin-top: -0.05em;
}

.intention-help-title {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.intention-help-title + .intention-help-title,
.intention-help-body + .intention-help-title {
  margin-top: 1.5rem;
}

.intention-help-body {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
}

.intention-help-body p {
  margin: 0;
}

.intention-help-body p + p {
  margin-top: 0.65rem;
}

.overlay-card--intention-help .btn-close {
  flex-shrink: 0;
  align-self: center;
}

.intention-help-activities {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.intention-help-activity {
  margin: 0;
}

.intention-help-activity + .intention-help-activity {
  margin-top: 0.35rem;
}

.activity-visibility-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.5rem 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}

.activity-visibility-btn:hover {
  background: rgba(44, 40, 37, 0.05);
}

.activity-eye {
  display: flex;
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  color: var(--muted);
}

.activity-visibility-btn:hover .activity-eye {
  color: var(--accent);
}

.activity-eye svg {
  display: block;
  width: 100%;
  height: 100%;
}

.activity-eye-closed {
  display: none;
}

.activity-visibility-btn.is-hidden .activity-eye-open {
  display: none;
}

.activity-visibility-btn.is-hidden .activity-eye-closed {
  display: block;
}

.card[data-card][hidden] {
  display: none !important;
}

.intention-display {
  max-width: min(27rem, 100%);
  margin: 0 auto;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.btn-inspire {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  padding: 0.75rem 1.5rem;
  cursor: pointer;
}

.btn-inspire:hover {
  filter: brightness(1.05);
}

.btn-set-intention {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
}

.btn-set-intention:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.overlay-card--intention-check {
  max-width: 24rem;
  text-align: center;
}

.intention-check-quote {
  margin: 0 0 1.25rem;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.intention-streak {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.intention-streak[hidden] {
  display: none;
}

.intention-streak-icon {
  font-size: 1rem;
  line-height: 1;
}

.intention-check-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.intention-check-consolation-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
}

.intention-check-consolation-text {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
}

#intention-check-consolation .btn-set-intention {
  min-width: 6rem;
}

.learn-quiz-prompt {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.learn-quiz-choices {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.learn-quiz-choice {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.learn-quiz-choice:hover:not(:disabled) {
  border-color: var(--accent);
}

.learn-quiz-choice:disabled {
  cursor: default;
}

.learn-quiz-choice--correct {
  color: #fff;
  background: #3d7a4a;
  border-color: #3d7a4a;
}

.learn-quiz-choice--wrong {
  color: #fff;
  background: #b54a42;
  border-color: #b54a42;
}

.debug-panel {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  max-width: min(24rem, calc(100vw - 1.5rem));
  padding: 0.5rem 0.65rem;
  font-size: 0.75rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.debug-panel[hidden] {
  display: none;
}

.debug-day-label {
  flex: 1 1 100%;
  color: var(--muted);
}

.debug-btn {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
}

.debug-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* —— Cards —— */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1rem 1.1rem;
  transition: padding 0.3s ease;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.card-check-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.card-check-box {
  width: 1.15rem;
  height: 1.15rem;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  background: var(--card);
}

.card-check-input:checked + .card-check-box {
  background: var(--accent);
  border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M2 6l3 3 5-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 10px;
}

.card-title {
  position: relative;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card > :not(.card-header) {
  overflow: hidden;
  max-height: 40rem;
  opacity: 1;
  transition:
    max-height 0.35s ease,
    opacity 0.25s ease,
    margin 0.3s ease;
}

.card.is-done {
  padding: 0.65rem 1rem;
}

.card.is-done > :not(.card-header) {
  max-height: 0;
  opacity: 0;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  pointer-events: none;
}

.card.is-done .card-header {
  margin-bottom: 0;
  transition: margin-bottom 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card > :not(.card-header),
  .card.is-done .card-header {
    transition: none;
  }
}

.card.is-done .card-title {
  color: var(--muted);
}

.card.is-done .card-title::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  background: var(--wiggle-line-small) center / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 1;
}

.card-body {
  margin: 0;
  font-size: 0.95rem;
}

.learn-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.text-link {
  color: var(--accent);
}

.text-link:hover {
  text-decoration: underline;
}

/* —— Word wheel —— */

.puzzle-body {
  display: flex;
  gap: 0.75rem 1rem;
  align-items: stretch;
}

.word-wheel {
  flex: 0 0 58%;
  width: 58%;
  max-width: 200px;
  height: auto;
}

.word-wheel__ring {
  stroke: var(--border);
  stroke-width: 1;
}

.word-wheel__spoke {
  stroke: var(--border);
  stroke-width: 1;
}

.word-wheel__center-fill {
  fill: var(--accent);
}

.word-wheel__letter {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  fill: var(--text);
  text-anchor: middle;
  dominant-baseline: central;
}

.word-wheel__letter--center {
  font-size: 22px;
  fill: #fff;
}

.puzzle-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  min-width: 0;
  padding: 0.25rem 0;
}

.puzzle-target-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.puzzle-target-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.puzzle-target-num {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
}

.puzzle-side-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.puzzle-show-answer {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
}

.puzzle-answer {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

@media (max-width: 768px) {
  .puzzle-body {
    flex-direction: row;
  }

  .word-wheel {
    flex: 0 0 52%;
    width: 52%;
    max-width: none;
  }
}

/* —— Media cards —— */

.stretch-name {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.stretch-embed {
  width: 100%;
  max-width: 16rem;
  margin: 0 auto;
  aspect-ratio: 9 / 16;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.stretch-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-link {
  display: block;
  width: 100%;
  padding: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.media-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.source-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.source-link:hover {
  color: var(--accent);
}

.learn-map {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: 11rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #e8e4df;
}

.learn-map.leaflet-container {
  font-family: var(--font-sans);
}

/* Keep all Leaflet UI inside the map card (below page overlays). */
.learn-map .leaflet-pane {
  z-index: 1 !important;
}

.learn-map .leaflet-tile-pane {
  z-index: 2 !important;
}

.learn-map .leaflet-overlay-pane {
  z-index: 3 !important;
}

.learn-map .leaflet-shadow-pane {
  z-index: 4 !important;
}

.learn-map .leaflet-marker-pane {
  z-index: 5 !important;
}

.learn-map .leaflet-tooltip-pane {
  z-index: 6 !important;
}

.learn-map .leaflet-popup-pane {
  z-index: 7 !important;
}

.learn-map .leaflet-control-container {
  z-index: 8 !important;
}

.card.is-done .learn-map {
  visibility: hidden;
}

.learn-country-label {
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 0.5rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--muted);
  pointer-events: none;
  text-shadow:
    0 0 3px var(--bg),
    0 0 3px var(--bg);
}

.learn-country-label--highlight {
  color: #fff;
  text-shadow:
    0 0 3px #8a3f2c,
    0 1px 2px rgba(44, 40, 37, 0.45);
}

.learn-country-label::before {
  display: none;
}

.learn-facts {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

/* —— Overlay —— */

.overlay {
  position: fixed;
  inset: 0;
  /* Above Leaflet panes (tile ~200, markers ~600, popups ~700). */
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.overlay[hidden] {
  display: none;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 40, 37, 0.4);
}

.overlay-card {
  position: relative;
  max-width: 22rem;
  width: 100%;
  padding: 1.75rem 1.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(44, 40, 37, 0.15);
  text-align: center;
}

.overlay-card--intention-help {
  display: flex;
  flex-direction: column;
  max-width: 52rem;
  max-height: calc(100dvh - 2rem);
  text-align: center;
}

.intention-help-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.intention-help-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  align-items: start;
  gap: 0;
  text-align: left;
}

.intention-help-copy {
  min-width: 0;
  padding-right: 1.5rem;
  text-align: center;
}

.intention-help-activities-col {
  min-width: 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--accent);
}

.intention-help-title--activities {
  margin-top: 0;
  text-align: left;
}

@media (max-width: 640px) {
  .intention-help-columns {
    grid-template-columns: 1fr;
  }

  .intention-help-copy {
    padding-right: 0;
  }

  .intention-help-activities-col {
    width: 100%;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    padding-left: 0;
    border-left: none;
    border-top: 2px solid var(--accent);
  }
}

.overlay-card--media {
  display: flex;
  flex-direction: column;
  width: min(96vw, 90rem);
  max-width: 96vw;
  max-height: calc(100dvh - 2rem);
  padding: 1rem 1.25rem;
  overflow: hidden;
  text-align: left;
}

.overlay-media-image {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #fff;
}

.overlay-text {
  margin: 0 0 1.25rem;
  font-size: 1.05rem;
  line-height: 1.45;
}

.overlay-card--media .btn-close {
  flex-shrink: 0;
  margin-top: 0.75rem;
  align-self: center;
}

.btn-close {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  cursor: pointer;
}

.btn-close:hover {
  border-color: var(--muted);
}
