:root{
  --centerW: 300px;
  --mainH: 300px;
  --sideW: 200px;
  --sideH: 300px;
  --statusH: 80px;

  /* фактический размер игрового окна (обновляется ResizeObserver-ом) */
  --gameW: 300px;
  --gameH: 300px;

  --bg: #070a0f;
  --text: #d7e0ee;
  --muted: #7b828c;
  --accent: #7dd3fc;
  --danger: #fb7185;
  --ok: #34d399;
  --info: #60a5fa;
  --warn: #fbbf24;
  --border: #1f2a3a;
  --cellSize: 4px; /* размер одной клетки в пикселях */
}


html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "fixedsys-excelsior", monospace;
  display: grid;
  place-items: center;
  overscroll-behavior: none; 
  touch-action: none; /* Отключает встроенный зум и скролл браузера */
}

.toast.bad{
  color: var(--danger);
}

/* Универсальная анимация появления карточек */
.modalAnim{
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}

.overlay.show .modalAnim{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Две колонки: слева центр (заголовок + игра), справа инфо-панель */
#wrap.wrap2{
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px;
  align-items: start;
  justify-content: center;
}


/* legacy panels removed in new UI */

#centerCol{
  display: grid;
  grid-template-rows: auto auto; /* title + mainPanel */
  gap: 5px;
}

.mainTitle{
  height: 15px;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.72);
  user-select: none;
}

/* Левый верх внутри mainPanel: морковки/монетки/режим */
.invOverlay{
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  display: grid;
  gap: 6px;
  pointer-events: auto;
  text-align: left;
}

.invOverlay .pill{
  border: none;
  background: transparent;
  padding: 0;
  color: rgba(255,255,255,0.70);
}

.invOverlay .miniInput{
  width: 56px;
  border: none;
  background: transparent;
  padding: 0 2px;
  color: rgba(255,255,255,0.82);
  outline: none;
}
.invOverlay .miniInput:focus{
  outline: 1px solid rgba(125,211,252,0.35);
  border-radius: 6px;
}

#infoPanel{
  border: 3px solid var(--border);
  border-radius: 15px;
  background: rgba(0,0,0,.10);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr;
  /* выравниваем верх инфо-панели по верхней кромке mainPanel (ниже заголовка) */
  margin-top: 20px;
  height: var(--gameH);
  /* ширина — чтобы влезли все табы + ⚙ */
  width: 350px;
  max-width: 92vw;
  min-width: 250px;
  resize: none;
  min-height: 240px;
}

.tabs{
  display:flex;
  gap:2px;
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  /* если не влезает — можно прокрутить, вместо обрезания */
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

/* Settings button lives in the top-right corner of the info panel */
.tabs .iconBtn{
  margin-left: auto;
  align-self: center;
  flex: 0 0 auto;
}

.tabBtn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 6px;
  cursor:pointer;
  font-weight: 500;
  font-size: 16px;
}
.tabBtn.isActive{ border-color: rgba(120,220,150,0.55); box-shadow: 0 0 0 2px rgba(120,220,150,0.10) inset; }

.tabBody{ display:none; overflow:auto; }
.tabBody.isActive{ display:block; }

.huePicker{
  margin: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
.hueTitle{ font-weight:500; margin-bottom:6px; }

.orgInfo{
	padding: 10px;
	color: rgba(255,255,255,0.85);
	text-align: center;
	font-size: 13px;
	line-height: 1.35;
	min-width: 210px;
	overflow: auto;
	}

#statusPanel{
  width: 100%;          /* было var(--centerW) */
  height: var(--statusH);
}

#mainPanel{
  width: 800px;         /* стартовый размер */
  height: 600px;        /* стартовый размер */
  position: relative;

  resize: none;
  overflow: hidden;     /* важно: resize работает, если overflow не visible */
  min-width: 240px;
  min-height: 240px;
}

.lifeOverlay{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  font-size: 12px;
  pointer-events: none;
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}


