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

:root {
  --bg: #121214;
  --surface: #1c1c21;
  --text: #e8e8ec;
  --muted: #888896;
  --accent: #6b9fff;
  --accent-hover: #8cb4ff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

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

.field label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field input[type="text"] {
  width: min(100%, 220px);
  padding: 0.5rem 0.65rem;
  border: 1px solid #33333c;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(107, 159, 255, 0.25);
}

button#generate {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #0d1117;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

button#generate:hover {
  background: var(--accent-hover);
}

.map-wrap {
  position: relative;
  border-radius: 10px;
  border: 1px solid #2a2a32;
  background: #0a0a0c;
  line-height: 0;
}

.toolbar-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid #2a2a32;
  border-radius: 8px;
  font-size: 0.85rem;
}

.field-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.field-group strong {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.radio-label, .check-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  color: #ccc;
  user-select: none;
}

.radio-label:hover, .check-label:hover {
  color: #fff;
}

.radio-label input, .check-label input {
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}

button.btn-secondary {
  margin-left: auto;
  padding: 0.4rem 0.8rem;
  border: 1px solid #4a4a52;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

button.btn-secondary:hover {
  background: #2a2a32;
  border-color: var(--accent);
  color: var(--accent);
}

#hud-info {
  position: sticky;
  top: 0;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  background: linear-gradient(180deg, rgba(20, 20, 25, 0.9) 0%, rgba(10, 10, 15, 0.95) 100%);
  color: #fff;
  padding: 0.6rem 1rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 215, 0, 0.3); /* Dourado suave estilo Civ */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 40px;
  backdrop-filter: blur(8px);
  z-index: 10;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  letter-spacing: 0.02em;
}

#hud-info b {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#hud-info .label {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.7rem;
  margin-right: 0.4rem;
}

#hud-info .biome-name {
  color: #ffd700;
  font-weight: 600;
  text-transform: uppercase;
}

.play-immersive-hint {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 27;
  min-width: 220px;
  max-width: min(76vw, 540px);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(22, 24, 30, 0.84) 0%, rgba(10, 11, 16, 0.9) 100%);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease, transform 160ms ease;
}

.play-immersive-hint.play-immersive-hint--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.play-immersive-hint__row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #f2f0e6;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.play-immersive-hint__sprite {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}

.play-immersive-hint__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(255, 238, 175, 0.5);
  background: rgba(255, 237, 164, 0.15);
  color: #fff4c3;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.22);
}

.play-immersive-hint__action {
  color: #ffedb0;
  font-weight: 700;
}

.play-immersive-hint__action-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 8px;
}

.play-immersive-hint__warn {
  color: #ffc8aa;
  font-weight: 700;
}

.play-immersive-hint__meta {
  margin-top: 5px;
  text-align: center;
  color: rgba(184, 214, 244, 0.86);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

#map {
  display: block;
  width: 100%;
  height: auto;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Click-to-focus map: no ring on pointer focus; keep hint for keyboard Tab */
#map:focus:not(:focus-visible) {
  outline: none;
}

.hidden {
  display: none !important;
}

/* Play: minimap + small header + back-to-global-map control */
.minimap-panel {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 22;
  display: none;
  flex-direction: column;
  align-items: stretch;
  width: 196px;
  border: 2px solid #33333c;
  border-radius: 6px;
  background: #0a0a0c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  overflow: visible;
}

.app.play-mode-active .map-wrap .minimap-panel:not(.hidden) {
  display: flex;
}

.minimap-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 5px 4px 7px;
  min-height: 26px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #1c1c24 0%, #121218 100%);
  border-bottom: 1px solid #2e2e38;
}

.minimap-panel__header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.minimap-panel__title {
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.52);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.minimap-panel__back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(190, 220, 255, 0.92);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.minimap-panel__back-btn:hover {
  background: rgba(230, 0, 18, 0.18);
  border-color: rgba(230, 0, 18, 0.35);
  color: #fff;
}

