/* ===== Doodle Splash Theme - 手绘涂鸦风 ===== */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Comic Neue', 'Kalam', 'Caveat', cursive;
  background: #f6f0e3;
  color: #2c2b28;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ===== Container ===== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ===== Hero Section - 气泡宫格 ===== */
.hero-section {
  padding: 25px 0;
  background: linear-gradient(180deg, #faf6ed 0%, #f6f0e3 100%);
  border-bottom: 3px dashed #ff8c5a;
  margin-bottom: 0px;
  position: relative;
}
.hero-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px 12px;
  max-width: 750px;
  margin: 0 auto;
  padding: 20px 0;
}
.hero-card {
  background: #fffef0;
  padding: 15px 8px 12px;
  width: 140px;
  text-align: center;
  border-radius: 60% 40% 70% 30% / 40% 55% 45% 60%;
  transform: rotate(var(--rot, 0deg));
  box-shadow: 8px 8px 0 rgba(0,0,0,0.08);
  border: 2px dashed #333;
  transition: all 0.2s ease;
}
.hero-card:nth-child(1) {
  --rot: -2deg;
  border-radius: 55% 45% 65% 35% / 45% 60% 40% 55%;
}
.hero-card:nth-child(2) {
  --rot: 3deg;
  border-radius: 45% 55% 35% 65% / 55% 45% 55% 45%;
}
.hero-card:nth-child(3) {
  --rot: -1deg;
  border-radius: 65% 35% 55% 45% / 40% 70% 30% 60%;
}
.hero-card:nth-child(4) {
  --rot: 2.5deg;
  border-radius: 50% 50% 45% 55% / 68% 40% 60% 32%;
}
.hero-card:nth-child(5) {
  --rot: -2.8deg;
  border-radius: 40% 60% 70% 30% / 50% 45% 55% 50%;
}
.hero-card:hover {
  transform: rotate(0deg) scale(1.03);
  background: #fffff0;
  box-shadow: 12px 12px 0 rgba(0,0,0,0.05);
  border-color: #ff8c5a;
  border-style: solid;
}
.hero-card img {
  width: 100%;
  height: auto;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 40% 60% 55% 45% / 55% 45% 60% 40%;
  border: 2px solid #ffb347;
  margin-bottom: 8px;
}
.hero-card span {
  font-family: 'Comic Neue', cursive;
  font-weight: bold;
  font-size: 0.75rem;
  color: #2c2b28;
  display: block;
  padding: 0 4px;
}

/* 平板端 */
@media (max-width: 768px) {
  .hero-section { padding: 20px 0; }
  .hero-grid { max-width: 500px; gap: 15px 10px; }
  .hero-card { width: 120px; padding: 12px 6px 10px; }
}

/* 手机端 */
@media (max-width: 480px) {
  .hero-section { padding: 0px 0; }
  .hero-grid { max-width: 320px; gap: 12px 8px; }
  .hero-card { width: 100px; padding: 10px 5px 8px; }
}

/* ===== Games Section ===== */
.games-section {
  padding: 8px 0 32px;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #ff8c5a;
  position: relative;
  display: inline-block;
  padding-left: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-5deg);
  width: 4px;
  height: 70%;
  background: #ff8c5a;
  border-radius: 4px;
}
@media (max-width: 768px) {
  .section-title { font-size: 1.25rem; }
}

/* ===== Game Grid (Home) ===== */
.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 5px 0;
}
@media (max-width: 1024px) { .game-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 768px)  { .game-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 576px)  { .game-grid { grid-template-columns: repeat(2, 1fr); gap: 2px; } }

/* ===== Game Card - 手绘卡片 ===== */
.game-card {
  background: #fffef7;
  overflow: hidden;
  border: 3px solid #2c2b28;
  filter: drop-shadow(4px 6px 0 rgba(0,0,0,0.15));
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  border-radius: 15px 25px 18px 22px / 25px 15px 28px 18px;
  transform: rotate(var(--card-rot, 0deg));
}
.game-card:hover {
  filter: drop-shadow(6px 10px 0 rgba(255,140,90,0.3));
  transform: rotate(0deg) translateY(-5px) scale(1.02);
  border-color: #ff8c5a;
  border-width: 4px;
}
.game-card-thumb {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  background: #fffef0;
  position: relative;
  border-bottom: 3px dashed #ccc;
}
.game-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.game-card:hover .game-card-thumb img { transform: scale(1.08) rotate(2deg); }
.game-card-title {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #2c2b28;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: #fffef7;
  font-family: 'Kalam', cursive;
}