.perfStats{
  display: grid;
  gap: 2px;
  font-size: 13px;
  color:  #cc632c;
}
.perfItem{
  line-height: 1.2;
}

.hdr{
  padding: 10px 10px 8px 10px;
  background: rgba(16, 24, 38, 0.72);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.hdr .t{
  font-weight: 500;
  font-size: 15px;
  letter-spacing: .4px;
  color: var(--accent);
}
.hdr .s{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.25;
}

.hud {
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  background: rgba(16, 24, 38, 0.40);
  user-select: none;
}
.hudLeft{
  display: grid;
  gap: 4px;
  min-width: 0;
 }

/* Status panel: keep only 2 rows (name row + stats row) */
.hudStatsRow{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.hudName{
  display:flex;
  gap:6px;
  align-items: baseline;
  justify-content: center; /* ← центрирует содержимое */
  width:100%;
  min-width: 0;
}
.hudName .nm{
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
}
.hudName .stage{
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.hudBars{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.pill {
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(0,0,0,.15);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: rgba(52, 211, 153, .35); }
.pill.info { color: var(--info); border-color: rgba(96, 165, 250, .35); }
.pill.warn { color: var(--warn); border-color: rgba(251, 191, 36, .35); }
.pill.bad { color: var(--danger); border-color: rgba(251, 113, 133, .35); }


/* Stat pills with icons (no labels) */
.pill.stat{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between; /* иконка слева, число справа */
  gap: 6px;
  width: 58px;        /* ← фиксированная ширина */
  box-sizing: border-box;
}
.pill.stat .ico{
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  font-size: 18px;
  line-height: 1;
}
.pill.stat .val{
  font-variant-numeric: tabular-nums;
}
.pill.stat[data-stat="food"] .ico{ background-image: var(--ico-carrot); }
.pill.stat[data-stat="clean"] .ico{ background-image: var(--ico-drop); }
.pill.stat[data-stat="hp"] .ico{ background-image: var(--ico-cross); }
/* mood/state use emoji inside .ico, no background-image */

.miniInput{
  width: 64px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 2px 6px;
  font: inherit;
}

.hudRight{
  display: grid;
  justify-items: end;
  gap: 6px;
}
.seedPill{
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iconBtn{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid #24344a;
  background: linear-gradient(180deg, #121c2c, #0b1320);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.iconBtn:hover{ border-color: #345073; }
.iconBtn:active{ transform: translateY(1px); }

.viewportFull{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2px;
  box-sizing: border-box;
}
.gridWrap{
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}

.grid{
  width: 100%;
  height: 100%;
  position: relative;
  display: block;

  user-select: none;
  border: 3px solid rgb(31,42,58);
  border-radius: 15px;
  background: rgba(0,0,0,.16);
  overflow: hidden;
  cursor: grab;
}

.grid.dragging{ cursor: grabbing; }

.cell{
  width: var(--cellSize);
  height: var(--cellSize);
  display: grid;
  place-items: center;
  font-size: calc(var(--cellSize) - 0px);
  line-height: 1;
}


.controlsOverlay{
  position: absolute;
  left: 3px;
  right: 10px;
  bottom: 10px;
  display: grid;
  border: none;
  border-radius: 0;
  background: transparent; /* убрать подложку */
  backdrop-filter: none;
  pointer-events: none; /* не блокировать клики по полю */
}

.actions {
  display: flex;
  justify-content: center; /* по центру строки */
  transform: translateY(-12px); /* поднимает кнопки вверх */
  gap: 5px;
  pointer-events: auto; /* кнопки кликабельны при pointer-events:none у контейнера */
}
.smallbtn{
  padding: 4px 6px;
  border-radius: 10px;
  border: 1px solid rgba(36,52,74,.9);
  background: transparent; /* убрать подложку у кнопок */
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  min-width: 75px;
}
.smallbtn:hover{ border-color: #345073; }
.smallbtn:active{ transform: translateY(1px); }
.smallbtn:disabled{
  opacity: 0.45;
  cursor: not-allowed;
  border-color: rgba(36,52,74,.5);
}

#saveSettings,
#symConfirmYes{
  border-color: rgba(52, 211, 153, .9);        /* var(--ok) */
  background: rgba(52, 211, 153, .10);
  color: var(--text);
}
#saveSettings:hover,
#symConfirmYes:hover{
  border-color: rgba(52, 211, 153, 1);
  background: rgba(52, 211, 153, .16);
}
#saveSettings:active,
#symConfirmYes:active{
  transform: translateY(1px);
  background: rgba(52, 211, 153, .22);
}

/* Red "cancel"/"no" */
#closeSettings,
#symConfirmNo{
  border-color: rgba(251, 113, 133, .9);       /* var(--danger) */
  background: rgba(251, 113, 133, .08);
  color: var(--text);
}
#closeSettings:hover,
#symConfirmNo:hover{
  border-color: rgba(251, 113, 133, 1);
  background: rgba(251, 113, 133, .14);
}
#closeSettings:active,
#symConfirmNo:active{
  transform: translateY(1px);
  background: rgba(251, 113, 133, .20);
}

/* Action buttons: icons + colored borders */
.actBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1;
}
.actBtn .actIco{
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.35));
}
.actBtn .actLbl{ display:inline-block; }

