/* tibia-js: minimal dark Tibia-ish UI */
* { box-sizing: border-box; }

body {
  background: #0c0c10;
  color: #d8d8d8;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 13px;
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.entry-screen {
  background-color: #080b0d;
  background-image:
    linear-gradient(rgba(5, 7, 8, 0.16), rgba(5, 7, 8, 0.42)),
    url("assets/login-background-76-heroine.webp");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

body.entry-screen .panel {
  background: rgba(19, 19, 23, 0.94);
  border-color: #5b5140;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.78), inset 0 0 0 1px rgba(215, 184, 102, 0.08);
  backdrop-filter: blur(2px);
}

.panel {
  background: #16161d;
  border: 1px solid #33333f;
  border-radius: 6px;
  padding: 28px 32px;
  width: 340px;
}

@media (prefers-reduced-transparency: reduce) {
  body.entry-screen .panel { backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  #asset-loader-fill, #asset-loader-fill::after, .asset-loader-runes i { animation: none; transition: none; }
}

h1 {
  font-size: 20px;
  margin: 0 0 4px;
  color: #e8c860;
  letter-spacing: 1px;
}

.subtitle { color: #777; margin: 0 0 18px; }

label {
  display: block;
  margin-bottom: 10px;
  color: #999;
}

input[type=text], input[type=password], input[type=number] {
  display: block;
  width: 100%;
  margin-top: 3px;
  background: #0c0c10;
  border: 1px solid #3a3a46;
  border-radius: 4px;
  color: #e8e8e8;
  padding: 7px 9px;
  font-size: 13px;
}

input:focus { outline: none; border-color: #e8c860; }

button {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  background: #e8c860;
  border: none;
  border-radius: 4px;
  color: #1a1a10;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
}
button:hover { background: #f4d878; }

.status { color: #999; margin: 14px 0 0; min-height: 16px; }

.asset-loader {
  margin-top: 14px;
  color: #b8ad94;
  font-size: 10px;
  letter-spacing: .2px;
  transition: opacity .25s ease;
}
.asset-loader-line { display: flex; justify-content: space-between; gap: 10px; }
#asset-loader-percent { color: #d7bf76; font-variant-numeric: tabular-nums; }
.asset-loader-track {
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  background: #070707;
  border: 1px solid #554b38;
  box-shadow: inset 0 1px 2px #000;
}
#asset-loader-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #796329, #d4b85f 70%, #f0d985);
  box-shadow: 0 0 7px rgba(218, 183, 82, .55);
  transition: width .16s ease-out;
  position: relative;
}
#asset-loader-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255,255,220,.5), transparent);
  animation: asset-shimmer 1.3s linear infinite;
}
.asset-loader-runes { display: flex; justify-content: center; gap: 5px; height: 8px; margin-top: 5px; }
.asset-loader-runes i {
  width: 4px;
  height: 4px;
  transform: rotate(45deg);
  background: #8d7740;
  box-shadow: 0 0 4px rgba(222, 187, 90, .55);
  animation: rune-pulse 1.05s ease-in-out infinite;
}
.asset-loader-runes i:nth-child(2) { animation-delay: .16s; }
.asset-loader-runes i:nth-child(3) { animation-delay: .32s; }
.asset-loader.is-complete #asset-loader-fill { background: #7e963d; box-shadow: 0 0 6px rgba(126,150,61,.55); }
.asset-loader.is-complete #asset-loader-fill::after,
.asset-loader.is-complete .asset-loader-runes { display: none; }
.asset-loader.is-error #asset-loader-fill { background: #8f3530; box-shadow: none; }
.asset-loader.is-error #asset-loader-fill::after,
.asset-loader.is-error .asset-loader-runes { display: none; }

@keyframes asset-shimmer { from { transform: translateX(-120%); } to { transform: translateX(350%); } }
@keyframes rune-pulse { 0%, 100% { opacity: .25; transform: rotate(45deg) scale(.75); } 50% { opacity: 1; transform: rotate(45deg) scale(1.15); } }

.outfit-row { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
#outfit-preview {
  background: #0c0c10;
  border: 1px solid #3a3a46;
  border-radius: 4px;
  image-rendering: pixelated;
}
.outfit-cols { flex: 1; }
.outfit-cols label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.outfit-cols input { width: 70px; margin-top: 0; }

/* ---- game screen ---- */
#game-screen { flex-direction: column; align-items: center; }

.game-main { display: flex; align-items: flex-start; gap: 6px; }

.canvas-col {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}
#zoom-btn {
  position: absolute;
  top: 4px; right: 4px;
  width: auto; margin: 0; padding: 2px 10px;
  background: rgba(22,22,29,0.85);
  border: 1px solid #444450; border-radius: 3px;
  color: #e8c860; font-size: 12px; z-index: 5;
}

#game-canvas {
  display: block;
  background: #000;
  border: 1px solid #33333f;
  image-rendering: pixelated;
  cursor: crosshair;
}
#game-canvas:focus { outline: none; border-color: #e8c860; }

#death-overlay {
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--game-viewport-height, 704px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(25, 0, 0, 0.68);
  color: #ddd;
  font-size: 16px;
  text-shadow: 1px 1px #000;
  pointer-events: all;
}
#death-overlay strong { color: #c8c8c8; font-size: 28px; font-weight: normal; }

.side { width: 260px; display: flex; flex-direction: column; gap: 8px; }

.hud-box {
  background: #16161d;
  border: 1px solid #33333f;
  border-radius: 4px;
  padding: 8px 10px;
}

.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bar-row > span { width: 44px; color: #999; }

.bar {
  position: relative;
  flex: 1;
  height: 14px;
  background: #0c0c10;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  overflow: hidden;
}

.bar-fill { height: 100%; transition: width 0.15s; }
.bar-fill.hp { background: #c02828; }
.bar-fill.mana { background: #2850c8; }
.bar-fill.exp { background: #68a030; }

.bar-text {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10px;
  line-height: 14px;
  color: #fff;
  text-shadow: 0 1px 1px #000;
}

.exp-text { color: #888; font-size: 11px; margin-top: 3px; }

#chat-console {
  width: 100%;
  margin-top: 3px;
  padding: 3px;
  background: #777;
  border: 2px outset #aaa;
}
#chat-log {
  height: 118px;
  min-height: 118px;
  max-height: 118px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  word-wrap: break-word;
}
#chat-log .chat-info { color: #e8c860; }
#chat-log .chat-loot { color: #68d868; }

#chat-input { width: 100%; }

.hint { color: #666; margin-top: 8px; }

/* minimap */
#minimap-box { padding: 6px; }
#minimap {
  display: block;
  width: 100%;
  background: #000;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  image-rendering: pixelated;
}

/* spells panel */
#spells-panel { padding: 6px 8px; }
#spells-header {
  display: flex; justify-content: space-between; align-items: center;
  color: #e8c860; font-weight: bold; font-size: 12px; cursor: pointer;
  user-select: none;
}
#spells-header #spells-toggle { color: #888; font-weight: normal; }
#spells-list { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
#spells-panel.collapsed #spells-list { display: none; }
.spell-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: #ccc;
}
.spell-row .spell-words { flex: 1; }
.spell-row .spell-info { color: #777; font-size: 10px; }
.spell-row.spell-disabled { opacity: 0.4; }
.spell-key {
  width: 18px; height: 18px; margin: 0; padding: 0;
  background: #23232c; border: 1px solid #3a3a46; border-radius: 3px;
  color: #e8c860; font-size: 11px; font-weight: bold; line-height: 1;
}
.spell-key:hover { border-color: #e8c860; }
.spell-key.rebinding { background: #e8c860; color: #1a1a10; }

.mlvl { color: #b48cff; margin-left: auto; }
.gold-text { color: #ffd24a; margin-top: 4px; font-size: 12px; }

/* equipment slots */
#equipment { padding: 6px; }
.equip-grid {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 4px;
  justify-content: center;
}
.slot {
  width: 40px; height: 40px;
  background: #0c0c10;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  position: relative;
}
.slot:hover { border-color: #e8c860; }
.slot canvas { image-rendering: pixelated; }
.slot .slot-count {
  position: absolute; right: 2px; bottom: 0;
  font-size: 10px; color: #fff; text-shadow: 0 1px 1px #000;
}

/* backpack */
#backpack { max-height: 150px; overflow-y: auto; padding: 6px; }
.bp-items { display: flex; flex-wrap: wrap; gap: 4px; }
.bp-item {
  width: 40px; height: 40px;
  background: #0c0c10;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
}
.bp-item:hover { border-color: #e8c860; }
.bp-item canvas { image-rendering: pixelated; }
.bp-item .slot-count {
  position: absolute; right: 2px; bottom: 0;
  font-size: 10px; color: #fff; text-shadow: 0 1px 1px #000;
}

/* floating panels (loot / trade) */
.float-panel {
  position: absolute;
  top: 60px; left: 520px;
  min-width: 260px;
  background: #16161d;
  border: 1px solid #444450;
  border-radius: 6px;
  padding: 10px;
  z-index: 10;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}
.panel-title {
  display: flex; justify-content: space-between; align-items: center;
  color: #e8c860; font-weight: bold; margin-bottom: 8px;
}
.close-btn {
  width: auto; margin: 0; padding: 0 8px;
  background: #333; color: #ccc; font-size: 12px;
}
.item-rows { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.item-row {
  display: flex; align-items: center; gap: 8px;
  background: #0c0c10; border: 1px solid #2c2c36; border-radius: 3px;
  padding: 3px 6px; cursor: pointer;
}
.item-row:hover { border-color: #e8c860; }
.item-row canvas { image-rendering: pixelated; }
.item-row .item-name { flex: 1; font-size: 12px; }
.item-row .item-count { color: #aaa; font-size: 11px; }
.item-row .item-price { color: #ffd24a; font-size: 11px; }
.trade-cols { display: flex; gap: 10px; }
.trade-col { flex: 1; }
.trade-col h3 { margin: 0 0 6px; font-size: 12px; color: #999; }
#loot-take-all { margin-top: 8px; }

/* Tibia-style container windows, docked in the right panel */
#containers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46vh;
  overflow-y: auto;
}
#containers:empty { display: none; }
.container-window {
  background: #16161d;
  border: 1px solid #33333f;
  border-radius: 4px;
  padding: 8px;
  user-select: none;
}
.container-window .panel-title { margin-bottom: 6px; }
.cw-grid {
  display: grid;
  grid-template-columns: repeat(4, 40px);
  gap: 4px;
}
.cw-pager {
  display: none;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.cw-pager button {
  width: auto; margin: 0; padding: 2px 10px;
  background: #333; color: #ccc; font-size: 12px;
}
.cw-page { color: #888; font-size: 11px; }
.bp-toggle {
  width: 100%;
  margin: 0 0 6px;
  padding: 5px;
  background: #23232c;
  border: 1px solid #3a3a46;
  border-radius: 3px;
  color: #e8c860;
  font-size: 12px;
}
.bp-toggle:hover { border-color: #e8c860; background: #23232c; }
.drag-ghost {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  opacity: 0.85;
}
.drag-ghost canvas { display: block; image-rendering: pixelated; }

/* ---- Tibia 7.6-style right sidebar ---- */
.side {
  width: 190px;
  gap: 3px;
  padding: 3px;
  background: #777;
  border: 2px outset #aaa;
  color: #111;
  height: var(--game-viewport-height, 704px);
  max-height: calc(100vh - 20px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #aaa #666;
  scrollbar-width: thin;
}
.side > * { flex-shrink: 0; }
.side::-webkit-scrollbar { width: 14px; }
.side::-webkit-scrollbar-track { background: #666; border: 2px inset #999; }
.side::-webkit-scrollbar-thumb { background: #aaa; border: 2px outset #ccc; }
.side .hud-box, .container-window {
  background: #888;
  border: 2px inset #bbb;
  border-radius: 0;
  padding: 4px;
}
#minimap-box { padding: 3px; }
#minimap { width: 100%; height: 112px; border: 2px inset #aaa; border-radius: 0; }
.minimap-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 2px; }
.minimap-controls button, .sidebar-tabs button {
  width: auto; min-width: 0; margin: 0; padding: 2px;
  color: #111; background: #aaa; border: 2px outset #ccc; border-radius: 0;
  font: bold 10px Verdana, sans-serif;
}
.minimap-controls button:active, .sidebar-tabs button:active { border-style: inset; }
#status-box { font-size: 10px; }
#status-box .bar-row { margin-bottom: 2px; gap: 3px; }
#status-box .bar-row > span { width: 30px; color: #111; }
#status-box .bar { height: 12px; border-radius: 0; border-color: #444; }
#status-box .bar-text { font-size: 9px; line-height: 11px; }
#condition-bar { display: flex; flex-wrap: wrap; gap: 2px; min-height: 0; margin-top: 3px; }
.condition-icon {
  position: relative; width: 22px; height: 22px; border: 2px inset #aaa;
  background: #666; color: #fff; text-align: center; line-height: 18px;
  font: bold 10px Verdana, sans-serif; cursor: help;
}
.condition-icon.harmful { color: #ffe0b0; background: #713b32; }
.condition-icon .condition-time {
  position: absolute; right: 1px; bottom: -1px; font-size: 7px; line-height: 8px;
  color: #fff; text-shadow: 1px 1px #000;
}
#equipment { padding: 4px; }
.doll-grid { position: relative; width: 154px; height: 170px; margin: 0 auto; }
#doll-preview { position: absolute; left: 45px; top: 53px; width: 64px; height: 64px; image-rendering: pixelated; opacity: .42; }
.doll-grid .slot { position: absolute; width: 32px; height: 32px; border: 2px inset #aaa; border-radius: 0; background: #555; }
.doll-head { left: 61px; top: 0; }
.doll-neck { left: 20px; top: 35px; }
.doll-pack { right: 20px; top: 35px; }
.doll-left { left: 0; top: 70px; }
.doll-armor { left: 61px; top: 70px; }
.doll-right { right: 0; top: 70px; }
.doll-ring { left: 20px; top: 105px; }
.doll-legs { left: 61px; top: 105px; }
.doll-ammo { right: 20px; top: 105px; }
.doll-boots { left: 61px; top: 138px; }
.soul-cap { display: flex; justify-content: space-between; padding: 2px 5px; font-size: 10px; }
.soul-cap b { font-weight: normal; }
.bp-toggle { background: #aaa; color: #111; border: 2px outset #ccc; border-radius: 0; padding: 3px; margin-bottom: 0; }
#fight-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 2px; }
#fight-controls button {
  width: auto; min-width: 0; margin: 0; padding: 2px 1px; color: #111;
  background: #aaa; border: 2px outset #ccc; border-radius: 0;
  font: bold 9px Verdana, sans-serif;
}
#fight-controls button.active { border-style: inset; background: #d0c080; }
.control-option {
  display: flex; align-items: center; gap: 4px; margin-top: 2px; padding: 2px 3px;
  border: 1px inset #aaa; background: #888; color: #111;
  font: 9px Verdana, sans-serif; cursor: pointer; user-select: none;
}
.control-option input { width: 12px; height: 12px; margin: 0; accent-color: #7b641f; }
.sidebar-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.side-panel { max-height: 180px; overflow-y: auto; font-size: 10px; }
.classic-title { padding: 1px 3px; margin: -2px -2px 3px; background: #555; color: #fff; font-weight: bold; }
.skill-line, .battle-line { display: flex; justify-content: space-between; padding: 2px 3px; border-bottom: 1px solid #777; }
.skill-vocation { text-align: center; font-weight: bold; padding: 2px; border-bottom: 1px solid #666; }
.skill-entry { padding-bottom: 1px; }
.skill-entry .skill-line { border-bottom: 0; padding-bottom: 0; }
.skill-meter { height: 4px; margin: 0 3px 1px; background: #555; border: 1px inset #999; }
.skill-meter span { display: block; height: 100%; background: #d4b83f; }
.battle-line { cursor: pointer; }
.battle-line:hover { background: #aaa; }
#spells-panel { display: none; }
#containers { max-height: none; overflow: visible; gap: 3px; }

#thing-tooltip {
  position: fixed; z-index: 200; max-width: 330px; pointer-events: none;
  padding: 4px 6px; background: rgba(20,20,20,.94); border: 1px solid #d8d8b0;
  color: #f2f2d6; font: 11px Verdana, sans-serif; line-height: 1.35;
  box-shadow: 1px 2px 5px rgba(0,0,0,.7); white-space: normal;
}
#classic-context-menu {
  position: fixed; z-index: 350; min-width: 138px; padding: 2px;
  color: #111; background: #aaa; border: 2px outset #ddd;
  box-shadow: 2px 3px 7px rgba(0,0,0,.65); font: 11px Verdana, sans-serif;
}
#classic-context-menu button {
  display: block; width: 100%; margin: 0; padding: 3px 18px 3px 6px;
  color: #111; background: transparent; border: 0; border-radius: 0;
  text-align: left; font: 11px Verdana, sans-serif;
}
#classic-context-menu button:hover { color: #fff; background: #404080; }
.classic-dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 292px; z-index: 300; padding: 2px; color: #111; background: #888;
  border: 2px outset #ccc; box-shadow: 3px 4px 10px rgba(0,0,0,.65);
  font: 11px Verdana, sans-serif;
}
.classic-dialog-title {
  padding: 2px 4px; color: #fff; background: #404080; font-weight: bold;
}
.move-amount-body { padding: 10px 8px 7px; }
.move-amount-body label { color: #111; margin: 0 0 8px; }
.move-amount-controls { display: flex; align-items: center; gap: 8px; }
.move-amount-controls input[type=range] { flex: 1; }
.move-amount-controls input[type=number] {
  width: 54px; margin: 0; padding: 2px 3px; color: #111; background: #fff;
  border: 2px inset #aaa; border-radius: 0; text-align: right;
}
.classic-dialog-buttons { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.classic-dialog-buttons button {
  width: 72px; margin: 0; padding: 3px; color: #111; background: #aaa;
  border: 2px outset #ccc; border-radius: 0; font: 11px Verdana, sans-serif;
}
.classic-dialog-buttons button:active { border-style: inset; }
.outfit-dialog-body { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; }
#outfit-dialog-preview {
  width: 64px; height: 64px; background: #555; border: 2px inset #aaa;
  image-rendering: pixelated;
}
.outfit-dialog-fields { flex: 1; min-width: 185px; }
.outfit-dialog-fields label { color: #111; margin: 0 0 5px; }
.outfit-dialog-fields select {
  display: block; width: 100%; margin-top: 2px; padding: 2px; background: #fff;
  border: 2px inset #aaa; font: 11px Verdana, sans-serif;
}
.outfit-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 5px; }
.outfit-color-grid label { display: flex; align-items: center; justify-content: space-between; }
.outfit-color-grid input[type=number] {
  width: 45px; margin: 0; padding: 1px 2px; color: #111; background: #fff;
  border: 2px inset #aaa; border-radius: 0;
}
.outfit-dialog-buttons { flex-basis: 100%; margin-top: 2px; }
.container-window { color: #111; }
.container-window .panel-title { color: #111; margin-bottom: 3px; }
.container-window .cw-title { flex: 1; padding-left: 3px; text-align: left; }
.container-window .close-btn, .container-window .cw-back {
  width: 22px; height: 20px; margin: 0; padding: 0;
  background: #aaa; color: #111; border: 2px outset #ccc; border-radius: 0;
  font: bold 11px Verdana, sans-serif;
}
.container-window .cw-back:active { border-style: inset; }
.cw-grid { grid-template-columns: repeat(4, 32px); gap: 2px; justify-content: center; }
.bp-item { width: 32px; height: 32px; border: 2px inset #aaa; border-radius: 0; background: #555; }
#chat-log {
  min-height: 118px; max-height: 118px; padding: 4px 6px;
  background: #222; color: #ddd; border: 2px inset #aaa; border-radius: 0;
}
#chat-input {
  height: 25px; margin: 2px 0 0; padding: 3px 5px; color: #111;
  background: #fff; border: 2px inset #aaa; border-radius: 0;
}