/* ===== Ad Slot ===== */
.ad-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
}

/* ===== Site Header ===== */
.site-header {
  background: #fffef7;
  border-bottom: 4px dashed #ff8c5a;
  padding: 16px 0;
  z-index: 100;
  box-shadow: 0 4px 0 rgba(0,0,0,0.05);
}
/* 首页隐藏页眉 */
body.index-page .site-header {
  display: none;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  font-weight: 700;
  color: #2c2b28;
  transition: all 0.2s ease;
  transform: rotate(-1deg);
}
.logo:hover {
  transform: rotate(1deg) scale(1.02);
  color: #ff8c5a;
}
.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #ff8c5a, #ffb347);
  border-radius: 50% 45% 55% 48% / 48% 55% 45% 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #2c2b28;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
  position: relative;
}
.logo-icon::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  transform: rotate(-45deg);
  top: 12px;
  left: 8px;
}
.logo-icon::after {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 10px solid #fff;
  bottom: 8px;
  right: 10px;
  transform: rotate(-45deg);
}
.logo span {
  color: #ff8c5a;
}

/* ===== Detail Page ===== */
.detail-wrap {
  display: flex;
  gap: 28px;
  padding: 32px 0;
  flex: 1;
}
.detail-main {
  flex: 7;
  min-width: 0;
}
.detail-sidebar {
  flex: 3;
  min-width: 280px;
  max-width: 360px;
}
@media (max-width: 900px) {
  .detail-wrap { flex-direction: column; }
  .detail-sidebar { max-width: 100%; min-width: 0; }
}

/* Game Frame Area - 手绘游戏框 */
.game-frame-wrap {
  background: #fffef7;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  border: 4px solid #2c2b28;
  filter: drop-shadow(6px 8px 0 rgba(0,0,0,0.15));
  border-radius: 20px 30px 25px 35px / 30px 20px 35px 25px;
}
.game-frame-wrap:fullscreen,
.game-frame-wrap:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  aspect-ratio: unset;
  border-radius: 0;
  filter: none;
}
.game-frame-wrap.mobile-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  z-index: 9999;
  aspect-ratio: unset;
  border-radius: 0;
  filter: none;
}
.game-frame-wrap.mobile-fullscreen .fullscreen-btn {
  display: block;
  z-index: 10;
}
.game-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  position: relative;
  z-index: 1;
}
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(246, 240, 227, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 3;
}
.game-overlay.hidden { opacity: 0; pointer-events: none; }
.game-overlay-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  z-index: 0;
  filter: contrast(90%) brightness(95%);
}
.play-btn {
  position: relative;
  z-index: 1;
  background: #ff8c5a;
  color: #ffffff;
  border: 3px solid #2c2b28;
  padding: 18px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-radius: 50px 40px 45px 55px / 40px 55px 50px 45px;
  box-shadow: 4px 4px 0 #2c2b28;
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
}
.play-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #2c2b28;
}
.play-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #2c2b28;
}

.fullscreen-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: #ffb347;
  color: #2c2b28;
  border: 2px solid #2c2b28;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: none;
  transition: all 0.2s ease;
  border-radius: 25px 20px 22px 18px / 20px 25px 18px 22px;
  box-shadow: 3px 3px 0 #2c2b28;
  font-family: 'Kalam', cursive;
}
.fullscreen-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 #2c2b28;
}
.game-frame-wrap.playing .fullscreen-btn { display: block; }
.game-frame-wrap.playing .game-overlay { display: none; }
.game-frame-wrap.playing .game-overlay-thumb { display: none; }

/* 移动端隐藏全屏按钮 */
@media (max-width: 768px) {
  .game-frame-wrap .fullscreen-btn {
    display: none !important;
  }
}

/* PC端（大于768px）游戏开始后显示全屏按钮 */
@media (min-width: 769px) {
  .game-frame-wrap.playing .fullscreen-btn {
    display: block;
  }
}

/* 全屏模式下隐藏按钮 */
.game-frame-wrap:fullscreen .fullscreen-btn,
.game-frame-wrap:-webkit-full-screen .fullscreen-btn {
  display: none !important;
}

