/* Copyright 2013 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

:root {
  --google-blue-600: blue;
}

body {
  margin: 0;
}

.icon {
  -webkit-user-select: none;
  display: inline-block;
}

.icon-offline {
  content: -webkit-image-set(
      url(images/default_100_percent/offline/100-error-offline.png) 1x,
      url(images/default_200_percent/offline/200-error-offline.png) 2x);
  position: relative;
}

.hidden {
  display: none;
}

.offline #main-frame-error {
  transition: filter 1.5s cubic-bezier(0.65, 0.05, 0.36, 1),
              background-color 1.5s cubic-bezier(0.65, 0.05, 0.36, 1);
}

.offline #main-message > p {
  display: none;
}

.offline #main-frame-error {
  background-color: #fff;
  filter: invert(0);
}

.offline.inverted #main-frame-error {
  background-color: #fff;
  filter: invert(1);
}

.offline .interstitial-wrapper {
  color: var(--text-color);
  font-size: 1em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 600px;
  padding-top: 100px;
  position: relative;
  width: 100%;
}

.offline .runner-container {
  direction: ltr;
  height: 150px;
  max-width: 600px;
  overflow: hidden;
  position: absolute;
  top: 35px;
  width: 44px;
}

.offline .runner-container:focus {
  outline: none;
}

.offline .runner-container:focus-visible {
  outline: 3px solid var(--google-blue-300);
}

.offline .runner-canvas {
  height: 150px;
  max-width: 600px;
  opacity: 1;
  overflow: hidden;
  position: absolute;
  top: 0;
  z-index: 10;
}

.offline .controller {
  height: 100vh;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 9;
}

#offline-resources {
  display: none;
}

#offline-instruction {
  image-rendering: pixelated;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 60px;
  width: fit-content;
}

.offline-runner-live-region {
  bottom: 0;
  clip-path: polygon(0 0, 0 0, 0 0);
  color: var(--background-color);
  display: block;
  font-size: xx-small;
  overflow: hidden;
  position: absolute;
  text-align: center;
  transition: color 1.5s cubic-bezier(0.65, 0.05, 0.36, 1);
  user-select: none;
}

/* Custom toggle */
.slow-speed-option {
  align-items: center;
  background: var(--google-gray-50);
  border-radius: 24px/50%;
  bottom: 0;
  color: var(--error-code-color);
  display: inline-flex;
  font-size: 1em;
  left: 0;
  line-height: 1.1em;
  margin: 5px auto;
  padding: 2px 12px 3px 20px;
  position: absolute;
  right: 0;
  width: max-content;
  z-index: 999;
}

.slow-speed-option.hidden {
  display: none;
}

.slow-speed-option {
  display: none;
}

.slow-speed-option [type=checkbox] {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.slow-speed-option .slow-speed-toggle {
  cursor: pointer;
  margin-inline-start: 8px;
  padding: 8px 4px;
  position: relative;
}

.slow-speed-option [type=checkbox]:disabled ~ .slow-speed-toggle {
  cursor: default;
}

.slow-speed-option-label [type=checkbox] {
  opacity: 0;
  pointer-events: none;
  position: absolute;
}

.slow-speed-option .slow-speed-toggle::before,
.slow-speed-option .slow-speed-toggle::after {
  content: '';
  display: block;
  margin: 0 3px;
  transition: all 100ms cubic-bezier(0.4, 0, 1, 1);
}

.slow-speed-option .slow-speed-toggle::before {
  background: rgb(189,193,198);
  border-radius: 0.65em;
  height: 0.9em;
  width: 2em;
}

.slow-speed-option .slow-speed-toggle::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 40%);
  height: 1.2em;
  position: absolute;
  top: 51%;
  transform: translate(-20%, -50%);
  width: 1.1em;
}

.slow-speed-option [type=checkbox]:focus + .slow-speed-toggle {
  box-shadow: 0 0 8px rgb(94, 158, 214);
  outline: 1px solid rgb(93, 157, 213);
}

