@import url('./chatModule.css');

.root {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
}

.bg {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background-image: url("../bg.webp");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  margin: 0;
  z-index: -1;
  transition: background-image 1s ease-in-out, filter 0.3s ease;
  will-change: background-image;
}

.blur {
  filter: blur(3px);
  z-index: 0;
  transition: filter 0.3s ease;
  /* box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.5); */
}

/* 页面加载动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.root-body > div:first-child {
  animation: fadeInUp 0.8s ease-out;
}

/* 打字机效果容器 */
.typewriter-container {
  position: relative;
}

.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background-color: currentColor;
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: baseline;
}

@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

/* 键盘快捷键提示 */
.keyboard-hint {
  position: fixed;
  bottom: 50px;
  right: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  z-index: 1000;
}

.keyboard-hint.show {
  opacity: 1;
  transform: translateY(0);
}

.keyboard-hint kbd {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
  margin: 0 2px;
}

/* 加载动画 */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.none {
  display: none !important;
}

.block {
  display: block !important;
}

.sticky {
  position: sticky;
}

.time {
  padding-top: 250px;
  text-align: center;
  font-size: 50px;
  color: #fff;
  text-shadow: 0px 0px 5px;
  position: relative;
}

.time span {
  cursor: pointer;
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.search {
  margin-top: 30px;
  display: flex;
  justify-content: center;
  width: 100%;
}

.box_search {
  width: 50%;
  position: relative;
}

.box_search input {
  font-family: "微软雅黑";
  border-radius: 25px;
  color: gray;
  width: 100%;
  height: 35px;
  box-shadow: 0px 0px 5px #fff;
  border: rgba(255, 255, 255, 0.5) solid 1px;
  background: rgba(255, 255, 255, 0.5);
  font-size: 22px;
  text-align: center;
  transition: all 0.2s ease;
  outline: none;
}

.box_search .chatgpt-container {
  position: absolute;
  display: none;
  left: 0;
  top: 40px;
  width: 100%;
  height: 350px;
  box-sizing: border-box;
  padding: 10px 5px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.8);
}

.chatgpt-container .chat-body {
  padding: 10px;
  display: flex;
  flex-flow: column nowrap;
}

/* .box_search:hover {
  width: 50%;
  box-shadow: 0px 0px 7px #fff;
  color: black;
  background: rgba(255, 255, 255, 0.7);
  transform: scale(1);
} */

.box_search:focus {
  border: rgba(255, 255, 255, 0.5) solid 1px;
  box-shadow: 0px 0px 10px #fff;
  color: black;
  background: rgba(255, 255, 255, 0.9);
  width: 50%;
  transform: scale(1);
  text-align: center;
}

.box_search::-webkit-input-placeholder{   /* 使用webkit内核的浏览器 */
	text-align: center;
}
.box_search:-moz-placeholder{    /* Firefox版本4-18 */
	text-align: center;
}              
.box_search::-moz-placeholder{    /* Firefox版本19+ */
	text-align: center;
}              
.box_search:-ms-input-placeholder{   /* IE浏览器 */
	text-align: center;
}

.root-nav {
  padding: 10px;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: space-between;
}