.minimap-panel__back-btn:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.85);
  outline-offset: 1px;
}

.minimap-panel__back-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.minimap-panel__music-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(200, 220, 255, 0.88);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.play-field-skill-wheel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 55;
  pointer-events: none;
}

.play-field-skill-wheel__ring {
  width: 230px;
  height: 230px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: radial-gradient(circle at center, rgba(10, 12, 18, 0.88) 0%, rgba(8, 9, 13, 0.78) 64%, rgba(8, 9, 13, 0.48) 100%);
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.6);
  position: relative;
}

.play-field-skill-wheel__hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #bdd9ff;
  font-size: 0.73rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.84;
  white-space: nowrap;
}

.play-field-skill-wheel__item {
  position: absolute;
  width: 86px;
  min-height: 36px;
  font-family: 'Inter', system-ui, sans-serif;
  border-radius: 999px;
  border: 1px solid rgba(154, 216, 255, 0.28);
  background: rgba(21, 31, 48, 0.82);
  color: #d4ecff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transform: translate(-50%, -50%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.44);
}

/* Reuse `type-icon type-*` palette without inheriting unrelated table/list sizing. */
.play-field-skill-wheel__item.type-icon {
  margin-bottom: 0;
  line-height: 1.1;
  text-transform: none;
  width: 86px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
}

.play-field-skill-wheel__item[data-skill="tackle"] {
  left: 50%;
  top: 22%;
}

.play-field-skill-wheel__item[data-skill="cut"] {
  left: 50%;
  top: 78%;
}

.play-field-skill-wheel__item.is-hover {
  border-color: rgba(255, 236, 144, 0.96);
  box-shadow: 0 0 0 2px rgba(255, 236, 144, 0.3), 0 8px 18px rgba(0, 0, 0, 0.45);
  color: #fff7cb;
}

.play-field-skill-wheel__item.is-selected {
  background: rgba(22, 62, 102, 0.88);
  border-color: rgba(111, 189, 255, 0.96);
}

/* Special attack wheel (Digit2): supports many entries without overlap. */
.play-field-skill-wheel--special .play-field-skill-wheel__ring {
  width: 620px;
  height: 620px;
}

.play-field-skill-wheel--special .play-field-skill-wheel__hint {
  font-size: 0.7rem;
  opacity: 0.8;
}

.play-field-skill-wheel--special .play-field-skill-wheel__item {
  width: 84px;
  min-height: 32px;
  font-size: 0.61rem;
  line-height: 1.12;
  padding: 4px 6px;
  text-align: center;
  white-space: normal;
}

.play-field-skill-wheel--special .play-field-skill-wheel__item.type-icon {
  width: 84px;
  min-height: 32px;
}

.minimap-panel__music-btn:hover {
  background: rgba(154, 216, 255, 0.12);
  border-color: rgba(154, 216, 255, 0.28);
  color: #fff;
}

.minimap-panel__music-btn[aria-pressed="true"] {
  background: rgba(154, 216, 255, 0.18);
  border-color: rgba(154, 216, 255, 0.4);
  color: #fff;
}

.minimap-panel__music-btn:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.85);
  outline-offset: 1px;
}

.minimap-panel__music-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.minimap-audio-popover {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(268px, calc(100vw - 32px));
  padding: 10px 12px 12px;
  box-sizing: border-box;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #e8e8ec;
  background: rgba(14, 16, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.minimap-audio-popover__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.minimap-audio-popover__label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(154, 216, 255, 0.9);
}

.minimap-audio-popover__range {
  width: 100%;
  accent-color: #9ad8ff;
  cursor: pointer;
}

.minimap-audio-popover__check-row {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
}

.minimap-audio-popover__check-row input[type="checkbox"] {
  margin-top: 2px;
  accent-color: #9ad8ff;
  flex-shrink: 0;
  cursor: pointer;
}

.minimap-audio-popover__check-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  color: rgba(220, 226, 240, 0.95);
  line-height: 1.35;
  cursor: pointer;
}

