/* ============================================
   希安 · 冥想心象 - 样式表
   ============================================ */

@font-face {
  font-family: 'Xian';
  src: url('../fonts/xiinthlea-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'XianVertical';
  src: url('../fonts/xiinthlea-vertical-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'RodeNotoSC';
  src: url('../fonts/RODE Noto Sans CJK SC B.otf') format('opentype');
  font-weight: bold;
  font-style: normal;
  font-display: block;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #05050c;
  overflow: hidden;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #d0d8ff;
  user-select: none;
  padding: 0;
  margin: 0;
}

/* ---------- Three.js 容器 ---------- */
#container {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 1;
  opacity: 0;
  transition: opacity 1s ease-out;
}

#container.animate-in {
  opacity: 1;
}

/* ---------- 1/4 弧线分隔 ---------- */
.arc-divider {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 50vmin;
  height: 50vmin;
  pointer-events: none;
  z-index: 5;
  opacity: 0.5;
}
.arc-divider.left {
  left: calc(50% - 25vmin - 16vw);
}
.arc-divider.right {
  right: calc(50% - 25vmin - 16vw);
}
.arc-divider svg { width: 100%; height: 100%; }
.arc-divider path {
  fill: none;
  stroke: url(#arcGradient);
  stroke-width: 1.5;
  stroke-linecap: round;
}


@keyframes pulse {
  0% { opacity: 0.3; text-shadow: 0 0 10px rgba(168, 106, 255, 0.3); }
  100% { opacity: 0.85; text-shadow: 0 0 25px rgba(168, 106, 255, 0.8); }
}

/* ---------- 两侧释义面板 ---------- */
.side-char-content {
  position: absolute;
  top: -30px;
  left: -30px;
  right: -30px;
  bottom: -30px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  overflow: visible;
}
.side-char-content.active { opacity: 1; }
.side-char-content.instruction-mode { opacity: 1; }
.side-char-content.instruction-mode .meaning-overlay { opacity: 0; }

/* 梯形底板容器（提供3D透视） */
.trap-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  perspective: 400px;
  perspective-origin: center center;
  pointer-events: none;
  overflow: visible;
}

/* 梯形底板 - 圆角矩形带光条 */
.trap-base {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 250px;
  height: 650px;
  border-radius: 30px;
  box-shadow: 
    0 0 30px rgba(150, 100, 255, 0.15),
    inset 0 0 40px rgba(100, 50, 200, 0.15);
  transform-style: preserve-3d;
  overflow: visible;
  background: rgba(20, 10, 40, 0.4);
}
.trap-base::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 30px;
  background: 
    radial-gradient(ellipse at center, transparent 50%, rgba(60, 40, 100, 0.3) 75%, rgba(80, 50, 130, 0.6) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: -1;
}

.trap-base.left {
  left: 20px;
  transform: translateY(-50%) translateX(-300px) rotateY(40deg);
  background: rgba(20, 10, 40, 0);
}

.trap-base.right {
  right: 20px;
  transform: translateY(-50%) translateX(300px) rotateY(-40deg);
  background: rgba(20, 10, 40, 0);
}

.trap-base.left.animate-in {
  animation: slideLeftIn 1s ease-out;
  animation-fill-mode: forwards;
}

.trap-base.right.animate-in {
  animation: slideRightIn 1s ease-out;
  animation-fill-mode: forwards;
}

@keyframes slideLeftIn {
  0% {
    transform: translateY(-50%) translateX(-300px) rotateY(40deg);
    background: rgba(20, 10, 40, 0);
  }
  100% {
    transform: translateY(-50%) translateX(0) rotateY(40deg);
    background: rgba(20, 10, 40, 0.4);
  }
}

@keyframes slideRightIn {
  0% {
    transform: translateY(-50%) translateX(300px) rotateY(-40deg);
    background: rgba(20, 10, 40, 0);
  }
  100% {
    transform: translateY(-50%) translateX(0) rotateY(-40deg);
    background: rgba(20, 10, 40, 0.4);
  }
}

.trap-base .light-strip {
  position: absolute;
  border-radius: 10px;
}

.trap-base.left .light-strip {
  border-left: none;
}

.trap-base.right .light-strip {
  border-right: none;
}

.trap-base .light-strip:nth-of-type(1) {
  top: 5px;
  left: 5px;
  right: 5px;
  bottom: 5px;
  border: 2px solid rgba(255, 240, 255, 0.7);
  border-radius: 26px;
}

