:root {
  --bg: #ffffff;
  --text: #1a2b28;
  --muted: #5b7a75;
  --line: #dbf0ec;
  --accent: #40b0a1;
  --accent-hover: #eaf6f4;
  --badge-bg: #eaf6f4;
  --card-shadow: 0 4px 20px rgba(64, 176, 161, 0.08);
}

* {
  box-sizing: border-box;
}

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

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

h1 {
  margin: 8px 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-hover);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  flex: 1;
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-hover);
}

button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

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

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

button.primary:hover:not(:disabled) {
  background: #369a8d;
  border-color: #369a8d;
  color: #fff;
}

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

.toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.meta {
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.progress-card {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--accent-hover);
}

.progress-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text);
}

.progress-bar-container {
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-sub {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.list, .results {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  max-height: 72vh;
  overflow-y: auto;
}

.item {
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.item:hover {
  background: var(--accent-hover);
}

.item.exact-match {
  background: var(--accent-hover);
  border-left: 4px solid var(--accent);
}

.rank {
  min-width: 44px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.concept {
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score {
  min-width: 65px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.save-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.save-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-hover);
}

.save-btn.saved {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.badge {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--badge-bg);
}

.mode-badge {
  display: inline-block;
  margin-top: 6px;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 500;
  background: #eaf6f4;
  color: #2b7a6f;
  border: 1px solid #bce3dc;
}

.status {
  padding: 16px 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

@media (max-width: 700px) {
  .container {
    padding-top: 16px;
  }
  
  .rank {
    min-width: 32px;
  }
}
