* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #1a1d22; color: #e6e6e6;
  font-family: -apple-system, system-ui, "Segoe UI", sans-serif; }

#app { display: grid; grid-template-columns: 1fr 320px; height: 100vh; }

#game-wrap { position: relative; background: #0a0d10; overflow: hidden; }
#game { display: block; width: 100%; height: 100%; cursor: crosshair; image-rendering: pixelated; }

#hud-top {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.55); padding: 6px 10px; border-radius: 6px;
  font-size: 13px; pointer-events: none;
}
#hud-online, #hud-coords { opacity: .75; margin-left: 8px; }

#toast {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(46,204,113,.92); color: #06241a; padding: 8px 14px;
  border-radius: 6px; font-weight: 600; opacity: 0; transition: opacity .25s;
  pointer-events: none;
}
#toast.show { opacity: 1; }

#dialogue {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%);
  width: min(560px, 80%);
  background: rgba(20,24,30,.96); border: 1px solid #364048;
  border-radius: 10px; padding: 14px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
#dialogue.hidden { display: none; }
.speaker { font-weight: 700; color: #f6c95d; margin-bottom: 6px; }
#dlg-line { line-height: 1.45; min-height: 50px; }
#dlg-next {
  margin-top: 10px; background: #2d6cdf; color: white; border: 0;
  padding: 6px 14px; border-radius: 5px; cursor: pointer;
}

#chat-wrap {
  position: absolute; left: 10px; bottom: 10px; width: min(420px, 60%);
}
#chat-log {
  max-height: 130px; overflow-y: auto;
  background: rgba(0,0,0,.4); padding: 6px 10px; border-radius: 6px;
  font-size: 12.5px; margin-bottom: 4px;
}
#chat-log .msg { line-height: 1.35; }
#chat-log .me { color: #f6c95d; }
#chat-input {
  width: 100%; background: rgba(0,0,0,.5); color: #fff;
  border: 1px solid #364048; padding: 6px 10px; border-radius: 6px;
  font-size: 13px; outline: none;
}
#chat-input:focus { border-color: #2d6cdf; }

#panel { background: #20252b; border-left: 1px solid #2c333a; display: flex;
  flex-direction: column; }
#tabs { display: flex; background: #181c20; }
.tab { flex: 1; padding: 10px 6px; background: transparent; color: #aaa;
  border: 0; border-bottom: 2px solid transparent; cursor: pointer;
  font-size: 13px; font-weight: 600; }
.tab.active { color: #fff; border-bottom-color: #f6c95d; background: #20252b; }
.tab:hover:not(.active) { color: #ddd; }

.tab-panel { display: none; padding: 14px; overflow-y: auto; flex: 1; }
.tab-panel.active { display: flex; flex-direction: column; }
.tab-panel h3 { margin: 0 0 12px; font-size: 15px; color: #f6c95d;
  text-transform: uppercase; letter-spacing: .08em; }
.tab-panel h4 { margin: 14px 0 6px; font-size: 13px; color: #aaa; }
.hint { color: #888; font-size: 12px; }

#inventory-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
}
.inv-slot {
  aspect-ratio: 1; background: #14181c; border: 1px solid #2c333a;
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  flex-direction: column; font-size: 22px;
  position: relative;
}
.inv-slot .count {
  position: absolute; bottom: 2px; right: 4px; font-size: 11px;
  color: #f6c95d; font-weight: 700;
}
.inv-slot .label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-size: 11px; background: rgba(0,0,0,.85); padding: 2px 6px;
  border-radius: 4px; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .12s; z-index: 5; margin-top: 4px;
}
.inv-slot:hover .label { opacity: 1; }
.inv-slot.empty { opacity: .35; }

#quest-list { list-style: none; padding: 0; margin: 0; }
#quest-list .empty { color: #666; font-style: italic; }
#quest-list li.quest {
  background: #14181c; border: 1px solid #2c333a; border-radius: 6px;
  padding: 10px; margin-bottom: 8px;
}
#quest-list li.quest .title { font-weight: 700; color: #f6c95d; }
#quest-list li.quest.done .title { color: #2ecc71; }
#quest-list li.quest.done { opacity: .6; }
#quest-list li.quest .obj { color: #bbb; font-size: 12.5px; margin-top: 4px; }
#quest-list li.quest .prog { color: #888; font-size: 12px; margin-top: 4px; }

#notebook {
  flex: 1; min-height: 280px; resize: none; width: 100%;
  background: #14181c; color: #e6e6e6; border: 1px solid #2c333a;
  border-radius: 6px; padding: 10px; font: 13px/1.5 ui-monospace, "SF Mono", monospace;
  outline: none;
}
#notebook:focus { border-color: #f6c95d; }

