:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #102116;
  background: #cde6ff;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; touch-action: none; }
#application { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: fixed; inset: 0; pointer-events: none; }
.glass { background: rgba(255,255,255,.84); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.72); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; padding: 8px 12px; border-radius: 16px; font-size: 14px; white-space: nowrap; }
.mission { position: absolute; top: 58px; left: 12px; width: min(350px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 14px; display: grid; gap: 3px; font-size: 13px; }
.context-panel { position: absolute; right: 12px; top: 58px; width: min(320px, calc(100vw - 24px)); padding: 10px 12px; border-radius: 14px; font-size: 13px; }
.context-panel strong { display:block; margin-bottom:5px; }
.hidden { display: none !important; }
.round-button, .action-button { pointer-events: auto; border: 0; box-shadow: 0 5px 15px rgba(0,0,0,.22); cursor: pointer; }
.round-button { position: absolute; right: 14px; bottom: 92px; width: 54px; height: 54px; border-radius: 50%; background: #fff; font-size: 25px; }
.action-button { position: absolute; right: 14px; bottom: 20px; min-width: 110px; height: 58px; border-radius: 18px; background: #2f7d3c; color: #fff; font-weight: 800; font-size: 17px; padding: 0 18px; }
.seed-tray { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display:flex; gap:8px; padding:8px; border-radius:16px; max-width: calc(100vw - 190px); overflow-x:auto; pointer-events:auto; }
.seed-button { border:2px solid transparent; background:#fff; border-radius:12px; padding:7px 10px; min-width:84px; font-size:12px; cursor:pointer; }
.seed-button.selected { border-color:#2f7d3c; background:#effbea; }
.seed-button small { display:block; opacity:.72; margin-top:2px; }
.toast { position:fixed; left:50%; top:125px; transform:translateX(-50%); background:rgba(20,35,20,.9); color:#fff; padding:10px 14px; border-radius:12px; z-index:20; pointer-events:none; }
.mobile-controls { position: fixed; inset:0; pointer-events:none; }
.joystick-base { pointer-events:auto; position:absolute; left:18px; bottom:18px; width:122px; height:122px; border-radius:50%; background:rgba(255,255,255,.25); border:2px solid rgba(255,255,255,.5); }
.joystick-knob { position:absolute; left:36px; top:36px; width:50px; height:50px; border-radius:50%; background:rgba(255,255,255,.78); box-shadow:0 4px 10px rgba(0,0,0,.18); }
.look-hint { position:absolute; right:10px; bottom:160px; color:rgba(255,255,255,.8); text-shadow:0 1px 3px #000; font-size:12px; text-align:center; display:none; }
@media (hover:hover) and (pointer:fine) { .joystick-base { opacity:.32; } }
@media (max-width:700px) {
  .topbar { left:10px; right:10px; transform:none; width:auto; overflow-x:auto; justify-content:flex-start; }
  .mission { top:60px; }
  .context-panel { top:130px; }
  .seed-tray { left:150px; right:136px; transform:none; max-width:none; }
}

.inventory-panel { position:fixed; z-index:30; left:50%; top:50%; transform:translate(-50%,-50%); width:min(520px,calc(100vw - 28px)); max-height:76vh; overflow:auto; border-radius:18px; padding:14px; pointer-events:auto; }
.inventory-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.inventory-head button { border:0; border-radius:50%; width:34px; height:34px; background:#fff; cursor:pointer; }
.inventory-row { display:grid; grid-template-columns:34px 1fr auto; gap:8px; align-items:center; padding:8px 4px; border-bottom:1px solid rgba(0,0,0,.08); }
.inventory-row small { display:block; opacity:.72; }

.mission-complete { width:min(440px,calc(100vw - 32px)); max-height:85vh; overflow:auto; border-radius:20px; padding:24px; color:#102116; }
.mission-complete::backdrop { background:rgba(12,28,18,.55); }
.mission-complete h2 { margin:0 0 14px; font-size:23px; }
.mission-complete p { line-height:1.5; }
.mission-continue { width:100%; min-height:48px; border:0; border-radius:12px; background:#2f7d3c; color:#fff; font-size:17px; font-weight:700; cursor:pointer; }
.mission-continue:focus-visible { outline:3px solid #bc861c; outline-offset:3px; }
#weatherEffects { position:fixed; inset:0; width:100%; height:100%; pointer-events:none; z-index:1; }
.hud,.seed-tray { z-index:2; }
.mobile-controls { z-index:3; }
.expansion-button { position:absolute; right:14px; bottom:156px; padding:10px 14px; min-height:44px; border:0; border-radius:14px; background:#fff6d9; color:#28472f; font-weight:700; cursor:pointer; pointer-events:auto; }
.dialog-close { width:100%; background:transparent; border:1px solid #6a806c; padding:12px; border-radius:12px; margin-top:12px; cursor:pointer; color:inherit; }
.mission-continue:disabled { background:#6c776e; cursor:default; }
.context-panel meter { display:block; width:100%; height:18px; margin:6px 0; }
@media(max-width:700px){
  .topbar { display:grid; grid-template-columns:1fr 1fr; gap:4px 12px; font-size:12px; }
  .mission { top:80px; }
  .context-panel { top:170px; }
  .action-button { max-width:124px; font-size:15px; }
}

/* La interfaz se organiza dentro del área real del navegador, también al redimensionar Edge. */
html,body { position:fixed; inset:0; width:100%; height:100%; overflow:hidden; overscroll-behavior:none; }
#gameViewport { position:fixed; inset:0; width:100%; height:100%; height:100dvh; overflow:hidden; isolation:isolate; }
#gameViewport:fullscreen { width:100%; height:100%; }
#application { position:absolute; inset:0; margin:0!important; padding:0; }
#weatherEffects,.mobile-controls { position:absolute; }
.hud { position:absolute; inset:10px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); gap:10px; align-content:start; padding-bottom:150px; }
.topbar { position:static; grid-column:1/-1; justify-self:center; transform:none; width:auto; max-width:calc(100% - 96px); display:flex; flex-wrap:wrap; justify-content:center; gap:6px 14px; overflow:visible; }
.mission,.context-panel { position:static; top:auto; left:auto; right:auto; width:100%; max-width:350px; min-width:0; align-self:start; max-height:100%; overflow:auto; overflow-wrap:anywhere; }
.mission { grid-column:1; grid-row:2; }
.context-panel { grid-column:2; grid-row:2; justify-self:end; pointer-events:auto; touch-action:pan-y; }
.fullscreen-button { position:absolute; top:0; right:0; width:40px; height:40px; border:0; border-radius:12px; font-size:27px; background:#fff; color:#315b3a; cursor:pointer; pointer-events:auto; }
.seed-tray { position:absolute; left:154px; right:152px; bottom:18px; width:auto; max-width:620px; margin:0 auto; transform:none; scrollbar-width:none; touch-action:pan-x; }
.seed-tray::-webkit-scrollbar { display:none; }
.seed-button { flex:0 0 84px; }
.inventory-panel,.toast { position:absolute; }
.action-button { right:4px; bottom:10px; max-width:140px; }
.round-button { right:4px; bottom:82px; }
.expansion-button { right:4px; bottom:146px; }
.mission-complete { max-height:calc(100dvh - 24px); }
@media(max-width:700px){
  .hud { inset:8px; gap:8px; }
  .topbar { max-width:calc(100% - 48px); justify-self:start; width:calc(100% - 48px); gap:4px 10px; font-size:12px; padding:7px 8px; }
  .mission,.context-panel { font-size:12px; padding:8px; }
  .seed-tray { left:130px; right:140px; padding:6px; }
  .joystick-base { width:104px; height:104px; left:12px; bottom:18px; }
  .joystick-knob { left:27px; top:27px; }
}
@media(max-width:520px) and (min-height:560px){
  .hud { grid-template-rows:auto auto minmax(0,1fr); padding-bottom:238px; }
  .topbar { display:grid; grid-template-columns:1.3fr 1fr; }
  .mission { grid-column:1/-1; grid-row:2; max-width:none; }
  .context-panel { grid-column:1/-1; grid-row:3; max-width:none; }
  .seed-tray { left:10px; right:10px; bottom:142px; max-width:none; }
  .expansion-button { bottom:84px; right:68px; font-size:12px; padding:8px; }
  .round-button { bottom:82px; }
}
@media(max-height:550px){
  .hud { padding-bottom:100px; gap:6px; }
  .topbar { font-size:11px; padding:5px 8px; gap:4px 10px; }
  .mission,.context-panel { font-size:11px; padding:7px; max-width:320px; }
  .seed-tray { left:112px; right:126px; bottom:12px; gap:5px; padding:5px; }
  .seed-button { flex-basis:80px; min-width:80px; padding:5px; font-size:11px; }
  .joystick-base { width:88px; height:88px; left:12px; bottom:12px; }
  .joystick-knob { left:23px; top:23px; width:38px; height:38px; }
  .action-button { bottom:4px; min-width:106px; max-width:116px; height:46px; font-size:13px; padding:0 10px; }
  .round-button { bottom:58px; width:42px; height:42px; font-size:21px; }
  .expansion-button { bottom:108px; min-height:36px; font-size:11px; padding:6px 9px; }
  .fullscreen-button { width:30px; height:30px; font-size:23px; }
}

/* Gestión en un diálogo: evita añadir paneles flotantes sobre el mundo. */
.farm-menu { width:min(640px,calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; padding:18px; border:0; border-radius:18px; color:#102116; }
.farm-menu::backdrop { background:rgba(12,28,18,.65); }
.farm-menu header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.farm-menu h2,.farm-menu h3 { margin:6px 0 10px; }
.farm-menu nav,.farm-actions { display:flex; flex-wrap:wrap; gap:8px; }
.farm-menu button,.learn-link { border:1px solid #6a806c; border-radius:10px; background:#f1f8eb; color:#16391c; padding:10px 12px; min-height:42px; cursor:pointer; font:inherit; }
.farm-menu button[aria-pressed="true"] { background:#296f39; color:white; }
.farm-menu button:disabled,.action-button:disabled,.seed-button:disabled { opacity:.55; cursor:default; }
.farm-card { padding:12px 0; border-bottom:1px solid #bdcdb9; }
#farmFeedback:not(:empty) { background:#e6f3dc; padding:12px; border-radius:10px; border:1px solid #527944; }
#farmMission { margin-top:20px; padding:12px; border-radius:12px; background:#e8efd9; }
.learn-link { min-height:28px; padding:3px 8px; font-size:11px; justify-self:start; pointer-events:auto; }
@media(max-width:520px){.farm-menu {padding:12px;font-size:14px;} .farm-menu button {padding:9px;}}

.farm-menu header { position:sticky; top:-18px; background:#e2e8df; z-index:2; padding:6px 0; }
@media(max-width:520px){.farm-menu header {top:-12px;}}

.valley-map {position:relative;height:300px;background:linear-gradient(90deg,transparent 73%,#c1a06d 73%,#c1a06d 75%,transparent 75%),linear-gradient(#739b57,#abc680);border-radius:12px;border:2px solid #547a41;overflow:hidden;}
.map-pin {position:absolute;transform:translate(-50%,-50%);padding:2px!important;min-height:24px!important;width:24px;font-size:15px!important;}
.map-player {position:absolute;transform:translate(-50%,-50%);color:#b22e22;font-size:20px;pointer-events:none;}
.topbar {max-width:calc(100% - 55px);}
#weatherLabel {max-width:360px;overflow-wrap:anywhere;}

/* Selector lateral: todas las semillas en una ventana, sin carrusel horizontal. */
.crop-selector {position:absolute;left:12px;bottom:154px;z-index:4;width:132px;min-height:54px;padding:8px;border-radius:14px;color:#16391c;font:inherit;font-weight:700;cursor:pointer;touch-action:manipulation;}
.crop-selector small {display:block;margin-top:3px;font-size:12px;font-weight:400;}
.crop-dialog {touch-action:pan-y;overscroll-behavior:contain;}
.crop-dialog .seed-tray {position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-width:none;width:100%;margin:0;padding:0;transform:none;overflow:visible;touch-action:pan-y;}
.crop-dialog .seed-button {min-width:0;min-height:74px;white-space:normal;overflow-wrap:anywhere;font-size:15px;}
.crop-dialog .seed-button small {font-size:12px;opacity:1;}
@media(min-width:600px){.crop-dialog .seed-tray {grid-template-columns:repeat(3,minmax(0,1fr));}}
@media(max-height:550px){.crop-selector {bottom:110px;min-height:48px;width:124px;font-size:14px;}}

.season-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));gap:8px} #seasonButton{display:block;margin-top:5px} .farm-card{overflow-wrap:anywhere}
