@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,560;9..144,700&family=Nunito:wght@600;700;800&display=swap");

/* Shared Claire's Room HUD palette — keep in sync with room-hud.css */
.bh-root {
  --cr-cream: #f7ecd6;
  --cr-cream-2: #efe0c0;
  --cr-parchment: #fbf6ea;
  --cr-ink: #3b2a1c;
  --cr-ink-soft: #6d5340;
  --cr-amber: #e59a2d;
  --cr-amber-bright: #f5a524;
  --cr-amber-deep: #8a5514;
  --cr-pink: #d39298;
  --cr-pink-deep: #b56870;
  --cr-rose: #f3ddd8;
  --cr-hp: #c45b5b;
  --cr-hp-empty: #e4d2b8;
  --cr-wood: #6b4a2e;
  --cr-shadow: 0 12px 32px rgba(59, 42, 28, 0.26);
  --cr-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --cr-sans: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  --bh-dock-h: 168px;

  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  color: var(--cr-ink);
  font-family: var(--cr-sans);
  -webkit-font-smoothing: antialiased;
  opacity: 1;
  visibility: visible;
  overflow: hidden;
  transition: opacity 280ms ease, visibility 280ms ease;
}

.bh-root *,
.bh-root *::before,
.bh-root *::after { box-sizing: border-box; }

.bh-root.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bh-plate,
.bh-dock,
.bh-round,
.bh-banner-inner,
.bh-move {
  pointer-events: auto;
}

/* paper grain */
.bh-plate,
.bh-dock,
.bh-round,
.bh-banner-inner {
  background-color: var(--cr-parchment);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%),
    radial-gradient(circle at 15% 20%, rgba(243, 221, 216, 0.55), transparent 46%),
    repeating-linear-gradient(90deg, rgba(107, 74, 46, 0.025) 0 1px, transparent 1px 3px);
  border: 1.5px solid rgba(138, 85, 20, 0.45);
  box-shadow:
    var(--cr-shadow),
    inset 0 0 0 3px rgba(247, 236, 214, 0.9),
    inset 0 0 0 5px rgba(213, 146, 152, 0.28);
}

.bh-plate {
  position: absolute;
  width: min(320px, calc(100% - 32px));
  padding: 12px 14px 11px;
  border-radius: 18px;
}

.bh-plate-beans { top: 18px; left: 18px; }
.bh-plate-claire { right: 18px; bottom: calc(var(--bh-dock-h) + 20px); }

.bh-plate-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.bh-name {
  margin: 0;
  font-family: var(--cr-serif);
  font-optical-sizing: auto;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--cr-ink);
}

.bh-who {
  font-family: var(--cr-sans);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cr-pink-deep);
}

.bh-hp-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bh-hp-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--cr-amber-deep);
  flex: 0 0 auto;
}

.bh-bar {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: var(--cr-hp-empty);
  box-shadow: inset 0 1px 3px rgba(59, 42, 28, 0.2);
  overflow: hidden;
  position: relative;
}

.bh-bar-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.35), transparent 55%),
    linear-gradient(90deg, #d9898c, var(--cr-hp) 55%, #a9444a);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 360ms ease;
}

.bh-hearts {
  display: flex;
  gap: 3px;
  margin-top: 8px;
}

.bh-heart {
  width: 16px;
  height: 15px;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
}

.bh-heart svg { display: block; width: 16px; height: 15px; }
.bh-heart .bh-heart-fill { fill: var(--cr-hp); }
.bh-heart .bh-heart-edge { fill: rgba(247, 236, 214, 0.55); stroke: var(--cr-amber-deep); stroke-width: 1.15; }
.bh-heart-fg {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  overflow: hidden;
}
.bh-heart-fg svg { width: 16px; max-width: none; }

.bh-round {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cr-ink-soft);
  white-space: nowrap;
}

.bh-dock {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  border-radius: 22px;
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.bh-say {
  margin: 0;
  min-height: 2.6em;
  padding: 6px 8px 4px;
  font-family: var(--cr-serif);
  font-size: 17px;
  font-weight: 560;
  line-height: 1.35;
  color: var(--cr-ink);
}

.bh-say.is-empty { color: var(--cr-ink-soft); }
.bh-say .bh-caret {
  display: inline-block;
  width: 0.55em;
  color: var(--cr-amber-deep);
  animation: bh-blink 1s steps(1) infinite;
}

.bh-moves {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.bh-move {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 72px;
  min-width: 44px;
  padding: 10px 8px 8px;
  border-radius: 16px;
  border: 1.5px solid rgba(138, 85, 20, 0.55);
  background:
    linear-gradient(180deg, #fffaf0 0%, #f3e0bf 100%);
  box-shadow:
    0 3px 0 #8a5514,
    0 8px 16px rgba(59, 42, 28, 0.16);
  color: var(--cr-ink);
  font-family: var(--cr-sans);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.bh-move:hover:not(:disabled) {
  filter: brightness(1.04);
}

.bh-move:focus-visible {
  outline: 3px solid var(--cr-amber-bright);
  outline-offset: 2px;
}

.bh-move:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 #8a5514,
    0 4px 10px rgba(59, 42, 28, 0.14);
}

.bh-move:disabled {
  cursor: default;
  opacity: 0.48;
  filter: grayscale(0.15);
  box-shadow: 0 1px 0 rgba(138, 85, 20, 0.35);
}

.bh-move-icon {
  width: 36px;
  height: 36px;
  display: block;
}
.bh-move-icon svg { width: 36px; height: 36px; display: block; }
.bh-move-hint {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--cr-ink-soft);
  text-transform: none;
}

.bh-banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at 50% 46%, rgba(26, 18, 12, 0.28), rgba(26, 18, 12, 0.08) 42%, transparent 70%);
}