.trap-base .light-strip:nth-of-type(2) {
  top: 13px;
  left: 13px;
  right: 13px;
  bottom: 13px;
  border: 2px solid rgba(220, 200, 255, 0.5);
  border-radius: 22px;
}

.trap-base .light-strip:nth-of-type(3) {
  top: 21px;
  left: 21px;
  right: 21px;
  bottom: 21px;
  border: 2px solid rgba(180, 160, 255, 0.3);
  border-radius: 18px;
}

/* 粒子环绕环 */
.particle-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}
.particle-ring::before,
.particle-ring::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(120, 170, 255, 0.15);
}
.particle-ring::before {
  width: 100%;
  height: 100%;
  border-color: rgba(120, 170, 255, 0.12);
  animation: spinRing 25s linear infinite;
  box-shadow: inset 0 0 40px rgba(100, 160, 255, 0.04);
}
.particle-ring::after {
  width: 65%;
  height: 65%;
  border-color: rgba(120, 170, 255, 0.08);
  animation: spinRing 18s linear infinite reverse;
}
.side-char.right .particle-ring::before {
  border-color: rgba(255, 180, 100, 0.12);
  box-shadow: inset 0 0 40px rgba(255, 160, 80, 0.04);
}
.side-char.right .particle-ring::after {
  border-color: rgba(255, 180, 100, 0.08);
}

@keyframes spinRing {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 环绕光点 */
.particle-ring .orb {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8ab4ff;
  box-shadow: 0 0 8px #8ab4ff, 0 0 16px rgba(138, 180, 255, 0.5);
  top: 50%;
  left: 50%;
  transform-origin: 0 0;
}
.side-char.right .particle-ring .orb {
  background: #ffcc88;
  box-shadow: 0 0 8px #ffcc88, 0 0 16px rgba(255, 204, 136, 0.5);
}

/* 释义覆盖层（在希安字上一层，横向排布） */
.meaning-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 120%;
  height: 120%;
  z-index: 3;
  text-align: center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* 使用说明覆盖层 */
.instruction-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: auto;
  max-height: 80%;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding: 30px;
  box-sizing: border-box;
  gap: 1.2em;
}
.instruction-overlay.visible {
  opacity: 0.55;
}
.instruction-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
}
.instruction-item {
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}
.instruction-action {
  color: rgba(160, 180, 220, 0.7);
  text-shadow: 
    0 0 6px rgba(130, 160, 220, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.4);
}
.instruction-function {
  color: rgba(220, 180, 255, 0.95);
  text-shadow: 
    0 0 10px rgba(200, 150, 255, 1),
    0 0 20px rgba(200, 150, 255, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.5);
}
.instruction-item.example {
  font-size: 0.85rem;
  margin-top: 0.6em;
}
.instruction-label {
  color: rgba(140, 150, 180, 0.5);
  margin-right: 0.5em;
}
.instruction-example {
  color: rgba(255, 200, 150, 0.85);
  font-family: 'Georgia', serif;
  text-shadow: 
    0 0 8px rgba(255, 180, 120, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.4);
}
.pos-tag {
  font-size: 0.75rem;
  color: rgba(150, 180, 240, 0.8);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 400;
  margin-bottom: 1.5em;
  text-shadow: 
    0 0 10px rgba(150, 180, 240, 0.6),
    0 2px 4px rgba(0, 0, 0, 0.5);
}
.def-box {
  width: 100%;
  padding: 1.5em 1em;
  box-sizing: border-box;
}
.def-en, .def-cn {
  font-size: 1.3rem;
  line-height: 2.2;
  font-weight: 500;
  letter-spacing: 0.06em;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  hyphens: auto;
  padding: 0.8em 1.5em;
  max-height: 70%;
  overflow: visible;
  display: inline-block;
  margin: -0.5em -1em;
  border-radius: 0;
}
.def-en {
  color: #ffffff;
  text-shadow: 
    0 0 5px rgba(100, 160, 255, 1),
    0 0 15px rgba(100, 160, 255, 0.9),
    0 0 30px rgba(100, 160, 255, 0.7),
    0 0 50px rgba(100, 160, 255, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 2px rgba(0, 0, 0, 0.6),
    0 4px 4px rgba(0, 0, 0, 0.4),
    0 6px 6px rgba(0, 0, 0, 0.2),
    1px 1px 0 rgba(80, 120, 200, 0.5),
    -1px -1px 0 rgba(120, 180, 255, 0.5);
}
.def-cn {
  color: #fffef0;
  text-shadow: 
    0 0 5px rgba(255, 200, 120, 1),
    0 0 15px rgba(255, 200, 120, 0.9),
    0 0 30px rgba(255, 200, 120, 0.7),
    0 0 50px rgba(255, 200, 120, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.8),
    0 2px 2px rgba(0, 0, 0, 0.6),
    0 4px 4px rgba(0, 0, 0, 0.4),
    0 6px 6px rgba(0, 0, 0, 0.2),
    1px 1px 0 rgba(200, 140, 80, 0.5),
    -1px -1px 0 rgba(255, 220, 150, 0.5);
}

/* ---------- 底部搜索框 ---------- */
.search-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 15;
  perspective: 600px;
  perspective-origin: center bottom;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

#footer-info {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 2rem;
  font-size: 0.75rem;
  color: rgba(150, 120, 200, 0.6);
  pointer-events: auto;
}