.actFeed{ border-color: rgba(251,146,60,.9); }
.actCoin{ border-color: rgba(234,179,8,.9); }
.actWash{ border-color: rgba(34,211,238,.85); }
.actHeal{ border-color: rgba(239,68,68,.9); }

.actFeed:hover{ border-color: rgba(251,146,60,1); }
.actCoin:hover{ border-color: rgba(234,179,8,1); }
.actWash:hover{ border-color: rgba(34,211,238,1); }
.actHeal:hover{ border-color: rgba(239,68,68,1); }

/* Active/pressed background (15% of border color). Also supports JS active state via .isActive */
.smallbtn.actFeed:active,
.smallbtn.actFeed.isActive{ background: rgba(251,146,60,.15); }

.smallbtn.actCoin:active,
.smallbtn.actCoin.isActive{ background: rgba(234,179,8,.15); }

.smallbtn.actWash:active,
.smallbtn.actWash.isActive{ background: rgba(34,211,238,.15); }

.smallbtn.actHeal:active,
.smallbtn.actHeal.isActive{ background: rgba(239,68,68,.15); }


/* Icons as tiny inline SVGs */
.actFeed .actIco{ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M5 2c.9 1.2 2.2 1.6 3.6 1.5C7.7 4.4 6.8 5.1 6.2 5.8c-1.6 1.8-2.3 3.7-1.7 4.7.7 1.1 2.8.8 4.7-.8 1.9-1.6 3-3.9 2.4-5.2-.4-1-1.5-1.6-2.9-1.6.2-.6.3-1.1.2-1.8-.9.7-1.9.9-3.1.9C5.5 1.8 5.2 1.9 5 2z' fill='%23f59e0b'/%3E%3Cpath d='M4.2 1.8c.7 1 1.6 1.6 2.8 1.8-.9.5-1.7.9-2.4 1.6-.2-.9-.3-2.2-.4-3.4z' fill='%2322c55e'/%3E%3C/svg%3E"); }
.actCoin .actIco{ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='5.5' fill='%23fbbf24' stroke='%23a16207' stroke-width='1'/%3E%3Ccircle cx='7' cy='7' r='3.3' fill='none' stroke='%23fde68a' stroke-width='1'/%3E%3C/svg%3E"); }
.actWash .actIco{ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M7 1.5c2.3 3.1 4.2 5.3 4.2 7.3A4.2 4.2 0 1 1 2.8 8.8C2.8 6.8 4.7 4.6 7 1.5z' fill='%2322d3ee' stroke='%230ea5b7' stroke-width='1'/%3E%3C/svg%3E"); }
.actHeal .actIco{ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Crect x='5.6' y='2.2' width='2.8' height='9.6' rx='0.6' fill='%23ef4444'/%3E%3Crect x='2.2' y='5.6' width='9.6' height='2.8' rx='0.6' fill='%23ef4444'/%3E%3C/svg%3E"); }

/* Legacy: keep generic active state, but don't force "feed" colors for every button */
.smallbtn.isActive{ box-shadow: 0 0 0 2px rgba(255,255,255,0.10) inset; }

.smallbtn.actFeed.isActive{ border-color: rgba(251,146,60,0.7); box-shadow: 0 0 0 2px rgba(251,146,60,0.15) inset; }
.smallbtn.actCoin.isActive{ border-color: rgba(234,179,8,0.7); box-shadow: 0 0 0 2px rgba(234,179,8,0.15) inset; }
.smallbtn.actWash.isActive{ border-color: rgba(34,211,238,0.7); box-shadow: 0 0 0 2px rgba(34,211,238,0.15) inset; }
.smallbtn.actHeal.isActive{ border-color: rgba(239,68,68,0.7); box-shadow: 0 0 0 2px rgba(239,68,68,0.15) inset; }

.footerNote {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  user-select: none;
}


.rulesBody{
  overflow: auto;
  padding: 8px 10px 10px 10px;
  font-size: 14px;
  color: var(--muted);
}

.rulesBody b{ color: var(--text); }
.rulesBody .rule{ margin: 0 0 8px 0; }
.rulesBody .hint{ opacity: .9; }

/* Legend: 2 columns */
#legendBody{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
}

.legendBody{
  padding: 8px 10px;
  overflow: auto;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}
.legendItem{
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  align-items: start;
  padding: 4px;

}
.legendSwatch{
  width: 24px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31,42,58,.8);
  border-radius: 6px;
  background: rgba(0,0,0,.12);
  font-size: 15px;
}

.statBox {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 8px;
  min-height: 28px;
  color: #e5e7eb;
  display: flex;
  align-items: center;
}

.logBody{
  padding: 8px 10px;
  overflow: auto;
  font-size: 13px;
  color: var(--text);
  line-height: 1.35;
}
.logEntry{
  padding: 6px 0;
  border-bottom: 1px dashed rgba(31,42,58,.6);
}
.logEntry .when{
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 2px;
}

#startOverlay{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: radial-gradient(120% 120% at 50% 30%, rgba(14,20,32,.95) 0%, rgba(7,10,15,.92) 70%);
  z-index: 300;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none;
}

#startOverlay.show{
  opacity: 1;
  pointer-events: auto;
}

