:root {
  --bg: #101010;
  --panel: #0f1113;
  --panel-2: #111519;
  --line: #453d2c;
  --gold: #9f8d5b;
  --gold-2: #b8a56c;
  --text: #d6d8db;
  --muted: #7d8792;
  --blue: #5271a0;
  --green: #3a8f4f;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #08090a;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  height: 100%;
  overflow: hidden;
}
button { font: inherit; }
#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#game-shell {
  width: min(1440px, 100vw);
  height: 100vh;
  display: grid;
  grid-template-rows: 72px 1fr 155px;
  background: #0a0c0d;
}
#top-bar {
  display: grid;
  grid-template-columns: 350px 1fr 160px;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(#111417, #090a0c);
  border-bottom: 1px solid #24282d;
}
.name-line { font-size: 28px; letter-spacing: 0.08em; }
.stat-bars { margin-top: 4px; }
.bar {
  height: 18px;
  width: 310px;
  border: 1px solid #23262b;
  background: #1a1d21;
  margin-bottom: 4px;
  position: relative;
  overflow: hidden;
}
.bar::before {
  content: "";
  position: absolute;
  inset: 0;
}
.bar.hp::before { background: linear-gradient(90deg, #31753a, #42a357); width: var(--bar-fill, 100%); }
.bar.energy::before { background: linear-gradient(90deg, #38528f, #5278c2); width: var(--bar-fill, 100%); }
.bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  text-shadow: 0 1px 2px #000;
}
.brand {
  text-align: center;
  font-size: 40px;
  color: #bcc3cf;
  letter-spacing: 0.12em;
}
.top-right { display: flex; justify-content: flex-end; gap: 10px; }
.top-button {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid #2b2f35; background: #101317;
}
#main-area {
  display: grid;
  grid-template-columns: 1fr 330px;
  min-height: 0;
}
#viewport-wrap {
  position: relative;
  background: #000;
  overflow: hidden;
}
#game-canvas {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
  background: #7ca26b;
}
#hover-text {
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 20px;
  font-weight: bold;
  text-shadow: 0 2px 4px #000;
  pointer-events: none;
}
#minimap {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 220px;
  height: 220px;
  border: 2px solid var(--gold);
  background: rgba(5, 10, 7, 0.75);
  box-shadow: 0 0 0 3px rgba(18, 28, 14, 0.85);
  image-rendering: pixelated;
}
#right-panel {
  display: grid;
  grid-template-rows: 54px 42px 1fr;
  border-left: 1px solid #24282d;
  background: linear-gradient(#111317, #0b0e10);
  min-height: 0;
}
#menu-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: #1a1d22;
}
.tab {
  color: var(--text);
  background: #101316;
  border: 0;
  font-size: 22px;
}
.tab.active { background: #171d22; color: #e7d39b; }
#tab-title {
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-top: 1px solid #22272e;
  border-bottom: 1px solid #22272e;
  color: #c7cbd1;
  letter-spacing: 0.22em;
}
#tab-content {
  overflow: auto;
  padding: 12px;
}
.panel-section { margin-bottom: 16px; }
.panel-section h3 {
  margin: 0 0 8px;
  color: #b8a56c;
  font-size: 16px;
  letter-spacing: 0.08em;
}
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.inv-slot {
  aspect-ratio: 1/1;
  border: 1px solid #39352b;
  background: #111315;
  padding: 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ece4c9;
  font-size: 11px;
}
.inv-slot .icon { font-size: 20px; }
.inv-slot .qty { position: absolute; right: 4px; bottom: 4px; color: #d8dbe1; }
.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #23272c;
  font-size: 14px;
}
.quest-box, .dialogue-box, .info-box {
  padding: 10px;
  border: 1px solid #35392f;
  background: #111418;
  margin-bottom: 10px;
}
#log-shell {
  display: grid;
  grid-template-rows: 36px 1fr 28px;
  border-top: 1px solid #24282d;
  background: #0a0c0e;
}
#log-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 6px 10px;
}
.log-tab {
  border: 1px solid #31353a;
  background: #111418;
  color: #b5bbc2;
  padding: 2px 10px;
}
.log-tab.active { color: #e3d29f; }
#activity-log {
  overflow: auto;
  padding: 12px 14px;
  font-size: 14px;
  color: #b8c3cf;
  line-height: 1.65;
}
.log-entry { border-left: 2px solid #415f91; padding-left: 8px; margin-right: 10px; display: inline-block; }
#chat-hint {
  color: #6f7882;
  font-size: 13px;
  border-top: 1px solid #20242a;
  display: flex;
  align-items: center;
  padding: 0 12px;
}
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  z-index: 50;
}
#modal-backdrop.hidden { display: none; }
#modal {
  width: min(520px, calc(100vw - 24px));
  max-height: 80vh;
  overflow: auto;
  background: #0d1115;
  border: 1px solid #413923;
  box-shadow: 0 0 0 2px #151a1f;
  padding: 16px;
}
#modal h2 { margin-top: 0; color: #d9c38d; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal-actions button, .small-btn {
  border: 1px solid #453d2c;
  background: #161a1f;
  color: #ddd8c8;
  padding: 6px 10px;
}
.small-btn { padding: 4px 8px; font-size: 12px; }
.small-note { color: var(--muted); font-size: 13px; }
.compact-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
@media (max-width: 1200px) {
  #game-shell { grid-template-rows: 72px 1fr 140px; }
  #main-area { grid-template-columns: 1fr 300px; }
  #top-bar { grid-template-columns: 290px 1fr 100px; }
  .bar { width: 250px; }
  .brand { font-size: 28px; }
}
