:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --like: #ff5c8a;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
  --radius-lg: 20px;
}

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

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
}
.screen.hidden { display: none; }

.focusable {
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer;
  outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}
.hidden { display: none !important; }

button {
  font-family: inherit;
  background: none;
  color: inherit;
  border: none;
}

/* ---------- Top bar ---------- */
.topbar {
  flex-shrink: 0;
  height: 68px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 9px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.brand-mark { font-size: 22px; }
.chip {
  background: var(--bg-tertiary);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.25);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Home ---------- */
.home-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 28px 4px;
  min-height: 0;
}
.compliment-card {
  width: 100%;
  max-width: 524px;
  min-height: 300px;
  padding: 40px 34px 30px;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, #1a1a2c 0%, #121220 100%);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.compliment-card:focus {
  background: linear-gradient(160deg, #1f1f36 0%, #15152a 100%);
  transform: translateY(-2px);
}
.quote-mark {
  position: absolute;
  top: 6px;
  left: 24px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 110px;
  line-height: 1;
  color: var(--accent);
  opacity: 0.16;
  pointer-events: none;
}
.compliment-text {
  position: relative;
  font-size: 30px;
  line-height: 1.42;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 1;
}
.card-hint {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.key {
  display: inline-block;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
}

@keyframes pop {
  0% { opacity: 0; transform: translateY(12px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.compliment-text.pop { animation: pop 0.3s ease both; }

/* ---------- Action bar ---------- */
.actions {
  flex-shrink: 0;
  padding: 16px 24px 26px;
  display: flex;
  gap: 12px;
}
.action-btn {
  flex: 1;
  min-height: 78px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 15px;
}
.action-btn .label { font-weight: 600; }
.action-btn .ico, .action-btn .heart { font-size: 24px; line-height: 1; }
.action-btn.wide { flex-direction: row; gap: 10px; }
.action-btn.wide .ico { font-size: 20px; }

#btn-favorite.active { background: rgba(255, 92, 138, 0.16); }
#btn-favorite.active .heart { color: var(--like); }
#btn-favorite.active .label { color: var(--like); }

/* ---------- Lists (categories + favorites) ---------- */
.list-main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 24px 14px;
  min-height: 0;
}
.list-main::-webkit-scrollbar { width: 0; height: 0; }
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.list-hint {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.cat-item {
  width: 100%;
  min-height: 62px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
}
.cat-name { flex: 1; }
.cat-item.active .cat-name { color: var(--accent); }
.cat-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}
.cat-count.selected { color: var(--accent); }

.fav-item {
  width: 100%;
  min-height: 64px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
}
.fav-text {
  flex: 1;
  font-size: 16px;
  line-height: 1.36;
  color: var(--text-primary);
}
.fav-remove {
  flex-shrink: 0;
  font-size: 18px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.fav-item:focus .fav-remove { color: var(--danger); }

/* ---------- Empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 28px;
  gap: 12px;
}
.empty-title { font-size: 21px; font-weight: 700; color: var(--text-primary); }
.empty-sub { font-size: 15px; line-height: 1.5; color: var(--text-secondary); max-width: 380px; }
.empty-sub strong { color: var(--text-primary); }

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 116px;
  transform: translateX(-50%) translateY(16px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
