.map-game {
  --map-ink: #193c2e;
  --map-green: #146044;
  --map-gold: #d9b965;
  width: 100%;
  max-width: 940px;
  min-width: 0;
  margin-inline: auto;
  padding: clamp(12px, 3vw, 26px);
  color: var(--map-ink);
  background: #fffdf6;
  border: 1px solid #ddd3b9;
  border-radius: 22px;
  text-align: start;
  font-family: inherit;
  line-height: 1.65;
  isolation: isolate;
}
.map-game, .map-game * { box-sizing: border-box; }
.map-game [hidden] { display: none !important; }
.map-game button { font: inherit; }
.map-game__heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-game__heading h2 { margin: 0; color: var(--map-ink); font-size: clamp(1.25rem, 4vw, 1.9rem); }
.map-game__eyebrow { margin: 0 0 2px; color: #756131; font-size: .8rem; font-weight: 700; }
.map-game__score { flex: 0 0 auto; text-align: center; border: 1px solid #d9c88e; background: #f5efd9; border-radius: 14px; padding: 5px 12px; }
.map-game__score strong { display: block; font-size: 1.35rem; line-height: 1.25; color: var(--map-green); }
.map-game__score span { font-size: .72rem; }
.map-game__intro { margin: 12px 0; font-size: .95rem; }
.map-game__controls { display: flex; flex-wrap: wrap; gap: 8px; }
.map-game .map-game__controls .btn { min-height: 44px; max-width: 100%; border-radius: 10px; padding: 8px 13px; white-space: normal; border: 1px solid #bcb08b; background: #fff; color: var(--map-ink); cursor: pointer; }
.map-game .map-game__controls .btn[aria-pressed="true"], .map-game .map-game__controls .btn[aria-expanded="true"] { background: #e5efdf; border-color: var(--map-green); }
.map-game__instructions { margin: 12px 0; font-size: .85rem; }
.map-game__help { margin-bottom: 14px; padding: 12px; border: 1px solid #d8c98e; border-radius: 12px; background: #f6f2e5; }
.map-game__help p { margin: 0 0 10px; font-size: .9rem; }
.map-game__help img { display: block; width: min(100%, 240px); height: auto; margin-inline: auto; border-radius: 8px; }
.map-game__workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: clamp(14px, 3vw, 28px); }
.map-game__area { min-width: 0; }
.map-game__area h3 { margin: 0 0 8px; color: var(--map-ink); font-size: .98rem; }
.map-game__board, .map-game__tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); direction: ltr; width: 100%; max-width: 330px; margin-inline: auto; min-width: 0; }
.map-game__board { gap: 2px; padding: 5px; border: 2px solid #b9a36b; border-radius: 12px; background: #d6caa9; }
.map-game__tray { gap: 8px; padding: 5px; }
.map-game__slot, .map-game__piece {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border: 1px solid #9b906e;
  border-radius: 5px;
  overflow: hidden;
  color: var(--map-ink);
  cursor: pointer;
  background-color: #f6f0dd;
}
.map-game__slot { background-image: repeating-linear-gradient(45deg, #f9f5e9 0, #f9f5e9 8px, #efe8d2 8px, #efe8d2 9px); }
.map-game__piece, .map-game__slot.is-placed { background-image: var(--map-picture); background-size: 300% 300%; background-position: var(--tile-x) var(--tile-y); background-repeat: no-repeat; }
.map-game__piece { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; box-shadow: 0 2px 4px #18372820; }
.map-game__badge, .map-game__slot-number { position: absolute; top: 5px; left: 5px; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 7px; background: #fffdf5ed; color: #173d2c; font: 700 .8rem/1 Arial, sans-serif; pointer-events: none; }
.map-game__slot-number { inset: 50% auto auto 50%; transform: translate(-50%, -50%); color: #6a5c39; background: #fffdf4; }
.map-game__slot.is-placed { border-color: #176448; box-shadow: inset 0 0 0 2px #42ad72; }
.map-game__slot.is-placed .map-game__slot-number { inset: auto 4px 4px auto; transform: none; min-width: 20px; height: 20px; color: #fff; background: #146044; font-size: .7rem; }
.map-game__piece.is-placed { cursor: default; box-shadow: none; border-color: #146044; }
.map-game__piece.is-selected { outline: 3px solid #a77614; outline-offset: 2px; }
.map-game__slot.is-hint { outline: 3px dashed #a77614; outline-offset: 2px; }
.map-game__slot.is-over { outline: 3px solid #1a754d; outline-offset: 1px; background-color: #e4edcf; }
.map-game__piece.is-dragging { opacity: .5; cursor: grabbing; }
.map-game__ghost { position: fixed; z-index: 2147483000; pointer-events: none; opacity: .95; margin: 0; transform: none; box-shadow: 0 10px 28px #15372d44; outline: 2px solid var(--map-gold); cursor: grabbing; }
.map-game button:focus-visible, .map-game a:focus-visible { outline: 3px solid #925f00; outline-offset: 3px; }
.map-game__status { margin: 14px 0 0; min-height: 1.65em; font-size: .93rem; color: #244d37; }
.map-game__success { margin: 10px 0 0; border: 1px solid #73a477; background: #e8f4df; color: #184c31; padding: 12px; border-radius: 10px; font-weight: 700; }
.map-game.is-complete .map-game__board { border-color: #2c8954; }
.map-game__credit { margin: 14px 0 0; font-size: .74rem; color: #756b52; overflow-wrap: anywhere; }
.map-game__credit a { color: #325940; text-decoration: underline; }
@media (max-width: 559px) {
  .map-game { padding: 8px; }
  .map-game__workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; }
  .map-game__area h3 { font-size: .86rem; }
  .map-game__board { max-width: 200px; padding: 0; border-width: 1px; gap: 2px; border-radius: 8px; }
  .map-game__tray { max-width: 220px; padding: 0; gap: 2px; }
  .map-game__badge, .map-game__slot-number { min-width: 20px; height: 20px; top: 3px; left: 3px; font-size: .72rem; }
  .map-game__slot-number { top: 50%; left: 50%; }
  .map-game__controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .map-game .map-game__controls .btn { padding: 6px 3px; font-size: .78rem; line-height: 1.4; }
}
@media (prefers-reduced-motion: reduce) {
  .map-game *, .map-game *::before, .map-game *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
