@charset "utf-8";

/* 防止横向滚动条的全局设置 */
* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
}

html,
body,
div,
ul,
li,
h1,
h2,
h3,
h4,
h5,
h6,
p,
form,
dl,
dt,
dd,
a,
abbr,
acronym,
address,
applet,
area,
article,
aside,
audio,
b,
abse,
absefont,
bdo,
big,
blockguote,
br,
button,
canvas,
caption,
center,
cite,
code,
col,
colgroup,
command,
datagrid,
datalist,
datatemplate,
del,
details,
dialog,
dir,
dfn,
em,
embed,
event-source,
fieldset,
figure,
font,
footer,
frameset,
frameset,
head,
header,
hr,
i,
iframe,
img,
input,
ins,
isindex,
kbd,
label,
legend,
link,
m,
map,
menu,
meta,
meter,
nav,
nest,
noframes,
noscript,
object,
optgroup,
option,
output,
,
param,
pre,
progress,
q,
rule,
s,
samp,
script,
select,
small,
source,
span,
strike,
strong,
style,
sub,
sup,
table,
tbody,
td,
textarea,
tfoot,
th,
thead,
time,
title,
tr,
tt,
u,
ul,
var,
video,
xmp {
  margin: 0;
  padding: 0;
  border: 0;
  font: normal 14px '微软雅黑', Arial, Helvetica, sans-serif;
  color: #333;
  -webkit-text-size-adjust: none;
}

a:link,
a:visited,
a:hover,
a:active {
  text-decoration: none;
  color: #333;
}

ul,
li,
ol,
dl,
dt {
  list-style: none;
  margin: 0;
  padding: 0;
}

html {
  margin: 0;
  padding: 0;
  height: 100%;
  /* 防止横向滚动条 */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 10px 0 0 0;
  background: #003567;
  height: 100%;
  /* 防止横向滚动条 */
  overflow-x: hidden;
  /* 使用100%而不是100vw来避免滚动条问题 */
  width: 100%;
  box-sizing: border-box;
}

#game_body {
  /* 移动端完全自适应：使用更安全的宽度计算 */
  width: min(calc(100vw - 20px), calc(100vh - 120px));
  height: min(calc(100vw - 20px), calc(100vh - 120px));
  /* 确保是正方形：强制宽高相等 */
  aspect-ratio: 1;
  margin: 10px auto;
  background: #3c5771;
  position: relative;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.game_list {
  /*background:#5091ba;*/
  background: #5091ba;
  position: absolute;
  border-radius: 5px;
  z-index: 1;
  cursor: move;
  /* 确保每个格子都是正方形 */
  aspect-ratio: 1;
  width: 23.5%;
  height: 23.5%;
}

#game_body p {
  width: 100%;
  height: 100%;
  /* 自适应字体大小：基于视口宽度，适应完全自适应的容器 */
  font-size: clamp(9px, 2.8vw, 14px);
  font-weight: bold;
  /* color will be set by JavaScript */
  text-align: center;
  border-radius: 6px;
  margin: 0;
  position: absolute;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  /* 垂直布局：图片在上，文字在下 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  box-sizing: border-box;
  -webkit-transition-property: all;
  -webkit-transition-delay: 0.0s;
  -webkit-transition-duration: 0.4s;
  -webkit-transition-timing-function: ease;
  -moz-transition-property: all;
  -moz-transition-delay: 0.0s;
  -moz-transition-duration: 0.4s;
  -moz-transition-timing-function: ease;
  -o-transition-property: all;
  -o-transition-delay: 0.0s;
  -o-transition-duration: 0.4s;
  -o-transition-timing-function: ease;
  -ms-transition-property: all;
  -ms-transition-delay: 0.0s;
  -ms-transition-duration: 0.4s;
  -ms-transition-timing-function: ease;
  transition-property: all;
  transition-delay: 0.0s;
  transition-duration: 0.4s;
  transition-timing-function: ease;
}

/* 游戏格子中的图片样式 */
#game_body p .car-image {
  width: 60%;
  height: 60%;
  object-fit: contain;
  /* 圆角边框设计 */
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  /* 确保背景完全透明 */
  background: transparent !important;
  background-color: transparent !important;
  padding: 3px;
  box-sizing: border-box;
  flex-shrink: 0;
  /* 添加轻微阴影增加层次感 */
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  /* 确保图片渲染质量 */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  /* 过渡动画 */
  transition: all 0.3s ease;
}

/* 游戏格子中的文字样式 */
#game_body p .car-name {
  font-size: inherit;
  font-weight: inherit;
  text-shadow: inherit;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  flex-shrink: 0;
}

/*#reset{line-height:30px;background:#d2d2d2;display:inline;padding:5px;border-radius:5px;box-shadow:3px 3px 5px 1px #000;}*/
.c {
  width: 100%;
  height: 0px;
  overflow: hidden;
  clear: both;
}