/* анимация карточки приветствия */
#startOverlay .startBox{
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}
#startOverlay.show .startBox{
  opacity: 1;
  transform: translateY(0) scale(1);
}

.startBox{
  width: 70%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16,24,38,.7);
  padding: 12px;
  box-sizing: border-box;
  text-align: center;
}
.startBox h1{
  margin: 0 0 6px 0;
  font-size: 23px;
  letter-spacing: .6px;
}
.startBox p{
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.35;
}
.btn {
  width: 50%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #24344a;
  background: linear-gradient(180deg, #142339, #0d1727);
  color: var(--text);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 1.2px;
  cursor: pointer;
  user-select: none;
}

.toast {
  position: absolute;
  left: 50%;
  right: auto;
  top: 10px;
  background: rgba(16, 24, 38, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  color: var(--text);
  text-align: center;
  width: fit-content;
  max-width: min(240px, 90vw);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.hide { opacity: 0; transform: translate(-50%, -10px); }
.toast b { color: var(--accent); }

/* generic overlay (used by offline report) */
.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(0,0,0,.45);
  z-index: 9999;

  opacity: 0;
  transition: opacity .18s ease;
}
.overlay.show{ opacity: 1; }

/* offline report ("Пока тебя не было") */
#offlineSummary .offlineCard{
	
  width: 250px; /* ~1.5x wider than previous */
  max-width: min(480px, 50vw);
  border: 1px solid #24344a;
  border-radius: 10px;
  background: rgba(16,24,38,.92);
  box-shadow: 0 14px 40px rgba(0,0,0,.60);
  padding: 16px 18px;
  box-sizing: border-box;
  color: rgba(255,255,255,0.88);

  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity .18s ease, transform .18s ease;
}
#offlineSummary.offlineOverlay.show .offlineCard{
  opacity: 1;
  transform: translateY(0) scale(1);
}

