@font-face {
  font-family: "ZhiwuSongti";
  src: url("./fonts/zhiwu-songti-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.chat-area {
  position: relative;
  flex: 1;
  min-height: min(370px, max(280px, calc(100vh - 500px)));
  min-height: min(370px, max(280px, calc(100svh - 500px)));
  display: flex;
  flex-direction: column;
}

.jingfang-scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.jingfang-compass {
  position: relative;
  width: min(calc(100% + 40px), 410px, calc(100vh - 410px));
  width: min(calc(100% + 40px), 410px, calc(100svh - 410px));
  aspect-ratio: 1;
  isolation: isolate;
}

.jingfang-compass .luopan {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 1;
}

.jingfang-compass .luopan::before,
.jingfang-compass .luopan::after { content: none; }

.luopan-canvas {
  display: block;
  width: 100%;
  height: 100%;
  filter: contrast(1.65) saturate(1.32) brightness(.82);
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

.luopan-canvas:active { cursor: grabbing; }

.jingfang-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(70, 88, 76, .25);
  border-radius: 50%;
  background: var(--bg);
  color: #526f5e;
  font-size: 21px;
  font-weight: 400;
  pointer-events: none;
}

.jingfang-fallback {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px solid rgba(70, 88, 76, .25);
  background: repeating-radial-gradient(circle, transparent 0 20px, rgba(70, 88, 76, .2) 21px, transparent 22px);
}

.three-ready .jingfang-fallback { display: none; }
.chat-area #chat { position: relative; z-index: 1; pointer-events: none; }
.chat-area .hint { max-width: 100%; text-align: center; line-height: 1.6; }
body.has-messages .jingfang-scene { display: none; }
body.has-messages #chat { pointer-events: auto; }
body.has-messages .chat-area { min-height: 0; }

body > .topbar { max-width: none; }
.jingfang-title { display: flex; align-items: center; justify-content: center; padding: 12px 4px 8px; text-align: center; }
body .mask { z-index: 2200; }
body .contact-card p { white-space: nowrap; }
body .disclaimer { padding: 6px 12px 10px; line-height: 1.5; }

@media (max-width: 820px) {
  body { --font: "ZhiwuSongti", serif; }
  body #q,
  body #send { font-family: "ZhiwuSongti", serif !important; }
  body #q { font-size: 16px; }
  body[data-page="jingfang"] main {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 10px;
  }
  body[data-page="jingfang"] .jingfang-title {
    position: relative;
    z-index: 2;
    top: 40px;
    padding: 4px 2px 1px;
    line-height: 1.1;
  }
  body[data-page="jingfang"] .jingfang-title h1 {
    font-size: clamp(24px, 7vw, 30px);
    line-height: 1.2;
  }
  body[data-page="jingfang"] .jingfang-title p {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.5;
  }
  body[data-page="jingfang"] .chat-area {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
  }
  body[data-page="jingfang"] #chat {
    padding: 2px 2px 4px;
    gap: 8px;
  }
  body[data-page="jingfang"] .hint {
    position: relative;
    z-index: 2;
    top: 40px;
    font-size: 11px;
    line-height: 1.6;
    padding: 7px 12px;
  }
  body[data-page="jingfang"] .jingfang-compass {
    width: min(calc(100% + 10px), 360px, calc(100svh - 360px));
  }
  .jingfang-center { width: 66px; height: 66px; font-size: 20px; }
  body[data-page="jingfang"] .composer {
    position: relative;
    z-index: 2;
    top: -68px;
  }
  body[data-page="jingfang"] .disclaimer {
    position: relative;
    top: -68px;
    max-width: 100%;
    padding: 8px 10px 10px;
    font-size: 10px;
    line-height: 1.6;
  }
}