.minimap-audio-popover__now {
  padding-top: 4px;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.minimap-audio-popover__now-title {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 4px;
}

.minimap-audio-popover__track {
  color: #f9f3d2;
  font-weight: 700;
  font-size: 0.75rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.minimap-audio-popover__status {
  margin-top: 4px;
  font-size: 0.65rem;
  color: rgba(182, 205, 231, 0.92);
  word-break: break-word;
}

.minimap-panel #minimap {
  display: block;
  width: 192px;
  height: 192px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0 0 4px 4px;
  background-color: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Zoom + help — same shape as music / back buttons */
.minimap-panel__zoom-btn,
.minimap-panel__help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(200, 220, 255, 0.88);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.minimap-panel__zoom-btn:hover,
.minimap-panel__help-btn:hover {
  background: rgba(154, 216, 255, 0.14);
  border-color: rgba(154, 216, 255, 0.3);
  color: #fff;
}

.minimap-panel__zoom-btn:focus-visible,
.minimap-panel__help-btn:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.85);
  outline-offset: 1px;
}

.minimap-panel__help-btn[aria-pressed="true"] {
  background: rgba(255, 236, 144, 0.14);
  border-color: rgba(255, 236, 144, 0.35);
  color: #fff7cb;
}

.minimap-panel__zoom-icon,
.minimap-panel__help-icon {
  width: 14px;
  height: 14px;
  display: block;
}

/* ─── Play help wiki (minimap book icon) ─────────────────────────────────── */
.play-help-wiki {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.play-help-wiki.hidden {
  display: none !important;
}

.play-help-wiki__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}

.play-help-wiki__card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(920px, 100%);
  max-height: min(88vh, 720px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(165deg, rgba(22, 24, 32, 0.98) 0%, rgba(10, 11, 16, 0.99) 100%);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.play-help-wiki__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 9, 13, 0.55);
}

.play-help-wiki__title {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 244, 210, 0.95);
}

.play-help-wiki__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #f2f0e6;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.play-help-wiki__close:hover {
  background: rgba(230, 0, 18, 0.2);
  border-color: rgba(230, 0, 18, 0.4);
  color: #fff;
}

.play-help-wiki__close:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.9);
  outline-offset: 2px;
}

.play-help-wiki__body {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 0;
  min-height: 0;
  flex: 1 1 auto;
}

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

.play-help-wiki__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px 14px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(6, 7, 10, 0.45);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}

@media (max-width: 640px) {
  .play-help-wiki__nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    max-height: 38vh;
  }
}

.play-help-wiki__toc-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(210, 220, 240, 0.92);
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.play-help-wiki__toc-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.play-help-wiki__toc-link.is-active {
  background: rgba(154, 216, 255, 0.12);
  border-color: rgba(154, 216, 255, 0.28);
  color: #e8f4ff;
}

.play-help-wiki__toc-link:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.75);
  outline-offset: 1px;
}

.play-help-wiki__article {
  padding: 16px 20px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.55;
  color: rgba(232, 234, 242, 0.94);
}

.play-help-wiki__h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff4c8;
}

.play-help-wiki__p {
  margin: 0 0 12px;
}

.play-help-wiki__ul {
  margin: 0;
  padding-left: 1.15rem;
}

.play-help-wiki__ul li {
  margin-bottom: 8px;
}

.play-help-wiki__ul li:last-child {
  margin-bottom: 0;
}

.play-help-wiki__h3 {
  margin: 18px 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffe4a1;
}

.play-help-wiki__table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 0.82rem;
}

.play-help-wiki__table th,
.play-help-wiki__table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

.play-help-wiki__table th {
  background: rgba(255, 255, 255, 0.04);
  color: #fff4c8;
  font-weight: 700;
  white-space: nowrap;
}

.play-help-wiki__table td kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: #fffbe6;
}

