@font-face {
  font-family: "MS Sans Serif Pixel";
  src: url("../assets/fonts/ms_sans_serif.woff2") format("woff2");
  font-weight: normal;
  font-display: swap;
}
@font-face {
  font-family: "MS Sans Serif Pixel";
  src: url("../assets/fonts/ms_sans_serif_bold.woff2") format("woff2");
  font-weight: bold;
  font-display: swap;
}
@font-face {
  font-family: "PixelGameFont";
  src: url("../assets/fonts/PixelGameFont.otf") format("truetype");
  font-weight: normal;
  font-display: swap;
}

:root {
  --silver: #c0c0c0;
  --dk: #0a0a0a;
  --grey: #808080;
  --w95-white: #dfdfdf;
  --font-win: "MS Sans Serif Pixel", Tahoma, Geneva, sans-serif;
  --font-pixel: "PixelGameFont", "MS Sans Serif Pixel", Tahoma, sans-serif;
}

.w95-hidden {
  display: none !important;
}

.w95-abs {
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
  font-family: var(--font-win);
}

/* ---------- ventana ---------- */
.window {
  background: var(--silver);
  padding: 3px;
  position: fixed;
  z-index: 30;
  width: min(680px, 94vw);
  max-height: 90vh;
  box-shadow:
    inset -1px -1px var(--dk),
    inset 1px 1px var(--w95-white),
    inset -2px -2px var(--grey),
    inset 2px 2px #fff;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.window.maximized {
  width: 100vw;
  height: 100vh;
  left: 0;
  top: 0;
  transform: none;
}

.title-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  padding: 3px 2px 3px 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.title-bar-text {
  color: #fff;
  font-weight: bold;
  font-family: var(--font-win);
  font-size: 13px;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 #000;
}

.title-bar-controls {
  display: flex;
  gap: 2px;
}

.title-bar-controls button {
  width: 16px;
  height: 14px;
  border: none;
  background: var(--silver);
  cursor: pointer;
  padding: 0;
  box-shadow:
    inset -1px -1px var(--dk),
    inset 1px 1px #fff,
    inset -2px -2px var(--grey),
    inset 2px 2px var(--w95-white);
}

.title-bar-controls button:active {
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px var(--dk),
    inset -2px -2px var(--w95-white),
    inset 2px 2px var(--grey);
}

.title-bar-controls button[aria-label="Minimize"] {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='6' height='2' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M0 0h6v2H0z'/%3E%3C/svg%3E");
  background-position: center 5px;
  background-repeat: no-repeat;
}

.title-bar-controls button[aria-label="Maximize"] {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='9' height='9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9 0H0v9h9V0zM8 2H1v6h7V2z' fill='%23000'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.title-bar-controls button[aria-label="Restore"] {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='8' height='9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' d='M2 0h6v2H2zM7 2h1v4H7zM2 2h1v1H2zM6 5h1v1H6zM0 3h6v2H0zM5 5h1v4H5zM0 5h1v4H0zM1 8h4v1H1z'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.title-bar-controls button[aria-label="Close"] {
  margin-left: 2px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='8' height='7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0 0h2v1h1v1h2V1h1V0h2v1H7v1H6v1H5v1h1v1h1v1h1v1H6V6H5V5H3v1H2v1H0V6h1V5h1V4h1V3H2V2H1V1H0V0z' fill='%23000'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.window-body {
  margin: 8px 0 0;
  position: relative;
  overflow: hidden;
}

#window-confirm .window-body,
#window-success .window-body {
  margin: 0;
}

.win-overlay {
  background: #fff;
  padding: 16px 18px;
  position: relative;
  max-height: calc(90vh - 62px);
  overflow: auto;
}

/* fondo de ventanas (confirmar y siguientes) */
.win-bg {
  position: relative;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  padding: 12px 0;
}

.win-bg--camping {
  background-image: url("../assets/campingpixelart.webp");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #0b130e;
}

.win-bg .win-overlay {
  background: rgba(255, 255, 255, 0.6);
  margin: 0 auto;
  max-width: 460px;
  box-shadow:
    inset 1px 1px var(--w95-white),
    inset -1px -1px var(--dk);
}

/* meeples detrás del texto (popup 3) */
.meeples-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 600px;
  height: 672px;
  pointer-events: none;
  z-index: 0;
}

.meeples-bg img {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  width: 300px;
  height: 336px;
  object-fit: contain;
  will-change: transform;
}

.meeples-bg #hand-img {
  width: 600px;
  height: 672px;
  opacity: 0.25;
}

.meeples-bg #meeples-img {
  opacity: 0.35;
}

.popup-content {
  position: relative;
  z-index: 1;
}

#popup-3 .win-overlay {
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.4;
  scrollbar-width: none;
}
#popup-3 .win-overlay::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* ---------- globo de mapa (historia) ---------- */
.map-bubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: min(420px, 92vw);
  background: #fff;
  border: 2px solid #000;
  border-radius: 14px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  animation: bubblePop 0.18s ease-out;
  transform-origin: top center;
}

.map-bubble.map-bubble--above {
  transform-origin: bottom center;
}

