/* 上班族追公交：只作用于本游戏，不改变乐园原有 UI。 */
.bus-card-rules {
  margin: 8px 0 12px !important;
  line-height: 1.8 !important;
}
.bus-languages {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.bus-game {
  --bus-ink: var(--text);
  --bus-muted: var(--text-2);
  --bus-green: var(--primary-d);
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #e7eee8;
  color: var(--bus-ink);
  font-family: var(--font);
  container-type: size;
}
.bus-game * {
  box-sizing: border-box;
}
.bus-game input {
  font: inherit;
}
.bus-game button:focus-visible,
.bus-game input:focus-visible {
  outline: 2px solid var(--primary-2);
  outline-offset: 3px;
}
.bus-street {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.bus-city-labels {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
.bus-city-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 4px 7px;
  border-radius: 10px;
  color: var(--text);
  background: var(--glass);
  border: 1px solid var(--line-2);
  box-shadow: 0 2px 4px #28452b22;
  font: 600 10px/1.2 var(--font);
  white-space: nowrap;
}
.bus-city-label::after {
  content: '';
  position: absolute;
  left: calc(50% - 3px);
  bottom: -4px;
  border: 3px solid transparent;
  border-bottom: 0;
  border-top-color: var(--glass);
}
.bus-city-label::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  width: 1px;
  height: var(--bus-leader, 0px);
  background: #35564470;
  transform-origin: top center;
  transform: rotate(var(--bus-leader-angle, 0rad));
}
.bus-city-label.mine {
  background: var(--accent);
  color: var(--text);
  border-color: #fff1c6;
  font-weight: 700;
}
.bus-city-label.mine::after {
  border-top-color: var(--accent);
}
.bus-city-label.edge::after {
  display: none;
}
.bus-city-label.edge::before {
  display: none;
}
.bus-city-label.left {
  opacity: 0.45;
}
@media (max-width: 680px) {
  .bus-city-label {
    font-size: 9px;
    padding: 3px 5px;
  }
}
@container (max-width:680px) and (max-height:520px) {
  .bus-city-label:not(.mine):not(.bus-driver) {
    display: none;
  }
}
.bus-title {
  position: absolute;
  left: 32px;
  top: 24px;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 18px 13px 13px;
}
.bus-title small {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-2);
}
.bus-title h2 {
  font-size: clamp(23px, 2.5vw, 26px);
  letter-spacing: 0;
  line-height: 1.2;
  margin: 5px 0 5px;
  font-weight: 800;
}
.bus-subtitle {
  margin: 0;
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 1px;
}
.bus-tools {
  position: absolute;
  top: 24px;
  right: 32px;
  text-align: right;
  padding: 12px 14px;
}
.bus-tools strong {
  font-size: 34px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.bus-tools > div {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.bus-tools .btn.sm {
  height: 28px;
  padding: 0 10px;
  font-size: 11px;
}
.bus-standings {
  position: absolute;
  left: 32px;
  top: 165px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 198px;
  padding: 8px;
}
.bus-standings > .bus-player {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 5px 7px;
  border-radius: 7px;
  min-width: 160px;
  border-left: 3px solid var(--player-color);
}
.bus-standings > div.me {
  background: var(--primary-soft);
  outline: 1px solid var(--primary-2);
}
.bus-standings > div.left {
  opacity: 0.45;
}
.bus-standings img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 7px;
  background: var(--primary-soft);
}
.bus-standings b {
  display: block;
  font-size: 11px;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.bus-standings small {
  display: block;
  color: var(--text-2);
  font-size: 10px;
  margin-top: 2px;
}
.bus-countdown {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
  width: min(460px, calc(100% - 30px));
  text-align: center;
  padding: 20px 24px;
}
.bus-countdown.off {
  display: none;
}
.bus-countdown small {
  font-size: 13px;
  color: var(--primary-d);
}
.bus-count-number {
  display: block;
  font-size: 62px;
  font-weight: 500;
  line-height: 1.2;
  margin: 8px 0;
}
.bus-count-tip {
  font-size: 11px;
  line-height: 1.8;
  color: var(--text-2);
  margin: 0;
}
.bus-near {
  position: absolute;
  left: 32px;
  bottom: 245px;
  padding: 12px 16px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.bus-typing {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 48px));
  overflow: hidden;
}
.bus-type-head {
  padding: 12px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bus-role {
  font-size: 11px;
  color: var(--primary-d);
}
.bus-metrics {
  font-size: 11px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bus-word {
  font-size: clamp(25px, 3vw, 36px);
  letter-spacing: 4px;
  white-space: nowrap;
  font-weight: 750;
  line-height: 1.5;
  padding: 6px 20px 0;
  min-height: 58px;
  color: var(--text);
}
.bus-game[data-lang='en'] .bus-word {
  font-size: clamp(18px, 2.5vw, 32px);
  letter-spacing: 1px;
}
.bus-word .done {
  color: var(--primary-d);
}
.bus-word .next {
  border-bottom: 3px solid var(--accent-d);
  background: var(--primary-soft);
}
.bus-input-label {
  display: block;
  margin: 0 20px;
  font-size: 0;
}
.bus-input {
  display: block;
  width: 100%;
  height: 38px;
  border: 1px solid var(--line-2);
  padding: 0 16px;
  background: var(--cr2);
  border-radius: 19px;
  color: var(--primary-d);

  outline: none;
  letter-spacing: 2px;
  font-size: 17px !important;
  user-select: text;
  -webkit-user-select: text;
}
.bus-game .bus-input:focus {
  background: #fff;
  box-shadow: 0 0 0 2px var(--primary-2);
  outline: none;
}
.bus-input::placeholder {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-3);
}
.bus-input.error {
  color: var(--red);
  border-color: var(--red);
}
.bus-input:disabled {
  opacity: 0.55;
}
.bus-type-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding: 8px 20px;
  font-size: 10px;
  color: var(--text-2);
  gap: 8px;
  line-height: 1.5;
}
.bus-typing.watching .bus-input-label {
  display: none;
}
.bus-typing.watching .bus-word {
  display: none;
}
.bus-progress {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(700px, calc(100% - 70px));
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text);
  padding-top: 9px;
}
.bus-progress-line {
  height: 5px;
  border-radius: 3px;
  box-shadow: 0 1px 0 #f9f5e1;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: var(--cr3);
}
.bus-progress-line i {
  position: absolute;
  top: -6px;
  width: 15px;
  height: 15px;
  transform: translateX(-50%);
  border-radius: 50%;
  font: normal 8px/15px system-ui;
  text-align: center;
  background: var(--primary);
  color: white;
  transition: left 0.2s linear;
  border: 1px solid #f3f1dd;
}
.bus-progress-line i.driver {
  background: var(--primary-d);
  z-index: 1;
}
.bus-progress-line i.me {
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 2;
}
.bus-cheers {
  position: absolute;
  right: 22px;
  bottom: 260px;
  display: flex;
  gap: 5px;
}
.bus-cheers .btn.sm {
  padding: 0;
  height: 34px;
  width: 34px;
  font-size: 16px;
}
.bus-reaction {
  position: absolute;
  right: 25px;
  bottom: 307px;
  color: var(--text);
  background: var(--glass);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.bus-reaction.on {
  opacity: 1;
}
.bus-result {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  place-items: center;
  background: #324c4166;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.bus-result.on {
  display: grid;
}
.bus-result-card {
  width: min(480px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 28px;
  text-align: center;
}
.bus-result-card > small {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-2);
}
.bus-result-card h2 {
  font-size: 32px;
  font-weight: 600;
  margin: 12px 0;
  color: var(--primary-d);
}
.bus-result-card > p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.8;
  margin: 0 0 10px;
}
.bus-earned {
  font-size: 12px;
  color: var(--accent-d);
  margin: 12px 0;
}
.bus-result-card ol {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bus-result-card li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--cr2);
  padding: 9px 10px;
  border-radius: 9px;
}
.bus-result-card li.me {
  outline: 1px solid var(--primary-2);
}
.bus-result-card li img {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary-soft);
}
.bus-result-card li > div {
  flex: 1;
  min-width: 0;
}
.bus-result-card li b {
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.bus-result-card li small {
  display: block;
  color: var(--text-2);
  font-size: 10px;
  margin-top: 4px;
}
.bus-result-card li > span {
  font-size: 12px;
  color: #54805c;
  text-align: right;
}
.bus-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

body:has(#game[data-g^='bus'].qh-on:not(.hidden)) .qh-toggle {
  display: none;
}
@media (max-width: 680px) {
  .bus-title {
    left: 16px;
    top: 16px;
  }
  .bus-title h2 {
    font-size: 23px;
    margin-top: 8px;
  }
  .bus-title small {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .bus-subtitle {
    font-size: 9px;
  }
  .bus-tools {
    top: 16px;
    right: 14px;
  }
  .bus-tools strong {
    font-size: 25px;
  }
  .bus-tools .btn.sm {
    font-size: 10px;
    padding: 4px 6px;
  }
  .bus-tools > div {
    gap: 4px;
  }
  .bus-standings {
    left: 14px;
    top: 122px;
    gap: 2px;
    padding: 4px;
    max-width: 140px;
  }
  .bus-standings > div {
    min-width: 112px;
    padding: 4px;
    gap: 5px;
  }
  .bus-standings img {
    width: 23px;
    height: 23px;
  }
  .bus-standings b {
    font-size: 10px;
    max-width: 85px;
  }
  .bus-standings small {
    font-size: 9px;
  }
  .bus-typing {
    bottom: 44px;
    width: calc(100% - 24px);
  }
  .bus-type-head {
    padding: 10px 14px 0;
    flex-wrap: wrap;
    gap: 6px;
  }
  .bus-role {
    font-size: 10px;
  }
  .bus-metrics {
    font-size: 10px;
  }
  .bus-word {
    font-size: 26px;
    padding: 8px 14px 0;
    min-height: 53px;
    letter-spacing: 2px;
  }
  .bus-game[data-lang='en'] .bus-word {
    font-size: 19px;
    letter-spacing: 0.5px;
  }
  .bus-input-label {
    margin: 0 14px;
  }
  .bus-type-bottom {
    padding: 7px 14px;
    flex-wrap: wrap;
    font-size: 9px;
    margin-top: 10px;
    gap: 2px;
  }
  .bus-assets {
    font-size: 8px;
  }
  .bus-near {
    left: 14px;
    bottom: 245px;
    font-size: 10px;
  }
  .bus-cheers {
    right: 14px;
    bottom: 245px;
  }
  .bus-cheers .btn.sm {
    height: 29px;
    width: 29px;
    font-size: 14px;
  }
  .bus-reaction {
    bottom: 285px;
    font-size: 11px;
  }
  .bus-countdown {
    top: 32%;
    padding: 12px 18px;
  }
  .bus-count-number {
    font-size: 46px;
  }
  .bus-countdown small {
    font-size: 11px;
  }
  .bus-count-tip {
    font-size: 10px;
  }
  .bus-result-card {
    padding: 22px;
  }
  .bus-result-card h2 {
    font-size: 27px;
  }
}
@media (max-height: 540px) and (min-width: 681px) {
  .bus-title {
    left: 18px;
    top: 12px;
  }
  .bus-title h2 {
    font-size: 24px;
    margin: 5px 0;
  }
  .bus-tools {
    top: 10px;
    right: 16px;
  }
  .bus-tools strong {
    font-size: 23px;
  }
  .bus-standings {
    top: 104px;
    left: 16px;
  }
  .bus-standings > div {
    padding: 2px 4px;
  }
  .bus-standings img {
    height: 22px;
    width: 22px;
  }
  .bus-typing {
    bottom: 32px;
    width: min(580px, calc(100% - 250px));
    left: auto;
    right: 16px;
    transform: none;
  }
  .bus-word {
    font-size: 25px;
    min-height: 42px;
    padding-top: 0;
  }
  .bus-input {
    height: 29px;
  }
  .bus-type-head {
    padding-top: 8px;
  }
  .bus-type-bottom {
    padding: 5px 15px;
    margin-top: 6px;
  }
  .bus-near {
    bottom: 60px;
    left: 16px;
  }
  .bus-cheers {
    bottom: 90px;
    left: 16px;
    right: auto;
  }
  .bus-reaction {
    bottom: 130px;
    left: 16px;
    right: auto;
  }
  .bus-countdown {
    top: 22%;
    width: 350px;
    padding: 10px;
  }
  .bus-count-number {
    font-size: 38px;
    margin: 4px;
  }
  .bus-count-tip {
    font-size: 10px;
  }
  .bus-progress {
    bottom: 8px;
  }
  .bus-subtitle {
    font-size: 9px;
  }
}
/* 键盘弹出时按游戏实际可视高度调整，输入区保持可见。 */
@container (max-height: 520px) {
  .bus-title {
    left: 16px;
    top: 10px;
  }
  .bus-title h2 {
    font-size: 21px;
    margin: 4px 0;
  }
  .bus-subtitle {
    font-size: 9px;
  }
  .bus-tools {
    top: 10px;
    right: 12px;
  }
  .bus-tools strong {
    font-size: 21px;
  }
  .bus-tools > div {
    margin-top: 5px;
  }
  .bus-standings {
    top: 87px;
    left: 12px;
    padding: 3px;
    gap: 2px;
    max-height: 120px;
    overflow: auto;
  }
  .bus-standings > div {
    padding: 2px 4px;
  }
  .bus-standings img {
    width: 20px;
    height: 20px;
  }
  .bus-standings small {
    font-size: 8px;
  }
  .bus-word {
    font-size: 22px;
    min-height: 37px;
    padding-top: 3px;
  }
  .bus-input {
    height: 30px;
  }
  .bus-type-head {
    padding-top: 7px;
  }
  .bus-type-bottom {
    padding: 4px 14px;
    margin-top: 5px;
  }
  .bus-assets {
    display: none;
  }
  .bus-near {
    bottom: 205px;
    font-size: 10px;
  }
  .bus-cheers {
    bottom: 205px;
  }
  .bus-reaction {
    bottom: 245px;
  }
  .bus-countdown {
    top: 24%;
    padding: 10px 16px;
  }
  .bus-count-number {
    font-size: 36px;
    margin: 4px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .bus-progress-line i,
  .bus-reaction {
    transition: none;
  }
}
@media (max-width: 680px) {
  .bus-standings {
    top: 116px;
    left: 14px;
    right: 14px;
    max-width: none;
    max-height: 53px;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
  .bus-standings > div {
    min-width: 95px;
    flex-shrink: 0;
    padding: 4px;
  }
  .bus-standings b {
    max-width: 66px;
  }
}
@container (max-width:680px) and (max-height:520px) {
  .bus-standings {
    top: 82px;
    max-height: 42px;
  }
  .bus-standings img {
    width: 17px;
    height: 17px;
  }
  .bus-standings > div {
    min-width: 84px;
    padding: 2px 3px;
  }
  .bus-standings b {
    font-size: 9px;
  }
  .bus-standings small {
    font-size: 8px;
    margin-top: 0;
  }
  .bus-title h2 {
    font-size: 20px;
  }
  .bus-typing {
    bottom: 32px;
  }
  .bus-near {
    bottom: 194px;
  }
  .bus-cheers {
    bottom: 194px;
  }
  .bus-type-bottom {
    font-size: 8px;
  }
}

/* 比赛读数与输入反馈。 */
.bus-line-number {
  display: grid;
  place-items: center;
  min-width: 57px;
  height: 70px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary-d);
  font: 850 34px/1 system-ui;
}
.bus-line-number small {
  color: var(--primary-d);
  font-size: 8px;
  letter-spacing: 1px;
}
.bus-standings-title {
  margin: 0;
  display: flex;
  justify-content: space-between;
  padding: 4px 7px 7px;
  font-size: 11px;
  font-weight: 750;
  border-bottom: 1px solid var(--line);
}
.bus-standings-title span {
  font-size: 9px;
  color: var(--text-2);
  font-weight: 400;
}
.bus-player em {
  font: normal 700 11px/1 system-ui;
  color: var(--text-2);
  width: 10px;
  flex-shrink: 0;
  text-align: center;
}
.bus-player > span {
  position: relative;
  padding-bottom: 5px;
  flex: 1;
}
.bus-player > span > i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: var(--player-color);
  transition: width 0.2s;
}
.bus-near > span {
  display: block;
  color: var(--text-2);
  font-size: 10px;
  letter-spacing: 1px;
}
.bus-near > strong {
  display: block;
  font: 800 36px/1.25 system-ui;
  letter-spacing: -1px;
  color: var(--primary-d);
}
.bus-near > strong small {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
}
.bus-near > b {
  display: block;
  color: var(--text-2);
  font-size: 10px;
  font-weight: 400;
}
.bus-chain {
  font-weight: 650;
  color: var(--primary-d);
  white-space: nowrap;
}
.bus-assets {
  display: none;
}
.bus-typing::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: var(--word-progress, 0%);
  height: 3px;
  background: var(--primary);
  transition: width 0.12s;
}
.bus-game.bus-word-complete .bus-typing {
  box-shadow:
    var(--shadow),
    0 0 0 2px var(--primary-2);
}
.bus-game.bus-mistake .bus-typing {
  border-top-color: var(--danger);
}
.bus-game[data-streak='hot'] .bus-chain {
  color: var(--primary-d);
}
.bus-game[data-close='true'] .bus-near {
  border-color: var(--accent);
}
.bus-game[data-close='true'] .bus-near > strong {
  color: var(--red);
}
.bus-game[data-urgent='true'] .bus-time {
  color: var(--red);
}
@media (max-width: 680px) {
  .bus-title {
    padding: 8px 10px;
    gap: 8px;
    top: 12px;
    left: 12px;
  }
  .bus-title h2 {
    font-size: 20px;
    letter-spacing: 0;
    margin: 4px 0;
  }
  .bus-title small {
    font-size: 8px;
    letter-spacing: 1px;
  }
  .bus-line-number {
    min-width: 36px;
    height: 52px;
    font-size: 24px;
  }
  .bus-line-number small {
    font-size: 6px;
    letter-spacing: 0;
  }
  .bus-tools {
    top: 12px;
    right: 12px;
    padding: 8px;
  }
  .bus-tools strong {
    font-size: 24px;
  }
  .bus-tools .btn.sm {
    height: 24px;
    padding: 0 5px;
    font-size: 9px;
  }
  .bus-tools > div {
    gap: 3px;
    margin-top: 6px;
  }
  .bus-standings {
    top: 107px;
  }
  .bus-standings-title {
    display: none;
  }
  .bus-standings > .bus-player {
    min-width: 100px;
  }
  .bus-player em {
    font-size: 9px;
    width: 7px;
  }
  .bus-near {
    padding: 8px 10px;
    bottom: 250px;
  }
  .bus-near > strong {
    font-size: 27px;
  }
  .bus-near > span,
  .bus-near > b {
    font-size: 9px;
  }
  .bus-chain {
    font-size: 9px;
  }
  .bus-type-bottom {
    flex-wrap: nowrap;
  }
}
@container (max-height:520px) {
  .bus-title {
    padding: 6px 10px;
  }
  .bus-title h2 {
    font-size: 19px;
    margin: 2px 0;
  }
  .bus-line-number {
    height: 45px;
    min-width: 36px;
    font-size: 24px;
  }
  .bus-tools {
    padding: 6px 9px;
  }
  .bus-tools strong {
    font-size: 21px;
  }
  .bus-standings {
    top: 95px;
  }
  .bus-standings-title {
    display: none;
  }
  .bus-near {
    padding: 6px 9px;
  }
  .bus-near > strong {
    font-size: 23px;
  }
  .bus-near > b {
    display: none;
  }
}
@container (max-width:680px) and (max-height:520px) {
  .bus-near {
    top: 145px;
    bottom: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 8px;
  }
  .bus-near > strong {
    font-size: 21px;
  }
  .bus-cheers {
    top: 145px;
    bottom: auto;
  }
}