.slow-speed-option [type=checkbox]:checked + .slow-speed-toggle::before {
  background: var(--google-blue-600);
  opacity: 0.5;
}

.slow-speed-option [type=checkbox]:checked + .slow-speed-toggle::after {
  background: var(--google-blue-600);
  transform: translate(calc(2em - 90%), -50%);
}

.slow-speed-option [type=checkbox]:checked:disabled +
  .slow-speed-toggle::before {
  background: rgb(189,193,198);
}

.slow-speed-option [type=checkbox]:checked:disabled +
  .slow-speed-toggle::after {
  background: var(--google-gray-50);
}

@media (max-height: 350px) {
  h1 {
    margin: 0 0 15px;
  }

  .icon-offline {
    margin: 0 0 10px;
  }

  .interstitial-wrapper {
    margin-top: 5%;
  }
}

@media (min-width: 420px) and (max-width: 736px) and
       (min-height: 240px) and (max-height: 420px) and
       (orientation:landscape) {
  .interstitial-wrapper {
    margin-bottom: 100px;
  }
}

@media (max-width: 360px) and (max-height: 480px) {
  .offline .interstitial-wrapper {
    padding-top: 60px;
  }

  .offline .runner-container {
    top: 8px;
  }
}

@media (min-height: 240px) and (orientation: landscape) {
  .offline .interstitial-wrapper {
    margin-bottom: 90px;
  }

  .icon-offline {
    margin-bottom: 20px;
  }
}

@media (max-height: 320px) and (orientation: landscape) {
  .icon-offline {
    margin-bottom: 0;
  }

  .offline .runner-container {
    top: 10px;
  }
}

@media (max-width: 240px) {
  .interstitial-wrapper {
    overflow: inherit;
    padding: 0 8px;
  }
}

.arcade-mode,
.arcade-mode .runner-container,
.arcade-mode .runner-canvas {
  image-rendering: pixelated;
  max-width: 100%;
  overflow: hidden;
}

.arcade-mode #buttons,
.arcade-mode #main-content {
  opacity: 0;
  overflow: hidden;
}

.arcade-mode .interstitial-wrapper {
  height: 100vh;
  max-width: 100%;
  overflow: hidden;
}

.arcade-mode .runner-container {
  left: 0;
  margin: auto;
  right: 0;
  transform-origin: top center;
  transition: transform 250ms cubic-bezier(0.4, 0, 1, 1) 400ms;
  z-index: 2;
}

@media (prefers-color-scheme: dark) {
  .icon {
    filter: invert(1);
  }

  .offline .runner-canvas {
    filter: invert(1);
  }

  .offline #main-frame-error {
    background-color: #000;
    filter: invert(0);
  }

  .offline.inverted #main-frame-error {
    background-color: #000;
    filter: invert(1);
  }

  .offline.inverted .offline-runner-live-region {
    color: #fff;
  }

  .slow-speed-option {
    background: var(--google-gray-800);
    color: var(--google-gray-100);
  }

  .slow-speed-option .slow-speed-toggle::before,
  .slow-speed-option [type=checkbox]:checked:disabled +
    .slow-speed-toggle::before {
     background: rgb(189,193,198);
  }

  .slow-speed-option [type=checkbox]:checked + .slow-speed-toggle::after,
  .slow-speed-option [type=checkbox]:checked + .slow-speed-toggle::before {
    background: var(--google-blue-300);
  }
}

/* anyini.site 定制：禁用双击缩放（与 2048 同款）
 * viewport 的 user-scalable=no 在 iOS 10+ 会被无视，
 * touch-action: manipulation 才是标准做法——保留平移/捏合，只干掉双击放大 */
html { overscroll-behavior: none; -webkit-overscroll-behavior: none; }

html,
body {
  touch-action: manipulation;
}