/* 滚动容器 - 全屏翻页 */
.scroll-container {
  height: calc(100vh - 90px);
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* 页面容器 */
.page {
  width: 100%;
  height: calc(100vh - 90px);
  min-height: calc(100vh - 90px);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* 第一页样式 */
.page-1 {
  padding-top: 0;
}

.page-1 .time {
  padding-top: 0;
}

/* 滚动提示 */
.scroll-hint {
  display: none;
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  animation: bounce 2s infinite;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.page-2 .scroll-hint {
  display: none;
}

.scroll-hint-text {
  font-size: 14px;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.scroll-hint-arrow {
  font-size: 24px;
  opacity: 0.7;
}

@keyframes bounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(10px);
  }
}

/* 页面指示器 */
.page-indicator {
  position: fixed;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 768px) {
  .page-indicator {
    right: 12px;
  }
}

@media (max-width: 480px) {
  .page-indicator {
    right: 8px;
    gap: 8px;
  }

  .page-dot {
    width: 8px;
    height: 8px;
  }

  .scroll-hint-text {
    font-size: 11px;
  }

  .scroll-hint-arrow {
    font-size: 16px;
  }
}

/* ============================================
   全面移动端响应式适配
   ============================================ */

/* iOS 安全区域（刘海屏/圆角屏） */
@supports (padding-top: env(safe-area-inset-top)) {
  .root-nav {
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-left: calc(10px + env(safe-area-inset-left));
    padding-right: calc(10px + env(safe-area-inset-right));
  }

  .copyright {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* 平板竖屏 (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
  .time {
    font-size: 38px;
    padding-top: 200px;
  }

  .search {
    margin-top: 20px;
  }

  .box_search {
    width: 70%;
  }

  .box_search input {
    font-size: 18px;
    height: 32px;
  }

  .box_search .chatgpt-container {
    height: 300px;
  }

  .logo {
    transform: scale(1.1);
    margin-left: 20px;
  }

  .rotate-loading {
    width: 32px;
    height: 32px;
  }
}

/* 大屏手机竖屏 (375px - 480px) */
@media screen and (min-width: 375px) and (max-width: 480px) {
  .time {
    font-size: 30px;
    padding-top: 140px;
  }

  .search {
    margin-top: 16px;
  }

  .box_search {
    width: 90%;
  }

  .box_search input {
    font-size: 16px;
    height: 44px;
    border-radius: 22px;
    text-align: left;
    padding: 0 20px;
    box-sizing: border-box;
  }

  .box_search .chatgpt-container {
    height: 320px;
    top: 50px;
  }

  .box_search:focus-within .chatgpt-container {
    display: block;
  }

  .logo-box {
    margin-left: 12px;
  }

  .logo {
    transform: scale(1.0);
    margin-left: 16px;
    font-size: 14px;
  }

  .rotate-loading {
    width: 28px;
    height: 28px;
  }

  .root-nav {
    padding: 8px 10px;
  }

  .scroll-hint {
    bottom: 70px;
  }
}

/* 小屏手机竖屏 (< 375px) */
@media screen and (max-width: 374px) {
  .time {
    font-size: 26px;
    padding-top: 120px;
  }

  .search {
    margin-top: 14px;
  }

  .box_search {
    width: 92%;
  }

  .box_search input {
    font-size: 15px;
    height: 42px;
    border-radius: 21px;
    text-align: left;
    padding: 0 16px;
  }

  .box_search .chatgpt-container {
    height: 280px;
    top: 48px;
  }

  .logo-box {
    margin-left: 10px;
  }

  .logo {
    transform: scale(0.9);
    margin-left: 12px;
    font-size: 13px;
  }

  .rotate-loading {
    width: 24px;
    height: 24px;
  }

  .root-nav {
    padding: 6px 8px;
  }

  .scroll-hint {
    bottom: 65px;
  }
}

/* 横屏模式适配 */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .time {
    font-size: 28px;
    padding-top: 80px;
  }

  .search {
    margin-top: 10px;
  }

  .box_search {
    width: 60%;
  }

  .box_search .chatgpt-container {
    height: 200px;
  }

  .scroll-hint {
    bottom: 20px;
  }
}

/* ============================================
   移动端输入框优化
   ============================================ */
@media screen and (max-width: 768px) {
  .box_search {
    position: relative;
  }

  .box_search input:focus {
    width: 100%;
    text-align: left;
    transform: none;
  }

  .chatgpt-container {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  }

  .ai-tip {
    font-size: 13px;
    width: 80%;
    padding: 10px 14px;
  }

  .chatgpt-container {
    background: rgba(255, 255, 255, 0.95);
  }
}

/* ============================================
   移动端聊天消息气泡
   ============================================ */
@media screen and (max-width: 480px) {
  .chat-child {
    max-width: 85%;
  }

  .chatgpt-container .chat-body {
    padding: 8px;
  }

  .bubble {
    padding: 10px 14px;
    font-size: 15px;
    border-radius: 16px;
    margin-bottom: 16px;
  }
}

/* ============================================
   移动端滚动容器优化
   ============================================ */
@media screen and (max-width: 768px) {
  .scroll-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .page {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
  }

  .page-content {
    overflow: hidden;
  }
}

/* ============================================
   移动端浮动按钮
   ============================================ */
@media screen and (max-width: 480px) {
  .qiuzhi-jianli-btn {
    top: auto !important;
    bottom: 70px;
    right: 50% !important;
    transform: translateX(50%);
    padding: 12px 22px;
    font-size: 13px;
    border-radius: 30px;
    white-space: nowrap;
  }

  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .qiuzhi-jianli-btn {
      bottom: calc(70px + env(safe-area-inset-bottom));
    }
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  .qiuzhi-jianli-btn {
    top: 50px;
    right: 5%;
    padding: 10px 18px;
    font-size: 13px;
  }
}

/* ============================================
   移动端页面指示器
   ============================================ */
@media screen and (max-width: 480px) {
  .page-indicator {
    position: fixed;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .page-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.6);
  }

  .page-dot.active {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.3);
    border-color: rgba(255, 255, 255, 1);
  }
}

/* ============================================
   移动端根元素优化
   ============================================ */
@media screen and (max-width: 768px) {
  .root-body {
    width: 100%;
    height: calc(100vh - 50px);
    height: calc(100dvh - 50px);
    overflow: hidden;
    position: relative;
  }

  .bg {
    background-attachment: scroll;
    background-size: cover;
    background-position: center center;
  }
}

/* ============================================
   移动端键盘提示隐藏 & 触摸反馈优化
   ============================================ */
@media screen and (max-width: 768px) {
  .keyboard-hint {
    display: none;
  }

  .box_search input,
  .box_search .chatgpt-container,
  .page-dot {
    -webkit-tap-highlight-color: transparent;
  }

  .page-dot:active {
    transform: scale(0.9);
  }
}

/* ============================================
   移动端页面内容布局
   ============================================ */
@media screen and (max-width: 768px) {
  .page-1 .page-content {
    justify-content: flex-start;
    padding-top: 0;
  }

  .page-2 .page-content {
    justify-content: flex-start;
    padding-top: 0;
  }
}

.page-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.6);
}

