/* ui-polish.css — slim stone/gold HUD, compact upgrade strip, pause, bounce+shine, win stars.
   Loaded last. Visual / HUD only; does not change game rules. */

/* ---- slim full-width top bar ---- */
#hud {
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  padding: 0 8px 0 10px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom: 2px solid #c9a24a;
  box-shadow: 0 0 0 1px #7a5a20, 0 2px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.25);
  z-index: 12;
  font-size: 14px;
  letter-spacing: 0.04em;
  box-sizing: border-box;
}
#hud-level, #hud-coins { min-width: 0; white-space: nowrap; color: #f4ecd4; }
#hud-upgrades { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-shrink: 1; overflow: hidden; }
.upg-icon {
  width: 22px;
  height: 22px;
  font-size: 11px;
  border-radius: 5px;
  flex: 0 0 auto;
}
#btn-level-prev, #btn-level-next { display: none !important; }
#btn-pause {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  margin-left: 6px;
  padding: 0;
  border: 2px solid #c9a24a;
  border-radius: 6px;
  background: #3f3c36;
  color: #e6c56a;
  box-shadow: 0 2px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.25);
  font: 700 13px Cinzel, Palatino, serif;
  letter-spacing: 0;
  cursor: pointer;
  line-height: 1;
}
#btn-pause:focus { outline: none; }

#word-list { top: 40px; }

/* ---- compact upgrade strip: no map overlay, sits just above the docks ---- */
#upgrade-popup {
  position: fixed !important;
  top: calc(52px + 54%) !important;
  left: 6px !important;
  right: 6px !important;
  bottom: auto !important;
  z-index: 14;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: none !important;
  pointer-events: none;
  padding: 2px 0 0;
  width: auto;
  height: auto;
}
#upgrade-popup.hidden { display: none !important; }
#upgrade-popup .upgrade-card {
  pointer-events: auto;
  width: 100%;
  max-width: 378px;
  min-width: 0 !important;
  padding: 5px 6px 6px !important;
  margin: 0;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(230, 197, 106, 0.18), rgba(230, 197, 106, 0) 8px),
    linear-gradient(180deg, #5a564c 0%, #3a3832 48%, #2a2824 100%) !important;
  color: #f4ecd4 !important;
  border: 2px solid #c9a24a !important;
  box-shadow: 0 0 0 1px #7a5a20, 0 3px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.25) !important;
  border-radius: 8px;
  filter: none !important;
  opacity: 1 !important;
}
#upgrade-popup .upgrade-card h2 { display: none; }
#upgrade-word {
  font-family: Cinzel, Palatino, serif;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #e6c56a !important;
  margin: 0 0 4px !important;
  line-height: 1.2;
  text-transform: uppercase;
}
.upgrade-choices {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
  margin-top: 0;
}
button.upg-choice {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 0;
  max-width: 122px;
  padding: 4px 4px 5px;
  border: 2px solid #c9a24a;
  border-radius: 8px;
  box-shadow: 0 2px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.22);
  color: #1a1020;
  font-family: Cinzel, Palatino, serif;
  font-weight: 700;
  gap: 2px;
  overflow: hidden;
}
button.upg-choice:active { transform: none; box-shadow: 0 1px 0 #1a1814; }
.upg-choice .ico {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #1a1020;
  font-size: 12px;
  flex: 0 0 auto;
}
.upg-choice .name {
  font-size: 11px;
  line-height: 1.15;
  color: #1a1020;
}
.upg-choice .hint {
  font-size: 9px;
  line-height: 1.15;
  font-weight: 600;
  color: #1a1020;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* When the strip is open, nudge docks down so letters stay clear. */
body.upgrade-open #slots { transform: translate(-50%, var(--upg-shift, 88px)); }
body.upgrade-open #queue { transform: translateX(-50%) translateY(var(--upg-shift, 88px)); }

/* ---- pause menu: small stone card, light dim ---- */
#pause-menu {
  position: fixed;
  inset: 0;
  z-index: 16;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 8, 0.28);
}
#pause-menu.hidden { display: none; }
#pause-menu .pause-card {
  min-width: 200px;
  padding: 16px 18px 14px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(230, 197, 106, 0.2), rgba(230, 197, 106, 0) 12px),
    linear-gradient(180deg, #5a564c 0%, #3a3832 48%, #2a2824 100%);
  border: 2px solid #c9a24a;
  border-radius: 10px;
  box-shadow: 0 0 0 1px #7a5a20, 0 4px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.25);
}
#pause-menu h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #e6c56a;
  letter-spacing: 0.08em;
}
#pause-menu .pause-actions { display: flex; flex-direction: column; gap: 8px; }
#pause-menu button,
#popup button {
  font-family: Cinzel, Palatino, serif;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border: 2px solid #c9a24a;
  border-radius: 8px;
  background: #3f3c36;
  color: #f4ecd4;
  box-shadow: 0 2px 0 #1a1814, inset 0 1px 0 rgba(255, 230, 170, 0.22);
  cursor: pointer;
}
#btn-resume { color: #e6c56a; }

/* ---- bouncy press + gold shine on every button ---- */
button {
  position: relative;
  overflow: hidden;
  transform-origin: center center;
}
button.is-press {
  animation: btn-bounce 0.28s cubic-bezier(0.2, 1.5, 0.35, 1);
}
@keyframes btn-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(0.88); }
  70% { transform: scale(1.07); }
  100% { transform: scale(1); }
}
button.is-press::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 224, 140, 0.75) 50%, transparent 65%);
  background-size: 220% 100%;
  background-repeat: no-repeat;
  animation: gold-sweep 0.36s ease-out;
}
@keyframes gold-sweep {
  from { background-position: 140% 0; }
  to { background-position: -80% 0; }
}

/* ---- win stars + coin count-up ---- */
#win-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 8px 0 4px;
  min-height: 36px;
}
#win-stars.hidden { display: none; }
#win-stars .star {
  font-size: 28px;
  line-height: 1;
  color: #3a3832;
  text-shadow: 0 1px 0 #1a1814;
  opacity: 0;
  transform: scale(0.3);
}
#win-stars.pop .star { animation: star-pop 0.42s cubic-bezier(0.2, 1.5, 0.35, 1) forwards; }
#win-stars.pop .star:nth-child(1) { animation-delay: 0.05s; }
#win-stars.pop .star:nth-child(2) { animation-delay: 0.28s; }
#win-stars.pop .star:nth-child(3) { animation-delay: 0.51s; }
#win-stars .star.on { color: #e6c56a; text-shadow: 0 0 8px rgba(230, 197, 106, 0.65), 0 2px 0 #1a1814; }
@keyframes star-pop {
  0% { opacity: 0; transform: scale(0.3) rotate(-18deg); }
  70% { opacity: 1; transform: scale(1.18) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
#win-coins {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #e6c56a;
  letter-spacing: 0.06em;
}
#win-coins.hidden { display: none; }