/* 现代化游戏头部样式 */
.game-header {
  width: calc(100% - 80px);
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: nowrap;
  /* 强制不换行，保持左右布局 */
}

/* 游戏标题区域 - 左侧 */
.game-title {
  flex: 1;
  min-width: 0;
  /* 允许收缩 */
  max-width: 65%;
  /* 最大占用65%宽度 */
}

.title-text {
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.title-main {
  display: block;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.title-desc {
  margin-top: 4px;
}

.title-subtitle {
  font-size: clamp(11px, 2.8vw, 14px);
  font-weight: 400;
  opacity: 0.9;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

/* 右侧区域 */
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  flex-shrink: 0;
  /* 不允许收缩 */
  min-width: 120px;
  max-width: 35%;
  /* 最大占用35%宽度 */
}

/* 当前成绩样式 */
.current-record {
  text-align: left;
}

.record-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
  font-weight: 500;
}

.record-value {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.record-icon {
  font-size: 18px;
}

.record-text {
  color: #fff;
  font-weight: 600;
  font-size: clamp(14px, 3.5vw, 16px);
}

.game-stats {
  flex: 1;
  min-width: 160px;
  text-align: right;
}

.stats-text {
  color: #fff;
  font-size: clamp(12px, 3vw, 14px);
  margin-bottom: 2px;
  font-weight: 500;
}

.highlight {
  color: #ffd700;
  font-weight: 700;
  font-size: 1.1em;
}

.challenge-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: clamp(10px, 2.5vw, 12px);
  font-style: italic;
}

/* 重置按钮样式 */
.reset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  color: #333;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 154, 158, 0.3);
  white-space: nowrap;
  min-width: auto;
}

.reset-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4);
  background: linear-gradient(135deg, #ffa8ac, #fed0f1);
}

.reset-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(255, 154, 158, 0.3);
}

.reset-icon {
  font-size: 14px;
  animation: rotate 3s linear infinite;
}

.reset-text {
  font-weight: 600;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* 旧样式保留（用于其他部分） */
.btn_foot,
.foot,
.foot_btn {
  height: 40px;
  width: 100%;
  max-width: 600px;
  padding: 0 20px;
  margin: 0 auto;
}

.foot {
  background: #3c5771;
  bottom: 0px;
  z-index: 10;
  display: none;
}

.floatR {
  float: right;
}

.foot_btn {
  margin-top: 0;
}

.foot_btn .btn_reset {
  line-height: 40px;
  background: transparent;
  font-size: 18px;
  font-weight: bold;
}

.foot_btn .btn_reset img {
  width: 25px;
  margin-top: 10px;
}

.h60 {
  height: 60px;
}

.bag {
  width: 300px;
  margin: 0 auto;
  background: url(http://i0.sinaimg.cn/qc/2014/bag.gif) no-repeat left top;
  background-size: 100%;
  height: 100%;
  position: relative;
}

.bag img {
  width: 100%;
  position: absolute;
  left: 0px;
  top: 350px;
  width: 100%;
}

/* 游戏结果页面样式 */
.result {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.result ul {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 30px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 280px;
  max-width: 90vw;
  margin: 0;
  list-style: none;
}

.result ul li {
  text-align: center;
  color: #fff;
  font-weight: bold;
  line-height: 1.4;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 16px;
}

.result ul li:nth-child(1) {
  font-size: clamp(20px, 5vw, 28px);
  color: #ff6b6b;
  margin-bottom: 20px;
}

.result ul li:nth-child(2) {
  font-size: clamp(16px, 4vw, 20px);
  opacity: 0.9;
  margin-bottom: 24px;
}

.result ul li:nth-child(3) {
  font-size: clamp(22px, 6vw, 32px);
  color: #ffd700;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.result ul li:nth-child(4) {
  margin-bottom: 0;
}

.result ul li img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* 结果页面重新开始按钮 */
.result-restart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  color: #333;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: clamp(14px, 3.5vw, 18px);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 16px rgba(255, 154, 158, 0.3);
  margin-top: 20px;
  width: 100%;
}

.result-restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 154, 158, 0.4);
  background: linear-gradient(135deg, #ffa8ac, #fed0f1);
}

.result-restart-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 154, 158, 0.3);
}

/* .result-restart-btn span:first-child {
  font-size: 16px;
  animation: rotate 3s linear infinite;
} */

/* PC端和大屏设备 */
@media screen and (min-width: 768px) {
  #game_body {
    /* PC端固定合适的正方形尺寸 */
    width: 480px;
    height: 480px;
    aspect-ratio: 1;
    margin: 20px auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  }

  #game_body p {
    font-size: 16px;
    border-radius: 8px;
  }

  #game_body p .car-image {
    width: 65%;
    height: 65%;
    /* PC端更大的圆角和边框 */
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
  }

  /* PC端头部优化 */
  .game-header {
    margin: 40px auto;
    padding: 24px;
  }

  .header-content {
    gap: 20px;
  }

  .game-info {
    flex-wrap: nowrap;
  }

  .reset-btn {
    padding: 14px 28px;
    font-size: 16px;
  }

  .reset-btn:hover {
    transform: translateY(-3px);
  }

  .bag {
    width: 600px;
    height: 800px;
  }

  .bag img {
    top: 650px;
  }

  /* PC端结果页面优化 */
  .result ul {
    min-width: 400px;
    padding: 50px 40px;
  }

  .result ul li img {
    max-width: 150px;
    max-height: 150px;
  }
}