/* Sidebar - 手绘侧边栏 */
.detail-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #ff8c5a;
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  transform: rotate(-1deg);
}
.detail-desc {
  font-size: 1rem;
  color: #4a4844;
  line-height: 1.8;
  margin-bottom: 20px;
  font-family: 'Kalam', cursive;
}
.tips-box {
  background: #fffef7;
  border-left: 4px dashed #ff8c5a;
  padding: 20px;
  margin-top: 16px;
  border-radius: 15px 25px 18px 22px / 25px 15px 28px 18px;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.08));
}
.tips-box h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ff8c5a;
  margin-bottom: 12px;
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  transform: rotate(-1deg);
}
.tips-box ul {
  list-style: none;
  padding: 0;
}
.tips-box li {
  font-size: 0.9rem;
  color: #4a4844;
  padding: 6px 0;
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
  font-family: 'Kalam', cursive;
}
.tips-box li::before {
  content: '★';
  position: absolute;
  left: 0;
  color: #ffb347;
  font-size: 0.8rem;
}

/* Related Games */
.related-section {
  padding: 32px 0;
}
.related-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #ff8c5a;
  position: relative;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  transform: rotate(-1deg);
}
.related-section h2::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 80%;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    #ff8c5a 0px,
    #ff8c5a 8px,
    transparent 8px,
    transparent 16px
  );
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
@media (max-width: 768px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }

/* ===== Footer - 旧纸板页脚 ===== */
.site-footer {
  background: #d4c4a8;
  padding: 40px 0;
  margin-top: auto;
  border-top: 4px dashed #ff8c5a;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-links a {
  font-size: 0.9rem;
  color: #2c2b28;
  transition: all 0.2s ease;
  font-weight: 600;
  padding: 8px 16px;
  position: relative;
  font-family: 'Kalam', cursive;
}
.footer-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: #ff8c5a;
  transition: all 0.2s ease;
  transform: translateX(-50%);
}
.footer-links a:hover::after {
  width: 80%;
}
.footer-links a:hover {
  color: #ff8c5a;
  transform: rotate(-2deg);
}
.footer-copy {
  font-size: 0.85rem;
  color: #6b6458;
  margin-top: 8px;
  font-family: 'Comic Neue', cursive;
}

/* ===== Info Pages (Contact/Policy/About) ===== */
.info-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 20px;
  flex: 1;
  background: #fffef7;
  margin-top: 32px;
  margin-bottom: 32px;
  border: 3px dashed #2c2b28;
  filter: drop-shadow(4px 6px 0 rgba(0,0,0,0.12));
  border-radius: 25px 35px 30px 40px / 35px 25px 40px 30px;
}
.info-page h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 28px;
  color: #ff8c5a;
  font-family: 'Caveat', cursive;
  font-size: 2.8rem;
  transform: rotate(-1deg);
}
.info-page h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: #ff8c5a;
  position: relative;
  padding-left: 16px;
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  transform: rotate(-0.5deg);
}
.info-page h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-5deg);
  width: 4px;
  height: 70%;
  background: #ff8c5a;
  border-radius: 4px;
}
.info-page p {
  font-size: 1rem;
  color: #4a4844;
  line-height: 1.9;
  margin-bottom: 16px;
  font-family: 'Kalam', cursive;
}
.info-page a {
  color: #ff8c5a;
  font-weight: 700;
  transition: all 0.2s ease;
  border-bottom: 2px dashed transparent;
}
.info-page a:hover {
  border-bottom-color: #ff8c5a;
  border-bottom-style: solid;
}
.info-page ul {
  list-style: none;
  padding: 0;
}
.info-page li {
  padding: 8px 0 8px 24px;
  position: relative;
  color: #4a4844;
  font-size: 1rem;
  line-height: 1.8;
  font-family: 'Kalam', cursive;
}
.info-page li::before {
  content: '✦';
  position: absolute;
  left: 4px;
  color: #ffb347;
  font-size: 0.9rem;
}

/* ===== Scrollbar - 手绘滚动条 ===== */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-track {
  background: #f6f0e3;
  border: 2px dashed #d4c4a8;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ff8c5a, #ffb347);
  border-radius: 20px 15px 18px 22px / 15px 20px 22px 18px;
  border: 2px solid #2c2b28;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff6b3d, #ffa026);
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
  .info-page { margin: 20px 16px; padding: 32px 20px; }
  .info-page h1 { font-size: 2rem; }
  .play-btn { padding: 14px 28px; font-size: 1.1rem; }
  .detail-title { font-size: 1.6rem; }
}
