* { box-sizing: border-box; }
html, body { height: 100%; }
html { background: #0a0714; }
body { margin: 0; background: #120d1e; color: #d8f0d0; font-family: 'Courier New', monospace; overflow: hidden; }
body::after { content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 1px, transparent 1px 3px); }

/* ---------- Login ---------- */
#login { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 380px; z-index: 10; }
.card { background: #1a1330; border: 4px solid #000; padding: 14px 16px; margin-bottom: 14px;
  box-shadow: inset 0 0 0 2px #33275c, 4px 4px 0 #000; }
.card h2 { margin: 0 0 10px; font-size: 14px; color: #9fdc7a; letter-spacing: 2px; text-transform: uppercase; }
.msg { color: #8fe07a; min-height: 1em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
input, select { background: #0d0919; color: #d8f0d0; border: 0; padding: 7px 9px; font-family: inherit;
  box-shadow: inset -2px -2px 0 #000, inset 2px 2px 0 #33275c; }
input { width: 130px; }
select { max-width: 240px; }
.hint { color: #7a8a9a; font-size: 12px; }

/* ---------- World layout: map fills screen, menu slides over the left ---------- */
#app { position: fixed; inset: 0; }
#mapwrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; cursor: grab; }
#menu-toggle { position: absolute; top: 10px; left: 10px; z-index: 30; background: #2c2050; color: #d8f0d0;
  border: 0; padding: 8px 14px; cursor: pointer; font-family: inherit; font-weight: bold; letter-spacing: 1px;
  box-shadow: inset -3px -3px 0 #000, inset 3px 3px 0 #4a3a7a; }
#menu-toggle:hover { background: #443380; color: #fff; }
#side { position: absolute; top: 0; left: 0; bottom: 0; width: 320px; z-index: 20; background: #14101f;
  border-right: 4px solid #000; box-shadow: 6px 0 0 #000; overflow-y: auto; padding: 12px;
  transition: transform .18s ease; }
#app.menu-closed #side { transform: translateX(-100%); }
#tabs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
#tabs button, .pxbtn { background: #2c2050; color: #d8f0d0; border: 0; padding: 8px 14px;
  cursor: pointer; font-family: inherit; font-weight: bold; letter-spacing: 1px; text-align: left;
  box-shadow: inset -3px -3px 0 #000, inset 3px 3px 0 #4a3a7a; }
#tabs button.on, #tabs button:hover, .pxbtn:hover { background: #443380; color: #fff; }
#logout { color: #ff9a8a; }
.tabpane .card { margin-bottom: 10px; }
.tabpane .card.pixel, .pixel { border-style: solid; }

/* ---------- Spot popup ---------- */
#spot-pop, #trade-pop { position: absolute; z-index: 40; width: 300px; background: #14101f; border: 4px solid #000;
  box-shadow: 6px 6px 0 #000; padding: 10px; }
#spot-pop .sp-head, #trade-pop .sp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#spot-pop .sp-head b, #trade-pop .sp-head b { color: #9fdc7a; font-size: 14px; }
#spot-pop .row, #trade-pop .row { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
#spot-pop select, #spot-pop input, #trade-pop select, #trade-pop input { font-size: 12px; padding: 5px 7px; }
#trade-pop .tr-list { max-height: 140px; overflow-y: auto; margin-top: 6px; }
#trade-pop .tr-list .queue-step { font-size: 12px; }
.sfx-vol { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #c8b8e8;
  padding: 4px 8px; cursor: pointer; }
.sfx-vol input[type="range"] { -webkit-appearance: none; appearance: none; width: 90px; height: 14px;
  margin: 0; background: transparent; cursor: pointer; }
.sfx-vol input[type="range"]::-webkit-slider-runnable-track { height: 8px; background: #2c2050;
  border: 2px solid #000; }
.sfx-vol input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 14px;
  margin-top: -1px; background: #9fdc7a; border: 2px solid #000; }
.sfx-vol input[type="range"]::-moz-range-track { height: 8px; background: #2c2050;
  border: 2px solid #000; }
.sfx-vol input[type="range"]::-moz-range-thumb { width: 10px; height: 12px; border-radius: 0;
  background: #9fdc7a; border: 2px solid #000; }
.sp-chars { max-height: 150px; overflow-y: auto; margin: 4px 0; border: 2px solid #2c2050; padding: 4px 6px; }
.sp-char-row { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 0; cursor: pointer; white-space: nowrap; }
.sp-char-row .char-sprite { width: 20px; height: 20px; margin-right: 0; flex: none; }
.sp-all { margin-top: 4px; width: 100%; }

/* ---------- Town interior view ---------- */
#town-view { position: absolute; z-index: 35; top: 14px; right: 14px; width: 500px;
  background: #14101f; border: 4px solid #000; box-shadow: 6px 6px 0 #000; padding: 10px; }
#town-view .tv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#town-view .tv-head b { color: #9fdc7a; font-size: 14px; }
#towncv { display: block; width: 100%; image-rendering: pixelated; border: 3px solid #000;
  box-shadow: inset 0 0 0 2px #33275c; cursor: crosshair; }
#town-view .hint { font-size: 11px; margin-top: 8px; }

/* ---------- Characters / shop / auctions ---------- */
.auction { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 2px solid #2c2050; flex-wrap: wrap; }
.auction .grow { flex: 1; }
.char { padding: 10px 0; border-bottom: 3px solid #2c2050; }
.char:last-child { border-bottom: 0; }
.char b { color: #9fdc7a; font-size: 15px; }
.badge { color: #8fe07a; }
small { color: #7a8a9a; }
.char-controls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.char-controls select, .char-controls input { font-size: 12px; padding: 5px 7px; }
.bulk-bar { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px 0 10px;
  border-bottom: 3px solid #2c2050; margin-bottom: 4px; }
.bulk-bar select, .bulk-bar input { font-size: 12px; padding: 5px 7px; }
.char-sel { flex: none; }
.pxbtn { font-size: 11px; padding: 5px 10px; }
.pxbtn.danger { color: #ff9a8a; }
#me-inv { color: #a8b8c8; font-size: 13px; }
.queue-step { display: flex; gap: 6px; align-items: center; padding: 3px 0; font-size: 12px; color: #c8b8e8; }
.queue-step .qnum { color: #9fdc7a; min-width: 20px; }
.quest-step.done .grow, .quest-step.claimed .grow { color: #6a8f5a; }
.quest-step.locked { opacity: .45; }
.quest-step.current .grow { color: #ffd75e; }
.qbar { width: 80px; height: 8px; background: #1a1226; border: 1px solid #3a2b52; display: inline-block; vertical-align: middle; }
.qbar span { display: block; height: 100%; background: #7fbf5a; }
.char-sprite { width: 34px; height: 34px; image-rendering: pixelated; vertical-align: middle; margin-right: 8px;
  border: 2px solid #000; box-shadow: inset 0 0 0 2px #33275c; }
.dim { color: #7a8a9a; font-size: 11px; }
.q-mode { display: inline-flex; gap: 2px; }
.q-mbtn.on { outline: 2px solid #9fdc7a; }
.jobbar { height: 6px; background: #1a1226; border: 1px solid #3a2b52; margin: 4px 0 2px; }
.jobbar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4f8f3a, #9fdc7a); transition: width .5s linear; }
.buff { display: inline-block; margin: 2px 6px 0 0; padding: 1px 6px; font-size: 11px; color: #d8c8ff;
  background: #241a38; border: 1px solid #4a3a6a; border-radius: 3px; }

/* ---------- Guided tutorial overlay ---------- */
#tut { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.tut-dim { position: absolute; background: rgba(4,8,4,.66); pointer-events: auto; }
#tut-holebox { position: absolute; border: 3px solid #9fdc7a; box-shadow: 0 0 12px #9fdc7a, inset 0 0 12px rgba(159,220,122,.35);
  pointer-events: none; transition: left .25s, top .25s, width .25s, height .25s; }
#tut-card { position: fixed; width: 300px; pointer-events: auto; background: #14101f; border: 4px solid #000;
  box-shadow: inset 0 0 0 2px #3a2b52, 0 0 0 2px #000, 6px 6px 0 rgba(0,0,0,.5); padding: 12px 14px; }
#tut-card h3 { margin: 2px 0 6px; color: #9fdc7a; font-size: 15px; }
#tut-card .hint { margin: 4px 0; }
#tut-count { color: #ffd75e; }
#tut-gold { color: #ffd75e; }
#tut-wait { color: #9fdc7a; }