#tab-settings label { font-size: 13px; color: #aaa; display: block; margin-bottom: 8px; }
#tab-settings input {
  width: 100%; background: #14181c; color: #fff; border: 1px solid #2c333a;
  padding: 6px 10px; border-radius: 5px; margin-top: 4px;
}
#name-save, #claim-btn, #login-btn, #logout-btn {
  margin-top: 4px; background: #2d6cdf; color: white;
  border: 0; padding: 6px 12px; border-radius: 5px; cursor: pointer;
}
#claim-btn, #login-btn { margin-right: 4px; }
#logout-btn { background: #555; }
#quick-login-buttons button {
  margin: 4px 4px 0 0; background: #444; color: #f6c95d;
  border: 1px solid #5a5a60; padding: 4px 10px; border-radius: 4px;
  cursor: pointer; font-size: 12px;
}
#quick-login-buttons button:hover { background: #555; }
#auth-msg.error { color: #e74c3c; }
#auth-msg.success { color: #2ecc71; }
#account-current { color: #f6c95d; }

.hidden { display: none !important; }

#inspect {
  position: absolute; pointer-events: none; z-index: 12;
  background: rgba(20,24,30,.96); border: 1px solid #364048;
  border-radius: 5px; padding: 6px 10px; font-size: 12.5px;
  max-width: 240px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
#inspect .iname { font-weight: 700; color: #f6c95d; }
#inspect .ihint { color: #aaa; font-size: 11px; margin-top: 2px; }

#xp-popups { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.xp-pop {
  position: absolute; font-weight: 800; font-size: 16px; color: #f6c95d;
  text-shadow: 0 2px 0 rgba(0,0,0,.7), 0 0 12px rgba(246,201,93,.5);
  animation: xpfloat 1.4s ease-out forwards;
  pointer-events: none;
}
@keyframes xpfloat {
  0%   { opacity: 0; transform: translateY(0) scale(0.8); }
  15%  { opacity: 1; transform: translateY(-6px) scale(1.05); }
  100% { opacity: 0; transform: translateY(-46px) scale(1); }
}

#chop-bar {
  position: absolute; bottom: 170px; left: 50%; transform: translateX(-50%);
  width: 180px; height: 12px; background: rgba(0,0,0,.6);
  border: 1px solid #3a4048; border-radius: 6px; overflow: hidden;
  z-index: 8;
}
#chop-fill { height: 100%; width: 0; background: linear-gradient(90deg, #f6c95d, #f08a3c); transition: width 60ms linear; }

.skill-row {
  background: #14181c; border: 1px solid #2c333a; border-radius: 6px;
  padding: 10px 12px; margin-bottom: 8px;
}
.skill-row .head { display: flex; justify-content: space-between; font-weight: 700; }
.skill-row .head .lv { color: #f6c95d; }
.skill-row .bar { height: 6px; background: #0a0d10; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.skill-row .bar .fill { height: 100%; background: linear-gradient(90deg, #f6c95d, #f08a3c); }
.skill-row .xp { color: #888; font-size: 11px; margin-top: 3px; }
