/* Base look shared by every screen: 蛋蛋大亂鬥 (pastel faceted-gem UI) */
:root {
  --font: "Trebuchet MS", sans-serif;
  --ink: #5a3d7a;        /* dark outline / text on light */
  --cream: #fff8ee;
  --lav: #b9a3ff;
  --peach: #ffb7a1;
  --mint: #a8e6cf;
  --gold: #ffd36e;
  --sky: #9fd8ff;
  --rose: #ff8fab;
  --outline: 0.09em 0 0 var(--ink), -0.09em 0 0 var(--ink), 0 0.09em 0 var(--ink), 0 -0.09em 0 var(--ink),
    0.065em 0.065em 0 var(--ink), -0.065em 0.065em 0 var(--ink), 0.065em -0.065em 0 var(--ink), -0.065em -0.065em 0 var(--ink),
    0 0.16em 0 rgba(90, 61, 122, 0.55);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f3e9ff; touch-action: none; user-select: none; -webkit-user-select: none; }
body { font-family: var(--font); color: var(--ink); }
#app { position: fixed; inset: 0; overflow: hidden; background: linear-gradient(#cfe9ff, #fbe4f1); }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
#fx-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#fade { position: absolute; inset: 0; background: var(--cream); opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
#fade.on { opacity: 1; pointer-events: auto; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; pointer-events: none; }
.screen > * { pointer-events: auto; }
.screen.passthru > * { pointer-events: none; }
.screen.passthru > .tappable, .screen.passthru .tappable { pointer-events: auto; }

/* text */
.t-out { color: #fff; text-shadow: var(--outline); font-weight: 900; letter-spacing: 0.02em; }
.t-ink { color: var(--ink); font-weight: 700; }
.t-title { font-size: 1.7rem; }
.t-big { font-size: 1.25rem; }
.t-mid { font-size: 1rem; }
.t-small { font-size: 0.85rem; }

/* panels: the generated ui-panel as a 9-slice */
.panel {
  border-style: solid; border-width: 1.4rem;
  border-image: url(assets/ui-panel.webp) 24% fill / 1.4rem stretch;
  background-clip: padding-box;
  padding: 0.25rem;
  filter: drop-shadow(0 0.25rem 0 rgba(90, 61, 122, 0.25));
}
.pop-in { animation: popIn 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.slide-up { animation: slideUp 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
.drop-in { animation: dropIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes popIn { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(40%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes dropIn { from { transform: translateY(-120%) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }

/* buttons: the generated ui-button as a 9-slice */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 2.9rem; min-width: 2.9rem; padding: 0 0.6rem;
  border-style: solid; border-width: 0.7rem 1rem;
  border-image: url(assets/ui-button.webp) 30% 18% fill / 0.7rem 1rem stretch;
  background: none; cursor: pointer;
  font-family: var(--font); font-size: 1.05rem; font-weight: 900; color: #fff; text-shadow: var(--outline);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.12s;
  outline: none; white-space: nowrap;
}
.btn:hover, .btn.focus { filter: brightness(1.1) drop-shadow(0 0 0.4rem rgba(255, 240, 160, 0.95)); transform: scale(1.05); }
.btn:active, .btn.pressed { transform: scale(0.92, 0.88); }
.btn.primary { font-size: 1.35rem; min-height: 3.6rem; }
.btn.alt { filter: hue-rotate(95deg) saturate(0.9); }
.btn.alt:hover, .btn.alt.focus { filter: hue-rotate(95deg) saturate(0.9) brightness(1.1) drop-shadow(0 0 0.4rem rgba(255, 240, 160, 0.95)); }
.btn.cool { filter: hue-rotate(200deg); }
.btn.cool:hover, .btn.cool.focus { filter: hue-rotate(200deg) brightness(1.1) drop-shadow(0 0 0.4rem rgba(255, 240, 160, 0.95)); }
.btn[disabled], .btn.disabled { filter: grayscale(0.85) brightness(0.95); opacity: 0.75; }
.btn img.ico { width: 1.4em; height: 1.4em; object-fit: contain; }

/* small square icon buttons (same plate as the pause button) */
.icon-btn {
  width: 2.9rem; height: 2.9rem; min-width: 44px; min-height: 44px; border: none; padding: 0; cursor: pointer;
  background: url(assets/ui-pause.webp) center / 100% 100% no-repeat; position: relative;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.12s;
}
.icon-btn.trophy { background-image: url(assets/ui-trophy.webp); }
.icon-btn:hover, .icon-btn.focus { transform: scale(1.08); filter: brightness(1.1); }
.icon-btn:active { transform: scale(0.9); }

/* gold chip in the HUD */
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.7rem 0.2rem 0.25rem;
  background: rgba(90, 61, 122, 0.55); border: 0.15rem solid rgba(255, 255, 255, 0.7); border-radius: 1.2rem;
  color: #fff; font-weight: 900; font-size: 1.05rem; text-shadow: var(--outline);
}
.chip img { width: 1.7rem; height: 1.7rem; object-fit: contain; }

/* toast + banner */
.toast {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 0.5rem 1rem; border-radius: 1rem;
  background: rgba(90, 61, 122, 0.85); color: #fff; font-weight: 900; font-size: 1rem; text-shadow: var(--outline);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both; white-space: nowrap; pointer-events: none; z-index: 50;
}
.banner {
  position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 2.6rem; font-weight: 900; color: #fff;
  text-shadow: var(--outline); animation: slam 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; pointer-events: none; z-index: 40;
}
@keyframes slam { from { transform: scale(2.4) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(-4deg); opacity: 1; } }

.subtitle {
  position: absolute; left: 6%; right: 6%; bottom: 7%; text-align: center; padding: 0.35rem 0.6rem;
  background: rgba(90, 61, 122, 0.55); border-radius: 0.8rem; z-index: 60; pointer-events: none;
}
.hidden { display: none !important; }