#offlineSummary .offlineHeader{
  margin-bottom: 12px;
  user-select: none;
}
#offlineSummary .offlineTitle{
  font-weight: 600;
  letter-spacing: 2px;
  font-size: 16px;
  text-align: center;
  color: var(--accent);
}
#offlineSummary .offlineSub{
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.25;
}

#offlineSummary .offlineBody{
  display: grid;
  gap: 8px;
}
#offlineSummary .offlineRow{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
}
#offlineSummary .offlineRow .label{
  font-size: 14px;
  color: var(--muted);
}
#offlineSummary .offlineRow .value{
  font-size: 14px;
  color: rgba(255,255,255,0.9);
}
#offlineSummary .offlineRow.good .value{
  color: var(--ok);
}
#offlineSummary .offlineRow.bad .value{
  color: var(--danger);
}
#offlineSummary .offlineRow.neutral .value{
  color: rgba(255,255,255,0.85);
}

#offlineSummary .offlineFooter{
  margin-top: 14px;
  display: flex;
  justify-content: center;
  font-family: inherit;
}

#settingsOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 14px;
  background: rgba(0,0,0,.45);
  z-index: 120;
}

#capsuleOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 14px;
  background: rgba(0,0,0,.45);
  z-index: 130;
}
#symbiosisOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 14px;
  background: rgba(0,0,0,.45);
  z-index: 125;
}
.modal{
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16,24,38,.92);
  padding: 12px;
  box-sizing: border-box;
}
#settingsOverlay .modal{
  /* narrowed by ~25% */
  max-width: 300px;
}
.symModal{
  max-width: 360px;
}
.modal h2{
  margin: 0 0 8px 0;
  font-size: 16px;
  text-align: center;
  letter-spacing: .4px;
  color: var(--accent);
}
.field{
  display: grid;
  gap: 6px;
  margin: 8px 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.field input{
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #24344a;
  background: #0b1320;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  outline: none;
}

/* Settings modal: compact numeric inputs, left aligned */
#settingsOverlay .modal input[type="number"]{
  width: 100px;
  padding: 6px 6px;
  justify-self: start;
}

/* Effects checkbox row: left aligned*/
.fxRow{
  display: flex;
  gap: 10px;
  user-select: none;
  white-space: nowrap;
  font-size: 14px;
  justify-content: flex-start;
}