body.play-help-wiki-open {
  overflow: hidden;
}

/* Zoom level badge shown in the title area via ::after on the panel */
.minimap-panel[data-zoom-level]::before {
  content: attr(data-zoom-level);
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(154, 216, 255, 0.85);
  background: rgba(10, 10, 14, 0.82);
  border: 1px solid rgba(154, 216, 255, 0.22);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
  white-space: nowrap;
}

/* PLAY MODE EXPERIÊNCIA FULLSCREEN */
body.play-mode-active {
  overflow: hidden;
  background: #000;
}

.app.play-mode-active {
  max-width: 100vw;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app.play-mode-active .toolbar,
.app.play-mode-active h1,
.app.play-mode-active .subtitle {
  display: none;
}

.app.play-mode-active .toolbar-secondary {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

.app.play-mode-active .map-wrap {
  flex-grow: 1;
  border-radius: 0;
  border-left: none;
  border-right: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.app.play-mode-active #map {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  border-radius: 0;
}

/* FPS — só visível no modo play (abaixo do #hud-info, que cobre o topo com z-index 10) */
.play-fps {
  display: none;
  position: absolute;
  top: 0;
  right: 10px;
  z-index: 15;
  padding: 6px 10px;
  line-height: 1.25;
  min-height: 1.25em;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c8f5c4;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  white-space: nowrap;
}

.app.play-mode-active .map-wrap .play-fps {
  display: block;
  /* #hud-info: padding ~0.6rem×2 + min-height 40px */
  top: calc(0.6rem + 0.6rem + 40px + 8px);
}

/* Minimal UI (immersive): #hud-info hidden — keep FPS top-right for performance */
.app.play-mode-active.app--play-immersive .map-wrap .play-fps {
  top: 10px;
  right: 10px;
}

.app.play-mode-active.app--play-immersive .map-wrap .play-immersive-hint {
  display: block;
}

.play-bgm-now-playing {
  display: none;
  position: absolute;
  right: 10px;
  top: calc(0.6rem + 0.6rem + 40px + 36px);
  z-index: 1201;
  width: min(320px, calc(100vw - 200px));
  padding: 8px 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #e8e8ec;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.app.play-mode-active .map-wrap .play-bgm-now-playing {
  display: block;
}

.play-bgm-now-playing-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ad8ff;
  font-size: 0.65rem;
  margin-bottom: 4px;
}

.play-bgm-now-playing-track {
  color: #f9f3d2;
  font-weight: 700;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-bgm-now-playing-status {
  color: #b6cde7;
  font-size: 0.66rem;
  opacity: 0.95;
  margin-top: 3px;
}

/* BGM toast — immersive / minimal UI only (see .app--play-immersive rules in character-selector.css) */
.play-bgm-toast {
  display: none;
  box-sizing: border-box;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: min(640px, calc(100vw - 24px));
  max-width: min(640px, calc(100vw - 24px));
  padding: 10px 12px 12px 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  line-height: 1.35;
  color: #e8e8ec;
  background: rgba(12, 14, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 1310;
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%) translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.28s ease;
}

.app.play-mode-active.app--play-immersive .map-wrap .play-bgm-toast {
  display: flex;
  /* Below compact FPS pill (top-right) */
  top: 48px;
}

.play-bgm-toast.play-bgm-toast--visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.play-bgm-toast__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.play-bgm-toast-title {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ad8ff;
  font-size: 0.62rem;
}

.play-bgm-toast-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: -4px -4px -4px 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.play-bgm-toast-close:hover {
  background: rgba(230, 0, 18, 0.2);
  border-color: rgba(230, 0, 18, 0.4);
  color: #fff;
}

.play-bgm-toast-close:focus-visible {
  outline: 2px solid rgba(154, 216, 255, 0.85);
  outline-offset: 1px;
}

.play-bgm-toast-track {
  text-align: left;
  color: #f9f3d2;
  font-weight: 700;
  font-size: 0.8rem;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.play-bgm-toast-status {
  text-align: left;
  color: #b6cde7;
  font-size: 0.65rem;
  opacity: 0.92;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* World time of day — play mode only, bottom-left (minimap is bottom-right) */
.play-world-time {
  display: none;
  position: absolute;
  left: 10px;
  top: calc(0.6rem + 0.6rem + 40px + 8px);
  bottom: auto;
  z-index: 1201;
  width: min(460px, calc(100vw - 160px));
  padding: 10px 12px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: #e8e8ec;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

.app.play-mode-active .map-wrap .play-world-time {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: stretch;
}

.play-world-time__section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.play-world-time__section + .play-world-time__section {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.play-social-overlay {
  display: none;
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 900;
  width: min(420px, calc(100vw - 160px));
  padding: 8px 10px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  color: #e8e8ec;
  background: rgba(0, 0, 0, 0.64);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

.play-social-overlay.is-active {
  opacity: 1;
}

.app.play-mode-active .map-wrap .play-social-overlay {
  display: block;
}

.play-social-overlay-title {
  margin-bottom: 6px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ad8ff;
}

.play-social-overlay-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.play-social-overlay-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
}

.play-social-overlay-item.is-active {
  border-color: rgba(255, 215, 90, 0.85);
  background: rgba(255, 215, 90, 0.2);
}

.play-social-overlay-key {
  min-width: 16px;
  color: #b7d8ff;
  font-weight: 700;
}

.play-social-overlay-figure {
  position: relative;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.play-social-overlay-portrait {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.play-social-overlay-emoji-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.play-social-overlay-emoji-fallback.is-hidden {
  display: none;
}

.play-social-overlay-label {
  font-size: 0.66rem;
  color: #e6edf7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-social-overlay-last {
  margin-top: 6px;
  min-height: 1.1em;
  color: #c8f5c4;
}

.play-world-time-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ad8ff;
  font-size: 0.65rem;
}

.play-world-time-phase {
  font-weight: 800;
  font-size: 0.95rem;
  color: #ffd78a;
}

.play-world-time-hour {
  color: #c8f5c4;
  font-variant-numeric: tabular-nums;
}

.play-world-time input[type="range"] {
  width: 100%;
  margin: 2px 0 0;
}

.play-world-time-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.play-world-time-preset {
  padding: 4px 6px;
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2a2a32;
  color: var(--text);
}

.play-world-time-preset:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.play-world-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  cursor: pointer;
  color: #b8b8c8;
}

.play-world-time-speed {
  width: 4.5rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid #444;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
}

.play-weather-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ad8ff;
  font-size: 0.65rem;
}

.play-weather-current {
  font-weight: 800;
  font-size: 0.95rem;
  color: #a3d9ff;
}

.play-weather-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.play-weather-preset {
  padding: 4px 6px;
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #444;
  background: #2a2a32;
  color: var(--text);
}

.play-weather-preset:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.play-weather-preset.is-active {
  border-color: #a3d9ff;
  color: #a3d9ff;
  background: rgba(163, 217, 255, 0.14);
}

.play-weather-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b8b8c8;
}

.play-weather-row input[type="range"] {
  flex: 1;
  margin: 0;
}

.play-weather-lightning {
  margin-top: 4px;
  padding: 5px 8px;
  font-size: 0.7rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  border: 1px solid #6a6a40;
  background: linear-gradient(180deg, #2e2a1e 0%, #1f1c13 100%);
  color: #ffe58a;
  letter-spacing: 0.04em;
}

.play-weather-lightning:hover {
  border-color: #ffe58a;
  color: #fff6c8;
  background: linear-gradient(180deg, #3a331f 0%, #27221a 100%);
}

.play-weather-lightning:active {
  transform: translateY(1px);
}

/* MODAL DE CONFIGURAÇÕES */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid #444;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--accent);
}

.config-row {
  margin-bottom: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.config-row label {
  font-size: 0.85rem;
  color: #aaa;
}

.config-row input[type="range"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.modal-footer {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

/* =========================================
   PLAY MODE CONTEXT MENU
   ========================================= */
.play-context-menu {
  position: fixed;
  z-index: 1100;
  min-width: 200px;
  padding: 6px 0;
  margin: 0;
  background: #12131a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.play-context-menu[hidden] {
  display: none !important;
}

.play-context-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #e8e8f0;
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.play-context-menu-item:hover,
.play-context-menu-item:focus {
  background: rgba(0, 210, 255, 0.12);
  color: #fff;
  outline: none;
}

/* =========================================
   DEBUG MODAL (PLANET GENESIS STYLE)
   ========================================= */
.tile-debug-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.tile-debug-modal.is-open {
  display: flex;
}

.tile-debug-card {
  background: #0a0b10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.6);
  color: #f0f0f5;
  font-family: 'Inter', sans-serif;
}

.tile-debug-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tile-debug-header .hud-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #00d2ff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.tile-debug-header .hud-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #00d2ff;
  border-radius: 50%;
  box-shadow: 0 0 10px #00d2ff;
}

.tile-debug-body {
  padding: 24px;
  overflow-y: auto;
}

.tile-debug-section {
  margin-bottom: 20px;
}
.tile-debug-section:last-child {
  margin-bottom: 0;
}

.tile-debug-section-title {
  font-size: 0.70rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a0a0b0;
  margin-bottom: 10px;
}

/* Alinhado ao tile-debug-modal do tile-detail-app (Planet Genesis) */
.tile-debug-hero-preview {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tile-debug-hero-stack .sprite-icon {
  width: 24px;
  height: 24px;
  background-size: auto;
  image-rendering: pixelated;
  transform: scale(1.5);
  transform-origin: left center;
  margin-right: 6px;
}

.tile-debug-hero-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e8e8f0;
}

.tile-debug-grid-3x3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 560px;
}

.tile-debug-grid-3x3 .tile-debug-cell {
  font-size: 0.68rem;
  padding: 8px;
}

.tile-debug-mini-sprites {
  margin-top: 6px;
}

.tile-debug-mini-sprites .sprite-icon {
  transform: scale(1.25);
  transform-origin: left top;
}

.tile-debug-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.tile-debug-table th,
.tile-debug-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tile-debug-table th {
  color: #a0a0b0;
  font-weight: 600;
}

.tile-debug-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 400px;
}

.tile-debug-cell {
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.tile-debug-cell.center {
  background: rgba(0, 210, 255, 0.1);
  border-color: #00d2ff;
}

.tile-debug-cell .cell-label {
  font-weight: 700;
  color: #a0a0b0;
  margin-bottom: 4px;
  display: block;
}

.btn-hud {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f0f0f5;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
}

.btn-hud:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #00d2ff;
}

.tile-debug-sprite-stack {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: left;
}

.sprite-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.05);
  margin-right: 8px;
  margin-bottom: 8px;
}

.sprite-badge-label {
  font-size: 0.75rem;
  color: #a0a0b0;
  font-family: 'JetBrains Mono', monospace;
}

/* Pequeno wrapper para a div de sprite que usa CSS background para renderizar o pedaço do spritesheet */
.sprite-icon {
  width: 16px; 
  height: 16px; 
  display: inline-block; 
  image-rendering: crisp-edges; 
  image-rendering: pixelated;
}

.tile-debug-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.tile-debug-matrix .tile-debug-cell {
  padding: 6px;
  text-align: center;
  font-size: 0.70rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

.tile-debug-matrix .tile-debug-cell.active-center {
  background: rgba(0, 210, 255, 0.1);
  border-color: #00d2ff;
  color: #fff;
  font-weight: bold;
}

.tile-debug-biome-label {
  display: block;
  font-size: 0.62rem;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
  text-align: center;
}
