:root {
  --blue-deep: #0c8fe9;
  --blue-mid: #0385db;
  --blue-dark: #0176cf;
  --blue-soft: #c4dff5;
  --blue-border: #c1e3ff;
  --blue-card: #0283d9;
  --text: #020202;
  --muted: #aaaaaa;
  --bg: #ffffff;
  --fish: #f8f8f8;
  --shadow-blue: rgba(0, 83, 155, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 100px;
  --footer-h: 132px;
  --app-max: 430px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Source Han Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  background:
    radial-gradient(120% 80% at 50% -10%, #7ecbff 0%, transparent 55%),
    linear-gradient(180deg, #e8f5ff 0%, #cfe9ff 45%, #b7dcff 100%);
  color: var(--text);
}

button,
input {
  font: inherit;
  border: none;
  outline: none;
  background: none;
}

.hidden {
  display: none !important;
}

.page {
  position: relative;
  width: min(100%, var(--app-max));
  height: 100%;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(1, 78, 140, 0.22);
}

/* ---------- Header ---------- */
.header {
  position: relative;
  z-index: 5;
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  padding: 16px 16px 30px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #fff;
  background:
    url("../assets/ui/header.png") center top / 100% 100% no-repeat,
    linear-gradient(180deg, var(--blue-deep) 0%, var(--blue-mid) 100%);
}

.title {
  margin-top: 6px;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(0, 70, 140, 0.25);
  position: relative;
  z-index: 1;
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn img {
  width: 36px;
  height: 36px;
  display: block;
  object-fit: contain;
}

.like-btn {
  position: absolute;
  left: 14px;
  top: 16px;
  z-index: 2;
}

.like-btn img {
  width: 35px;
  height: 36px;
}

.header-actions {
  position: absolute;
  right: 10px;
  top: 14px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.header-action-btn,
.moderation-switch {
  position: static;
  min-width: 78px;
  height: 30px;
  padding: 0 10px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 1px 0 rgba(0, 70, 140, 0.2);
}

.header-action-btn:active,
.moderation-switch:active {
  transform: scale(0.97);
}

.header-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.moderation-switch.is-deepseek {
  background: rgba(12, 40, 90, 0.28);
  border-color: rgba(255, 255, 255, 0.7);
}

.moderation-switch-label {
  white-space: nowrap;
}

.batch-card {
  width: min(92vw, 360px);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
}

.batch-progress {
  margin: 10px 0 8px;
  height: 8px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
}

.batch-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1aa0f0, #0c8fe9);
  transition: width 0.2s ease;
}

.batch-log {
  margin: 0 0 12px;
  padding: 10px;
  max-height: 42vh;
  overflow: auto;
  border-radius: 10px;
  background: #f6f8fb;
  color: #333;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

/* ---------- Main ---------- */
.main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background-color: #fff;
  background-image: url("../assets/ui/fish-pattern.png");
  background-size: 182px 130px;
  background-repeat: repeat;
}

.state {
  width: 100%;
  height: 100%;
}

.state-idle,
.state-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 40px;
  text-align: center;
}

.mascot {
  width: min(58vw, 220px);
  max-width: 220px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(12, 143, 233, 0.18));
  animation: floaty 3.6s ease-in-out infinite;
}

.mascot-error {
  width: min(56vw, 210px);
}

.idle-tip,
.error-tip {
  margin-top: 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.2;
}

.reload-btn {
  margin-top: 18px;
  min-width: 148px;
  height: 44px;
  padding: 0 28px;
  border-radius: 999px;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(180deg, #1aa0f0 0%, #0b86df 100%);
  box-shadow: 0 6px 0 rgba(0, 83, 155, 0.25), 0 10px 18px rgba(12, 143, 233, 0.28);
}

.reload-btn:active {
  transform: translateY(2px);
  box-shadow: 0 3px 0 rgba(0, 83, 155, 0.25), 0 6px 12px rgba(12, 143, 233, 0.24);
}

.state-chat {
  height: 100%;
  overflow: hidden;
}

.chat-list {
  height: 100%;
  overflow-y: auto;
  padding: 18px 15px 24px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  display: flex;
  margin-bottom: 16px;
  animation: rise 0.28s ease;
}

.msg-user {
  justify-content: flex-end;
}

.msg-bot {
  justify-content: flex-start;
}

.bubble-user {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: 24px;
  color: #fff;
  font-size: 18px;
  line-height: 1.35;
  background: linear-gradient(180deg, #1aa0f0 0%, #0c8fe9 100%);
  box-shadow: 0 2px 0 rgba(0, 83, 155, 0.28);
  word-break: break-word;
}

.bubble-typing {
  width: 87px;
  height: 49px;
  border-radius: 16px;
  border: 1px solid var(--blue-card);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 1px 0 rgba(0, 83, 155, 0.15);
}

.bubble-typing i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue-deep);
  opacity: 0.35;
  animation: blink 1.2s infinite ease-in-out;
}

.bubble-typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.bubble-typing i:nth-child(3) {
  animation-delay: 0.3s;
}

.answer-card {
  width: min(100%, 345px);
  padding: 16px 18px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--blue-card);
  box-shadow: 0 2px 0 rgba(0, 83, 155, 0.12);
}

.answer-card h3 {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.answer-card .body {
  font-size: 18px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.answer-card .stream-body {
  min-height: 1.5em;
}

.answer-card .stream-body.is-typing::after {
  content: '▍
  display: inline-block;
  margin-left: 1px;
  color: #0283d9;
  animation: typingCaret 0.8s steps(1) infinite;
}

@keyframes typingCaret {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.answer-card .divider {
  height: 1px;
  margin: 14px 0 12px;
  background: #d6d6d6;
}

.answer-card .card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 2px;
}

.answer-card .action-btn {
  width: 33px;
  height: 33px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #f2f4f7;
  display: grid;
  place-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.answer-card .action-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.answer-card .action-btn:active {
  transform: scale(0.96);
}

.answer-card .action-btn.loading {
  opacity: 0.72;
}

.answer-card .action-btn.loading::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 2px solid rgba(2, 131, 217, 0.2);
  border-top-color: #0283d9;
  animation: spin 0.8s linear infinite;
}

.answer-card .action-btn.loading img {
  opacity: 0.25;
}

.answer-card .action-btn.playing {
  box-shadow: 0 0 0 2px rgba(2, 131, 217, 0.28);
}

.answer-card .action-btn.reported {
  opacity: 0.55;
  pointer-events: none;
}

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

.answer-card .footer-note {
  font-size: 15px;
  line-height: 1.5;
  color: #333;
}

.recommend {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: 16px;
  margin-bottom: 16px;
  width: min(100%, 345px);
}

.recommend-title {
  text-align: center;
  color: #aaaaaa;
  font-size: 15px;
  margin-bottom: 12px;
}

.recommend-item {
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #d6d6d6;
  color: #272727;
  font-size: 15px;
  line-height: 1.4;
  cursor: pointer;
}

.recommend-item:active {
  border-color: #0283d9;
  background: #f3faff;
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 6;
  flex: 0 0 calc(var(--footer-h) + var(--safe-bottom));
  min-height: calc(var(--footer-h) + var(--safe-bottom));
  padding: 0 0 var(--safe-bottom);
  overflow: visible;
}

.footer-deco {
  position: absolute;
  inset: 0 0 var(--safe-bottom);
  background: url("../assets/ui/footer.png?v=3") center bottom / 100% 100% no-repeat;
  pointer-events: none;
  z-index: 0;
}

.composer {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 38px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 8;
  overflow: visible;
}

/* 整图胶囊底，避免三段拼接开裂露白 */
.field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 54px;
  z-index: 2;
  display: flex;
  align-items: center;
}

.field-bg-img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 0;
  user-select: none;
}

.hold-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 54px;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  padding: 0 18px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  border: none;
  background: transparent;
}