.field input:focus{ border-color: #345073; }
.modalBtns{
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "new rules"
    "sym sym"
    "cancel apply";
  gap: 12px;
  margin-top: 16px;
}

#newCreature   { grid-area: new; }
#rulesBtn      { grid-area: rules; }
#symbiosisBtn  { grid-area: sym; }
#closeSettings { grid-area: cancel; }
#saveSettings  { grid-area: apply; }

.modalBtns .smallbtn{
  display: flex;
  align-items: center;
  justify-content: center;
}

.symTabs{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.symTabs .tabBtn{
  background: #0b1320;
  border: 1px solid #24344a;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 13px;
}
.symTabs .tabBtn.isActive{
  border-color: var(--accent);
  color: var(--text);
}
.symBody{
  display: block;
  gap: 8px;
}
.symBody .symRow{
  margin-bottom: 10px;
}
.symHint{
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}
.symTextArea{
  width: 100%;
  min-height: 68px;
  border-radius: 10px;
  border: 1px solid #24344a;
  background: #0b1320;
  color: var(--text);
  padding: 8px;
  font-size: 13px;
  box-sizing: border-box;
  resize: vertical;
}
.symTextAreaShare{
  min-height: 54px;
  font-size: 12px;
  color: var(--muted);
}
.symRow{
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}

/* Capsules (reuse symModal styles) */
.capsRow{
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  background: rgba(0,0,0,0.15);
}
.capsRowTop{
  display:flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.capsBtns{ display:flex; gap:6px; flex-wrap: wrap; }
.capsKey{ margin-top:8px; font-size:12px; }
.muted{ color: var(--muted); }
.symConfirm{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.6);
  border-radius: 12px;
}
.symConfirmCard{
  width: 100%;
  max-width: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(16,24,38,.98);
  padding: 12px;
  text-align: center;
}
.symConfirmTitle{
  font-weight: 400;
  margin-bottom: 6px;
  color: var(--accent);
}
.symConfirmText{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}
.symConfirmBtns{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.hint{
  font-size:13px;
  color: var(--muted);
  line-height:1.3;
  opacity: .8;
}
.logEntry.good .msg { color: #34d399; }     /* зелёный */
.logEntry.warn .msg { color: #fbbf24; opacity: .75; } /* бледно-оранжевый */
.logEntry.alert .msg { color: #ef4444; font-weight: 400; } /* красный */


/* Pixel renderer */
#canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  
  user-select: none;
}

#grid, #canvas{
  touch-action: none;
}
#grid{
  overscroll-behavior: none;
}

@media (max-width: 980px){
  html, body{
    display:block;
  }

  #wrap.wrap2{
    grid-template-columns: 1fr;
    padding: 10px;
  }

  #centerCol{ min-width: 0; }

  #mainPanel{
    width: 100%;
    height: min(445px, 56vh);
    resize: none;
  }

  #infoPanel{
    margin-top: 0;
    width: 100%;
    max-height: 40vh;
    height: auto;
    resize: none;
  }

  .tabBody{ overflow:auto; -webkit-overflow-scrolling: touch; }
  
/*  .lifeOverlay{
  position: absolute;
  top: 26px;
}
*/
}

.logEntry.bud .msg { color: #38bdf8; font-weight: 400; }
.logEntry.bud .when { color: #38bdf8; }
.modalBtns #symbiosisBtn{
  color: var(--muted);
  justify-self: center;
  width: 60%;
}
/* Organism list (info tab) */
.orgList{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:10px;
}
.orgCell{
  border:1px solid var(--border);
  border-radius:10px;
  padding:8px 8px;
  cursor:pointer;
  background: rgba(255,255,255,0.03);
  user-select:none;
}
.orgCell:hover{
  background: rgba(255,255,255,0.05);
}
.orgCell.isActive{
  outline:2px solid rgba(34,197,94,0.55);
  background: rgba(34,197,94,0.08);
}
.orgCellTop{
  display:flex;
  align-items:center;
  gap:10px;
}

/* имена существ — голубым */
.orgCellTop .orgCellName,
.orgCellTop .orgName,
.orgCellTop .nm,
.orgCellTop b{
  color: var(--accent);
}

.orgMetaInline{
  margin-left:auto;
  font-size:13px;
  color:var(--muted);
  font-weight:400;
}

.orgCellStage{
  font-weight:500;
  font-size:13px;
  opacity:0.7;
}
.orgCellMeta{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:6px;
  font-size:13px;
  color: var(--muted);
  flex-wrap:wrap;
}
.orgBars{
  display:flex;
  gap:10px;
  margin-top:6px;
}

/* organism list: show the same pill style as the top HUD */
.orgCellPills{
  display:flex;
  gap:6px;
  width: 58px;          /* фиксированная общая ширина */
  margin:0;             /* убираем третью строку */
}

.orgBar{
  flex: 1 1 0;           /* делят ширину поровну */
  height:6px;
}
.orgBarFill{
  height:100%;
  width:0%;
}
.orgDetails{
  border-top:1px solid var(--border);
  padding-top:10px;
}

.invItem{
  display:inline-flex;
  align-items:center;
  border:1px solid var(--border);
  border-radius:10px;
  gap:0px;
  margin-right:10px;
  color: rgba(255,255,255,0.75);
}

.hudIco{
  width: 14px;
  height: 14px;
  background-image: var(--ico);
  background-size: 14px 14px;
  background-repeat: no-repeat;
  opacity: 1;
}
.invVal{
  font-size: 13px;
}

/* === UI FONT OVERRIDE (должно быть в самом конце файла) === */

@font-face{
  font-family: "Fixedsys-Excelsior";
  src: url("./fonts/fixedsys-excelsior.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root{
  --ui-font: "Fixedsys-Excelsior", monospace;
}

html, body,
button, input, select, textarea,
.tabBtn, .tabBtn.isActive{
  font-family: var(--ui-font);
}


/* Cosmetics shop (v2.2 sinks) */
#cosmeticsOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 40;
}



#rulesOverlay{
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 145;
}


