:root{
  --bg: #3C6446;
  --panel: #12161b;
  --text: #e9eef5;
  --muted: #b8c4d1;
  --primary: #3C6446;

  /* STATUS COLORS (from your SVG legend) */
  --available:   #8fcbad; /* disponiveis */
  --sold:        #eaa49e; /* vendidos   */
  --negotiation: #E1AA32; /* emnegociacao */

  --unknown: #8e9aa6;
  --outline: rgba(255,255,255,0.85);
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

/* Webfont for SVG labels (ensure the font is shipped, not OS-dependent) */
@font-face{
  font-family: 'Quning';
  src: url('Quning.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}


* { box-sizing: border-box; }

html, body {
  /* Use dvh (dynamic viewport height) for mobile - accounts for browser chrome */
  height: 100dvh;
  /* Fallback for older browsers */
  height: 100vh;
  height: 100dvh; /* Override after fallback */
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  overflow: hidden; /* Prevent scrolling */
  width: 100%;
  position: fixed; /* Lock to viewport on mobile */
  inset: 0;
}

.app-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 12px 16px;
  background: var(--panel);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.app-header h1{
  font-size: 1.1rem;
  margin: 0;
  font-weight: 600;
}

.legend{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .9rem;
  color: var(--muted);
}
.legend .swatch{
  display:inline-block; width:12px; height:12px; border-radius:3px; margin-right:6px; vertical-align:middle;
  border: 1px solid rgba(255,255,255,0.15);
}
.swatch-available{ background: var(--available); }
.swatch-reserved{ background: var(--reserved); }
.swatch-sold{ background: var(--sold); }
.swatch-unknown{ background: var(--unknown); }

.canvas{
  height: 100vh;
  padding: 10px;
  display: grid;
  place-items: center;
}

/* Language toggle */
.lang-toggle{
  position: fixed; top: 10px; right: 32px; z-index: 30;
  display: flex; gap: 10px;
  font-family: 'Quning', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}
.lang-toggle button{
  background: #26303a; color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
  width: 44px; height: 44px; padding: 0; border-radius: 12px; cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
}
.lang-toggle button:hover{ filter: brightness(1.05); }
.lang-toggle button.active{
  background: var(--primary);
  border-color: rgba(255,255,255,0.28);
}

/* Currency toggle */
.currency-toggle{
  position: fixed; top: 68px; right: 32px; z-index: 30;
  display: flex; gap: 10px;
  font-family: 'Quning', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
}
.currency-toggle button{
  background: #26303a; color: var(--text);
  border: 1px solid rgba(255,255,255,0.18);
  width: 44px; height: 44px; padding: 0; border-radius: 12px; cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: .95rem;
}
.currency-toggle button:hover{ filter: brightness(1.05); }
.currency-toggle button.active{
  background: var(--primary);
  border-color: rgba(255,255,255,0.28);
}

/* MOBILE: Buttons in top right corner (same as desktop) */
@media only screen and (max-width: 1020px) {
  .lang-toggle {
    /* Keep in top right corner on mobile */
    top: 10px;
    right: 10px; /* Slightly closer to edge on mobile for more space */
  }
  
  .currency-toggle {
    /* Keep below language toggle on mobile */
    top: 68px;
    right: 10px; /* Slightly closer to edge on mobile */
  }
}

/* Rotate overlay for portrait mobile */
.overlay{
  display:none;
  position:fixed;
  top:0; left:0;
  width:100%; height:100%;
  background-color:rgba(0,0,0,.7);
  z-index: 40;
}
.zoom-overlay{
  display:none;
  position:fixed;
  top:0; left:0;
  width:100%; height:100%;
  background-color:rgba(0,0,0,.35);
  z-index: 35;
  pointer-events: none;
}
.iconContainer{
  width:200px; height:200px; position:absolute; left:50%; top:50%; margin-left:-100px; margin-top:-100px;
}
.iconContainer p{
  display:inline-block; width:100%; text-align:center; margin:0; font-size:18px; opacity:0; color:#fff;
}
.phone{
  position:relative; left:50%; margin-left:-50px; width:0; height:0; border:0 solid #000; background:#a9a9a9; border-radius:10px; box-sizing:border-box;
}
.phone i{ text-align:center; width:100%; line-height:120px; font-size:50px; color:#454545; opacity:0; display:inline-block; }

@media only screen and (max-width: 1020px) and (orientation: portrait){
  body.app-ready .overlay{ display:block; }
  body.app-ready .overlay .phone{
    animation: sizeIncrease .5s forwards ease, borderIncrease .5s .5s forwards ease, rotateRight .7s 1s forwards ease;
  }
  body.app-ready .overlay .phone i{ animation: fadeIn .5s .8s forwards ease; }
  body.app-ready .overlay .iconContainer p{ animation: fadeIn .5s 1.3s forwards ease; }
}

@media only screen and (max-width: 1020px) and (orientation: landscape){
  body.app-ready .zoom-overlay.show{ display:block; }
  body.app-ready .zoom-overlay .iconContainer{ left:50%; top:50%; margin-left:-100px; margin-top:-100px; }
  body.app-ready .zoom-overlay .iconContainer p{ animation: fadeIn .4s .2s forwards ease; color:#fff; opacity:1; font-weight:700; font-size:22px; letter-spacing:.4px; text-align:center; }
}

/* Pinch animation: two dots move apart and fade */
.pinch{ position: relative; width: 200px; height: 80px; margin: 0 auto 8px; }
.pinch .dot{ position:absolute; top:50%; width:14px; height:14px; margin-top:-7px; background:#fff; border-radius:50%; opacity:.9; }
.pinch .left{ left:50%; animation: pinchLeft 1.8s ease-in-out infinite; }
.pinch .right{ left:50%; animation: pinchRight 1.8s ease-in-out infinite; }

@keyframes pinchLeft{ 0%{ transform: translateX(-12px); opacity:.2; } 30%{ opacity:.9; } 100%{ transform: translateX(-80px); opacity:.1; } }
@keyframes pinchRight{ 0%{ transform: translateX(12px); opacity:.2; } 30%{ opacity:.9; } 100%{ transform: translateX(80px); opacity:.1; } }

@keyframes sizeIncrease { 0% { width: 0; height:10px; } 50% { width: 100px; height: 10px; } 100% { width: 100px; height:160px; } }
@keyframes borderIncrease { 100% { border-width:20px 10px; } }
@keyframes fadeIn { 100% { color:#fff; opacity:1; } }
@keyframes rotateRight { 100% { transform: rotate(90deg); } }

/* Loader overlay - Simple spinner */
.loader-overlay{ position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 50; }
.loader-overlay[hidden]{ display:none; }
.loader-card{ text-align: center; }
.loader-logo{ 
  display: block; 
  width: 280px; 
  max-width: 80vw; 
  margin: 0 auto; 
  filter: drop-shadow(0 0 10px rgba(0,0,0,0.4));
  animation: pulse 2s ease-in-out infinite;
}

/* Simple pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* Spinner ring below logo */
.loader-spinner {
  width: 50px;
  height: 50px;
  margin: 24px auto 0;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* DESKTOP ONLY: Green border bar at top */
@media only screen and (min-width: 1021px) {
  #svg-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    /* Height = width of letterbox. Map is 16:9 (3840/2160) */
    /* letterbox width = (100vw - (100vh * 16/9)) / 2 */
    /* Same height for the top bar to match letterbox width */
    height: calc(max(0px, (100vw - (100vh * 16 / 9)) / 2));
    background: var(--bg);
    z-index: 40; /* Above map, below modals */
    pointer-events: none;
  }
}



#svg-container{
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  background: var(--bg);
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  contain: layout style paint;
  /* Enable pinch-to-zoom on mobile */
  touch-action: pan-x pan-y pinch-zoom;
}

/* The inlined SVG scales to fit, maintaining aspect ratio */
#svg-container svg{
  width: 100%;
  height: 100%;
  display: block;
  /* preserveAspectRatio set dynamically in JavaScript based on screen size */
  /* smooth edges */
  shape-rendering: geometricPrecision;
  text-rendering: optimizeLegibility;
  /* Ensure proper sizing on mobile */
  max-width: 100%;
  max-height: 100%;
}

.plot{
  cursor: pointer;
  transition: transform .08s ease-out, filter .08s ease-out, stroke .08s ease-out, stroke-width .08s ease-out;
  /* keep clicks on path interior only */
  pointer-events: painted;
  /* Allow pinch-to-zoom while still enabling tap */
  touch-action: manipulation;
}

/* Hover “pop” and crisper edge */
.plot:hover{
  filter: drop-shadow(0 0 0.5px var(--outline));
  stroke: #ffffff;
  stroke-width: 1.5;
}

/* Tooltip */
.tooltip{
  position: fixed;
  background: rgba(22,26,31,0.95);
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: .9rem;
  pointer-events: none;
  z-index: 20;
  box-shadow: var(--shadow);
  max-width: 360px;
  text-align: center;
  overflow: hidden;
}

/* Tooltip price table styling */
.tooltip .price-table{ border: 1px solid #ffffff; table-layout: fixed; width:100%; }
.tooltip .price-table th,
.tooltip .price-table td{ border: 1px solid #ffffff; text-align: center; padding: 2px 4px; }
.tooltip .price-table th{ border: 1px solid #ffffff; text-align: center; padding: 2px 4px; }

/* Price table subtext */
.tooltip .price-table .sub{ display:block; font-size:.55em; color: #ffffff; font-weight: 400; white-space: nowrap; }
/* Style strike-through clarity */
.tooltip s{ opacity: .8; }

/* Ensure only status and prices are bold by default */
.tooltip th{ font-weight: 400; }
.tooltip td{ font-weight: 400; }

/* Modal */
.modal{
  border: none;
  padding: 0;
  width: min(720px, 96vw);
  background: transparent;
}

.modal::backdrop{
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
}

.modal-card{
  background: #2a3844;
  color: #f2f6fb;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: var(--shadow);
  margin: 0;
}

.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: center;
}
.modal-header h2{ margin:0; font-size: 1.1rem; }

.btn-close{
  border: none; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer;
}

.modal-body{ padding: 14px; color: var(--muted); line-height: 1.4; text-align: center; }
.modal-footer{ display:flex; gap:10px; justify-content:center; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.06); }

.btn{
  background: #26303a; color: var(--text); border: 1px solid rgba(255,255,255,0.12);
  padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600;
}
.btn:hover{ filter: brightness(1.05); }
.btn-primary{ background: var(--primary); border-color: rgba(255,255,255,0.18); }

/* Payment options in modal */
.pay-grid{ display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 8px; align-items: stretch; }
.pay-card{ border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; padding: 10px; text-align:center; background: #26303a; color: var(--text); cursor: pointer; }
.pay-card input[type="radio"]{ margin-bottom: 6px; }
.pay-card .title{ font-weight: 600; }
.pay-card .sub{ display:block; font-size:.8em; color: #ffffff; opacity:.9; }
.pay-price div{ margin: 2px 0; }
.pay-price s{ opacity: .8; }
.pay-card.selected{ background: #335043; border-color: rgba(255,255,255,0.3); }
.pay-prompt{ color: var(--text); margin: 8px 0 4px; }

/* Embedded slideshow in SVG */
.svg-slideshow-image{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}

/* Slideshow container - simple passthrough layer */
#slideshow-container{
  pointer-events: none;
}

/* FAQ modal basics */
.faq-item{ border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; margin: 8px 0; overflow: hidden; }
.faq-question{ display:flex; justify-content:space-between; align-items:center; padding: 10px 12px; cursor: pointer; background:#324353; color: #f2f6fb; }
.faq-answer{ display:none; padding: 10px 12px; background:#2b3946; color: #d7e2ee; }
.faq-item.open .faq-question{ background:#2b3641; }
.faq-item .highlight{ color: var(--text); font-weight: 600; }
.timeline, .example{ background:rgba(255,255,255,0.06); padding: 8px 10px; border-radius:8px; margin-top:6px; }