/* 大屏手机和小平板 - 自适应但有最大限制 */
@media screen and (min-width: 480px) and (max-width: 767px) {
  #game_body {
    /* 确保正方形：取宽高的最小值 */
    width: min(calc(100vw - 24px), calc(100vh - 120px), 500px);
    height: min(calc(100vw - 24px), calc(100vh - 120px), 500px);
    aspect-ratio: 1;
    margin: 12px auto;
  }

  #game_body p {
    font-size: clamp(12px, 3.2vw, 16px);
  }

  #game_body p .car-image {
    width: 62%;
    height: 62%;
    /* 大屏手机适中的圆角和边框 */
    border-radius: 7px;
    border: 2px solid rgba(255, 255, 255, 0.35);
  }

  /* 大屏手机头部优化 */
  .header-content {
    flex-wrap: nowrap;
  }

  .game-title {
    min-width: 250px;
  }

  .header-right {
    min-width: 140px;
  }
}

/* 小屏手机 - 完全自适应 */
@media screen and (max-width: 479px) {
  #game_body {
    /* 确保正方形：取宽高的最小值 */
    width: min(calc(100vw - 16px), calc(100vh - 100px));
    height: min(calc(100vw - 16px), calc(100vh - 100px));
    aspect-ratio: 1;
    margin: 8px auto;
  }

  #game_body p {
    /* 基于实际容器宽度的字体大小 */
    font-size: clamp(9px, 2.8vw, 13px);
  }

  #game_body p .car-image {
    width: 58%;
    height: 58%;
    /* 小屏手机紧凑的圆角和边框 */
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
  }

  /* 小屏幕头部布局调整 */
  .header-content {
    gap: 12px;
  }

  .game-title {
    max-width: 60%;
    /* 小屏幕时左侧占60% */
  }

  .header-right {
    max-width: 40%;
    /* 小屏幕时右侧占40% */
    min-width: 100px;
  }

  .title-main {
    font-size: clamp(18px, 4.5vw, 24px);
  }

  .title-subtitle {
    font-size: clamp(10px, 2.5vw, 12px);
  }

  /* 确保页面边距最小化 */
  body {
    padding: 5px 0 0 0;
    margin: 0;
    overflow-x: hidden;
  }
}

/* 旧的媒体查询已被新的自适应方案替代 */

/* 极小屏幕优化 (如 iPhone SE) */
@media screen and (max-width: 320px) {
  #game_body {
    /* 极小屏幕确保正方形 */
    width: min(calc(100vw - 12px), calc(100vh - 80px));
    height: min(calc(100vw - 12px), calc(100vh - 80px));
    aspect-ratio: 1;
    margin: 6px auto;
    border-radius: 6px;
  }

  #game_body p {
    font-size: clamp(8px, 2.5vw, 12px);
    border-radius: 4px;
  }

  #game_body p .car-image {
    width: 55%;
    height: 55%;
    /* 极小屏幕最小的圆角和边框 */
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  /* 极小屏幕头部优化 */
  .game-header {
    margin: 10px auto;
    padding: 12px;
    border-radius: 12px;
  }

  .header-content {
    gap: 8px;
    /* 保持左右布局，但间距更小 */
  }

  .game-title {
    max-width: 55%;
    /* 极小屏幕时左侧占55% */
  }

  .header-right {
    max-width: 45%;
    /* 极小屏幕时右侧占45% */
    min-width: 90px;
    gap: 8px;
  }

  .title-main {
    font-size: clamp(16px, 4vw, 20px);
    margin-bottom: 2px;
  }

  .title-subtitle {
    font-size: clamp(9px, 2.2vw, 11px);
  }

  .record-label {
    font-size: 10px;
  }

  .record-text {
    font-size: clamp(11px, 2.8vw, 13px);
  }

  .reset-btn {
    padding: 6px 10px;
    font-size: 10px;
  }

  .reset-icon {
    font-size: 12px;
  }

  body {
    padding: 2px 0 0 0;
    overflow-x: hidden;
  }
}

/* 超大屏幕优化 */
@media screen and (min-width: 1200px) {
  #game_body {
    width: 520px;
    height: 520px;
    aspect-ratio: 1;
    margin: 20px auto;
  }

  #game_body p {
    font-size: 18px;
  }

  #game_body p .car-image {
    width: 70%;
    height: 70%;
    /* 大屏PC最大的圆角和边框 */
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

@media screen and(max-device-width:480px) {}