/* UI v5 (owner 3 Oct: "ui เอฟเฟคกากมาก ทำใหม่เหอะ"; 16 Oct "ทำเสร็จยัง"): the combat controls as pixel-art jewels and
   the bars as sunken gauges. Frames are drawn in tools/art/ui5.mjs (one art pixel = two CSS pixels at the normal
   sizes); this file only dresses what style.css, pvp.css and pvp-modes.css place, so every position stays theirs. */

/* ------------------------------------------------------------ the buttons: a metal rim round a sunken socket */
.skills button {
  isolation: isolate;
  border: 0;
  background: url('../assets/ui5-skill.png') center / 100% 100% no-repeat;
  box-shadow: 0 3px 0 rgba(18, 12, 22, 0.5);
  image-rendering: pixelated;
}

.skills .skill {
  overflow: visible;
}

.skills .skill.locked {
  border: 0;
  background: url('../assets/ui5-skill-locked.png') center / 100% 100% no-repeat;
  box-shadow: 0 3px 0 rgba(18, 12, 22, 0.35);
}

.skills .attack {
  border: 0;
  background: url('../assets/ui5-attack.png') center / 100% 100% no-repeat;
}

.skills .attack img {
  filter: drop-shadow(0 2px 0 rgba(10, 4, 8, 0.8));
}

.skills .skill-swap {
  border: 0;
  background: url('../assets/ui5-swap.png') center / 100% 100% no-repeat;
  color: #c8fff2;
  text-shadow: 0 1px 0 #06201e;
}

.skills .skill-swap.ready {
  box-shadow: 0 3px 0 rgba(18, 12, 22, 0.5), 0 0 12px rgba(95, 224, 200, 0.95);
}

.skills .pvp-dodge {
  border: 0;
  background: url('../assets/ui5-dodge.png') center / 100% 100% no-repeat;
}

.skills .pvp-bash {
  border: 0;
  background: url('../assets/ui5-bash.png') center / 100% 100% no-repeat;
}

/* the icon sits in the socket and reads on the dark */
.skills .skill img {
  filter: drop-shadow(0 1px 0 rgba(10, 4, 8, 0.9));
}

/* recovering: the shadow sweeps round inside the socket only, and the seconds stand out on it */
.skills .skill .cd,
.skills .pvp-move .cd {
  inset: 18%;
  background: conic-gradient(rgba(8, 4, 12, 0.72) calc(var(--cd, 0) * 360deg), transparent 0);
}

.skills .skill .t {
  font-size: 21px;
  color: #fff6d8;
  text-shadow:
    0 2px 0 #120c16,
    2px 0 0 #120c16,
    -2px 0 0 #120c16,
    0 -2px 0 #120c16,
    0 0 6px rgba(0, 0, 0, 0.6);
}

/* the key: a small dark plaque with a gold edge, hanging on the bottom of the rim */
.skills .skill small {
  bottom: -5px;
  padding: 0 4px;
  border: 1px solid #c8901a;
  border-radius: 4px;
  background: #1a1220;
  color: #ffe680;
}

.skills .skill small.lock {
  border-color: #605e70;
  color: #d8d6e6;
}

/* the moment a skill is ready again: a ring of light opens round it */
.skills .skill.fresh {
  animation: ui5-fresh 0.45s ease-out;
}

@keyframes ui5-fresh {
  0% {
    box-shadow: 0 3px 0 rgba(18, 12, 22, 0.5), 0 0 0 0 rgba(255, 240, 180, 0.95);
  }

  100% {
    box-shadow: 0 3px 0 rgba(18, 12, 22, 0.5), 0 0 0 14px rgba(255, 240, 180, 0);
  }
}

.skills button.pressed {
  animation: ui5-press 0.18s ease-out;
}

@keyframes ui5-press {
  40% {
    transform: scale(0.88);
    filter: brightness(1.35);
  }
}

/* ------------------------------------------------------------ the ultimate: a gold crown; full, it burns */
.skills .skill.ult {
  border: 0;
  background: none;
  box-shadow: none;
}

.skills .skill.ult::before {
  content: '';
  position: absolute;
  inset: -14.3%;
  z-index: -1;
  background: url('../assets/ui5-ult.png') center / 100% 100% no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 0 rgba(18, 12, 22, 0.5));
  pointer-events: none;
}