/* anyini.site 定制：返回 4🐾99 的悬浮链接 */
.dino-back {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 999;
  font-family: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  color: rgba(30, 30, 30, 0.6);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(30, 30, 30, 0.14);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: color 0.15s ease, background 0.15s ease;
}
.dino-back:hover { color: #111; background: #fff; }

/* anyini.site 定制：好友排行榜（仿 2048 小游戏）
 * 按钮放在右下角：画布在 arcade 模式下垂直居中且底部留有空隙，
 * 右下角不挡跑道/计分/返回链接 */
.dino-lb-btn {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 998;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(30, 30, 30, 0.14);
  background: rgba(255, 255, 255, 0.8);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease, transform 0.15s ease;
}
.dino-lb-btn:hover { background: #fff; transform: scale(1.06); }

.dino-lb {
  position: fixed;
  right: 14px;
  bottom: 70px;
  z-index: 997;
  width: 250px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(30, 30, 30, 0.12);
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  padding: 14px 16px;
  font-family: "Inter", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #262a31;
}
.dino-lb[hidden] { display: none; }
.dino-lb-head {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: rgba(38, 42, 49, 0.55);
  margin-bottom: 10px;
}
.dino-lb-rows { display: flex; flex-direction: column; gap: 7px; }
.dino-lb-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dino-lb-pos { width: 20px; text-align: center; font-weight: 600; color: rgba(38, 42, 49, 0.45); flex: none; }
.dino-lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dino-lb-name .rank-me { color: #c98a12; }
.dino-lb-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.dino-lb-sep { border-top: 1px dashed rgba(38, 42, 49, 0.18); margin: 4px 0; }
.dino-lb-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(38, 42, 49, 0.1);
  font-size: 12px;
  color: rgba(38, 42, 49, 0.6);
}
.dino-lb-foot a { color: #c98a12; text-decoration: none; }
.dino-lb-empty { font-size: 13px; color: rgba(38, 42, 49, 0.45); padding: 6px 0; }

/* anyini.site 定制：固定黑夜模式（不再跟随系统、不做日夜切换）
 * 画布反色 + 页面黑底无条件生效（覆盖游戏自带的 prefers-color-scheme 深色规则），
 * 奖杯降饱和 + 按钮/面板/返回链接黑系玻璃 */
.offline .runner-canvas { filter: invert(1); }
.offline #main-frame-error { background-color: #000; }
.dino-lb-btn {
  background: rgba(20, 20, 24, 0.8);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.dino-lb-btn:hover { background: rgba(34, 34, 40, 0.92); }
.dino-lb-btn .dino-lb-trophy {
  filter: grayscale(0.75);
  opacity: 0.88;
}
.dino-lb {
  background: rgba(22, 22, 27, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
  color: #d8d8db;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}
.dino-lb-head { color: rgba(216, 216, 219, 0.55); }
.dino-lb-pos { color: rgba(216, 216, 219, 0.45); }
.dino-lb-name .rank-me { color: #d9a83c; }
.dino-lb-score { color: #e8e8ea; }
.dino-lb-sep { border-top-color: rgba(255, 255, 255, 0.15); }
.dino-lb-foot {
  border-top-color: rgba(255, 255, 255, 0.1);
  color: rgba(216, 216, 219, 0.6);
}
.dino-lb-foot a { color: #d9a83c; }
.dino-lb-empty { color: rgba(216, 216, 219, 0.45); }
.dino-back {
  background: rgba(20, 20, 24, 0.8);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(220, 220, 224, 0.75);
}
.dino-back:hover { background: rgba(34, 34, 40, 0.92); color: #fff; }

/* anyini.site 定制：intro 撑开动画会把容器先缩到 44px 再撑到全宽，
 * 期间 .arcade-mode 的 max-width:100% 会把画布横向压扁（点击开跑时闪一下变形）。
 * 去掉画布宽度上限：动画期间容器只是「裁剪窗口」，画布保持原比例。 */
.arcade-mode .runner-canvas {
  max-width: none;
}