#rulesOverlay .rulesBody{
  overflow-y: auto;
  flex: 1 1 auto;
  padding-right: 6px;    /* чтобы скролл не налезал на текст */
}

#cosmeticsOverlay .modal,
#rulesOverlay .modal{
  width: 80%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;  
}

.shopGrid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
@media (min-width: 700px){
  .shopGrid{ grid-template-columns: repeat(3, minmax(0,1fr)); }
}
.shopItem{
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.04);
}
.shopItem .name{ font-weight: 700; margin-bottom: 6px; }
.shopItem .meta{ opacity: .75; font-size: 12px; margin-bottom: 8px; }
.shopItem .row{ display:flex; gap:8px; align-items:center; justify-content:space-between; }
.shopItem .tag{
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  opacity: .85;
}
.equippedRow{
  display:flex;
  gap:8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.equipPill{
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
}




/* Inventory tab — clean layout, no inline styles */
#tab-inv .invPanel{
  text-align: left; /* вместо inline text-align */
}

#tab-inv .invGrid{
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

/* one inventory row: left value + right button */
#tab-inv .invRow{
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

/* left part: icon + number */
#tab-inv .invLeft{
  display: inline-flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  gap: 8px;
  min-width: 86px;
}

/* number */
#tab-inv .invValue{
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.9);
}

/* exchange button: keep in one line */
#tab-inv .invExchangeBtn{
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  width: fit-content;
  min-width: 0;           /* важно для grid */
  padding-left: 10px;
  padding-right: 10px;
}

#tab-inv .invExchangeBtn .invIco{
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

/* coins row: no button, just label on the right */
#tab-inv .invRowCoins{
  grid-template-columns: auto 1fr;
}
#tab-inv .invRightHint{
  color: var(--muted);
  font-size: 13px;
  opacity: .8;
  justify-self: end;
}

/* inventory action area */
#tab-inv .invActions{
  margin-top: 12px;
}


/* Label with icon instead of text */
#tab-inv .invLabel{
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 6px;
  opacity: .95;
}

/* Icon base */
#tab-inv .invIco{
  width: 18px;
  height: 18px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.35));
}


/* Reuse existing UI icons (already defined in your CSS vars) */
#tab-inv .invFood  { background-image: var(--ico-carrot); }
#tab-inv .invWater { background-image: var(--ico-drop); }
#tab-inv .invHeal  { background-image: var(--ico-cross); }

/* Coin icon — same SVG vibe as in actCoin */
#tab-inv .invCoin{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='5.5' fill='%23fbbf24' stroke='%23a16207' stroke-width='1'/%3E%3Ccircle cx='7' cy='7' r='3.3' fill='none' stroke='%23fde68a' stroke-width='1'/%3E%3C/svg%3E");
}

#cosmeticsBtn{
  width: fit-content;
  align-items: center;
}
 
 .offlineCatch{
  color: #22c55e;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(34,197,94,.6);
}

.stasisWarn{
  color: #ef4444;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(239,68,68,.6);
}

.orgHonorLine{
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.2;
  text-align: left;
  color: #f59e0b;
}

.orgHonorLabel{
  color: #f59e0b;
  opacity: 0.95;
}

.orgHonorValue{
  color: #fbbf24;
}