.footer-item {
  display: flex;
  align-items: center;
}

.footer-item a {
  color: rgba(180, 140, 255, 0.8);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-item a:hover {
  color: rgba(200, 160, 255, 1);
  text-shadow: 0 0 10px rgba(180, 140, 255, 0.6);
}

.search-box {
  position: relative;
  width: calc(100% - 600px);
  max-width: 600px;
  min-width: 300px;
  height: 72px;
  margin: 0 300px 50px;
  border-radius: 18px;
  box-shadow: 
    0 0 24px rgba(150, 100, 255, 0.15),
    inset 0 0 36px rgba(100, 50, 200, 0.15);
  transform-style: preserve-3d;
  transform: translateY(100px) rotateX(35deg);
  background: rgba(20, 10, 40, 0);
  overflow: visible;
  pointer-events: auto;
}

.search-box.animate-in {
  animation: slideUpIn 1s ease-out;
  animation-delay: 0.3s;
  animation-fill-mode: forwards;
}

@keyframes slideUpIn {
  0% {
    transform: translateY(100px) rotateX(35deg);
    background: rgba(20, 10, 40, 0);
  }
  100% {
    transform: translateY(0) rotateX(35deg);
    background: rgba(20, 10, 40, 0.4);
  }
}

.search-box::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 15px;
  background: 
    radial-gradient(ellipse at center, transparent 40%, rgba(60, 40, 100, 0.3) 70%, rgba(80, 50, 130, 0.6) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: -1;
}

.search-box .search-light-strip {
  position: absolute;
  border-radius: 8px;
}

.search-box .search-light-strip:nth-of-type(1) {
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border: 2px solid rgba(255, 240, 255, 0.7);
  border-radius: 16px;
}

.search-box .search-light-strip:nth-of-type(2) {
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 2px solid rgba(220, 200, 255, 0.5);
  border-radius: 12px;
}

.search-box .search-light-strip:nth-of-type(3) {
  top: 16px;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border: 2px solid rgba(180, 160, 255, 0.3);
  border-radius: 8px;
}

.search-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  height: 70%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#search-input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #d0d8ff;
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  padding: 0 18px;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

#search-input::placeholder {
  color: rgba(150, 180, 220, 0.5);
  letter-spacing: 0.1em;
}

#search-btn {
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  outline: none;
  color: rgba(150, 180, 240, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.3s ease;
}

#search-btn:hover {
  color: rgba(100, 160, 255, 1);
  transform: scale(1.1);
}

#search-btn svg {
  transition: filter 0.3s ease;
}

#search-btn:hover svg {
  filter: drop-shadow(0 0 8px rgba(100, 160, 255, 0.8));
}

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .xian-char-large { font-size: 50vh; max-height: 50vh; }
  .side-char { height: 50vh; }
  .search-box { 
    width: calc(100% - 400px);
    margin: 0 200px 50px;
    max-width: 500px;
    height: 60px;
  }
}

@media (max-width: 768px) {
  .xian-char-large { font-size: 40vh; max-height: 40vh; }
  .side-char { height: 40vh; }
  .def-en, .def-cn { font-size: 0.75rem; }
  .arc-divider { display: none; }
}