.bh-banner[hidden] { display: none; }

.bh-banner-inner {
  pointer-events: auto;
  min-width: min(420px, calc(100% - 40px));
  padding: 22px 36px 20px;
  border-radius: 28px;
  text-align: center;
  transform: scale(0.88);
  opacity: 0;
  animation: bh-banner-in 520ms cubic-bezier(0.2, 1.15, 0.32, 1) forwards;
}

.bh-banner-kind {
  display: block;
  font-family: var(--cr-serif);
  font-weight: 700;
  font-size: clamp(42px, 7vw, 72px);
  letter-spacing: 0.08em;
  line-height: 0.95;
  color: var(--cr-amber-deep);
  text-shadow: 0 2px 0 rgba(247, 236, 214, 0.8);
}

.bh-banner.is-win .bh-banner-kind,
.bh-banner.is-victory .bh-banner-kind { color: #9a5f16; }
.bh-banner.is-lose .bh-banner-kind { color: var(--cr-pink-deep); }
.bh-banner.is-tie .bh-banner-kind { color: var(--cr-ink-soft); }

.bh-banner.is-victory .bh-banner-inner {
  box-shadow:
    var(--cr-shadow),
    inset 0 0 0 3px rgba(247, 236, 214, 0.9),
    inset 0 0 0 6px rgba(245, 165, 36, 0.45),
    0 0 0 6px rgba(245, 165, 36, 0.12);
}

.bh-banner-text {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--cr-ink-soft);
}

.bh-banner-text:empty { display: none; }

@keyframes bh-banner-in {
  from { opacity: 0; transform: scale(0.86) translateY(8px); }
  60% { opacity: 1; transform: scale(1.04) translateY(0); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bh-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (min-width: 900px) {
  .bh-move {
    flex-direction: row;
    gap: 14px;
    min-height: 64px;
    padding: 8px 18px;
  }
  .bh-move-hint { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .bh-root,
  .bh-bar-fill,
  .bh-move { transition: none; }
  .bh-banner-inner { animation: none; opacity: 1; transform: none; }
  .bh-say .bh-caret { animation: none; }
}

@media (max-width: 640px) {
  .bh-root { --bh-dock-h: 198px; }
  .bh-plate {
    width: min(220px, calc(100% - 118px));
    padding: 10px 12px 9px;
    border-radius: 16px;
  }
  .bh-plate-beans { top: 12px; left: 12px; }
  .bh-plate-claire { right: 12px; bottom: calc(var(--bh-dock-h) + 12px); }
  .bh-name { font-size: 18px; }
  .bh-round {
    top: 14px;
    left: auto;
    right: 12px;
    transform: none;
    font-size: 10px;
    padding: 6px 10px;
  }
  .bh-dock {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 10px 12px;
    border-radius: 18px;
  }
  .bh-say { font-size: 16px; min-height: 2.7em; }
  .bh-moves { gap: 8px; }
  .bh-move { min-height: 76px; font-size: 11px; letter-spacing: 0.06em; }
  .bh-banner-inner { padding: 18px 20px 16px; border-radius: 22px; }
}


/* Stage 5: compact phone layout so the HUD never covers Claire and Beans (they stand mid-screen) */
@media (max-width: 640px) {
  .bh-root { --bh-dock-h: 128px; }
  .bh-plate { width: calc(50% - 16px); padding: 6px 9px 6px; border-radius: 14px; }
  .bh-plate-beans { top: 8px; left: 8px; }
  .bh-plate-claire { top: 8px; right: 8px; bottom: auto; }
  .bh-name { font-size: 15px; }
  .bh-round { top: 78px; left: 50%; right: auto; transform: translateX(-50%); font-size: 9px; padding: 4px 9px; }
  .bh-dock { left: 8px; right: 8px; bottom: 8px; padding: 6px 8px 8px; gap: 4px; border-radius: 16px; }
  .bh-say { font-size: 13px; min-height: 1.5em; padding: 2px 6px; }
  .bh-moves { gap: 6px; }
  .bh-move { min-height: 52px; font-size: 10px; }
}
@media (max-width: 640px) {
  .bh-say { font-size: 12px; min-height: 1.2em; padding: 0 6px; }
  .bh-move { min-height: 42px; }
  .bh-move svg, .bh-move img { max-height: 18px; }
  .bh-dock { bottom: 6px; padding: 5px 7px 7px; }
}
@media (max-width: 640px) {
  .bh-say { position: fixed; top: 104px; left: 14px; right: 14px; z-index: 5; text-align: center; font-size: 13px; background: rgba(255,248,240,.92); border-radius: 12px; padding: 5px 10px; box-shadow: 0 2px 8px rgba(0,0,0,.25); min-height: 0; }
  .bh-say.is-empty { display: none; }
  .bh-dock { padding: 4px 6px 6px; gap: 0; bottom: 4px; }
  .bh-move { min-height: 40px; }
}
