﻿/* Same chrome as #game-score-display.eg-solo-hud-total (duel.css) — reversed “Round Total” line */
.reversed-score-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(var(--theme-gold-rgb), 0.45);
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-weight: 800;
  font-size: 0.95rem;
  text-align: center;
  font-family: inherit;
  -webkit-text-stroke: 0;
  text-shadow: none;
  margin: 0 auto;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
}

.reversed-wrong-marks {
  color: #c0392b;
  font-weight: 900;
  margin-left: 0.2em;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

.reversed-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.reversed-option-btn {
  border: 1px solid #444;
  background: transparent;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  transform-style: preserve-3d;
  width: fit-content;
  justify-self: center;
  align-self: start;
}

.reversed-option-btn:hover {
  border-color: #eec566;
}

.reversed-option-btn.reversed-wrong {
  border-color: #ffffff;
  background: #ffffff;
  opacity: 1;
  transform: rotateY(180deg);
}

.reversed-option-btn.reversed-wrong img,
.reversed-option-btn.reversed-wrong canvas,
.reversed-option-btn.reversed-wrong .reversed-option-pair {
  opacity: 0;
  visibility: hidden;
}

.reversed-option-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  align-items: center;
}

.reversed-option-btn img,
.reversed-option-btn canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 132px;
  object-fit: contain;
}

.reversed-option-pair .difficulty-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 132px;
  border-radius: 12px;
}

/* Reversed: same full-map inset frame as solo; round base + 9 cards centered over map; HUD bottom-left; End game bottom-right; Confirm above bottom row */
body.reversed-mode #game-container {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

body.reversed-mode #main-container {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: visible;
  padding-bottom: 0;
}

body.game-view.reversed-mode #main-container.eg-page-shell {
  flex: 1 1 0%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
}

body.reversed-mode #main-container.eg-solo-match-stage {
  margin-bottom: 0;
  padding: 0;
  border-radius: 0;
  position: relative;
  flex: 1 1 0%;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame {
  position: absolute;
  inset: clamp(10px, 2vmin, 18px);
  z-index: 0;
  width: auto;
  height: auto;
  margin: 0;
  border-radius: 14px;
  border: 1px solid var(--map-frame-border-mid);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  overflow: hidden;
  box-sizing: border-box;
  background: transparent;
  isolation: isolate;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  flex: none !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 0 !important;
}

/* Leaflet can promote tile/overlay layers above sibling DOM; keep the map subtree under the face UI. */
body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame .leaflet-container {
  z-index: 0 !important;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-top.leaflet-left {
  top: var(--eg-map-overlay-padding);
  left: var(--eg-map-overlay-padding);
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-top.leaflet-left .leaflet-control {
  margin-top: 0;
  margin-left: 0;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-bottom.leaflet-right {
  bottom: var(--eg-map-overlay-padding);
  right: var(--eg-map-overlay-padding);
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-bottom.leaflet-right .leaflet-control {
  margin-bottom: 0;
  margin-right: 0;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-bottom.leaflet-left {
  bottom: var(--eg-map-overlay-padding);
  left: var(--eg-map-overlay-padding);
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-map-frame #map-container.leaflet-container .leaflet-bottom.leaflet-left .leaflet-control {
  margin-bottom: 0;
  margin-left: 0;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-float {
  position: absolute;
  left: 50%;
  top: var(--eg-map-overlay-padding);
  transform: translateX(-50%);
  right: auto;
  bottom: auto;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  max-width: min(96vw, 520px);
  width: min(96vw, 520px);
  max-height: calc(100% - var(--eg-map-overlay-padding) * 2 - 5.5rem);
  pointer-events: none;
  isolation: isolate;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-float > * {
  pointer-events: auto;
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-hud {
  position: absolute;
  bottom: var(--eg-map-overlay-padding);
  left: var(--eg-map-overlay-padding);
  right: auto;
  top: auto;
  z-index: 10050;
  flex: none;
  align-items: flex-start;
  text-align: left;
  margin: 0;
  width: auto;
  max-width: min(46vw, 280px);
  pointer-events: auto;
}

body.reversed-mode #main-container.eg-solo-match-stage #back-to-menu.eg-solo-end-game {
  position: absolute;
  bottom: var(--eg-map-overlay-padding);
  right: var(--eg-map-overlay-padding);
  left: auto;
  top: auto;
  z-index: 10052;
  margin: 0;
  text-align: right;
  max-width: min(46vw, 220px);
}

body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-hud-name {
  color: #000;
}

body.reversed-mode #main-container.eg-solo-match-stage #game-score-display.eg-solo-hud-total {
  color: #000;
}

body.reversed-mode #main-container.eg-solo-match-stage #confirm-guess.eg-primary-btn {
  position: absolute;
  bottom: calc(var(--eg-map-overlay-padding) + 3.85rem);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  z-index: 10051;
  width: min(92vw, 440px);
  max-width: 440px;
  margin: 0 !important;
  flex: none !important;
}

body.reversed-mode #main-container.eg-solo-match-stage #confirm-guess.eg-primary-btn:hover:not(.disabled) {
  transform: translateX(-50%) translateY(-1px) scale(1.01);
}

/* Reversed 3×3 grid: must keep a real height — auto + min-height:0 collapsed #face-container to ~2px inside the centered flex overlay */
body.reversed-mode #main-container.eg-solo-match-stage #face-container {
  position: relative;
  z-index: 1;
  width: 100% !important;
  max-width: min(96vw, 480px);
  min-height: min(44vh, 380px) !important;
  height: min(52vh, 420px) !important;
  max-height: min(52vh, 420px) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 0 !important;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
  border: none;
  cursor: default;
  touch-action: auto;
  flex: 0 0 auto !important;
}

body.reversed-mode #face-flip-container {
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

/* Flipped result: same multi-pane card + ribbon as solo — needs space so Summary / Map / Description + “Click me for info” aren’t clipped */
body.reversed-mode #main-container.eg-solo-match-stage #face-container:has(#face-flip-container.flip) {
  max-height: min(82vh, 680px) !important;
  min-height: min(58vh, 520px) !important;
  height: auto !important;
  width: min(96vw, 440px) !important;
  overflow: visible !important;
  z-index: 10005;
  align-self: center;
}

body.reversed-mode #main-container.eg-solo-match-stage #face-container:has(#face-flip-container.flip) #face-flip-container {
  overflow: visible;
}

body.reversed-mode #main-container.eg-solo-match-stage #face-container:has(#face-flip-container.flip) #result-popup.duel-face-back {
  min-height: min(52vh, 480px);
}