.hold-btn.pressing {
  filter: brightness(0.95);
}

.side-btn {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  z-index: 3;
}

.side-btn img {
  width: 38px;
  height: 38px;
  display: block;
  object-fit: contain;
}

.text-input {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 54px;
  padding: 0 16px;
  color: #fff;
  font-size: 15px;
  line-height: 54px;
  border: none;
  outline: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.text-input::placeholder {
  color: var(--blue-soft);
  line-height: 54px;
}

.send-btn {
  position: relative;
  z-index: 2;
  display: none;
  flex: 0 0 auto;
  height: 30px;
  min-width: 48px;
  margin-right: 10px;
  padding: 0 12px;
  border: none;
  border-radius: 15px;
  color: var(--blue-deep);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(0, 83, 155, 0.15);
}

.send-btn.active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.send-btn:active {
  transform: translateY(1px);
}

.send-btn:disabled,
.hold-btn:disabled,
.side-btn:disabled,
.text-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.page.is-asking .composer {
  pointer-events: none;
}

/* ---------- Voice overlay ---------- */
.voice-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-end;
}

.voice-panel {
  width: 100%;
  height: 42%;
  min-height: 260px;
  padding: 28px 20px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  background:
    url("../assets/ui/voice-bg.png?v=2") center bottom / cover no-repeat,
    linear-gradient(180deg, #021a3a 0%, #0a6fc4 45%, #1a9af0 100%);
  box-shadow: 0 -10px 30px rgba(1, 90, 160, 0.25);
  animation: slideUp 0.2s ease;
}

.voice-panel.cancel {
  filter: saturate(0.75) brightness(0.92);
}

.voice-transcript {
  max-width: 86%;
  min-height: 1.4em;
  margin: 0 0 2px;
  padding: 0 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.voice-transcript.visible {
  opacity: 1;
  visibility: visible;
}

.voice-tip {
  font-size: 15px;
  letter-spacing: 0.5px;
}

.voice-tip.cancel {
  color: #ffd7d7;
}

.mic-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.06);
}

