/* Hex Realm - title, HUD, tile tray and end panel over the canvas (frame.css sets the page and the back link) */
html, body { touch-action: none; }
body { background: #a8dcf0; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
canvas.hr-canvas { position: fixed; inset: 0; width: 100%; height: 100%; }

.hr-fade { position: fixed; inset: 0; z-index: 5; background: #0f1a2e; opacity: 0; pointer-events: none; transition: opacity 0.45s; }
.hr-fade.hr-on { opacity: 1; }

/* title (attract mode) */
.hr-title { position: fixed; inset: 0; z-index: 12; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: calc(7vh + env(safe-area-inset-top)) 16px calc(7vh + env(safe-area-inset-bottom)); text-align: center; opacity: 0; transition: opacity 0.5s; }
.hr-title.hr-show { opacity: 1; }
.hr-title h1 { margin: 0; font-size: clamp(44px, 9vw, 104px); line-height: 1; font-weight: 800; letter-spacing: -0.03em; color: #fff; text-shadow: 0 2px 0 rgb(20 50 70 / 0.35), 0 6px 28px rgb(10 40 60 / 0.55); }
.hr-title h1 span { display: block; margin-top: 10px; font-size: clamp(13px, 1.7vw, 18px); line-height: 1.4; font-weight: 600; letter-spacing: 0.02em; color: rgb(255 255 255 / 0.92); text-shadow: 0 1px 8px rgb(10 40 60 / 0.7); }
.hr-title p { margin: 0; padding: 8px 18px; border-radius: 9999px; background: rgb(15 30 45 / 0.55); font-size: 15px; line-height: 20px; font-weight: 600; color: #fff; animation: hr-pulse 2.2s ease-in-out infinite; }
@keyframes hr-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* HUD */
.hr-hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
.hr-hud.hr-show { opacity: 1; }
.hr-scorebox { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: calc(60px + env(safe-area-inset-right)); text-align: right; text-shadow: 0 1px 8px rgb(10 30 50 / 0.6); }
.hr-score { font-size: 38px; line-height: 40px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.hr-score.hr-pop { animation: hr-pop 0.25s ease-out; }
@keyframes hr-pop { 0% { transform: scale(1.25); } 100% { transform: scale(1); } }
.hr-goal { margin-top: 2px; font-size: 12px; line-height: 16px; font-weight: 600; color: rgb(255 255 255 / 0.9); font-variant-numeric: tabular-nums; }
.hr-goalbar { margin: 4px 0 0 auto; width: 150px; height: 6px; border-radius: 3px; background: rgb(15 30 45 / 0.45); overflow: hidden; }
.hr-goalfill { display: block; width: 100%; height: 100%; background: #ffd66e; transform-origin: 0 50%; transform: scaleX(0); transition: transform 0.3s; }

.hr-mute { position: fixed; z-index: 30; top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid rgb(255 255 255 / 0.2); background: rgb(15 30 45 / 0.55); color: #fff; font-family: inherit; font-size: 17px; line-height: 1; font-weight: 700; cursor: pointer; }
.hr-mute::after { content: ""; position: absolute; left: 7px; right: 7px; top: 17px; height: 2px; border-radius: 1px; background: #fff; transform: rotate(-45deg) scaleX(0); transition: transform 0.15s; }
.hr-mute.hr-off { color: rgb(255 255 255 / 0.5); }
.hr-mute.hr-off::after { transform: rotate(-45deg) scaleX(1); }

.hr-tray { position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 8px 16px 8px 10px; border-radius: 18px; background: rgb(15 30 45 / 0.62); border: 1px solid rgb(255 255 255 / 0.14); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hr-icons { display: flex; align-items: center; gap: 2px; flex: none; }
.hr-icons canvas { display: block; width: 40px; height: 40px; opacity: 0.8; }
.hr-icons canvas.hr-now { width: 64px; height: 64px; opacity: 1; }
.hr-icons canvas.hr-none { visibility: hidden; }
.hr-info { min-width: 0; text-align: left; }
.hr-kind { font-size: 15px; line-height: 20px; font-weight: 700; }
.hr-kind span { white-space: nowrap; margin-left: 8px; font-size: 12px; font-weight: 600; color: #ffd66e; font-variant-numeric: tabular-nums; }
.hr-rule { max-width: 270px; font-size: 12px; line-height: 16px; color: rgb(255 255 255 / 0.82); }

.hr-hint { position: absolute; left: 50%; bottom: calc(108px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 6px 14px; border-radius: 14px; background: rgb(15 30 45 / 0.55); font-size: 13px; line-height: 18px; font-weight: 500; text-align: center; opacity: 0; transition: opacity 1s; }
.hr-hint.hr-show { opacity: 1; }

.hr-toast { position: absolute; left: 50%; top: 20%; transform: translate(-50%, 8px); padding: 6px 16px; border-radius: 9999px; background: rgb(15 30 45 / 0.7); font-size: 16px; line-height: 24px; font-weight: 700; color: #ffe39a; white-space: nowrap; opacity: 0; transition: opacity 0.3s, transform 0.3s; }
.hr-toast.hr-show { opacity: 1; transform: translate(-50%, 0); }

/* numbers in the world */
.hr-labels { position: fixed; inset: 0; z-index: 9; pointer-events: none; overflow: hidden; }
.hr-float, .hr-preview { position: absolute; left: 0; top: 0; margin: -14px 0 0 -30px; width: 60px; text-align: center; font-size: 22px; line-height: 28px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 rgb(0 0 0 / 0.35), 0 2px 10px rgb(10 30 50 / 0.8); font-variant-numeric: tabular-nums; will-change: transform, opacity; }
.hr-float.hr-neg { color: #ff8a7a; }
.hr-float.hr-water { color: #9be4ff; }
.hr-float.hr-self { color: #ffe39a; font-size: 28px; }
.hr-float.hr-zero { color: rgb(255 255 255 / 0.7); }
.hr-preview { margin: -15px 0 0 -30px; display: none; }
.hr-preview b { display: inline-block; min-width: 26px; padding: 1px 9px; border-radius: 9999px; background: rgb(15 30 45 / 0.78); border: 1px solid rgb(255 255 255 / 0.3); font-size: 17px; line-height: 24px; text-shadow: none; }
.hr-preview.hr-show { display: block; }
.hr-preview.hr-zero b { color: rgb(255 255 255 / 0.6); }

/* touch only controls */
.hr-touchbar { position: fixed; z-index: 20; right: calc(10px + env(safe-area-inset-right)); bottom: calc(108px + env(safe-area-inset-bottom)); display: none; flex-direction: column; gap: 8px; }
.hr-touch .hr-touchbar.hr-show { display: flex; }
.hr-touchbar button { width: 52px; height: 52px; padding: 0; border-radius: 16px; border: 1px solid rgb(255 255 255 / 0.22); background: rgb(15 30 45 / 0.62); color: #fff; font-family: inherit; font-size: 30px; line-height: 1; font-weight: 700; }
.hr-touchbar button.hr-small { font-size: 13px; }
.hr-touchbar button:disabled { opacity: 0.4; }
.hr-touch .hr-hint { bottom: calc(112px + env(safe-area-inset-bottom)); max-width: calc(100vw - 150px); }

/* end panel */
.hr-end { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgb(10 22 36 / 0.45); }
.hr-end.hr-show { display: flex; animation: hr-in 0.4s ease-out; }
@keyframes hr-in { 0% { opacity: 0; } 100% { opacity: 1; } }
.hr-card { width: min(340px, calc(100vw - 40px)); box-sizing: border-box; padding: 26px 24px 22px; border-radius: 22px; background: rgb(16 30 46 / 0.92); border: 1px solid rgb(255 255 255 / 0.16); text-align: center; box-shadow: 0 20px 60px rgb(0 0 0 / 0.4); }
.hr-card h2 { margin: 0; font-size: 14px; line-height: 20px; font-weight: 600; color: rgb(255 255 255 / 0.75); }
.hr-final { margin-top: 6px; font-size: 64px; line-height: 68px; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hr-finalcap { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgb(255 255 255 / 0.6); }
.hr-best { margin-top: 12px; font-size: 15px; line-height: 20px; font-weight: 600; color: #ffe39a; }
.hr-again { margin-top: 18px; width: 100%; height: 46px; border: 0; border-radius: 9999px; background: #ffd66e; color: #2b2208; font-family: inherit; font-size: 16px; line-height: 1; font-weight: 700; cursor: pointer; }
.hr-again:hover { background: #ffe08d; }
.hr-again:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.hr-tray.hr-empty .hr-icons { display: none; }
.hr-enter { margin-top: 10px; font-size: 12px; line-height: 16px; color: rgb(255 255 255 / 0.6); }

@media (max-width: 560px) {
  .hr-score { font-size: 30px; line-height: 32px; }
  .hr-goalbar { width: 110px; }
  .hr-icons canvas { width: 30px; height: 30px; }
  .hr-icons canvas.hr-now { width: 52px; height: 52px; }
  .hr-rule { font-size: 11px; line-height: 14px; }
  .hr-tray { gap: 8px; padding: 6px 12px 6px 6px; }
}
