@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&family=Noto+Serif+SC:wght@500;700&display=swap');

:root {
  --bg: #08111f;
  --panel: rgba(12, 19, 34, 0.92);
  --card: rgba(16, 25, 45, 0.96);
  --line: rgba(148, 163, 184, 0.18);
  --text: #edf2f7;
  --muted: #94a3b8;
  --gold: #facc15;
  --blue: #38bdf8;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans SC', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 32%),
    radial-gradient(circle at top right, rgba(250, 204, 21, 0.08), transparent 28%),
    linear-gradient(180deg, #07111d, #0b1220);
  color: var(--text);
}

.page {
  width: min(1240px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero, .panel, .question-card, .sub-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}

.hero {
  padding: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 12px 0 10px;
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(26px, 4vw, 40px);
}

.hero p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.8;
}

.toolbar {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
  margin-top: 20px;
}

.panel { padding: 18px; }

.title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.title-row h2, .title-row h3 {
  margin: 0;
  font-size: 18px;
}

.subtle {
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

button {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 14px;
  font: inherit;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover { transform: translateY(-1px); }

.btn-main {
  padding: 10px 14px;
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #111827;
  font-weight: 700;
}

.btn-sub {
  padding: 10px 14px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.drop-zone {
  min-height: 108px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-radius: 18px;
  border: 1.5px dashed rgba(56, 189, 248, 0.45);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(250, 204, 21, 0.05));
  text-align: center;
  color: #cbd5e1;
  line-height: 1.8;
}

.drop-zone.dragover {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.12), rgba(56, 189, 248, 0.08));
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.summary-item .label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.summary-item .value {
  font-size: 24px;
  font-weight: 700;
}

.stats-title {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.usage-grid {
  margin-top: 4px;
}

.usage-value {
  font-size: 20px !important;
}

.usage-mini {
  font-size: 14px !important;
  line-height: 1.5;
  word-break: break-word;
}

.status-text {
  margin-top: 12px;
  min-height: 24px;
  color: #cbd5e1;
}

.warning-list {
  margin: 12px 0 0 18px;
  color: #fbbf24;
  line-height: 1.7;
}

#questionList {
  display: grid;
  gap: 20px;
}

.empty {
  padding: 50px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 22px;
}

.question-card {
  overflow: hidden;
  background: linear-gradient(180deg, rgba(16, 25, 45, 0.98), rgba(10, 17, 31, 0.98));
}

.question-head {
  padding: 20px 22px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(140deg, rgba(250, 204, 21, 0.08), transparent 30%);
}

.meta-top, .chip-row, .meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
}

.meta-top {
  justify-content: space-between;
  margin-bottom: 10px;
}

.q-title {
  margin: 0;
  font-family: 'Noto Serif SC', serif;
  font-size: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.gold {
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.18);
}

.blue {
  background: rgba(56, 189, 248, 0.12);
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.18);
}

.green {
  background: rgba(34, 197, 94, 0.12);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.18);
}

.red {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.18);
}

.meta-line {
  color: #cbd5e1;
  font-size: 14px;
}

.block {
  margin-top: 14px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.block-label {
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.content {
  line-height: 1.9;
  word-break: break-word;
}

.content img.content-image {
  display: block;
  max-width: min(100%, 420px);
  margin: 12px auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.fill-placeholder {
  display: inline-block;
  min-width: 54px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(148, 163, 184, 0.12);
  color: #cbd5e1;
}

.image-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.image-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.image-card h4 {
  margin: 0;
  padding: 10px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  color: #cbd5e1;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: #0f172a;
}

.image-card a {
  display: block;
  padding: 10px 12px 12px;
  color: #93c5fd;
  word-break: break-all;
  font-size: 12px;
}

.sub-list { padding: 0 18px 18px; }

.sub-card {
  margin-top: 16px;
  background: var(--card);
}

.sub-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.sub-title {
  margin: 0;
  font-size: 18px;
}

.sub-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  padding: 18px;
}

.col {
  display: grid;
  gap: 12px;
}

.qa-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
}

.qa-row .k {
  color: var(--muted);
  font-size: 13px;
}

.portrait {
  border-left: 3px solid var(--red);
  padding-left: 12px;
  color: #fecaca;
  line-height: 1.8;
}

.ask-btn {
  padding: 10px 14px;
  background: linear-gradient(135deg, #38bdf8, #6366f1);
  color: #f8fafc;
  font-weight: 700;
}

.chat {
  display: none;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.65);
}

.chat.open { display: block; }

.chat-tip {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.messages {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.avatar.ai {
  background: rgba(56, 189, 248, 0.15);
  color: #bae6fd;
}

.avatar.user {
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
}

.bubble {
  flex: 1;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.94);
  line-height: 1.85;
}

.bubble.user {
  background: rgba(52, 38, 5, 0.92);
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0 44px;
}

.suggestion-btn {
  padding: 8px 12px;
  background: rgba(56, 189, 248, 0.14);
  color: #e0f2fe;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 999px;
  font-size: 13px;
}

.usage-badge {
  margin: 8px 0 0 44px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.bubble p:first-child { margin-top: 0; }
.bubble p:last-child { margin-bottom: 0; }

.typing::after {
  content: '';
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -2px;
  background: rgba(255, 255, 255, 0.85);
  animation: blink 0.9s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.dots {
  display: inline-flex;
  gap: 5px;
}

.dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  animation: pulse 1.1s infinite ease-in-out;
}

.dots span:nth-child(2) { animation-delay: 0.12s; }
.dots span:nth-child(3) { animation-delay: 0.24s; }

@keyframes pulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.45; }
  40% { transform: scale(1); opacity: 1; }
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

textarea {
  width: 100%;
  min-height: 52px;
  max-height: 140px;
  resize: vertical;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.96);
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
  line-height: 1.7;
}

.send-btn {
  min-width: 92px;
  padding: 0 16px;
  background: linear-gradient(135deg, #facc15, #f97316);
  color: #111827;
  font-weight: 700;
}

.send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.hidden { display: none; }

footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 960px) {
  .toolbar, .sub-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 18px, 100%);
    padding-top: 14px;
  }

  .qa-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }
}
