:root {
  --bg: #e7edf3;                 /* Light corporate gray-blue */
  --panel: rgba(255,255,255,0.92); /* Clean white panels */
  --text: #1f2937;               /* Dark slate text */
  --muted: #5b6b7a;              /* Corporate muted gray */
  --border: rgba(15,23,42,0.12);
  --radius: 16px;
}

/* ------------------ BASE ------------------ */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(
    1200px 900px at 20% -10%,
    #f4f7fb 0%,   /* Soft highlight */
    var(--bg) 55%
  );
  color: var(--text);
  min-height: 100vh;
}

.pageWrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px;
}

/* Slightly tighter on very small screens */
@media (max-width: 600px) {
  .pageWrap {
    padding: 12px;
  }
}

.hidden { display: none; }
.muted { color: var(--muted); }

/* ------------------ HEADER ------------------ */
h1 {
  margin: 0;
  font-size: 26px;
}

/* ------------------ TOP INFO ROW ------------------ */
.topRow {
  display: flex;
  gap: 16px;
  margin: 16px 0;
}

.infoBox {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

.imageBox {
  border-radius: 14px;
  padding: 0;
  overflow: hidden; 
  border: 1px solid rgba(15,23,42,0.12);
  width: 150px;
  height: 150px;
}

.imageBox img {
  width: 100%;
  height: 100%;
  object-fit: cover;        
  object-position: center;    
  display: block;
}

.envBox {
  flex: 1;
}

.statsLine {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ------------------ THINKING INDICATOR ------------------ */
.thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.thinking.hidden {
  display: none;
}

.thinking .dot {
  width: 6px;
  height: 6px;
  background: #2563eb; /* Corporate blue */
  border-radius: 50%;
  animation: pulse 1.4s infinite ease-in-out;
}

.thinking .dot:nth-child(1) { animation-delay: 0s; }
.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%   { opacity: 0.3; }
  50%  { opacity: 1; }
  100% { opacity: 0.3; }
}

.thinkingText {
  margin-left: 6px;
}

/* ------------------ STORY ------------------ */
#storyBox {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

#narrative {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 17px;
}

#choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.choice {
  width: 100%;
  text-align: left;
  background: #f1f5f9;          /* Soft neutral */
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}

.choice:hover {
  background: #e2e8f0;
}

/* ------------------ TABS ------------------ */
.tabBar {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

.tabBtn {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
}

.tabBtn.active {
  background: var(--panel);
  color: var(--text);
  border-bottom-color: transparent;
}

/* ------------------ TAB CONTENT ------------------ */
#tabContent {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 16px 16px 16px;
  padding: 14px;
  min-height: 120px;
}

.tabPanel:not(.hidden) {
  display: block;
}

/* ------------------ LOG ------------------ */
.logEntry {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
  margin-bottom: 10px;
}

/* ------------------ ACTION BUTTONS ------------------ */
.bottomActions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

button {
  background: #e2e8f0;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(40%);
}

button:hover {
  background: #dbeafe; /* Subtle blue lift */
}

/* ------------------ INVENTORY ------------------ */
.inventoryHeader {
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

.inventoryList {
  display: grid;
  gap: 8px;
}

.inventoryItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
}

.inventoryItem:hover {
  background: #eef2f7;
}

.inventoryItem.selected {
  background: #dbeafe;          /* Corporate blue highlight */
  border-color: #2563eb;
}

/* ------------------ STATS ------------------ */
.statBubble:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.statValue {
  font-weight: 600;
  color: var(--muted);
}