.page-dot.active {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(1.3);
  border-color: rgba(255, 255, 255, 1);
}

.root-body {
  height: calc(100% - 90px);
  overflow: hidden;
}

.project {
  margin: 250px auto 0;
  width: 60%;
  display: flex;
  flex-flow: row wrap;
  gap: 5px;
}

.project > div {
  color: #fff;
  line-height: 40px;
  height: 40px;
  background-color: rgba(0, 0, 0, 0.5);
  text-align: center;
  border-radius: 5px;
  flex: 1 1 auto;
}

.more-container {
  position: absolute;
  top: 20px;
  right: 0;
  min-width: 100px;
  padding: 10px;
  background-color: inherit;
  border-radius: 5px;
  display: none;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
  text-align: center;
}

.logo-box {
  display: flex;
  align-items: center;
  margin-left: 20px;
}

.rotate-loading {
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 50%;
  position: relative;
}

.rotate-loading::after, .rotate-loading:after{
  animation: rotate 4s linear infinite;
  content:'';
  position:absolute;
  left:-50%;
  top:-50%;
  width:80px;
  height:80px;
  background-repeat:no-repeat;
  background-size:50% 50%,50% 50%;
  background-position:0 0, 100% 0, 100% 100%, 0 100%;
  background-image:linear-gradient(#d53e33,#d53e33), linear-gradient(#399953,#399953),linear-gradient(#377af5,#377af5), linear-gradient(#fbb300,#fbb300);
}

.box {
  white-space: nowrap;
}

.scrollContent {
  width: 600px;
  display: inline-block;
  text-align: center;
  animation: loop 3s linear infinite;
}

.logo {
  transform: scale(1.3);
  margin-left: 30px;
  font-weight: 400;
}

@keyframes rotate {
  100% {
    transform: rotate(1turn);
  }
}

@keyframes loop {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

span {
  background-image: linear-gradient(to right, #fff, #eee, #1c95c8, #087fb3);
  background-repeat: no-repeat;
  background-size: 0 2px;
  cursor: pointer;
  white-space: nowrap;
}

span:not(.logo, .marquee, .heat-value-span, .tag):hover {
  transform: translateX(-50%) scale(1.1);
  text-shadow: 0px 0px 5px;
  transition: background-size 1s ease-in-out;
  background-size: 100% 2px;
  background-position: left bottom;
}

.copyright {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  line-height: 30px;
  text-align: center;
  background: repeating-linear-gradient(to right, #000, transparent,#000);
  font-size: 12px;
}

.marquee {
  letter-spacing: 0.2rem;
  font-size: 1.2rem;
  line-height: 40px;
  font-weight: bold;
  background-image: -webkit-linear-gradient(left, #fbb300, #d53e33 25%, #399953 50%, #377af5, #fbb300);
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  -webkit-background-size: 200% 100%;
  -webkit-animation: maskedAnimation 6s infinite linear;
}
@keyframes maskedAnimation {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: -100% 0;
    }
}