:root {
  --shared-navbar-h: 78px;
  --site-nav-h: var(--shared-navbar-h);
  --shared-navbar-bg: rgba(255, 255, 255, 0.94);
  --shared-navbar-border: rgba(255, 196, 116, 0.75);
  --shared-navbar-shadow: 0 10px 30px rgba(255, 159, 67, 0.1);
  --shared-navbar-text: #333344;
  --shared-navbar-muted: #ff9f43;
  --shared-navbar-red: #ff6b6b;
}

.hidden {
  display: none !important;
}

[data-site-navbar] {
  position: sticky;
  top: 0;
  z-index: 120;
  display: block;
}

.shared-navbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: var(--shared-navbar-h);
  padding: 10px 16px;
  background: var(--shared-navbar-bg);
  border-bottom: 1px solid var(--shared-navbar-border);
  box-shadow: var(--shared-navbar-shadow);
  backdrop-filter: blur(18px);
}

.shared-navbar-home {
  flex-shrink: 0;
  color: var(--shared-navbar-red);
  text-decoration: none;
  font-size: 26px;
  line-height: 1;
  transition: transform 0.2s;
}

.shared-navbar-home:hover {
  transform: scale(1.1) rotate(-6deg);
}

.shared-navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--shared-navbar-red);
  text-decoration: none;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
}

.shared-navbar-brand-mark {
  font-size: 28px;
  line-height: 1;
}

.shared-navbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 18px;
  border: 1px solid var(--shared-navbar-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: border-color 0.24s ease, box-shadow 0.24s ease, transform 0.24s ease;
}

.shared-navbar-search:focus-within {
  border-color: #ff9f43;
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.12), 0 12px 24px rgba(255, 159, 67, 0.08);
  transform: translateY(-1px);
}

.shared-navbar-search-icon {
  flex-shrink: 0;
  color: #8d7aa8;
  font-size: 22px;
  line-height: 1;
}

.shared-navbar-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--shared-navbar-text);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.shared-navbar-search input::placeholder {
  color: var(--shared-navbar-muted);
}

.shared-navbar-search button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 159, 67, 0.12);
  color: #c96b2d;
  font-size: 16px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s ease;
}

.shared-navbar-search button:hover {
  background: rgba(255, 159, 67, 0.2);
  transform: scale(1.05);
}

.shared-navbar-voice {
  width: 38px !important;
  height: 38px !important;
  background: linear-gradient(135deg, #ff7a6e, #ffb04e) !important;
  color: #fff !important;
  box-shadow: 0 10px 18px rgba(255, 107, 67, 0.22);
}

.shared-navbar-voice:hover {
  background: linear-gradient(135deg, #ff6b6b, #ff9f43) !important;
}

.shared-navbar-voice.is-listening {
  animation: sharedVoicePulse 1s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.34);
}

@keyframes sharedVoicePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.34);
  }

  70% {
    transform: scale(1.06);
    box-shadow: 0 0 0 14px rgba(255, 107, 107, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
}

.shared-navbar-avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 240, 220, 0.9);
  box-shadow: 0 8px 18px rgba(255, 159, 67, 0.14);
  font-size: 28px;
  line-height: 1;
  transition: transform 0.24s ease, filter 0.24s ease;
}

.shared-navbar-avatar:hover {
  transform: scale(1.08) rotate(-4deg);
  filter: drop-shadow(0 8px 18px rgba(255, 159, 67, 0.24));
}

.game-back-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--shared-navbar-text);
  font-family: 'Fredoka One', cursive;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(14px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.game-back-pill:hover {
  transform: translateY(-2px);
  background: rgba(255, 248, 238, 0.98);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
}

.game-back-pill.is-floating {
  position: fixed;
  top: calc(var(--shared-navbar-h) + 12px);
  left: 18px;
  z-index: 140;
}

.game-page-topbar {
  position: fixed;
  top: calc(var(--shared-navbar-h) + 10px);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 32px));
  z-index: 138;
  min-height: 62px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255, 247, 236, 0.96);
  border: 1px solid rgba(255, 196, 116, 0.7);
  border-radius: 22px;
  box-shadow: 0 14px 30px rgba(255, 159, 67, 0.12);
  backdrop-filter: blur(18px);
}

.game-page-topbar-back {
  border: 0;
  background: transparent;
  color: var(--shared-navbar-red);
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s ease, color 0.2s ease;
}

.game-page-topbar-back:hover {
  transform: translateX(-2px);
  color: #ff7f6d;
}

.game-page-topbar-title {
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: 20px;
  color: var(--shared-navbar-red);
  line-height: 1.1;
  min-width: 0;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-page-topbar-score {
  justify-self: end;
  font-family: 'Fredoka One', cursive;
  font-size: 16px;
  color: #f0ab00;
  white-space: nowrap;
  min-width: max-content;
}

@media (max-width: 720px) {
  :root {
    --shared-navbar-h: 72px;
  }

  .shared-navbar {
    gap: 10px;
    padding: 10px 12px;
  }

  .shared-navbar-brand-text {
    display: none;
  }

  .shared-navbar-search {
    padding: 10px 14px;
  }

  .shared-navbar-search-icon {
    font-size: 20px;
  }

  .game-back-pill.is-floating {
    top: calc(var(--shared-navbar-h) + 10px);
    left: 14px;
  }

  .game-page-topbar {
    top: calc(var(--shared-navbar-h) + 8px);
    width: min(1120px, calc(100vw - 24px));
    min-height: 58px;
    padding: 0 14px;
  }

  .game-page-topbar-title {
    font-size: 18px;
  }
}

@media (max-width: 560px) {
  :root {
    --shared-navbar-h: 68px;
  }

  .shared-navbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .shared-navbar-home {
    font-size: 22px;
  }

  .shared-navbar-brand {
    gap: 6px;
  }

  .shared-navbar-brand-mark {
    font-size: 24px;
  }

  .shared-navbar-search {
    padding: 8px 10px;
    gap: 8px;
  }

  .shared-navbar-search input {
    font-size: 13px;
  }

  .shared-navbar-search button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .shared-navbar-voice {
    width: 32px !important;
    height: 32px !important;
  }

  .shared-navbar-avatar {
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .game-back-pill {
    min-height: 38px;
    padding: 9px 14px;
    font-size: 13px;
  }

  .game-page-topbar {
    gap: 8px;
    width: min(1120px, calc(100vw - 20px));
    min-height: 54px;
    padding: 0 12px;
  }

  .game-page-topbar-back {
    font-size: 14px;
  }

  .game-page-topbar-title {
    font-size: 16px;
  }

  .game-page-topbar-score {
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  .shared-navbar {
    gap: 6px;
    padding: 8px;
  }

  .shared-navbar-home {
    font-size: 20px;
  }

  .shared-navbar-brand-mark {
    font-size: 22px;
  }

  .shared-navbar-search {
    padding: 8px 9px;
  }

  .shared-navbar-search-icon {
    font-size: 18px;
  }

  .shared-navbar-avatar {
    width: 34px;
    height: 34px;
    font-size: 20px;
  }

  .shared-navbar-voice {
    width: 30px !important;
    height: 30px !important;
  }

  .game-back-pill.is-floating {
    top: calc(var(--shared-navbar-h) + 8px);
    left: 10px;
  }

  .game-page-topbar {
    width: min(1120px, calc(100vw - 16px));
  }
}