body.reversed-mode #face-front {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

body.reversed-mode #image-container.reversed-image-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px 12px 10px;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Solo game: duel.css `#main-container…#face-front img` (2× ID) wins over `.reversed-option-btn img` and applies portrait oval rules to the 3×3 grid — reset for reversed picks. */
body.reversed-mode #main-container.eg-solo-match-stage #face-front.duel-face-front {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}

/* Fill each grid cell: photos use cover; scrambled canvases use contain so the full tile grid stays visible */
body.reversed-mode #main-container.eg-solo-match-stage #face-front .reversed-option-btn img {
  border-radius: 10px !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  object-fit: cover !important;
  object-position: center center !important;
  flex: 1 1 auto !important;
  aspect-ratio: unset !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

body.reversed-mode #main-container.eg-solo-match-stage #face-front .reversed-option-btn canvas {
  border-radius: 10px !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  flex: 1 1 auto !important;
  aspect-ratio: unset !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

body.reversed-mode #main-container.eg-solo-match-stage #face-front .reversed-option-pair .difficulty-image {
  border-radius: 12px !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

body.reversed-mode .reversed-score-live {
  flex: 0 0 auto;
  align-self: center;
}

@media (max-width: 420px) {
  body.reversed-mode .reversed-score-live {
    font-size: clamp(0.78rem, 3.2vw, 0.95rem);
    padding: 5px 10px;
  }
}

body.reversed-mode .reversed-option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  flex: 1 1 0;
  min-height: 0;
  gap: clamp(3px, 0.8vw, 8px);
}

body.reversed-mode .reversed-option-btn {
  width: 100%;
  height: 100%;
  max-width: none;
  min-width: 0;
  min-height: 0;
  justify-self: stretch;
  align-self: stretch;
  justify-content: stretch;
  align-items: stretch;
  padding: 2px;
  box-sizing: border-box;
}

body.reversed-mode .reversed-option-btn > .reversed-option-pair {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

body.reversed-mode .reversed-option-btn img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  object-position: center center;
}

body.reversed-mode .reversed-option-btn canvas {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center center;
}

body.reversed-mode .reversed-option-pair {
  width: 100%;
  height: 100%;
  min-height: 0;
  align-items: stretch;
}

body.reversed-mode .reversed-option-pair .difficulty-image {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center center;
}

@media (max-width: 768px) {
  body.reversed-mode #main-container.eg-solo-match-stage .eg-solo-float {
    max-height: min(56vh, 480px);
  }

  body.reversed-mode #main-container.eg-solo-match-stage #face-container {
    min-height: min(38vh, 300px) !important;
    height: min(44vh, 360px) !important;
    max-height: min(44vh, 360px) !important;
  }

  body.reversed-mode #main-container.eg-solo-match-stage #confirm-guess.eg-primary-btn {
    bottom: calc(var(--eg-map-overlay-padding) + 4.35rem);
    max-width: min(88vw, 320px);
  }
}

.mode-toggle span {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.ethnos-content-wrapper {
  display: flex;
  gap: 20px;
  margin-top: 15px;
  align-items: flex-start;
  width: 100%;
  max-width: 600px;
  box-sizing: border-box;
}

.checkboxes-column {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.settings-info-panel {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
  border: 2px solid var(--theme-gold-base);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(var(--theme-gold-rgb), 0.2);
  overflow: hidden;
  box-sizing: border-box;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.info-line {
  margin: 6px 0;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.info-line:first-child {
  margin-top: 0;
}

.info-line:last-child {
  margin-bottom: 0;
}

.info-line strong {
  color: var(--theme-gold-base);
  display: inline-block;
  min-width: 60px;
}

.info-line span {
  color: #cccccc;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

