@import url('https://fonts.googleapis.com/css2?family=Overpass:wght@300;600;700&display=swap');

:root {
  --hb-toolbar-height: 58px;
  --hb-toolbar-bg: rgba(7, 11, 8, 0.96);
  --hb-toolbar-border: rgba(0, 255, 136, 0.18);
  --hb-panel-bg: rgba(8, 12, 9, 0.98);
  --hb-panel-border: rgba(0, 255, 136, 0.16);
  --hb-text-dim: #9fb1a5;
  --hb-accent: #00ff88;
}

.hb-with-toolbar {
  --hb-safe-top: calc(var(--hb-toolbar-height) + 14px);
}

.hb-toolbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hb-toolbar-height);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  background: var(--hb-toolbar-bg);
  border-bottom: 1px solid var(--hb-toolbar-border);
  backdrop-filter: blur(12px);
  font-family: 'Overpass', system-ui, sans-serif;
}

body[data-hitbit-page="home"] {
  min-height: 100vh;
  padding-top: var(--hb-toolbar-height);
}

body[data-hitbit-page="game"] {
  height: 100vh;
  overflow: hidden;
}

.hb-toolbar-inner {
  width: min(1120px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.hb-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.hb-brand img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.hb-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hb-toolbar-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  cursor: pointer;
  font: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.hb-toolbar-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 255, 136, 0.24);
  background: rgba(0, 255, 136, 0.08);
  box-shadow: 0 0 18px rgba(0, 255, 136, 0.16);
}

.hb-modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.58);
  z-index: 5100;
}

.hb-modal-backdrop.open {
  display: flex;
}

.hb-modal-backdrop {
  font-family: 'Overpass', system-ui, sans-serif;
}

.hb-modal {
  width: min(460px, 100%);
  max-height: min(80vh, 760px);
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid var(--hb-panel-border);
  background: var(--hb-panel-bg);
  color: #fff;
  font-family: 'Overpass', system-ui, sans-serif;
}

.hb-modal-wide {
  width: min(720px, 100%);
}

.hb-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.hb-modal h2 {
  font-size: 1.4rem;
}

.hb-close {
  border: none;
  background: transparent;
  color: var(--hb-text-dim);
  font: inherit;
  font-size: 1.2rem;
  cursor: pointer;
}

.hb-profile-copy,
.hb-empty,
.hb-leaderboard-note {
  color: var(--hb-text-dim);
}

.hb-profile-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

.hb-profile-row label {
  font-size: 0.9rem;
  color: var(--hb-text-dim);
}

.hb-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font: inherit;
}

.hb-save {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--hb-accent);
  color: #02130b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.hb-profile-meta {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--hb-text-dim);
}

.hb-feedback {
  min-height: 20px;
  margin-top: 10px;
  color: var(--hb-accent);
  font-size: 0.9rem;
}

.hb-game-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.hb-game-tab {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.hb-game-tab.active {
  border-color: rgba(0, 255, 136, 0.24);
  background: rgba(0, 255, 136, 0.1);
  color: var(--hb-accent);
}

.hb-table {
  width: 100%;
  border-collapse: collapse;
}

.hb-table th,
.hb-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
}

.hb-table th {
  color: var(--hb-text-dim);
  font-size: 0.85rem;
  font-weight: 600;
}

.hb-table td:last-child,
.hb-table th:last-child {
  text-align: right;
}

body[data-hitbit-page="game"] #homeBtn,
body[data-hitbit-page="game"] #titleButton,
body[data-hitbit-page="game"] #hitbit,
body[data-hitbit-page="game"] #logo {
  top: var(--hb-safe-top);
}

body[data-hitbit-page="game"] #combo,
body[data-hitbit-page="game"] #hud,
body[data-hitbit-page="game"] #ui,
body[data-hitbit-page="game"] #scoreDisplay {
  top: calc(var(--hb-safe-top) + 8px);
}

body[data-hitbit-page="game"] #healthbar {
  margin-top: var(--hb-toolbar-height);
}

body[data-hitbit-game="memory"] {
  padding-top: calc(var(--hb-toolbar-height) + 18px) !important;
}

body[data-hitbit-game="timing"] #scoreDisplay {
  margin-top: 18px !important;
}

body[data-hitbit-game="stack"] #ui {
  top: calc(var(--hb-safe-top) + 8px) !important;
}

body[data-hitbit-game="orbfall"] #combo {
  top: calc(var(--hb-safe-top) + 8px) !important;
}

body[data-hitbit-game="strafe"] #hud {
  top: calc(var(--hb-safe-top) + 8px) !important;
}

body[data-hitbit-game="timing"] #titleScreen,
body[data-hitbit-game="timing"] #overlay {
  top: var(--hb-toolbar-height) !important;
  height: calc(100vh - var(--hb-toolbar-height)) !important;
}

body[data-hitbit-game="visualreaction"] #gameContainer {
  top: calc(50% + (var(--hb-toolbar-height) / 2));
}

@media (max-width: 640px) {
  .hb-toolbar-inner {
    width: calc(100% - 16px);
  }

  .hb-brand span {
    display: none;
  }

  .hb-toolbar-actions {
    gap: 8px;
  }

  .hb-toolbar-btn {
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .hb-modal,
  .hb-modal-wide {
    width: 100%;
  }
}
