:root {
  /* Design system de Terres (kit de terres.com.ar): naranja #EC7C23, marrón #40180A, texto #763318, cremas */
  --bg: #FDEFD8; --fg: #40180A; --texto: #763318; --card: #FEF8EE; --primary: #EC7C23; --primary-fg: #FFFFFF;
  --border: #F6C489; --muted: #9C5031; --accent: #FADDB7; --danger: #BA1A1A; --secondary: #B84A16;
  --serif: "IBM Plex Serif", Georgia, serif; --sans: "IBM Plex Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-weight: 400; color: var(--texto); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

.panel { position: fixed; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(10px);
  border: 1.5px solid color-mix(in srgb, var(--border) 55%, transparent); border-radius: 18px;
  box-shadow: 0 6px 24px rgba(64, 24, 10, .14); }

#buscar { top: max(16px, env(safe-area-inset-top)); left: 16px; padding: 12px 14px 14px; width: min(340px, calc(100vw - 32px)); }
.marca { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.marca b { font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--texto); }
.logo { font-family: var(--sans); font-weight: 700; font-size: 21px; letter-spacing: -.01em; color: var(--primary); line-height: 1; }
#buscar label { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); }
.fila { display: flex; gap: 8px; margin-top: 4px; }
input[type=text], #smp { width: 100%; min-width: 0; padding: 9px 12px; font: 600 15px var(--sans);
  color: var(--fg); background: #fff; border: 1.5px solid var(--border); border-radius: 12px; }
#smp:focus { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); }
button { font: 600 14px var(--sans); cursor: pointer; }
#buscar button { padding: 0 18px; border: 0; border-radius: 12px; background: var(--primary); color: var(--primary-fg); }
#buscar button:hover { filter: brightness(1.06); }
#ficha { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accent); }
.chip b { font-weight: 700; }

#controles { left: 50%; transform: translateX(-50%); bottom: calc(max(16px, env(safe-area-inset-bottom)) + 26px); padding: 8px; display: flex; gap: 6px;
  align-items: center; border-radius: 999px; max-width: calc(100vw - 24px); overflow-x: auto; }
#controles button { display: flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; border: 1.5px solid transparent;
  background: transparent; color: var(--muted); white-space: nowrap; transition: all .15s; }
