:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --text: #111827;
  --muted: #6b7280;
  --bg: #f3f4f6;
  --card: #ffffff;
  --highlight: #dc2626;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body.modal-open {
  overflow: hidden;
}

.tips-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tips-btn:hover {
  background: #eff6ff;
}

.tips-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.tips-modal[hidden] {
  display: none;
}

.tips-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.tips-dialog {
  position: relative;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.tips-dialog h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--blue);
}

.tips-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.tips-section {
  margin-bottom: 1rem;
}

.tips-section h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.tips-section p {
  margin: 0.35rem 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: #374151;
}

.tips-section code {
  font-size: 0.82rem;
  background: #f3f4f6;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.tips-qr {
  display: block;
  margin: 0.75rem auto 0;
  border-radius: 8px;
}

.header {
  position: relative;
  background: linear-gradient(180deg, #eff6ff 0%, #f3f4f6 100%);
  padding: 2rem 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--blue);
}

.tagline {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  max-width: 560px;
  margin: 0 auto;
}

.search-form input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 1rem;
  outline: none;
}

.search-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-form button {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.search-form button:hover {
  background: var(--blue-dark);
}

.main {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

.status {
  text-align: center;
  color: var(--muted);
  margin: 0 0 1rem;
}

.status.error {
  color: #b91c1c;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1rem 0.85rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card-source {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.card-body {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.sentence-text {
  flex: 1;
  line-height: 1.6;
  cursor: pointer;
  user-select: none;
}

.sentence-text b {
  color: var(--highlight);
  font-weight: 700;
}

.chinese-text {
  color: #374151;
}

.chinese-text.hidden {
  display: none;
}

.english-text.hidden {
  display: none;
}

.tts-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.tts-btn:hover {
  background: #eff6ff;
}

@media (max-width: 480px) {
  .search-form {
    flex-direction: column;
  }

  .search-form button {
    width: 100%;
  }
}
