:root {
  --primary-color: #8B4513;
  --secondary-color: #A0522D;
  --background-color: #FDF5E6;
  --text-color: #4A4A4A;
  --border-color: #DEB887;
  --success-color: #2E8B57;
  --error-color: #CD5C5C;
  --shadow-color: rgba(139, 69, 19, 0.1);
  --transition-time: 0.3s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Serif SC', serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 页面切换动画 */
.page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: translateX(100%);
  transition: all 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page.active {
  transform: translateX(0);
}

/* 头部样式 */
.app-header, .page-header {
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 4px var(--shadow-color);
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.logo {
  width: 50px;
  height: 50px;
}

h1 {
  font-size: 2rem;
  margin: 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 主要内容区域 */
.main-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 100px;
}

/* 时间显示 */
.current-time {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow-color);
  margin-bottom: 30px;
}

.date-display, .time-display {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

/* 按钮样式 */
.btn-primary, .btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-time) ease;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-secondary {
  background-color: white;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-primary:hover, .btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-color);
}

/* 起卦动画 */
.divination-animation {
  position: relative;
  height: 200px;
  margin: 30px 0;
  perspective: 1000px;
}

.card-stack,
.selected-card {
  width: 120px;
  height: 180px;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  box-shadow: 0 4px 8px var(--shadow-color);
  transition: all 0.5s ease;
  backface-visibility: hidden;
}

.card-stack {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.selected-card {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.3s ease;
}

.selected-card.animate {
  transform: translateX(-50%) translateY(-100px) rotateY(180deg);
  opacity: 1;
}

/* 结果展示 */
.result-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.hexagram-header {
  text-align: center;
  margin-bottom: 30px;
}

.hexagram-title {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 15px;
}

.hexagram-image {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.interpretation-section {
  margin-bottom: 25px;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeIn 0.5s ease forwards;
}

.interpretation-section:nth-child(1) { animation-delay: 0.1s; }
.interpretation-section:nth-child(2) { animation-delay: 0.2s; }
.interpretation-section:nth-child(3) { animation-delay: 0.3s; }
.interpretation-section:nth-child(4) { animation-delay: 0.4s; }

.interpretation-section h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.2rem;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .main-content {
    padding: 15px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .date-display, .time-display {
    font-size: 1rem;
  }

  .btn-primary, .btn-secondary {
    width: 100%;
    margin-bottom: 10px;
  }

  .calendar-day {
    font-size: 0.9rem;
  }
}

/* 动画关键帧 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* 加载动画 */
.loading-animation {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
}

.loading-circle {
  width: 60px;
  height: 60px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

/* 按钮点击效果 */
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.95);
}

.btn-back {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  background-color: #f5f5f5;
  color: #333;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 91;
}

.btn-back:hover {
  background-color: #e0e0e0;
}

.icon-back {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z' fill='%23333'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.result-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 16px;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.result-actions .btn-primary,
.result-actions .btn-secondary {
  flex: 1;
  max-width: 200px;
}

.page-header {
  position: sticky;
  top: 0;
  background-color: #fff;
  z-index: 90;
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.page-header h2 {
  margin: 0;
  text-align: center;
  width: 100%;
}

.interpretation-content {
  padding: 16px;
  padding-bottom: 96px;
}

.divination-time {
  color: var(--text-color);
  font-size: 1rem;
  margin-bottom: 20px;
}

/* 只在页面显示时使用动画，保存图片时不需要动画和透明度 */
.page.active .interpretation-section {
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

.interpretation-section h3 {
  color: var(--primary-color);
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: bold;
}

.interpretation-section p {
  color: var(--text-color);
  line-height: 1.8;
  font-size: 1rem;
}

.lost-item-button {
  margin-top: 20px;
}

#lostItemPage .interpretation-section {
  margin-bottom: 20px;
}

#lostItemPage .current-time {
  margin-bottom: 30px;
}

/* 首页功能按钮样式 */
.feature-buttons {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-button {
    width: 100%;
}

.feature-button button {
    width: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.feature-button button:hover {
    transform: translateY(-2px);
}

.feature-title {
    font-size: 1.5rem;
    font-weight: bold;
}

.feature-desc {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* 寻物诀时间选择样式 */
.time-selector {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow-color);
    margin-bottom: 20px;
}

.time-input-group {
    margin: 20px 0;
}

.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.input-row label {
    width: 60px;
    flex-shrink: 0;
}

.input-row input {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.lunar-display {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.lunar-display div {
    margin-bottom: 5px;
}

#calculateLostItem {
    width: 100%;
    margin-top: 20px;
}

.disclaimer-text {
    text-align: center;
    color: #666;
    font-size: 12px;
    padding: 10px 0;
    margin-top: 20px;
}