* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1c2430;
  --muted: #67707e;
  --border: #e3e7ec;
  --accent: #b3372f;
  --accent-hover: #9c2d26;
  --ok: #1e7f4f;
  --warn: #9a6700;
  --err: #b42318;
  --radius: 10px;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

header h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

textarea {
  width: 100%;
  resize: vertical;
  font: inherit;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

button {
  font: inherit;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: rgba(179, 55, 47, 0.07);
}

button.icon {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 4px 8px;
  font-size: 1rem;
}

button.icon:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.05);
  color: var(--err);
}

.status-area {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  white-space: pre-wrap;
}

.status-area.error {
  border-color: rgba(180, 35, 24, 0.4);
  background: #fdf1f0;
  color: var(--err);
}

.status-area.ok {
  border-color: rgba(30, 127, 79, 0.4);
  background: #eefaf3;
  color: var(--ok);
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.queue-header h2 {
  margin: 0;
}

.count-badge {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.95rem;
}

#queue-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.card .chinese {
  font-size: 1.25rem;
  font-weight: 600;
}

.card .pinyin {
  color: var(--accent);
  font-size: 0.95rem;
}

.card .english {
  color: var(--muted);
  font-size: 0.95rem;
}

.card audio {
  width: 100%;
  height: 34px;
  margin-top: 4px;
}

.card-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-badge.pending {
  background: #eef1f5;
  color: var(--muted);
}

.card-badge.syncing {
  background: #fff3d6;
  color: var(--warn);
}

.card-badge.added,
.card-badge.duplicate {
  background: #e3f5ec;
  color: var(--ok);
}

.card-badge.failed {
  background: #fdf1f0;
  color: var(--err);
}

.card-error {
  font-size: 0.85rem;
  color: var(--err);
}

.empty-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 12px 0 0;
}

.card.fading {
  opacity: 0.5;
}