#controles button span { font-size: 17px; filter: grayscale(1); opacity: .6; }
#controles button.activa, #controles button[aria-pressed=true] { background: var(--accent); color: var(--fg); border-color: color-mix(in srgb, var(--border) 60%, transparent); }
#controles button.activa span, #controles button[aria-pressed=true] span { filter: none; opacity: 1; }
#xray[aria-pressed=true] { background: var(--primary); color: var(--primary-fg); }
#horapanel { right: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 26px); padding: 8px 10px 6px; width: 284px; user-select: none; }
.hora-cab { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.hora-cab b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hora-cab span { font-size: 12px; font-weight: 600; color: var(--muted); }
#sol { display: block; width: 100%; height: auto; border-radius: 10px; touch-action: none; cursor: pointer; outline: none; }
#sol:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); }
#sol text { font: 600 9px var(--sans); }
/* la barra de capas mide ~900 px: con menos de ~1540 px los paneles de los costados quedarían encima */
@media (max-width: 1540px) { #horapanel { bottom: 110px; } }
@media (max-width: 1100px) {
  /* sin lugar para texto: sólo los íconos (el texto sigue en el botón para los lectores de pantalla) */
  #controles button { font-size: 0; gap: 0; padding: 8px 11px; } #controles button span { font-size: 19px; } }
@media (max-width: 520px) { #horapanel { width: 220px; } }

html { overflow-x: hidden; }
html.embedded, html.embedded body { height: 100dvh; overflow: hidden; }
html.embedded #espacio, html.embedded .seo-content, html.embedded #insertar, html.embedded .mas, html.embedded .nota-sep { display: none; }
#espacio { height: 100dvh; pointer-events: none; }
#nota { left: 0; right: 0; bottom: 0; margin: 0; padding: 4px 12px; border-radius: 0; border-width: 1px 0 0; text-align: center; font-size: 11px; line-height: 1.4; color: var(--muted); }
#nota a { color: var(--muted); } #nota a.terres { font-weight: 600; color: var(--primary); text-decoration: none; } #nota .nota-sep { margin: 0 6px; }
#insertar { display: inline-block; position: relative; margin-left: 10px; }
#insertar summary { cursor: pointer; font-weight: 600; color: var(--fg); }
#insertar .snippet { position: absolute; right: 0; bottom: 26px; width: min(420px, 90vw); padding: 10px 12px; text-align: left; background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; box-shadow: 0 6px 24px rgba(64,24,10,.2); }
#insertar .snippet p { margin: 0 0 6px; } #insertar textarea { width: 100%; font: 11px/1.4 ui-monospace, monospace; color: var(--fg); background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; resize: none; }
/* contenido editorial (se lee sin JS; en un iframe se oculta) */
.seo-content { position: relative; z-index: 6; background: var(--bg); color: var(--texto); padding: 48px 16px 64px; }
.seo-in { max-width: 760px; margin: 0 auto; line-height: 1.6; font-size: 16px; }
.seo-in h1 { font-family: var(--serif); font-size: clamp(26px, 4vw, 36px); line-height: 1.2; color: var(--fg); margin: 0 0 16px; }
.seo-in h2 { font-family: var(--serif); font-size: 22px; color: var(--fg); margin: 32px 0 8px; } .seo-in h3 { font-size: 16px; color: var(--fg); margin: 20px 0 4px; }
.seo-in p { margin: 0 0 12px; } .seo-in a { color: var(--secondary); }
.seo-in .lede { font-size: 18px; }
.key-stats { list-style: none; margin: 24px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.key-stats li { background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 12px; } .key-stats b { display: block; font: 700 26px var(--serif); color: var(--primary); } .key-stats span { font-size: 13px; color: var(--muted); }
.seo-in .volver { margin-top: 32px; font-size: 14px; }
#verParcela { position: fixed; left: 50%; top: 120px; transform: translateX(-50%); z-index: 5; padding: 10px 18px; border: 0; border-radius: 999px; background: var(--primary); color: var(--primary-fg); font: 600 14px var(--sans, inherit); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
#verParcela[hidden] { display: none; }
#acerca { margin-top: 10px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
#acerca summary { cursor: pointer; font-weight: 600; color: var(--fg); }
#acerca p { margin: 6px 0 0; }
#acerca .rojo { color: #B3261E; }
#acerca a.terres { display: inline-block; margin-top: 6px; font-weight: 600; color: var(--primary); text-decoration: none; }
#acerca a.terres:hover { text-decoration: underline; }

.velo { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: linear-gradient(160deg, var(--bg), var(--card)); z-index: 10;
  transition: opacity .5s; }
.velo.fuera { opacity: 0; pointer-events: none; }
.velo p { margin: 0; font-family: var(--serif); font-weight: 600; color: var(--texto); }
.velo .logo { font-size: 34px; text-decoration: none; margin-bottom: 22px; }
.velo .velo-texto { max-width: 340px; padding: 0 20px; text-align: center; font-family: var(--sans); font-weight: 400; font-size: 14px; line-height: 1.5; color: var(--muted); }
.velo .velo-texto b { font-weight: 600; color: var(--texto); }
.cubos { display: flex; gap: 8px; }
.cubos i { width: 20px; height: 20px; border-radius: 6px; background: var(--primary); animation: salto .9s ease-in-out infinite; }
.cubos i:nth-child(2) { animation-delay: .15s; background: var(--border); }
.cubos i:nth-child(3) { animation-delay: .3s; background: var(--secondary); }
@keyframes salto { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-22px) scale(.92, 1.1); } 70% { transform: translateY(0) scale(1.15, .85); } }
.toast { position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 20; padding: 10px 16px; border-radius: 14px;
  background: var(--danger); color: #FFEDEA; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }

#creditos { position: fixed; left: 16px; bottom: max(76px, env(safe-area-inset-bottom)); margin: 0; font-size: 10.5px; color: var(--fg); opacity: .75;
  background: color-mix(in srgb, var(--card) 80%, transparent); padding: 3px 8px; border-radius: 8px; }
@media (min-width: 1101px) { #creditos { bottom: 16px; } }

.chip.alerta { background: #FFD9D4; color: #8A1208; }
#nota .rojo { color: #B3261E; }

#crecimiento { left: 16px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 26px); width: min(300px, calc(100vw - 32px)); padding: 10px 12px 10px; }
.crec-cab { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.crec-cab b { font-family: var(--serif); font-weight: 600; color: var(--texto); }
.crec-cab button { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--accent); color: var(--fg); font-size: 12px; }
.crec-cab button.activo { background: var(--primary); color: var(--primary-fg); }
.crec-fila { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.crec-fila input { flex: 1; accent-color: #2BA79E; }
.crec-fila output { min-width: 40px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
#crecTxt { margin: 2px 0 0; font-size: 12.5px; font-weight: 600; }
.crec-nota { margin: 4px 0 0; font-size: 10.5px; line-height: 1.35; color: var(--muted); }
#creditos { left: 50% !important; transform: translateX(-50%); top: 10px; bottom: auto !important; }
@media (max-width: 1540px) { #crecimiento { bottom: 110px; } }

.campo { position: relative; flex: 1; min-width: 0; }
#ac-list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; max-height: 260px; overflow-y: auto;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(56, 0, 0, .2); }
#ac-list li { padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
#ac-list li[aria-selected=true], #ac-list li:hover { background: var(--accent); }
#ac-list li.buscando { color: var(--muted); cursor: default; }
#ac-list li.buscando:hover { background: transparent; }
#ac-msg { margin: 6px 2px 0; font-size: 12px; font-weight: 600; color: var(--danger); }
#ac-msg.info { color: var(--muted); }

.chip.crece { background: #FFF1B8; color: #5C4300; }
.chip.sin { background: var(--muted-chip, #EFE9E2); color: var(--muted); }

a.logo { text-decoration: none; transition: filter .15s, transform .15s; }
a.logo:hover { filter: brightness(1.08); transform: translateY(-1px); }
#nota a.terres:hover { text-decoration: underline; }

/* --- Controles de la vista con clics (escritorio): zoom, giro, inclinación y vista inicial --- */
#vista { right: 16px; top: 50%; transform: translateY(-50%); padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#vista button { display: grid; place-items: center; grid-auto-flow: column; gap: 6px; width: 38px; height: 38px; padding: 0; border-radius: 12px;
  border: 1.5px solid var(--border); background: var(--accent); color: var(--fg); touch-action: none; user-select: none; }
#vista button:hover { background: var(--card); }
#vista button:active, #vista button.mantenido { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
#vista button.ancho { grid-column: 1 / -1; width: auto; padding: 0 10px; font-size: 12px; }
#vista svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* --- Versión mínima para el celular: buscador + 📍, el deslizador de crecimiento y la marca abajo. Sin capas, ficha ni hora. --- */
#ubicar { display: none; }
.nota-credito { display: none; }
@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
  #controles, #ficha, #acerca, #horapanel, #vista, #creditos, .crec-nota, .nota-larga { display: none !important; }
  #buscar #ubicar { display: grid; width: 44px; flex: none; padding: 0; border: 1.5px solid var(--border); border-radius: 12px; background: var(--accent); color: var(--fg); display: grid; place-items: center; }
  #buscar #ubicar:disabled { opacity: .5; }
  #buscar { left: 10px; right: 10px; width: auto; padding: 10px 12px 12px; }
  #buscar label { display: none; }
  .marca { margin-bottom: 6px; }
  #buscar button[type=submit] { padding: 0 16px; }
  #crecimiento { left: 10px; right: 10px; width: auto; bottom: calc(62px + env(safe-area-inset-bottom)); }
  #nota { display: block; left: 0; right: 0; top: auto; bottom: 0; max-width: none; padding: 6px 12px max(8px, env(safe-area-inset-bottom));
    border-radius: 0; text-align: center; font-size: 11px; line-height: 1.3; backdrop-filter: blur(10px); }
  #nota .nota-credito { display: inline; margin-right: 8px; }
  #nota a.terres { display: inline; margin: 0; }
}