/* the gauge darkens the part of the rim not yet filled; the filled part is the bright gold */
.skills .skill .gauge {
  inset: 0;
  background: conic-gradient(transparent calc(var(--g, 0) * 360deg), rgba(18, 10, 20, 0.62) 0);
  -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%, #000 92%, transparent 93%);
  mask: radial-gradient(circle, transparent 62%, #000 63%, #000 92%, transparent 93%);
}

.skills .skill.ult.ready {
  animation: none;
}

.skills .skill.ult.ready::after {
  content: '';
  position: absolute;
  inset: -28.6%;
  z-index: -2;
  background: url('../assets/ui5-ult-flame.png') 0 0 / 400% 100% no-repeat;
  image-rendering: pixelated;
  animation: ui5-flame 0.36s steps(4) infinite;
  pointer-events: none;
}

@keyframes ui5-flame {
  to {
    background-position: 133.333% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skills .skill.ult.ready::after {
    animation: none;
  }
}

/* ------------------------------------------------------------ the bars: sunken gauges with a lit fill */
.bar {
  border: 2px solid #2b1f2e;
  border-radius: 4px;
  background: #3a2f45;
  box-shadow: inset 0 2px 0 rgba(10, 4, 14, 0.45), 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* (a bright top band, the colour, a darker bottom band: hard stops, so it reads as pixels) */
.bar i {
  position: relative;
  z-index: 1;
  background: linear-gradient(#c8f08a 0 26%, #6dbb4f 26% 68%, #458a41 68%);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.55);
}

.bar.adv i {
  background: linear-gradient(#e4d2ff 0 26%, #9a74e6 26% 68%, #6a46b8 68%);
}

.bar.hp i,
.bossbar .bar i {
  background: linear-gradient(#ffb0a0 0 26%, #e0473a 26% 68%, #a82a22 68%);
}

/* what was just lost stays a moment in pale gold behind the fill, then runs down to it */
.bar.hp::before,
.bossbar .bar::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--lag, 0%);
  background: #ffe6a0;
  transition: width 0.45s ease 0.3s;
}

.bar span {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1;
  white-space: nowrap;
  color: #fff6e0;
  text-shadow: 0 1px 0 #120c16, 1px 0 0 #120c16, -1px 0 0 #120c16, 0 -1px 0 #120c16;
}

.bar.hp {
  height: 14px;
}

.bossbar .bar {
  border-color: #2b1f2e;
  background: #2a1418;
  box-shadow: inset 0 2px 0 rgba(10, 4, 14, 0.45), 0 0 0 2px #c8901a;
}

/* ------------------------------------------------------------ โหมดสู้'s button in the same metal */
/* off: the bronze jewel; up: the gold-and-ruby one, glowing; coming down: amber; not here or not yet: iron */
.flag-btn {
  border: 0;
  background: url('../assets/ui5-skill.png') center / 100% 100% no-repeat;
  box-shadow: 0 4px 0 rgba(18, 12, 22, 0.45);
  image-rendering: pixelated;
}

.flag-btn > img {
  filter: drop-shadow(0 1px 0 rgba(10, 4, 8, 0.9));
}

.flag-label {
  color: #ffe680;
  text-shadow: 0 1px 0 #120c16, 1px 0 0 #120c16, -1px 0 0 #120c16, 0 -1px 0 #120c16;
}

.flag-btn.on {
  border: 0;
  background: url('../assets/ui5-attack.png') center / 100% 100% no-repeat;
}

.flag-btn.on .flag-label,
.flag-btn.leaving .flag-label {
  color: #fff;
  text-shadow: 0 1px 0 #3a0610, 1px 0 0 #3a0610, -1px 0 0 #3a0610, 0 -1px 0 #3a0610;
}

.flag-btn.leaving {
  border: 0;
  background: url('../assets/ui5-bash.png') center / 100% 100% no-repeat;
}

.flag-btn.safe,
.flag-btn.low,
.flag-btn.wound {
  border: 0;
  background: url('../assets/ui5-skill-locked.png') center / 100% 100% no-repeat;
}

.flag-btn.safe .flag-label,
.flag-btn.low .flag-label,
.flag-btn.wound .flag-label {
  color: #d8d6e6;
}

/* ============================================================ step 2: the rest of the HUD in the same bronze */
/* A lit metal rim (bright at the top left, dark at the bottom right, like the jewels) with a dark outline round it,
   drawn as a gradient on the border box under the face, so no size or position changes. */
:root {
  --rim: linear-gradient(150deg, #fff1c2 0%, #f2c46a 16%, #cf9440 38%, #9c6428 64%, #6a3d18 100%);
  --rim-gold: linear-gradient(150deg, #fffbe0 0%, #ffe680 16%, #f2c23a 40%, #c8901a 66%, #8a5a0c 100%);
  --outline-ring: 0 0 0 2px #120c16;
  --drop: 0 4px 0 rgba(18, 12, 22, 0.42);
}

.card,
.menu button,
.chat form button,
.place,
.clock,
.flag-board {
  border-color: transparent;
  background: linear-gradient(var(--face, var(--paper)), var(--face, var(--paper))) padding-box, var(--rim) border-box;
  box-shadow: var(--outline-ring), inset 0 2px 0 rgba(255, 255, 255, 0.55), var(--drop);
}

.card {
  border-radius: 10px;
}

.quest {
  --face: #fff8e1;
  background: linear-gradient(var(--face), var(--face)) padding-box, var(--rim-gold) border-box;
}

.menu button {
  border-radius: 10px;
}

.menu button:hover {
  --face: #fffaf0;
  filter: brightness(1.04);
}

.menu button:active {
  box-shadow: var(--outline-ring), inset 0 2px 0 rgba(255, 255, 255, 0.55), 0 1px 0 rgba(18, 12, 22, 0.42);
}

.place.home {
  --face: var(--green-light);
}

/* the item bar: a dark bronze-framed tray of sockets, like the skills' */
.hotbar {
  border-color: transparent;
  background: linear-gradient(#2a1d24, #1d1418) padding-box, var(--rim) border-box;
  box-shadow: var(--outline-ring), inset 0 2px 0 rgba(255, 241, 194, 0.25), var(--drop);
}

.slot {
  border: 2px solid #120c16;
  border-radius: 8px;
  background: radial-gradient(circle at 60% 70%, #54477a 0%, #3a3058 38%, #2a2244 70%, #1d1630 100%);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 0 1px #9c6428;
}

.slot.on {
  border-color: #120c16;
  background: radial-gradient(circle at 60% 70%, #7a6aa8 0%, #54477a 40%, #3a3058 100%);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 2px #f2c23a, 0 0 10px rgba(255, 207, 58, 0.75);
}

.slot img {
  filter: drop-shadow(0 1px 0 rgba(10, 4, 8, 0.85));
}

.slot .n {
  color: #fff6e0;
  text-shadow: 0 1px 0 #120c16, 1px 0 0 #120c16, -1px 0 0 #120c16, 0 -1px 0 #120c16;
}

.slot .key {
  color: #ffe680;
  text-shadow: 0 1px 0 #120c16;
}

/* the bait: a socket of its own, set a little apart, teal like water */
.slot.bait {
  border-style: solid;
  background: radial-gradient(circle at 60% 70%, #5fe0c8 0%, #1f8070 30%, #13574f 65%, #0c3a36 100%);
}

/* the yard's button beside the bar: a green socket, its word light on it */
.yardslot {
  border-color: #120c16;
  background: radial-gradient(circle at 60% 70%, #b5e878 0%, #6dbb4f 30%, #3e7d3a 65%, #2a5a33 100%);
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.35), 0 0 0 1px #9c6428, 0 3px 0 rgba(18, 12, 22, 0.42);
}

.yardslot small {
  color: #fff6e0;
  text-shadow: 0 1px 0 #120c16, 1px 0 0 #120c16, -1px 0 0 #120c16, 0 -1px 0 #120c16;
}

/* the level badge inside the adventure bar keeps its own colours, without the bar's outline */
.bar span .alv {
  text-shadow: none;
}

/* แรงฮึด on a small screen: the numbers alone, one tight line (with Level 999 on the card grew onto the chat button
   and the clock) */
@media (max-height: 520px), (max-width: 400px) {
  #me-vigor {
    margin-top: 1px;
    padding: 0 6px 0 3px;
    font-size: 10px;
    line-height: 13px;
  }

  #me-vigor .word {
    display: none;
  }

  #me-vigor .icon {
    width: 12px;
    height: 12px;
  }
}

/* a very short screen on its side, fighting: the farm's EXP bar (it does not move in a fight) gives its row up */
@media (max-height: 400px) {
  body.fighting .me .bar.farm {
    display: none;
  }
}

/* ------------------------------------------------------------ the world map (the owner's picture, js/ui/map.js) */
.worldmap-wrap {
  margin: 0 0 12px;
}

.worldmap {
  position: relative;
  margin: 0;
  border: 3px solid transparent;
  border-radius: 10px;
  background: var(--rim) border-box;
  box-shadow: var(--outline-ring), var(--drop);
  overflow: hidden;
}

.worldmap img {
  display: block;
  width: 100%;
  height: auto;
}

.wm-pins {
  position: absolute;
  inset: 0;
}

/* a place: over its name drawn on the picture (only its badge shows), or a label of its own where it has none */
.wm-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
}

.wm-pin.drawn {
  width: 11%;
  height: 5.5%;
  justify-content: flex-end;
}

.wm-pin.drawn:hover,
.wm-pin.drawn:focus-visible {
  outline: 2px solid #ffe680;
  outline-offset: 1px;
  border-radius: 6px;
}

.wm-pin.label span {
  padding: 1px 7px;
  border: 2px solid #4f3224;
  border-radius: 7px;
  background: #fdf3d8;
  color: #4a2f23;
  font-size: clamp(9px, 1.4vw, 12px);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(18, 12, 22, 0.4);
}

.wm-pin.lair {
  width: 9%;
  height: 4.5%;
}

.wm-pin.lair:hover,
.wm-pin.lair:focus-visible {
  outline: 2px solid #ff8a6a;
  border-radius: 6px;
}

.wm-badge {
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 2px solid #120c16;
  border-radius: 8px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transform: translate(40%, -40%);
}

.wm-pin.label .wm-badge {
  transform: none;
}

.wm-badge.go { background: #6dbb4f; color: #fff; }
.wm-badge.walk { background: #fdf3d8; color: #4a2f23; }
.wm-badge.locked { background: #3a3058; }
.wm-badge.locked img { width: 10px; height: 10px; }
.wm-badge.soon { background: rgba(26, 18, 32, 0.8); color: #ffe680; }
.wm-badge.here { background: #e0473a; color: #fff; animation: wm-here 1s ease-in-out infinite alternate; }

@keyframes wm-here {
  to { box-shadow: 0 0 0 4px rgba(224, 71, 58, 0.35); }
}

/* what a tap tells, under the picture */
.wm-info {
  margin-top: 8px;
  padding: 8px 10px;
  border: 2px solid #c8901a;
  border-radius: 10px;
  background: #fff8e1;
}

.wm-info p {
  margin: 4px 0;
  font-size: 13px;
}

.wm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.wm-head > b:first-child {
  font-size: 16px;
}

.wm-head small {
  color: var(--ink-soft);
  font-weight: 700;
}

.wm-head .btn,
.wm-head .soon,
.wm-head .here {
  margin-left: auto;
}

.wm-head .soon {
  color: #8a5a0c;
}

/* the maps of the game on the world map: a chip with the name, green = warp there, red = here, grey = locked */
.wm-chip {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 1px 3px 1px 7px;
  border: 2px solid #120c16;
  border-radius: 8px;
  background: #fdf3d8;
  box-shadow: 0 2px 0 rgba(18, 12, 22, 0.45);
  color: #4a2f23;
  font: inherit;
  font-size: clamp(9px, 1.5vw, 12px);
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
}

.wm-chip b {
  font-weight: 800;
}

.wm-chip small {
  padding: 0 5px;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 800;
}

.wm-chip.go {
  background: linear-gradient(#8fe07a, #4f9e3c);
  color: #fff;
  text-shadow: 0 1px 0 #1f4a18;
  animation: wm-go 1.6s ease-in-out infinite alternate;
}

.wm-chip.go small {
  background: #fff6c8;
  color: #2f5a22;
  text-shadow: none;
}

.wm-chip.go:hover,
.wm-chip.go:focus-visible {
  filter: brightness(1.12);
  transform: translate(-50%, -50%) scale(1.08);
}

@keyframes wm-go {
  to { box-shadow: 0 2px 0 rgba(18, 12, 22, 0.45), 0 0 0 3px rgba(143, 224, 122, 0.55); }
}

.wm-chip.here {
  background: linear-gradient(#ff8a7a, #c8281e);
  color: #fff;
  text-shadow: 0 1px 0 #5a0a06;
}

.wm-chip.here small {
  background: #fff;
  color: #a8180e;
  text-shadow: none;
}

.wm-chip.locked {
  background: #c8bccc;
  color: #3a3058;
}

.wm-chip.locked small {
  background: #3a3058;
  color: #fff;
}

.wm-chip.locked img {
  width: 12px;
  height: 12px;
}

/* a map opened lately, not visited yet */
.wm-new {
  position: absolute;
  top: -11px;
  right: -8px;
  padding: 0 4px;
  border: 1.5px solid #120c16;
  border-radius: 5px;
  background: #ffd23a;
  color: #8a1a0c;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
  text-shadow: none;
  transform: rotate(8deg);
}

/* the big warp button in the box under the map */
.wm-head .wm-warp {
  margin-left: auto;
  min-height: 40px;
  padding: 4px 18px;
  font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
  .wm-chip.go {
    animation: none;
  }
}

/* a narrow screen: the colour says "warp", so the green chips drop their little word to stay short */
@media (max-width: 480px) {
  .wm-chip.go small,
  .wm-chip.home small {
    display: none;
  }

  .wm-chip {
    padding: 1px 6px;
  }
}

/* back to my farm: a big button over the world map, and a chip on the farms of the picture */
.worldmap-wrap .wm-home {
  display: flex;
  width: 100%;
  margin: 0 0 8px;
  min-height: 42px;
  border-color: #8a5a0c;
  background: linear-gradient(#ffe680, #f2c23a);
  color: #4a2f05;
  font-size: 15px;
  font-weight: 800;
}

.wm-chip.home {
  background: linear-gradient(#ffe680, #e0a32a);
  color: #4a2f05;
}

.wm-chip.home small {
  background: #fff6c8;
  color: #6a4a08;
}

.wm-chip.home img {
  width: 12px;
  height: 12px;
}