.map-bubble.map-bubble--above::before {
  top: auto;
  bottom: -18px;
  border: 9px solid transparent;
  border-bottom: 0;
  border-top: 14px solid #000;
}

.map-bubble.map-bubble--above::after {
  top: auto;
  bottom: -13px;
  border: 7px solid transparent;
  border-bottom: 0;
  border-top: 10px solid #fff;
}

.map-bubble::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top: 0;
  border-bottom: 14px solid #000;
}

.map-bubble::after {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-top: 0;
  border-bottom: 10px solid #fff;
}

.map-bubble iframe {
  display: block;
  width: 100%;
  height: 200px;
  border: 0;
  border-radius: 12px 12px 0 0;
}

.map-bubble-cta {
  display: block;
  padding: 10px 14px;
  text-align: center;
  font-family: var(--font-win);
  font-size: 13px;
  font-weight: 700;
  color: #000080;
  border-top: 1px solid #888;
  border-radius: 0 0 12px 12px;
}

.map-bubble-close {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  width: 22px;
  height: 22px;
  line-height: 1;
  padding: 0;
  border: 2px solid #000;
  border-radius: 4px;
  background: #fff;
  color: #000;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.9;
}

@keyframes bubblePop {
  from {
    transform: translateX(-50%) scale(0.9);
  }
  to {
    transform: translateX(-50%) scale(1);
  }
}

/* ---------- botones ---------- */
.btn-w95 {
  font-family: var(--font-win);
  font-size: 13px;
  color: #222;
  background: var(--silver);
  border: none;
  min-height: 26px;
  min-width: 84px;
  padding: 2px 14px;
  cursor: pointer;
  box-shadow:
    inset -1px -1px var(--dk),
    inset 1px 1px var(--w95-white),
    inset -2px -2px var(--grey),
    inset 2px 2px #fff;
}

.btn-w95:active:not(:disabled) {
  box-shadow:
    inset -1px -1px var(--w95-white),
    inset 1px 1px var(--dk),
    inset -2px -2px #fff,
    inset 2px 2px var(--grey);
  transform: translate(1px, 1px);
}

.btn-w95:disabled {
  color: var(--grey);
  text-shadow: 1px 1px 0 #fff;
  cursor: default;
}

.btn-w95:focus,
.btn-w95:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -5px;
}

/* botones del escritorio */
.btn-main {
  font-family: var(--font-win);
  font-size: 24px;
  color: #222;
  background: var(--silver);
  border: none;
  min-width: 320px;
  padding: 22px 44px;
  cursor: pointer;
  box-shadow:
    inset -1px -1px var(--dk),
    inset 1px 1px var(--w95-white),
    inset -2px -2px var(--grey),
    inset 2px 2px #fff;
}

.btn-main:active {
  box-shadow:
    inset -1px -1px var(--w95-white),
    inset 1px 1px var(--dk),
    inset -2px -2px #fff,
    inset 2px 2px var(--grey);
  transform: translate(1px, 1px);
}

.btn-main:focus-visible,
.btn-secondary:focus-visible,
.btn-w95:focus-visible {
  outline: 1px dotted #000;
  outline-offset: -5px;
}

.btn-main::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 12px;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg width='18' height='18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='1' y='1' width='15' height='15' fill='%23c0c0c0' stroke='%23000'/%3E%3Cpath d='M9 3l1.5 3.5L14 8l-3.5 1.5L9 13l-1.5-3.5L4 8l3.5-1.5z' fill='%23000'/%3E%3C/svg%3E") no-repeat center/contain;
  vertical-align: -3px;
}

.btn-secondary {
  font-family: var(--font-win);
  font-size: 12px;
  color: #222;
  background: var(--silver);
  border: none;
  min-width: 200px;
  padding: 6px 24px;
  cursor: pointer;
  box-shadow:
    inset -1px -1px var(--dk),
    inset 1px 1px var(--w95-white),
    inset -2px -2px var(--grey),
    inset 2px 2px #fff;
}

.btn-secondary:active {
  box-shadow:
    inset -1px -1px var(--w95-white),
    inset 1px 1px var(--dk),
    inset -2px -2px #fff,
    inset 2px 2px var(--grey);
  transform: translate(1px, 1px);
}

/* ---------- escritorio ---------- */
.desktop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.start-panel {
  pointer-events: auto;
  background: transparent;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0;
}

.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.step-counter {
  font-family: var(--font-win);
  font-size: 11px;
  color: #404040;
  letter-spacing: 1px;
}

/* ---------- meeples girando ---------- */

.win-bg--pixel {
  font-family: var(--font-pixel);
}

.win-pixel-text {
  font-family: var(--font-pixel);
  font-size: 16px;
  line-height: 1.5;
}

.win-pixel-text.letra-chica {
  font-size: 13px;
}

