/* Dark Mage of Mossfen — the town (v0.16): the Shop window, gold, and the townsfolk's name
   plates and speech bubbles. Same look as style.css and items.css. */

/* ---- the town's look: warm banner, a soft evening vignette ---------------------- */
#app[data-theme="honeycombe"] { --map-accent: #ffd98a; --map-glow: rgba(255, 190, 90, 0.6); }
#app[data-theme="honeycombe"] #vignette {
  opacity: 1;
  background: radial-gradient(ellipse 82% 78% at 50% 48%, transparent 58%, rgba(66, 34, 8, 0.34) 100%);
}

/* ---- gold ------------------------------------------------------------------ */
.coin { color: #ffd76a; font-family: var(--f-pixel); font-weight: 700; font-variant-numeric: tabular-nums; }
.coin::before, .purse output::before {
  content: ''; display: inline-block; width: 0.72em; height: 0.72em; margin-right: 0.3em; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #f0b93a 55%, #a8721c);
  box-shadow: 0 0 0 1px #5a3d10; vertical-align: -0.02em;
}
.purse {
  display: flex; justify-content: space-between; align-items: baseline; margin-top: 5px;
  font: 700 12px/1 var(--f-display); letter-spacing: 0.08em; color: var(--ink-dim);
}
.purse output { font: 700 13px/1 var(--f-pixel); color: #ffd76a; font-variant-numeric: tabular-nums; }
.bag-gold { margin-right: 14px; color: var(--ink-dim); }
#bag header .win-close { margin-left: 10px; }

/* ---- the Shop window --------------------------------------------------------- */
#shop {
  top: 12px; right: 12px; z-index: 5;
  width: min(424px, calc(100% - 24px));
  max-height: calc(100% - 100px);
  overflow-y: auto;
  padding: 10px 14px 12px;
}
#shop header { align-items: center; }
.shop-purse { margin-left: auto; font: 600 13px/1 var(--f-display); letter-spacing: 0.05em; color: var(--ink-dim); }
#shop-gold { display: inline-block; }
#shop-gold.is-up { animation: gold-up 0.5s ease-out 1; }
#shop-gold.is-down { animation: gold-down 0.5s ease-out 1; }
@keyframes gold-up { 0% { transform: scale(1.5); color: #9bff8a; } 100% { transform: scale(1); } }
@keyframes gold-down { 0% { transform: scale(1.3); color: #ff9a7a; } 100% { transform: scale(1); } }

.shop-who { display: flex; align-items: center; gap: 12px; padding: 2px 0 10px; }
.shop-who img {
  width: 72px; height: 72px; flex-shrink: 0; border-radius: 50%; object-fit: cover;
  background: radial-gradient(circle at 50% 40%, rgba(255, 215, 106, 0.28), rgba(11, 15, 12, 0.9) 72%);
  box-shadow: inset 0 0 0 2px var(--edge-strong), 0 0 0 1px #000;
}
.shop-who p { margin: 0; font: italic 500 14.5px/1.35 var(--f-body); color: var(--ink); }
.shop-who p::before { content: '“'; } .shop-who p::after { content: '”'; }

.shop-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.shop-tabs button {
  padding: 8px 0; border: 1px solid #000; border-radius: 4px; cursor: pointer;
  background: #0b0f0c; box-shadow: inset 0 0 0 1px var(--edge);
  color: var(--ink-dim); font: 700 14px/1 var(--f-display); letter-spacing: 0.08em; text-transform: uppercase;
}
.shop-tabs button.is-on { color: #1b140f; background: linear-gradient(#f3d68a, #c99d45); box-shadow: none; }
.shop-tabs button:focus-visible { outline: 2px solid #f3d68a; outline-offset: 2px; }

.shop-buy { display: grid; gap: 6px; }
.shop-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 7px 8px; border-radius: 4px; background: rgba(11, 15, 12, 0.6); border: 1px solid rgba(206, 184, 118, 0.14);
}
.shop-row img { width: 44px; height: 44px; border-radius: 4px; border: 2px solid var(--grade, #7a6a45); }
.shop-what { display: grid; gap: 2px; min-width: 0; }
.shop-what strong { font: 700 16px/1.1 var(--f-display); letter-spacing: 0.03em; color: var(--ink); }
.shop-what > span { font-size: 12.5px; color: var(--ink-faint); }
.shop-what em { font-style: normal; font-size: 13.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.shop-what .bag-compare { font-size: 12.5px; gap: 2px 8px; }
.shop-what .bag-compare small { font-size: 12px; }
.shop-price { display: flex; gap: 5px; }
.shop-btn { display: grid; justify-items: center; gap: 3px; min-width: 50px; padding: 6px 8px; }
.shop-btn small { font: 700 12px/1 var(--f-pixel); color: #5a3d10; font-variant-numeric: tabular-nums; }
.shop-btn small::before {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 3px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b8, #f0b93a 55%, #a8721c); box-shadow: 0 0 0 1px #5a3d10;
}
.shop-btn:disabled { filter: grayscale(0.9) brightness(0.6); cursor: not-allowed; }
.shop-btn.is-confirming { background: linear-gradient(#ffb09a, #d8573d); }

.shop-grid { margin: 0 0 10px; }
.shop-grid .bag-cell .price {
  position: absolute; left: 2px; top: 1px; text-decoration: none;
  font: 700 10px/1 var(--f-pixel); color: #ffd76a; text-shadow: 0 0 2px #000, 1px 1px 0 #000;
}
.shop-detail { min-height: 84px; }
.shop-detail .bag-head span b { margin-left: 2px; }
.shop-note { margin: 0; font-size: 13px; color: #ffc94a; }
body.shop-open #help { visibility: hidden; }

/* ---- the townsfolk ------------------------------------------------------------ */
#scene.is-over-npc { cursor: pointer; }
.npc-label { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.npc-label b, .npc-label small {
  position: absolute; left: 0; transform: translateX(-50%); white-space: nowrap;
  text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000, 0 2px 4px #000;
}
.npc-label b { bottom: 17px; font: 700 14px/1 var(--f-display); letter-spacing: 0.03em; color: #f6eed8; }
.npc-label small { bottom: 3px; font: 700 11px/1 var(--f-display); letter-spacing: 0.1em; text-transform: uppercase; color: #cfc6a8; }
.npc-label.is-shop small { color: #ffd76a; }
.npc-label.is-hover b, .npc-label.is-trading b { color: #ffe9a8; }
.npc-label p {
  position: absolute; left: 0; bottom: 38px; transform: translateX(-50%);
  width: max-content; max-width: 250px; margin: 0; padding: 7px 11px; border-radius: 9px;
  background: rgba(248, 240, 218, 0.97); color: #2a2118; border: 1px solid #1b140f;
  font: 500 13.5px/1.3 var(--f-body); text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: say-in 0.18s ease-out 1;
}
.npc-label p::after {
  content: ''; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px; margin-left: -5px;
  background: rgba(248, 240, 218, 0.97); border-right: 1px solid #1b140f; border-bottom: 1px solid #1b140f; transform: rotate(45deg);
}
@keyframes say-in { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%); } }
#log .tone-npc { color: #e9d7a0; }

@media (max-width: 760px) {
  #shop { top: 12px; bottom: 84px; max-height: none; }
  .shop-who img { width: 56px; height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  #shop-gold.is-up, #shop-gold.is-down, .npc-label p { animation: none; }
}
