/* 金財宮 V5: original HUD refinement. Load after community.css and i18n.css.
   Scope is the temple wordmark + top HUD; game sheets, camera and hit logic stay intact.
   Font: renamed three-glyph TW-Kai derivative, OFL-1.1; see fonts/jincai-temple-kai-OFL.txt. */
@font-face {
  font-family: "Jincai Temple Kai";
  src: url("fonts/jincai-temple-kai-v5.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  unicode-range: U+5BAE, U+8CA1, U+91D1;
}
:root { --temple-wordmark: "Jincai Temple Kai", "Kaiti TC", "STKaiti", "KaiTi", serif; }
.hud-top {
  z-index: 8;
  isolation: isolate;
  gap: 14px;
  padding-bottom: 10px;
}
.hud-top::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 -18px;
  background: linear-gradient(180deg, #2416118c, #2416112b 70%, transparent);
  pointer-events: none;
}
.hud-top .brand {
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  gap: 9px;
  padding: 5px 11px 5px 6px;
  border: 1px solid #d0ae6f80;
  border-radius: 5px;
  background: linear-gradient(110deg, #372019ed, #5b2d22d9);
  box-shadow: 0 3px 14px #190e1226, inset 0 0 0 2px #23150c30;
}
.hud-top .brand .seal { width: 38px; height: 38px; }
.hud-top .brand > div:last-child { min-width: 0; }
.hud-top .brand b {
  font-family: var(--temple-wordmark);
  font-size: 32px;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.08;
  letter-spacing: .08em;
  white-space: nowrap;
  color: #f6dea6;
  text-shadow: 0 1px 1px #160b07;
}
.hud-top .brand small {
  display: block;
  color: #e5cba1;
  font: 11px/1.45 var(--body);
  letter-spacing: .1em;
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
  text-shadow: none;
}
.gate-card .vert {
  font-family: var(--temple-wordmark);
  font-weight: 400;
  font-synthesis: none;
  letter-spacing: .16em;
  margin-right: -.16em;
}
.hud-top .tools { gap: 6px; }
.hud-top .tools .tbtn {
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid #bfa16e;
  border-radius: 8px;
  background: #f8efddf5;
  color: #56392c;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: normal;
  box-shadow: 0 2px 6px #21120e20;
  touch-action: manipulation;
}
.hud-top .tools .tbtn:hover { background: #fff7e7; border-color: #915642; color: #713527; }
.hud-top .tools .tbtn:active { background: #edddc3; }
.hud-top .tools .tbtn[aria-pressed="true"] { border-color: #9c4b36; background: #f1ddbb; color: #6d281d; }
.hud-top .tools .tbtn:focus-visible,
.hud-top #liveCoin:focus-visible { outline: 3px solid #f3d086; outline-offset: 2px; }
.hud-top .live { align-items: center; gap: 4px; }
.hud-top .live span,
.hud-top .live button {
  box-sizing: border-box;
  border-radius: 5px;
  border: 1px solid #c1a777;
  padding: 3px 6px;
  background: #f7eddaed;
  color: #49372a;
  font: 12px/1.4 var(--body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  box-shadow: 0 2px 6px #23170c16;
}
.hud-top #liveCoin { min-height: 44px; }

@media (max-width: 600px) {
  .hud-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    grid-template-areas: "brand tools" "live tools" "progress progress";
    align-items: start;
    gap: 4px 10px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-bottom: 6px;
  }
  /* This wrapper is a non-semantic div. Keep the DOM/event targets and reading order. */
  .hud-top .brand-col { display: contents; }
  .hud-top .brand { grid-area: brand; pointer-events: auto; align-self: center; gap: 7px; padding: 4px 9px 4px 5px; }
  .hud-top .brand .seal { width: 32px; height: 32px; }
  .hud-top .brand b { font-size: 31px; letter-spacing: .07em; }
  .hud-top .brand small { font-size: 11px; line-height: 1.4; letter-spacing: .04em; }
  .hud-top .tools {
    grid-area: tools;
    display: grid;
    grid-template-columns: repeat(2, 48px);
    grid-auto-rows: minmax(44px, auto);
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    flex: none;
    gap: 4px;
    align-self: start;
    justify-content: start;
    pointer-events: auto;
  }
  .hud-top .tools .tbtn { width: 48px; min-height: 44px; padding: 4px 3px; font-size: 13px; line-height: 1.15; }
  /* 音声 オフ / 소리 꺼짐 may wrap at their existing space; no ellipsis or tiny type. */
  .hud-top .live {
    grid-area: live;
    pointer-events: auto;
    min-width: 0;
    max-width: none;
    display: flex;
    flex-wrap: nowrap;
    align-self: start;
    gap: 3px 4px;
  }
  .hud-top .live span,
  .hud-top .live button { font-size: 12px; padding: 3px 5px; }
  /* Keep the wallet beside the status. Long translated status wraps inside its
     own flexible cell, rather than pushing the entire wallet to another row. */
  .hud-top #liveHere {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 44px;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }
  .hud-top #liveHere .dot { flex: 0 0 6px; }
  .hud-top #liveCoin { flex: 0 0 auto; min-width: 44px; min-height: 44px; white-space: nowrap; }
  .hud-top #liveIncense { flex: 0 0 auto; }
  .hud-top .prog {
    grid-area: progress;
    pointer-events: auto;
    width: auto;
    max-width: 100%;
    min-width: 0;
    margin-top: 2px;
    flex-wrap: wrap;
  }
}
@media (max-width: 359px) {
  .hud-top { grid-template-columns: minmax(0, 1fr) 92px; column-gap: 8px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .hud-top .tools { width: 92px; min-width: 92px; max-width: 92px; grid-template-columns: repeat(2, 44px); }
  .hud-top .tools .tbtn { width: 44px; padding-inline: 2px; }
  .hud-top .brand b { font-size: 29px; }
  .hud-top .brand .seal { width: 28px; height: 28px; }
}
@media (prefers-reduced-transparency: reduce) {
  .hud-top .brand { background: #44251d; }
  .hud-top .tools .tbtn, .hud-top .live span, .hud-top .live button { background: #f8efdd; }
}