/* resaltes dorados en el texto pixel */
.gold-hl,
.gold-sub {
  font-family: var(--font-pixel);
  background: linear-gradient(to bottom, #9e7c00 0%, #c99801 25%, #fff 70%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.gold-hl {
  font-size: 80px;
  font-weight: 700;
  -webkit-text-stroke: 2px #000;
  paint-order: stroke fill;
}

.gold-sub {
  font-size: 25px;
  text-decoration: underline;
  -webkit-text-stroke: 2px #000;
  text-underline-offset: 4px;
  display: inline;
  margin: 0;
}

.gold-sub:hover {
  text-decoration-color: #ffd53f;
}

/* ---------- formularios ---------- */
.w95-field {
  margin-bottom: 14px;
}

.w95-label {
  display: block;
  font-family: var(--font-win);
  font-size: 13px;
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
}

.w95-input {
  font-family: var(--font-win);
  font-size: 13px;
  background: #fff;
  border: none;
  color: #222;
  padding: 4px 6px;
  height: 24px;
  width: 100%;
  box-sizing: border-box;
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px var(--grey),
    inset -2px -2px var(--w95-white),
    inset 2px 2px var(--dk);
}

.w95-input:focus {
  outline: none;
}

.w95-num {
  width: 90px;
  box-sizing: border-box;
}

.w95-check,
.w95-radio {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  font-family: var(--font-win);
  font-size: 13px;
  font-weight: 700;
  color: #222;
  user-select: none;
}

.w95-check + .w95-check,
.w95-radio + .w95-radio {
  margin-top: 6px;
}

.w95-check input,
.w95-radio input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ck-box,
.rd-box {
  flex: 0 0 auto;
  display: inline-block;
  position: relative;
  background: #fff;
  box-shadow:
    inset -1px -1px #fff,
    inset 1px 1px var(--grey),
    inset -2px -2px var(--w95-white),
    inset 2px 2px var(--dk);
}

.ck-box {
  width: 13px;
  height: 13px;
  margin-right: 8px;
}

.rd-box {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
}

.w95-check input:checked + .ck-box::after {
  content: "";
  position: absolute;
  inset: 1px;
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg width='7' height='7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M7 0H6v1H5v1H4v1H3v1H2V3H1V2H0v3h1v1h1v1h1V6h1V5h1V4h1V3h1V0z' fill='%23000'/%3E%3C/svg%3E") center/7px 7px no-repeat;
}

.w95-radio input:checked + .rd-box::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #000;
}

.w95-check input:disabled + .ck-box,
.w95-radio input:disabled + .rd-box {
  background: var(--silver);
}

.w95-check input:focus-visible + .ck-box,
.w95-radio input:focus-visible + .rd-box {
  outline: 1px dotted #000;
  outline-offset: 2px;
}

.w95-group {
  border: none;
  padding: 8px 0 4px;
  margin: 0 0 10px;
}

.acomp-block {
  border-top: 1px dashed #aaa;
  padding-top: 8px;
  margin-top: 8px;
}

.w95-group legend {
  font-family: var(--font-win);
  font-size: 13px;
  font-weight: bold;
  color: #000080;
  padding: 0;
  margin-bottom: 6px;
}

.error-msg {
  font-family: var(--font-win);
  font-size: 11px;
  color: #a40000;
  margin-top: 4px;
  display: none;
}

.error-msg.show {
  display: block;
}

.form-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* ---------- ventana de éxito ---------- */
.ok-title {
  font-family: var(--font-win);
  font-weight: bold;
  font-size: 15px;
  color: #000080;
  margin-bottom: 8px;
}

.cal-links {
  margin: 10px 0;
}

.cal-links a,
.dl-link {
  display: block;
  font-family: var(--font-win);
  font-size: 13px;
  color: #0000ee;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 3px 0;
  text-align: left;
}

.cal-links a:hover,
.dl-link:hover {
  color: #551a8b;
}

/* ---------- helpers ---------- */
.show-in {
  animation: fadeIn 0.8s ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-up {
  animation: fadeUp 0.6s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 750px) {
  .window {
    width: 96vw;
    max-height: 92vh;
  }
  .btn-main {
    min-width: 82vw;
    font-size: 19px;
    padding: 18px 18px;
  }
  .btn-secondary {
    min-width: 60vw;
  }
  .win-overlay {
    padding: 12px 12px;
    max-height: calc(92vh - 60px);
  }
  .win-pixel-text {
    font-size: 18px;
  }
  .win-pixel-text.letra-chica {
    font-size: 16px;
  }
  .gold-hl {
    font-size: 32px;
    -webkit-text-stroke: 1.5px #000;
  }
  .gold-sub {
    font-size: 21px;
    -webkit-text-stroke: 1.5px #000;
  }
  .meeples-bg {
    width: 330px;
    height: 368px;
  }
  .meeples-bg img {
    width: 165px;
    height: 184px;
  }
  .meeples-bg #hand-img {
    width: 330px;
    height: 368px;
  }
  .map-bubble iframe {
    height: 150px;
  }
  .title-bar-text {
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .actions-row {
    flex-wrap: wrap;
    justify-content: center;
  }
  .btn-w95 {
    min-width: 0;
    flex: 1 1 auto;
  }
  .step-counter {
    order: -1;
    width: 100%;
    text-align: center;
  }
}