.mic-icon {
  width: 28px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 36px;
}

.wave i {
  width: 3px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  animation: wave 0.9s ease-in-out infinite;
}

.wave i:nth-child(odd) {
  animation-duration: 0.75s;
}

.wave i:nth-child(3n) {
  animation-delay: 0.1s;
}

.wave i:nth-child(4n) {
  animation-delay: 0.2s;
}

@keyframes wave {
  0%,
  100% {
    height: 8px;
    opacity: 0.55;
  }
  50% {
    height: 28px;
    opacity: 1;
  }
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- PC / tablet ---------- */
@media (min-width: 768px) {
  body {
    display: grid;
    place-items: center;
    padding: 24px;
  }

  .page {
    height: min(844px, calc(100vh - 48px));
    border-radius: 28px;
    overflow: hidden;
  }

  .header {
    border-radius: 28px 28px 0 0;
  }
}

@media (max-width: 360px) {
  .title {
    font-size: 20px;
  }

  .hold-btn,
  .idle-tip,
  .error-tip,
  .bubble-user,
  .answer-card p,
  .answer-card h3 {
    font-size: 16px;
  }
}

/* ---------- Moderation modal ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 40, 80, 0.45);
}

.modal-card {
  width: min(320px, 100%);
  padding: 22px 20px 18px;
  border-radius: 18px;
  background: #fff;
  text-align: center;
  box-shadow: 0 16px 40px rgba(1, 70, 130, 0.28);
  animation: rise 0.22s ease;
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: #045ea8;
  margin-bottom: 10px;
}

.modal-card p {
  font-size: 15px;
  line-height: 1.55;
  color: #333;
  margin-bottom: 18px;
}

.modal-ok {
  min-width: 120px;
  height: 40px;
  padding: 0 22px;
  border: none;
  border-radius: 20px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: linear-gradient(180deg, #1aa0f0 0%, #0b86df 100%);
}

.modal-ok:active {
  transform: translateY(1px);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-cancel {
  min-width: 108px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid #cfd8e3;
  border-radius: 20px;
  color: #4a5b6d;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: #f5f7fa;
}

.modal-cancel:active {
  transform: translateY(1px);
}

/* ---------- Report page ---------- */
.report-page {
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  z-index: 40;
  width: min(100%, var(--app-max));
  display: flex;
  flex-direction: column;
  background:
    url("../assets/ui/fish-pattern.png") center / 120px repeat,
    linear-gradient(180deg, #f7fbff 0%, #eef6ff 100%);
  box-shadow: 0 18px 50px rgba(1, 78, 140, 0.22);
  transform: translate3d(-50%, 0, 0);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.report-page.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.report-page.is-closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.report-header {
  position: relative;
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  padding: 16px 16px 30px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #fff;
  background:
    url("../assets/ui/header.png") center top / 100% 100% no-repeat,
    linear-gradient(180deg, var(--blue-deep) 0%, var(--blue-mid) 100%);
}

.report-back {
  position: absolute;
  left: 14px;
  top: 40px;
  z-index: 2;
}

.report-back img {
  width: 35px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 60, 120, 0.25));
}

.report-body {
  flex: 1;
  overflow: auto;
  padding: 12px 15px 20px;
  -webkit-overflow-scrolling: touch;
}

.report-tip {
  margin: 4px 0 16px;
  text-align: center;
  color: #636363;
  font-size: 15px;
  line-height: 1.45;
}

.report-types {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 15px;
  margin-bottom: 18px;
}

.report-type {
  height: 50px;
  border-radius: 14px;
  border: 1px solid #d6d6d6;
  background: #fff;
  color: #272727;
  font-size: 18px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.report-type.active {
  border-color: #0283d9;
  color: #0283d9;
  box-shadow: 0 0 0 1px rgba(2, 131, 217, 0.2);
}

.report-other {
  border-radius: 16px;
  border: 1px solid #d6d6d6;
  background: #fff;
  padding: 14px 14px 12px;
}

.report-other h3 {
  font-size: 18px;
  font-weight: 500;
  color: #272727;
  margin-bottom: 10px;
}

.report-desc-box {
  position: relative;
  border-radius: 12px;
  background: #f5f5f5;
  padding: 12px 12px 28px;
}

.report-desc-box textarea {
  width: 100%;
  min-height: 88px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #272727;
  font-size: 15px;
  line-height: 1.5;
  font-family: inherit;
}

.report-desc-box textarea::placeholder {
  color: #aaaaaa;
}

.report-count {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: #aaaaaa;
  font-size: 13px;
}

.report-footer {
  flex: 0 0 auto;
  padding: 12px 20px calc(18px + var(--safe-bottom));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #fff 35%),
    #fff;
}

.report-submit {
  width: 100%;
  max-width: 210px;
  height: 45px;
  margin: 0 auto;
  display: block;
  border: none;
  border-radius: 24px;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(180deg, #1aa0f0 0%, #0b86df 100%);
  box-shadow: 0 4px 0 rgba(0, 83, 155, 0.28);
}

.report-submit:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 rgba(0, 83, 155, 0.28);
}

/* ---------- Report success modal ---------- */
.report-success-card {
  width: min(300px, 100%);
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  text-align: center;
  box-shadow: 0 16px 40px rgba(1, 70, 130, 0.28);
  animation: rise 0.22s ease;
}

.report-success-head {
  position: relative;
  height: 88px;
  background: linear-gradient(180deg, #0c8fe9 0%, #0385db 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.report-success-banner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  pointer-events: none;
}

.report-success-head h3 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  text-shadow: 0 1px 0 rgba(0, 70, 140, 0.25);
}

.report-success-msg {
  margin: 22px 22px 18px;
  color: #333;
  font-size: 15px;
  line-height: 1.65;
}

.report-success-ok {
  margin: 0 auto 20px;
  min-width: 140px;
  height: 42px;
}
