* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: linear-gradient(135deg, #f5f0e8 0%, #e8dfd0 100%);
  min-height: 100vh;
  color: #2c2416;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #5b3a1c;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.95rem;
  color: #8b7355;
}

.card {
  background: #fffdf7;
  border: 1px solid #e5dccf;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.card-label {
  font-size: 0.85rem;
  color: #b08968;
  margin-bottom: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.read-btn {
  background: none;
  border: 1px solid #d9cdb8;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 8px;
  line-height: 1.4;
  transition: background 0.2s;
  font-family: inherit;
}

.read-btn:hover {
  background: #f0e8d8;
}

.read-btn.hidden {
  display: none;
}

.sentence-text {
  font-size: 1.35rem;
  line-height: 1.8;
  color: #3c2a14;
  font-weight: 500;
}

.sentence-pinyin {
  margin-top: 10px;
  font-size: 0.95rem;
  color: #8b7355;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.sentence-source {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #a89580;
}

.controls {
  margin-bottom: 16px;
}

.api-key-label {
  display: block;
  font-size: 0.85rem;
  color: #8b7355;
  margin-bottom: 6px;
  font-weight: 600;
}

#apiKey {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d9cdb8;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fffdf7;
  color: #3c2a14;
  transition: border-color 0.2s;
}

#apiKey:focus {
  outline: none;
  border-color: #b08968;
}

#apiKey::placeholder {
  color: #c4b9a6;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: #8b5e3c;
  color: #fffdf7;
}

.btn-primary:hover:not(:disabled) {
  background: #6b4530;
}

.btn-secondary {
  background: #5b7a6e;
  color: #fffdf7;
}

.btn-secondary:hover:not(:disabled) {
  background: #456058;
}

.explain-card {
  transition: opacity 0.3s;
}

.explain-card.hidden {
  display: none;
}

.explain-text {
  font-size: 1.02rem;
  line-height: 1.85;
  color: #3c2a14;
  white-space: pre-wrap;
}

.error-toast {
  background: #fdecea;
  color: #b33a3a;
  border: 1px solid #f5c6c7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.error-toast.hidden {
  display: none;
}

.loading .explain-text {
  color: #8b7355;
  font-style: italic;
}
